nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gn...@apache.org
Subject [incubator-nuttx] 03/04: syscall: Generate SYS_ number from syscall_lookup.h
Date Thu, 07 May 2020 16:31:17 GMT
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 32cec2a439d5d66544312d45b2cbbedb392906b4
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
AuthorDate: Thu May 7 14:42:52 2020 +0800

    syscall: Generate SYS_ number from syscall_lookup.h
    
    to reduce the maintainance effort
    
    Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
---
 include/sys/syscall.h                     | 524 +-----------------------------
 {syscall => include/sys}/syscall_lookup.h | 137 ++++----
 syscall/syscall_funclookup.c              |  18 +-
 syscall/syscall_nparms.c                  |  16 +-
 syscall/syscall_stublookup.c              |  10 +-
 5 files changed, 91 insertions(+), 614 deletions(-)

diff --git a/include/sys/syscall.h b/include/sys/syscall.h
index 88c7d4c..1cf0760 100644
--- a/include/sys/syscall.h
+++ b/include/sys/syscall.h
@@ -46,529 +46,35 @@
 #  define CONFIG_SYS_RESERVED          (0)
 #endif
 
-/* System call numbers
- *
- * These first system calls are supported regardless of the NuttX
- * configuration
- */
-
-#define SYS__exit                      (CONFIG_SYS_RESERVED + 0)
-#define SYS_exit                       (CONFIG_SYS_RESERVED + 1)
-#define SYS_get_errno                  (CONFIG_SYS_RESERVED + 2)
-#define SYS_getpid                     (CONFIG_SYS_RESERVED + 3)
-
-#define SYS_sched_getparam             (CONFIG_SYS_RESERVED + 4)
-#define SYS_sched_getscheduler         (CONFIG_SYS_RESERVED + 5)
-#define SYS_sched_lock                 (CONFIG_SYS_RESERVED + 6)
-#define SYS_sched_lockcount            (CONFIG_SYS_RESERVED + 7)
-#define SYS_sched_rr_get_interval      (CONFIG_SYS_RESERVED + 8)
-#define SYS_sched_setparam             (CONFIG_SYS_RESERVED + 9)
-#define SYS_sched_setscheduler         (CONFIG_SYS_RESERVED + 10)
-#define SYS_sched_unlock               (CONFIG_SYS_RESERVED + 11)
-#define SYS_sched_yield                (CONFIG_SYS_RESERVED + 12)
-#define SYS_sched_get_stackinfo        (CONFIG_SYS_RESERVED + 13)
-
-#ifdef CONFIG_SMP
-#  define SYS_sched_getaffinity        (CONFIG_SYS_RESERVED + 14)
-#  define SYS_sched_getcpu             (CONFIG_SYS_RESERVED + 15)
-#  define SYS_sched_setaffinity        (CONFIG_SYS_RESERVED + 16)
-#  define __SYS_set_errno              (CONFIG_SYS_RESERVED + 17)
-#else
-#  define __SYS_set_errno              (CONFIG_SYS_RESERVED + 14)
-#endif
-
-#define SYS_set_errno                  (__SYS_set_errno + 0)
-#define SYS_uname                      (__SYS_set_errno + 1)
-#define __SYS_uid                      (__SYS_set_errno + 2)
-
-/* User identity */
-
-#ifdef CONFIG_SCHED_USER_IDENTITY
-#  define SYS_setuid                   (__SYS_uid + 0)
-#  define SYS_getuid                   (__SYS_uid + 1)
-#  define SYS_setgid                   (__SYS_uid + 2)
-#  define SYS_getgid                   (__SYS_uid + 3)
-#  define __SYS_sem                    (__SYS_uid + 4)
-#else
-#  define __SYS_sem                    (__SYS_uid + 0)
-#endif
-
-/* Semaphores */
-
-#define SYS_sem_destroy                (__SYS_sem + 0)
-#define SYS_sem_post                   (__SYS_sem + 1)
-#define SYS_sem_timedwait              (__SYS_sem + 2)
-#define SYS_sem_trywait                (__SYS_sem + 3)
-#define SYS_sem_wait                   (__SYS_sem + 4)
-
-#ifdef CONFIG_PRIORITY_INHERITANCE
-#  define SYS_sem_setprotocol          (__SYS_sem + 5)
-#  define __SYS_named_sem              (__SYS_sem + 6)
-#else
-#  define __SYS_named_sem              (__SYS_sem + 5)
-#endif
-
-/* Named semaphores */
-
-#ifdef CONFIG_FS_NAMED_SEMAPHORES
-#  define SYS_sem_open                 (__SYS_named_sem + 0)
-#  define SYS_sem_close                (__SYS_named_sem + 1)
-#  define SYS_sem_unlink               (__SYS_named_sem + 2)
-#  define __SYS_task_create            (__SYS_named_sem + 3)
-#else
-#  define __SYS_task_create            (__SYS_named_sem + 0)
-#endif
-
-/* Task creation APIs based on global entry points cannot be use with
- * address environments.
- */
-
-#ifndef CONFIG_BUILD_KERNEL
-#  define SYS_task_create              (__SYS_task_create + 0)
-#ifdef CONFIG_BUILD_PROTECTED
-#  define SYS_nx_task_spawn            (__SYS_task_create + 1)
-#  define __SYS_task_delete            (__SYS_task_create + 2)
-#else
-#  define __SYS_task_delete            (__SYS_task_create + 1)
-#endif
-
-/* pgalloc() is only available with address environments with the page
- * allocator selected.  MMU support from the CPU is also required.
- */
-
-#else
-#  define SYS_pgalloc                  (__SYS_task_create + 0)
-#  define __SYS_task_delete            (__SYS_task_create + 1)
-#endif
-
-#  define SYS_task_delete              (__SYS_task_delete + 0)
-#  define SYS_task_restart             (__SYS_task_delete + 1)
-#  define SYS_task_setcancelstate      (__SYS_task_delete + 2)
-#  define SYS_up_assert                (__SYS_task_delete + 3)
-
-#  ifdef CONFIG_CANCELLATION_POINTS
-#    define SYS_task_setcanceltype     (__SYS_task_delete + 4)
-#    define SYS_task_testcancel        (__SYS_task_delete + 5)
-#    define __SYS_vfork                (__SYS_task_delete + 6)
-#  else
-#    define __SYS_vfork                (__SYS_task_delete + 4)
-#  endif
-
-/* The following can be individually enabled */
-
-#if defined(CONFIG_SCHED_WAITPID) && defined(CONFIG_ARCH_HAVE_VFORK)
-#  define SYS_vfork                    (__SYS_vfork + 0)
-#  define __SYS_atexit                 (__SYS_vfork + 1)
-#else
-#  define __SYS_atexit                 (__SYS_vfork + 0)
-#endif
-
-#ifdef CONFIG_SCHED_ATEXIT
-#  define SYS_atexit                   (__SYS_atexit + 0)
-#  define __SYS_on_exit                (__SYS_atexit + 1)
-#else
-#  define __SYS_on_exit                (__SYS_atexit + 0)
-#endif
-
-#ifdef CONFIG_SCHED_ONEXIT
-#  define SYS_on_exit                  (__SYS_on_exit + 0)
-#  define __SYS_waitpid                (__SYS_on_exit + 1)
-#else
-#  define __SYS_waitpid                (__SYS_on_exit + 0)
-#endif
-
-#ifdef CONFIG_SCHED_WAITPID
-#  define SYS_waitpid                  (__SYS_waitpid + 0)
-#  ifdef CONFIG_SCHED_HAVE_PARENT
-#    define SYS_wait                   (__SYS_waitpid + 1)
-#    define SYS_waitid                 (__SYS_waitpid + 2)
-#    define __SYS_insmod               (__SYS_waitpid + 3)
-#  else
-#    define __SYS_insmod               (__SYS_waitpid + 1)
-#  endif
-#else
-#  define __SYS_insmod                 (__SYS_waitpid + 0)
-#endif
-
-/* The following can only be defined if we are configured to load
- * OS modules from a file system.
- */
-
-#ifdef CONFIG_MODULE
-#  define SYS_insmod                  (__SYS_insmod + 0)
-#  define SYS_rmmod                   (__SYS_insmod + 1)
-#  define SYS_modhandle               (__SYS_insmod + 2)
-#  define __SYS_exec                  (__SYS_insmod + 3)
-#else
-#  define __SYS_exec                  (__SYS_insmod + 0)
-#endif
-
-/* The following can only be defined if we are configured to execute
- * programs from a file system.
- */
-
-#ifndef CONFIG_BINFMT_DISABLE
-#  ifndef CONFIG_BUILD_KERNEL
-#    define SYS_exec                   (__SYS_exec + 0)
-#    define __SYS_posix_spawn          (__SYS_exec + 1)
-#  else
-#    define __SYS_posix_spawn          (__SYS_exec + 0)
-#  endif
-#  ifdef CONFIG_LIBC_EXECFUNCS
-#    ifdef CONFIG_LIB_ENVPATH
-#      define SYS_posix_spawnp         (__SYS_posix_spawn + 0)
-#    else
-#      define SYS_posix_spawn          (__SYS_posix_spawn + 0)
-#    endif
-#    define SYS_execv                  (__SYS_posix_spawn + 1)
-#    define __SYS_signals              (__SYS_posix_spawn + 2)
-#  else
-#    define __SYS_signals              (__SYS_posix_spawn + 0)
-#  endif
-#else
-#  define __SYS_signals                (__SYS_exec + 0)
-#endif
-
-/* The following are only defined is signals are supported in the NuttX
- * configuration.
- */
-
-#define SYS_kill                       (__SYS_signals + 0)
-#define SYS_sigaction                  (__SYS_signals + 1)
-#define SYS_sigpending                 (__SYS_signals + 2)
-#define SYS_sigprocmask                (__SYS_signals + 3)
-#define SYS_sigqueue                   (__SYS_signals + 4)
-#define SYS_sigsuspend                 (__SYS_signals + 5)
-#define SYS_sigtimedwait               (__SYS_signals + 6)
-#define SYS_sigwaitinfo                (__SYS_signals + 7)
-#define SYS_clock_nanosleep            (__SYS_signals + 8)
-#define __SYS_clock                    (__SYS_signals + 9)
-
-/* The following are only defined if the system clock is enabled in the
- * NuttX configuration.
- */
-
-#define SYS_clock                      (__SYS_clock + 0)
-#define SYS_clock_getres               (__SYS_clock + 1)
-#define SYS_clock_gettime              (__SYS_clock + 2)
-#define SYS_clock_settime              (__SYS_clock + 3)
-#ifdef CONFIG_CLOCK_TIMEKEEPING
-#  define SYS_adjtime                  (__SYS_clock + 4)
-#  define __SYS_timers                 (__SYS_clock + 5)
-#else
-#  define __SYS_timers                 (__SYS_clock + 4)
-#endif
-
-/* The following are defined only if POSIX timers are supported */
-
-#ifndef CONFIG_DISABLE_POSIX_TIMERS
-#  define SYS_timer_create             (__SYS_timers + 0)
-#  define SYS_timer_delete             (__SYS_timers + 1)
-#  define SYS_timer_getoverrun         (__SYS_timers + 2)
-#  define SYS_timer_gettime            (__SYS_timers + 3)
-#  define SYS_timer_settime            (__SYS_timers + 4)
-#  define SYS_getitimer                (__SYS_timers + 5)
-#  define SYS_setitimer                (__SYS_timers + 6)
-#  define __SYS_syslog                 (__SYS_timers + 7)
-#else
-#  define __SYS_syslog                 (__SYS_timers + 0)
-#endif
-
-/* Unconditional system logging */
-
-#define SYS_nx_vsyslog                 (__SYS_syslog + 0)
-#define __SYS_descriptors              (__SYS_syslog + 1)
-
-/* The following are defined if either file or socket descriptor are
- * enabled.
- */
-
-#define SYS_close                    (__SYS_descriptors + 0)
-#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)
-
-#ifdef CONFIG_FS_AIO
-#  define SYS_aio_read               (__SYS_descriptors + 6)
-#  define SYS_aio_write              (__SYS_descriptors + 7)
-#  define SYS_aio_fsync              (__SYS_descriptors + 8)
-#  define SYS_aio_cancel             (__SYS_descriptors + 9)
-#  define __SYS_poll                 (__SYS_descriptors + 10)
-#else
-#  define __SYS_poll                 (__SYS_descriptors + 6)
-#endif
-
-#define SYS_poll                     (__SYS_poll + 0)
-#define SYS_select                   (__SYS_poll + 1)
-#define SYS_ppoll                    (__SYS_poll + 2)
-#define SYS_pselect                  (__SYS_poll + 3)
-#define __SYS_ifindex                (__SYS_poll + 4)
-
-#ifdef CONFIG_NETDEV_IFINDEX
-#  define SYS_if_indextoname         (__SYS_ifindex + 0)
-#  define SYS_if_nametoindex         (__SYS_ifindex + 1)
-#  define __SYS_termios              (__SYS_ifindex + 2)
-#else
-#  define __SYS_termios              (__SYS_ifindex + 0)
-#endif
-
-#ifdef CONFIG_SERIAL_TERMIOS
-#  define SYS_tcdrain                (__SYS_termios + 0)
-#  define __SYS_boardctl             (__SYS_termios + 1)
-#else
-#  define __SYS_boardctl             (__SYS_termios + 0)
-#endif
-
-/* Board support */
-
-#ifdef CONFIG_LIB_BOARDCTL
-#    define SYS_boardctl                (__SYS_boardctl + 0)
-#  define __SYS_filedesc                (__SYS_boardctl + 1)
-#else
-#  define __SYS_filedesc                (__SYS_boardctl + 0)
-#endif
-
-/* The following are defined if file descriptors are enabled */
-
-#define SYS_closedir                   (__SYS_filedesc + 0)
-#define SYS_dup                        (__SYS_filedesc + 1)
-#define SYS_dup2                       (__SYS_filedesc + 2)
-#define SYS_fcntl                      (__SYS_filedesc + 3)
-#define SYS_lseek                      (__SYS_filedesc + 4)
-#define SYS_mmap                       (__SYS_filedesc + 5)
-#define SYS_open                       (__SYS_filedesc + 6)
-#define SYS_opendir                    (__SYS_filedesc + 7)
-#define SYS_readdir                    (__SYS_filedesc + 8)
-#define SYS_rewinddir                  (__SYS_filedesc + 9)
-#define SYS_seekdir                    (__SYS_filedesc + 10)
-#define SYS_stat                       (__SYS_filedesc + 11)
-#define SYS_fstat                      (__SYS_filedesc + 12)
-#define SYS_statfs                     (__SYS_filedesc + 13)
-#define SYS_fstatfs                    (__SYS_filedesc + 14)
-#define SYS_telldir                    (__SYS_filedesc + 15)
-
-#ifdef CONFIG_FS_RAMMAP
-#  define SYS_munmap                   (__SYS_filedesc + 16)
-#  define __SYS_link                   (__SYS_filedesc + 17)
-#else
-#  define __SYS_link                   (__SYS_filedesc + 16)
-#endif
-
-#if defined(CONFIG_PSEUDOFS_SOFTLINKS)
-#  define SYS_link                     (__SYS_link + 0)
-#  define SYS_readlink                 (__SYS_link + 1)
-#  define __SYS_pipes                  (__SYS_link + 2)
-#else
-#  define __SYS_pipes                  (__SYS_link + 0)
-#endif
-
-#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
-#  define SYS_nx_pipe                  (__SYS_pipes + 0)
-#  define SYS_nx_mkfifo                (__SYS_pipes + 1)
-#  define __SYS_fs_fdopen              (__SYS_pipes + 2)
-#else
-#  define __SYS_fs_fdopen              (__SYS_pipes + 0)
-#endif
-
-#if CONFIG_NFILE_STREAMS > 0
-#  define SYS_fs_fdopen                (__SYS_fs_fdopen + 0)
-#  define SYS_sched_getstreams         (__SYS_fs_fdopen + 1)
-#  define __SYS_sendfile               (__SYS_fs_fdopen + 2)
-#else
-#  define __SYS_sendfile               (__SYS_fs_fdopen + 0)
-#endif
-
-#if defined(CONFIG_NET_SENDFILE)
-#  define SYS_sendfile,                (__SYS_sendfile + 0)
-#  define __SYS_mountpoint             (__SYS_sendfile + 1)
-#else
-#  define __SYS_mountpoint             (__SYS_sendfile + 0)
-#endif
-
-#if !defined(CONFIG_DISABLE_MOUNTPOINT)
-#  define SYS_mount                    (__SYS_mountpoint + 0)
-#  define SYS_fsync                    (__SYS_mountpoint + 1)
-#  define SYS_ftruncate                (__SYS_mountpoint + 2)
-#  define SYS_mkdir                    (__SYS_mountpoint + 3)
-#  define SYS_rename                   (__SYS_mountpoint + 4)
-#  define SYS_rmdir                    (__SYS_mountpoint + 5)
-#  define SYS_umount2                  (__SYS_mountpoint + 6)
-#  define SYS_unlink                   (__SYS_mountpoint + 7)
-#  define __SYS_shm                    (__SYS_mountpoint + 8)
-#else
-#  define __SYS_shm                    (__SYS_mountpoint + 0)
-#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 + 0)
-#endif
-
-/* The following are defined if pthreads are enabled */
-
-#ifndef CONFIG_DISABLE_PTHREAD
-#  define SYS_pthread_cancel           (__SYS_pthread + 0)
-#  define SYS_pthread_cond_broadcast   (__SYS_pthread + 1)
-#  define SYS_pthread_cond_signal      (__SYS_pthread + 2)
-#  define SYS_pthread_cond_wait        (__SYS_pthread + 3)
-#  define SYS_pthread_create           (__SYS_pthread + 4)
-#  define SYS_pthread_detach           (__SYS_pthread + 5)
-#  define SYS_pthread_exit             (__SYS_pthread + 6)
-#  define SYS_pthread_getschedparam    (__SYS_pthread + 7)
-#  define SYS_pthread_getspecific      (__SYS_pthread + 8)
-#  define SYS_pthread_join             (__SYS_pthread + 9)
-#  define SYS_pthread_key_create       (__SYS_pthread + 10)
-#  define SYS_pthread_key_delete       (__SYS_pthread + 11)
-#  define SYS_pthread_mutex_destroy    (__SYS_pthread + 12)
-#  define SYS_pthread_mutex_init       (__SYS_pthread + 13)
-#  define SYS_pthread_mutex_timedlock  (__SYS_pthread + 14)
-#  define SYS_pthread_mutex_trylock    (__SYS_pthread + 15)
-#  define SYS_pthread_mutex_unlock     (__SYS_pthread + 16)
-
-#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
-#  define SYS_pthread_mutex_consistent (__SYS_pthread + 17)
-#  define __SYS_pthread_setschedparam  (__SYS_pthread + 18)
-#else
-#  define __SYS_pthread_setschedparam  (__SYS_pthread + 17)
-#endif
-
-#  define SYS_pthread_setschedparam    (__SYS_pthread_setschedparam + 0)
-#  define SYS_pthread_setschedprio     (__SYS_pthread_setschedparam + 1)
-#  define SYS_pthread_setspecific      (__SYS_pthread_setschedparam + 2)
-#  define __SYS_pthread_smp            (__SYS_pthread_setschedparam + 3)
-
-#  ifdef CONFIG_SMP
-#    define SYS_pthread_setaffinity_np (__SYS_pthread_smp + 0)
-#    define SYS_pthread_getaffinity_np (__SYS_pthread_smp + 1)
-#    define __SYS_pthread_signals      (__SYS_pthread_smp + 2)
-#  else
-#    define __SYS_pthread_signals      (__SYS_pthread_smp + 0)
-#  endif
-
-#  define SYS_pthread_cond_timedwait   (__SYS_pthread_signals + 0)
-#  define SYS_pthread_kill             (__SYS_pthread_signals + 1)
-#  define SYS_pthread_sigmask          (__SYS_pthread_signals + 2)
-#  define __SYS_pthread_cleanup        (__SYS_pthread_signals + 3)
-
-#  ifdef CONFIG_PTHREAD_CLEANUP
-#    define SYS_pthread_cleanup_push   (__SYS_pthread_cleanup + 0)
-#    define SYS_pthread_cleanup_pop    (__SYS_pthread_cleanup + 1)
-#    define __SYS_mqueue               (__SYS_pthread_cleanup + 2)
-#  else
-#    define __SYS_mqueue               (__SYS_pthread_cleanup + 0)
-#  endif
-
-#else
-#  define __SYS_mqueue                 (__SYS_pthread + 0)
-#endif
-
-/* The following are defined only if message queues are enabled */
-
-#ifndef CONFIG_DISABLE_MQUEUE
-#  define SYS_mq_close                 (__SYS_mqueue + 0)
-#  define SYS_mq_getattr               (__SYS_mqueue + 1)
-#  define SYS_mq_notify                (__SYS_mqueue + 2)
-#  define SYS_mq_open                  (__SYS_mqueue + 3)
-#  define SYS_mq_receive               (__SYS_mqueue + 4)
-#  define SYS_mq_send                  (__SYS_mqueue + 5)
-#  define SYS_mq_setattr               (__SYS_mqueue + 6)
-#  define SYS_mq_timedreceive          (__SYS_mqueue + 7)
-#  define SYS_mq_timedsend             (__SYS_mqueue + 8)
-#  define SYS_mq_unlink                (__SYS_mqueue + 9)
-#  define __SYS_environ                (__SYS_mqueue + 10)
-#else
-#  define __SYS_environ                (__SYS_mqueue + 0)
-#endif
-
-/* The following are defined only if environment variables are supported */
-
-#ifndef CONFIG_DISABLE_ENVIRON
-#  define SYS_clearenv                 (__SYS_environ + 0)
-#  define SYS_getenv                   (__SYS_environ + 1)
-#  define SYS_putenv                   (__SYS_environ + 2)
-#  define SYS_setenv                   (__SYS_environ + 3)
-#  define SYS_unsetenv                 (__SYS_environ + 4)
-#  define __SYS_netdb                  (__SYS_environ + 5)
-#else
-#  define __SYS_netdb                  (__SYS_environ + 0)
-#endif
-
-/* The following are defined if netdb is supported */
-
-#ifdef CONFIG_LIBC_NETDB
-#  define SYS_sethostname              (__SYS_netdb + 0)
-#  define __SYS_network                (__SYS_netdb + 1)
-#else
-#  define __SYS_network                (__SYS_netdb + 0)
-#endif
-
-/* The following are defined only if networking AND sockets are supported */
-
-#ifdef CONFIG_NET
-#  define SYS_accept                   (__SYS_network + 0)
-#  define SYS_bind                     (__SYS_network + 1)
-#  define SYS_connect                  (__SYS_network + 2)
-#  define SYS_getpeername              (__SYS_network + 3)
-#  define SYS_getsockname              (__SYS_network + 4)
-#  define SYS_getsockopt               (__SYS_network + 5)
-#  define SYS_listen                   (__SYS_network + 6)
-#  define SYS_recv                     (__SYS_network + 7)
-#  define SYS_recvfrom                 (__SYS_network + 8)
-#  define SYS_send                     (__SYS_network + 9)
-#  define SYS_sendto                   (__SYS_network + 10)
-#  define SYS_setsockopt               (__SYS_network + 11)
-#  define SYS_socket                   (__SYS_network + 12)
-#  define __SYS_socket                 (__SYS_network + 13)
-#else
-#  define __SYS_socket                 (__SYS_network + 0)
-#endif
-
-/* The following is defined only if CONFIG_TASK_NAME_SIZE > 0 */
-
-#if CONFIG_TASK_NAME_SIZE > 0
-#  define SYS_prctl                    (__SYS_socket + 0)
-#  define __SYS_prctl                  (__SYS_socket + 1)
-#else
-#  define __SYS_prctl                  (__SYS_socket + 0)
-#endif
-
-/* The following is defined only if entropy pool random number generator
- * is enabled.
- */
-
-#ifdef CONFIG_CRYPTO_RANDOM_POOL
-#  define SYS_getrandom                (__SYS_prctl + 0)
-#  define SYS_maxsyscall               (__SYS_prctl + 1)
-#else
-#  define SYS_maxsyscall               (__SYS_prctl + 0)
-#endif
-
 /* Note that the reported number of system calls does *NOT* include the
  * architecture-specific system calls.  If the "real" total is required,
  * use SYS_maxsyscall.
  */
 
