From e7404280e842cbde8fc8087301f4f55dc56ac2ca Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 14 Feb 2017 10:44:01 -0600 Subject: [PATCH] fstat(): Add syscall support --- include/sys/syscall.h | 15 ++++++++------- syscall/syscall.csv | 1 + syscall/syscall_lookup.h | 1 + syscall/syscall_stublookup.c | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/sys/syscall.h b/include/sys/syscall.h index b195fafc38..1aca056143 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -2,7 +2,7 @@ * include/sys/syscall.h * This file contains the system call numbers. * - * Copyright (C) 2011-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -320,15 +320,16 @@ # define SYS_rewinddir (__SYS_filedesc+9) # define SYS_seekdir (__SYS_filedesc+10) # define SYS_stat (__SYS_filedesc+11) -# define SYS_statfs (__SYS_filedesc+12) -# define SYS_telldir (__SYS_filedesc+13) +# define SYS_fstat (__SYS_filedesc+12) +# define SYS_statfs (__SYS_filedesc+13) +# define SYS_telldir (__SYS_filedesc+14) # if defined(CONFIG_PSEUDOFS_SOFTLINKS) -# define SYS_link (__SYS_filedesc+14) -# define SYS_readlink (__SYS_filedesc+15) -# define __SYS_pipes (__SYS_filedesc+16) +# define SYS_link (__SYS_filedesc+15) +# define SYS_readlink (__SYS_filedesc+16) +# define __SYS_pipes (__SYS_filedesc+17) # else -# define __SYS_pipes (__SYS_filedesc+14) +# define __SYS_pipes (__SYS_filedesc+15) # endif # if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0 diff --git a/syscall/syscall.csv b/syscall/syscall.csv index acba1d86db..56620d82ea 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -23,6 +23,7 @@ "fcntl","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int","int","..." "fs_fdopen","nuttx/fs/fs.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR struct file_struct*","int","int","FAR struct tcb_s*" "fs_ioctl","nuttx/fs/fs.h","defined(CONFIG_LIBC_IOCTL_VARIADIC) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","int","int","unsigned long" +"fstat","sys/stat.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int","FAR struct stat*" "fsync","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","int" "get_errno","errno.h","!defined(__DIRECT_ERRNO_ACCESS)","int" "get_errno_ptr","errno.h","defined(__DIRECT_ERRNO_ACCESS)","FAR int*" diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index 784613adc4..9151e92f1b 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -229,6 +229,7 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) SYSCALL_LOOKUP(rewinddir, 1, STUB_rewinddir) SYSCALL_LOOKUP(seekdir, 2, STUB_seekdir) SYSCALL_LOOKUP(stat, 2, STUB_stat) + SYSCALL_LOOKUP(fstat, 2, STUB_fstat) SYSCALL_LOOKUP(statfs, 2, STUB_statfs) SYSCALL_LOOKUP(telldir, 1, STUB_telldir) diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index 971879d308..5ea3939f19 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -1,7 +1,7 @@ /**************************************************************************** * syscall/syscall_stublookup.c * - * Copyright (C) 2011-2013, 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013, 2015-2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -235,6 +235,7 @@ uintptr_t STUB_readdir(int nbr, uintptr_t parm1); uintptr_t STUB_rewinddir(int nbr, uintptr_t parm1); uintptr_t STUB_seekdir(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_stat(int nbr, uintptr_t parm1, uintptr_t parm2); +uintptr_t STUB_fstat(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_statfs(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_telldir(int nbr, uintptr_t parm1);