From 29075cf666e3a0f19b47d9a2fbae03baf17b007b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 22 Sep 2014 15:24:09 -0600 Subject: [PATCH] Add system calls for shared memory interfaces --- include/sys/syscall.h | 18 +++++++++++++++--- syscall/syscall.csv | 4 ++++ syscall/syscall_lookup.h | 9 +++++++++ syscall/syscall_stublookup.c | 10 ++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/include/sys/syscall.h b/include/sys/syscall.h index 10e6fb2c88..6a350eb0a5 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -275,13 +275,25 @@ # define SYS_rmdir (__SYS_mountpoint+4) # define SYS_umount (__SYS_mountpoint+5) # define SYS_unlink (__SYS_mountpoint+6) -# define __SYS_pthread (__SYS_mountpoint+7) +# define __SYS_shm (__SYS_mountpoint+7) # else -# define __SYS_pthread __SYS_mountpoint +# define __SYS_shm __SYS_mountpoint # endif #else -# define __SYS_pthread __SYS_filedesc +# define __SYS_shm __SYS_filedesc +#endif + +/* Shared memory interfaces */ + +#ifdef CONFIG_MM_SHM +# define SYS_shmget (__SYS_shm+0) +# define SYS_shmat (__SYS_shm+1) +# define SYS_shmctl (__SYS_shm+2) +# define SYS_shmdt (__SYS_shm+3) +# define __SYS_pthread (__SYS_shm+4) +#else +# define __SYS_pthread __SYS_shm #endif /* The following are defined if pthreads are enabled */ diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 254464f8ee..56f8518ed4 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -113,6 +113,10 @@ "set_errno","errno.h","","void","int" "setenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","const char*","const char*","int" "setsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR const void*","socklen_t" +"shmat", "sys/shm.h", "defined(CONFIG_MM_SHM)", "FAR void *", "int", "FAR const void *", "int" +"shmctl", "sys/shm.h", "defined(CONFIG_MM_SHM)", "int", "int", "int", "FAR struct shmid_ds *" +"shmdt", "sys/shm.h", "defined(CONFIG_MM_SHM)", "int", "FAR const void *" +"shmget", "sys/shm.h", "defined(CONFIG_MM_SHM)", "int", "key_t", "size_t", "int" "sigaction","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","int","FAR const struct sigaction*","FAR struct sigaction*" "sigpending","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t*" "sigprocmask","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","int","FAR const sigset_t*","FAR sigset_t*" diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index ac4fd20f2e..9b14f91158 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -200,6 +200,15 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) # endif #endif +/* Shared memory interfaces */ + +#ifdef CONFIG_MM_SHM + SYSCALL_LOOKUP(shmget, 3, STUB_shmget) + SYSCALL_LOOKUP(shmat, 3, STUB_shmat) + SYSCALL_LOOKUP(shmctl, 3, STUB_shmctl) + SYSCALL_LOOKUP(shmdt, 1, STUB_shmdt) +#endif + /* The following are defined if pthreads are enabled */ #ifndef CONFIG_DISABLE_PTHREAD diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index 9776836035..ddb7f899ac 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -210,6 +210,16 @@ uintptr_t STUB_rmdir(int nbr, uintptr_t parm1); uintptr_t STUB_umount(int nbr, uintptr_t parm1); uintptr_t STUB_unlink(int nbr, uintptr_t parm1); +/* Shared memory interfaces */ + +uintptr_t STUB_shmget(int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3); +uintptr_t STUB_shmat(int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3); +uintptr_t STUB_shmctl(int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3); +uintptr_t STUB_shmdt(int nbr, uintptr_t parm1); + /* The following are defined if pthreads are enabled */ uintptr_t STUB_pthread_barrier_destroy(int nbr, uintptr_t parm1);