-#define SYS_nsyscalls                  (SYS_maxsyscall-CONFIG_SYS_RESERVED)
+#define SYS_nsyscalls                  (SYS_maxsyscall - CONFIG_SYS_RESERVED)
+
+#ifndef __ASSEMBLY__
 
 /****************************************************************************
  * Public Type Definitions
  ****************************************************************************/
 
+enum
+{
+#  define SYSCALL_LOOKUP_(f)     SYS_##f
+#  define SYSCALL_LOOKUP1(f,n,p) SYSCALL_LOOKUP_(f) = CONFIG_SYS_RESERVED
+#  define SYSCALL_LOOKUP(f,n,p)  , SYSCALL_LOOKUP_(f)
+#  include "syscall_lookup.h"
+  , SYS_maxsyscall
+#  undef SYSCALL_LOOKUP_
+#  undef SYSCALL_LOOKUP1
+#  undef SYSCALL_LOOKUP
+};
+
 /****************************************************************************
  * Public Data
  ****************************************************************************/
 
-#ifndef __ASSEMBLY__
-
 #ifdef __cplusplus
 #define EXTERN extern "C"
 extern "C"
diff --git a/syscall/syscall_lookup.h b/include/sys/syscall_lookup.h
similarity index 76%
rename from syscall/syscall_lookup.h
rename to include/sys/syscall_lookup.h
index e9eb8ce..60b2e43 100644
--- a/syscall/syscall_lookup.h
+++ b/include/sys/syscall_lookup.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * syscall/syscall_lookup.h
+ * include/sys/syscall_lookup.h
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -18,10 +18,6 @@
  *
  ****************************************************************************/
 
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
 /* SYSCALL_LOOKUP must be defined before including this file.
  *
  * These first system calls are supported regardless of the NuttX
@@ -45,21 +41,22 @@ SYSCALL_LOOKUP(sched_yield,                0, STUB_sched_yield)
 SYSCALL_LOOKUP(sched_get_stackinfo,        2, STUB_sched_get_stackinfo)
 
 #ifdef CONFIG_SMP
-SYSCALL_LOOKUP(sched_getaffinity,          3, STUB_sched_getaffinity)
-SYSCALL_LOOKUP(sched_getcpu,               0, STUB_sched_getcpu)
-SYSCALL_LOOKUP(sched_setaffinity,          3, STUB_sched_setaffinity)
+  SYSCALL_LOOKUP(sched_getaffinity,        3, STUB_sched_getaffinity)
+  SYSCALL_LOOKUP(sched_getcpu,             0, STUB_sched_getcpu)
+  SYSCALL_LOOKUP(sched_setaffinity,        3, STUB_sched_setaffinity)
 #endif
 
 SYSCALL_LOOKUP(set_errno,                  1, STUB_set_errno)
 SYSCALL_LOOKUP(uname,                      1, STUB_uname)
+SYSCALL_LOOKUP(sethostname,                2, STUB_sethostname)
 
 /* User identity */
 
 #ifdef CONFIG_SCHED_USER_IDENTITY
