From 032fbb7ace8de228e7c3019ee44f26bef97fbfe1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 4 Oct 2014 07:31:45 -0600 Subject: [PATCH] Add pread(0 and pwrite() system calls --- include/sys/syscall.h | 10 ++++++---- syscall/syscall.csv | 2 ++ syscall/syscall_lookup.h | 2 ++ syscall/syscall_stublookup.c | 12 ++++++++---- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/sys/syscall.h b/include/sys/syscall.h index 4a85ee3310..3003793b6c 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -232,12 +232,14 @@ # define SYS_ioctl (__SYS_descriptors+1) # define SYS_read (__SYS_descriptors+2) # define SYS_write (__SYS_descriptors+3) +# define SYS_pread (__SYS_descriptors+4) +# define SYS_pwrite (__SYS_descriptors+5) # ifndef CONFIG_DISABLE_POLL -# define SYS_poll (__SYS_descriptors+4) -# define SYS_select (__SYS_descriptors+5) -# define __SYS_filedesc (__SYS_descriptors+6) +# define SYS_poll (__SYS_descriptors+6) +# define SYS_select (__SYS_descriptors+7) +# define __SYS_filedesc (__SYS_descriptors+8) # else -# define __SYS_filedesc (__SYS_descriptors+4) +# define __SYS_filedesc (__SYS_descriptors+6) # endif #else # define __SYS_filedesc __SYS_descriptors diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 218f33ae3c..15b058f83d 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -46,6 +46,8 @@ "pipe","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int [2]|int*" "poll","poll.h","!defined(CONFIG_DISABLE_POLL) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","FAR struct pollfd*","nfds_t","int" "prctl","sys/prctl.h", "CONFIG_TASK_NAME_SIZE > 0","int","int","..." +"pread","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","ssize_t","int","FAR void*","size_t","off_t" +"pwrite","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","ssize_t","int","FAR const void*","size_t","off_t" "posix_spawnp","spawn.h","!defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_BINFMT_EXEPATH)","int","FAR pid_t *","FAR const char *","FAR const posix_spawn_file_actions_t *","FAR const posix_spawnattr_t *","FAR char *const []|FAR char *const *","FAR char *const []" "posix_spawn","spawn.h","!defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS) && !defined(CONFIG_BINFMT_EXEPATH)","int","FAR pid_t *","FAR const char *","FAR const posix_spawn_file_actions_t *","FAR const posix_spawnattr_t *","FAR char *const []|FAR char *const *","FAR char *const []|FAR char *const *" "pthread_barrier_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*" diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index fe1e965010..e45f3355c1 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -163,6 +163,8 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) SYSCALL_LOOKUP(ioctl, 3, STUB_ioctl) SYSCALL_LOOKUP(read, 3, STUB_read) SYSCALL_LOOKUP(write, 3, STUB_write) + SYSCALL_LOOKUP(pread, 4, STUB_pread) + SYSCALL_LOOKUP(pwrite, 4, STUB_pwrite) # ifndef CONFIG_DISABLE_POLL SYSCALL_LOOKUP(poll, 3, STUB_poll) SYSCALL_LOOKUP(select, 5, STUB_select) diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index ddb7f899ac..3c97d6c396 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -160,14 +160,18 @@ uintptr_t STUB_timer_settime(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t STUB_close(int nbr, uintptr_t parm1); uintptr_t STUB_ioctl(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3); -uintptr_t STUB_poll(int nbr, uintptr_t parm1, uintptr_t parm2, - uintptr_t parm3); uintptr_t STUB_read(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3); +uintptr_t STUB_write(int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3); +uintptr_t STUB_pread(int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3, uintptr_t parm4); +uintptr_t STUB_pwrite(int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3, uintptr_t parm4); +uintptr_t STUB_poll(int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3); uintptr_t STUB_select(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5); -uintptr_t STUB_write(int nbr, uintptr_t parm1, uintptr_t parm2, - uintptr_t parm3); /* The following are defined if file descriptors are enabled */