-SYSCALL_LOOKUP(setuid,                     1, STUB_setuid)
-SYSCALL_LOOKUP(getuid,                     0, STUB_getuid)
-SYSCALL_LOOKUP(setgid,                     1, STUB_setgid)
-SYSCALL_LOOKUP(getgid,                     0, STUB_getgid)
+  SYSCALL_LOOKUP(setuid,                   1, STUB_setuid)
+  SYSCALL_LOOKUP(getuid,                   0, STUB_getuid)
+  SYSCALL_LOOKUP(setgid,                   1, STUB_setgid)
+  SYSCALL_LOOKUP(getgid,                   0, STUB_getgid)
 #endif
 
 /* Semaphores */
@@ -71,34 +68,34 @@ SYSCALL_LOOKUP(sem_trywait,                1, STUB_sem_trywait)
 SYSCALL_LOOKUP(sem_wait,                   1, STUB_sem_wait)
 
 #ifdef CONFIG_PRIORITY_INHERITANCE
-SYSCALL_LOOKUP(sem_setprotocol,            2, STUB_sem_setprotocol)
+  SYSCALL_LOOKUP(sem_setprotocol,          2, STUB_sem_setprotocol)
 #endif
 
 /* Named semaphores */
 
 #ifdef CONFIG_FS_NAMED_SEMAPHORES
-SYSCALL_LOOKUP(sem_open,                   4, STUB_sem_open)
-SYSCALL_LOOKUP(sem_close,                  1, STUB_sem_close)
-SYSCALL_LOOKUP(sem_unlink,                 1, STUB_sem_unlink)
+  SYSCALL_LOOKUP(sem_open,                 4, STUB_sem_open)
+  SYSCALL_LOOKUP(sem_close,                1, STUB_sem_close)
+  SYSCALL_LOOKUP(sem_unlink,               1, STUB_sem_unlink)
 #endif
 
 #ifndef CONFIG_BUILD_KERNEL
-SYSCALL_LOOKUP(task_create,                5, STUB_task_create)
+  SYSCALL_LOOKUP(task_create,              5, STUB_task_create)
 #ifdef CONFIG_LIB_SYSCALL
-SYSCALL_LOOKUP(nx_task_spawn,              1, STUB_nx_task_spawn)
+  SYSCALL_LOOKUP(nx_task_spawn,            1, STUB_nx_task_spawn)
 #endif
 #else
-SYSCALL_LOOKUP(pgalloc,                    2, STUB_pgalloc)
+  SYSCALL_LOOKUP(pgalloc,                  2, STUB_pgalloc)
 #endif
 SYSCALL_LOOKUP(task_delete,                1, STUB_task_delete)
 SYSCALL_LOOKUP(task_restart,               1, STUB_task_restart)
 SYSCALL_LOOKUP(task_setcancelstate,        2, STUB_task_setcancelstate)
 SYSCALL_LOOKUP(up_assert,                  2, STUB_up_assert)
 
-#  ifdef CONFIG_CANCELLATION_POINTS
+#ifdef CONFIG_CANCELLATION_POINTS
   SYSCALL_LOOKUP(task_setcanceltype,       2, STUB_task_setcanceltype)
   SYSCALL_LOOKUP(task_testcancel,          0, STUB_task_testcancel)
-#  endif
+#endif
 
 /* The following can be individually enabled */
 
@@ -116,10 +113,10 @@ SYSCALL_LOOKUP(up_assert,                  2, STUB_up_assert)
 
 #ifdef CONFIG_SCHED_WAITPID
   SYSCALL_LOOKUP(waitpid,                  3, STUB_waitpid)
-#  ifdef CONFIG_SCHED_HAVE_PARENT
+#ifdef CONFIG_SCHED_HAVE_PARENT
   SYSCALL_LOOKUP(wait,                     1, STUB_wait)
   SYSCALL_LOOKUP(waitid,                   4, STUB_waitid)
-#  endif
+#endif
 #endif
 
 /* The following can only be defined if we are configured to load
@@ -154,24 +151,24 @@ SYSCALL_LOOKUP(up_assert,                  2, STUB_up_assert)
  * configuration.
  */
 
-  SYSCALL_LOOKUP(kill,                     2, STUB_kill)
-  SYSCALL_LOOKUP(sigaction,                3, STUB_sigaction)
-  SYSCALL_LOOKUP(sigpending,               1, STUB_sigpending)
-  SYSCALL_LOOKUP(sigprocmask,              3, STUB_sigprocmask)
-  SYSCALL_LOOKUP(sigqueue,                 3, STUB_sigqueue)
-  SYSCALL_LOOKUP(sigsuspend,               1, STUB_sigsuspend)
-  SYSCALL_LOOKUP(sigtimedwait,             3, STUB_sigtimedwait)
-  SYSCALL_LOOKUP(sigwaitinfo,              2, STUB_sigwaitinfo)
-  SYSCALL_LOOKUP(clock_nanosleep,          4, STUB_clock_nanosleep)
+SYSCALL_LOOKUP(kill,                       2, STUB_kill)
+SYSCALL_LOOKUP(sigaction,                  3, STUB_sigaction)
+SYSCALL_LOOKUP(sigpending,                 1, STUB_sigpending)
+SYSCALL_LOOKUP(sigprocmask,                3, STUB_sigprocmask)
+SYSCALL_LOOKUP(sigqueue,                   3, STUB_sigqueue)
+SYSCALL_LOOKUP(sigsuspend,                 1, STUB_sigsuspend)
+SYSCALL_LOOKUP(sigtimedwait,               3, STUB_sigtimedwait)
+SYSCALL_LOOKUP(sigwaitinfo,                2, STUB_sigwaitinfo)
+SYSCALL_LOOKUP(clock_nanosleep,            4, STUB_clock_nanosleep)
 
 /* The following are only defined if the system clock is enabled in the
  * NuttX configuration.
  */
 
-  SYSCALL_LOOKUP(syscall_clock,            0, STUB_clock)
-  SYSCALL_LOOKUP(clock_getres,             2, STUB_clock_getres)
-  SYSCALL_LOOKUP(clock_gettime,            2, STUB_clock_gettime)
-  SYSCALL_LOOKUP(clock_settime,            2, STUB_clock_settime)
+SYSCALL_LOOKUP(clock,                      0, STUB_clock)
+SYSCALL_LOOKUP(clock_getres,               2, STUB_clock_getres)
+SYSCALL_LOOKUP(clock_gettime,              2, STUB_clock_gettime)
+SYSCALL_LOOKUP(clock_settime,              2, STUB_clock_settime)
 #ifdef CONFIG_CLOCK_TIMEKEEPING
   SYSCALL_LOOKUP(adjtime,                  2, STUB_adjtime)
 #endif
@@ -190,18 +187,18 @@ SYSCALL_LOOKUP(up_assert,                  2, STUB_up_assert)
 
 /* System logging */
 
-  SYSCALL_LOOKUP(nx_vsyslog,               3, STUB_nx_vsyslog)
+SYSCALL_LOOKUP(nx_vsyslog,                 3, STUB_nx_vsyslog)
 
 /* The following are defined if either file or socket descriptor are
  * enabled.
  */
 
-  SYSCALL_LOOKUP(close,                    1, STUB_close)
-  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)
+SYSCALL_LOOKUP(close,                      1, STUB_close)
+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)
 #ifdef CONFIG_FS_AIO
   SYSCALL_LOOKUP(aio_read,                 1, STUB_aio_read)
   SYSCALL_LOOKUP(aio_write,                1, STUB_aio_write)
@@ -228,28 +225,28 @@ SYSCALL_LOOKUP(up_assert,                  2, STUB_up_assert)
 
 /* The following are defined if file descriptors are enabled */
 
-  SYSCALL_LOOKUP(closedir,                 1, STUB_closedir)
-  SYSCALL_LOOKUP(dup,                      1, STUB_dup)
-  SYSCALL_LOOKUP(dup2,                     2, STUB_dup2)
-  SYSCALL_LOOKUP(fcntl,                    3, STUB_fcntl)
-  SYSCALL_LOOKUP(lseek,                    3, STUB_lseek)
-  SYSCALL_LOOKUP(mmap,                     6, STUB_mmap)
-  SYSCALL_LOOKUP(open,                     3, STUB_open)
-  SYSCALL_LOOKUP(opendir,                  1, STUB_opendir)
-  SYSCALL_LOOKUP(readdir,                  1, STUB_readdir)
-  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(fstatfs,                  2, STUB_fstatfs)
-  SYSCALL_LOOKUP(telldir,                  1, STUB_telldir)
-
-#if defined(CONFIG_FS_RAMMAP)
+SYSCALL_LOOKUP(closedir,                   1, STUB_closedir)
+SYSCALL_LOOKUP(dup,                        1, STUB_dup)
+SYSCALL_LOOKUP(dup2,                       2, STUB_dup2)
+SYSCALL_LOOKUP(fcntl,                      3, STUB_fcntl)
+SYSCALL_LOOKUP(lseek,                      3, STUB_lseek)
+SYSCALL_LOOKUP(mmap,                       6, STUB_mmap)
+SYSCALL_LOOKUP(open,                       3, STUB_open)
+SYSCALL_LOOKUP(opendir,                    1, STUB_opendir)
+SYSCALL_LOOKUP(readdir,                    1, STUB_readdir)
+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(fstatfs,                    2, STUB_fstatfs)
+SYSCALL_LOOKUP(telldir,                    1, STUB_telldir)
+
+#ifdef CONFIG_FS_RAMMAP
   SYSCALL_LOOKUP(munmap,                   2, STUB_munmap)
 #endif
 
-#if defined(CONFIG_PSEUDOFS_SOFTLINKS)
+#ifdef CONFIG_PSEUDOFS_SOFTLINKS
   SYSCALL_LOOKUP(link,                     2, STUB_link)
   SYSCALL_LOOKUP(readlink,                 3, STUB_readlink)
 #endif
@@ -260,15 +257,15 @@ SYSCALL_LOOKUP(up_assert,                  2, STUB_up_assert)
 #endif
 
 #if CONFIG_NFILE_STREAMS > 0
-  SYSCALL_LOOKUP(fdopen,                   3, STUB_fs_fdopen)
+  SYSCALL_LOOKUP(fs_fdopen,                3, STUB_fs_fdopen)
   SYSCALL_LOOKUP(sched_getstreams,         0, STUB_sched_getstreams)
 #endif
 
-#if defined(CONFIG_NET_SENDFILE)
+#ifdef CONFIG_NET_SENDFILE
   SYSCALL_LOOKUP(sendfile,                 4, STUB_fs_sendifile)
 #endif
 
-#if !defined(CONFIG_DISABLE_MOUNTPOINT)
+#ifndef CONFIG_DISABLE_MOUNTPOINT
   SYSCALL_LOOKUP(mount,                    5, STUB_mount)
   SYSCALL_LOOKUP(fsync,                    1, STUB_fsync)
   SYSCALL_LOOKUP(ftruncate,                2, STUB_ftruncate)
@@ -352,12 +349,6 @@ SYSCALL_LOOKUP(up_assert,                  2, STUB_up_assert)
   SYSCALL_LOOKUP(unsetenv,                 1, STUB_unsetenv)
 #endif
 
-/* The following are defined only if netdb is supported */
-
-#ifdef CONFIG_LIBC_NETDB
-  SYSCALL_LOOKUP(sethostname,              2, STUB_sethostname)
-#endif
-
 /* The following are defined only if networking AND sockets are supported */
 
 #ifdef CONFIG_NET
@@ -389,7 +380,3 @@ SYSCALL_LOOKUP(up_assert,                  2, STUB_up_assert)
 #ifdef CONFIG_CRYPTO_RANDOM_POOL
   SYSCALL_LOOKUP(getrandom,                2, STUB_getrandom)
 #endif
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
diff --git a/syscall/syscall_funclookup.c b/syscall/syscall_funclookup.c
index f3ad80e..37e71d5 100644
--- a/syscall/syscall_funclookup.c
+++ b/syscall/syscall_funclookup.c
@@ -91,6 +91,10 @@
 #include <time.h>
 #include <unistd.h>
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
 /* Errno access is awkward. We need to generate get_errno() and set_errno()
  * interfaces to support the system calls, even though we don't use them
  * ourself.
@@ -103,10 +107,6 @@
 #undef set_errno
 
 /****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
  * Public Data
  ****************************************************************************/
 
@@ -119,18 +119,14 @@
 
 const uintptr_t g_funclookup[SYS_nsyscalls] =
 {
-#  undef SYSCALL_LOOKUP1
 #  define SYSCALL_LOOKUP1(f,n,p) (uintptr_t)f
-#  undef SYSCALL_LOOKUP
 #  define SYSCALL_LOOKUP(f,n,p)  , (uintptr_t)f
-#  include "syscall_lookup.h"
+#  include <sys/syscall_lookup.h>
+#  undef SYSCALL_LOOKUP1
+#  undef SYSCALL_LOOKUP
 };
 
 /****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
  * Public Functions
  ****************************************************************************/
 
diff --git a/syscall/syscall_nparms.c b/syscall/syscall_nparms.c
index 164ab3e..48ef680 100644
--- a/syscall/syscall_nparms.c
+++ b/syscall/syscall_nparms.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * syscall/syscall_stublookup.c
+ * syscall/syscall_nparms.c
  *
  *   Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved.
  *   Author: Gregory Nutt <gnutt@nuttx.org>
@@ -43,10 +43,6 @@
 #ifdef CONFIG_LIB_SYSCALL
 
 /****************************************************************************
- * Pre-processor definitions
- ****************************************************************************/
-
-/****************************************************************************
  * Public Data
  ****************************************************************************/
 
@@ -57,18 +53,14 @@
 
 const uint8_t g_funcnparms[SYS_nsyscalls] =
 {
-#  undef SYSCALL_LOOKUP1
 #  define SYSCALL_LOOKUP1(f,n,p) n
-#  undef SYSCALL_LOOKUP
 #  define SYSCALL_LOOKUP(f,n,p)  , n
-#  include "syscall_lookup.h"
+#  include <sys/syscall_lookup.h>
+#  undef SYSCALL_LOOKUP1
+#  undef SYSCALL_LOOKUP
 };
 
 /****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
  * Public Functions
  ****************************************************************************/
 
diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c
index 7083ce7..957da7f 100644
--- a/syscall/syscall_stublookup.c
+++ b/syscall/syscall_stublookup.c
@@ -417,18 +417,14 @@ uintptr_t STUB_getrandom(int nbr, uintptr_t parm1, uintptr_t parm2);
 
 const uintptr_t g_stublookup[SYS_nsyscalls] =
 {
-#  undef SYSCALL_LOOKUP1
 #  define SYSCALL_LOOKUP1(f,n,p) (uintptr_t)p
-#  undef SYSCALL_LOOKUP
 #  define SYSCALL_LOOKUP(f,n,p)  , (uintptr_t)p
-#  include "syscall_lookup.h"
+#  include <sys/syscall_lookup.h>
+#  undef SYSCALL_LOOKUP1
+#  undef SYSCALL_LOOKUP
 };
 
 /****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
  * Public Functions
  ****************************************************************************/
 


Mime
View raw message