2018-06-16 21:07:12 +02:00
|
|
|
/****************************************************************************
|
2011-03-28 23:21:11 +02:00
|
|
|
* include/sys/syscall.h
|
|
|
|
* This file contains the system call numbers.
|
|
|
|
*
|
2019-02-26 01:19:13 +01:00
|
|
|
* Copyright (C) 2011-2019 Gregory Nutt. All rights reserved.
|
2012-04-26 17:00:35 +02:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
2011-03-28 23:21:11 +02:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_SYS_SYSCALL_H
|
|
|
|
#define __INCLUDE_SYS_SYSCALL_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2011-03-29 02:07:02 +02:00
|
|
|
#include <nuttx/config.h>
|
2011-04-06 17:04:57 +02:00
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
# include <stdint.h>
|
|
|
|
#endif
|
2011-03-29 02:07:02 +02:00
|
|
|
|
2014-08-29 01:03:54 +02:00
|
|
|
#ifdef CONFIG_LIB_SYSCALL
|
2013-03-06 20:56:32 +01:00
|
|
|
|
2011-03-28 23:21:11 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2011-04-04 14:43:35 +02:00
|
|
|
/* Reserve the first system calls for platform-specific usage if so
|
|
|
|
* configured.
|
|
|
|
*/
|
2011-03-29 02:07:02 +02:00
|
|
|
|
2011-04-06 17:04:57 +02:00
|
|
|
#ifndef CONFIG_SYS_RESERVED
|
2011-04-04 14:43:35 +02:00
|
|
|
# define CONFIG_SYS_RESERVED (0)
|
2011-03-29 02:07:02 +02:00
|
|
|
#endif
|
|
|
|
|
2011-04-04 04:28:29 +02:00
|
|
|
/* System call numbers
|
|
|
|
*
|
|
|
|
* These first system calls are supported regardless of the NuttX
|
|
|
|
* configuration
|
|
|
|
*/
|
|
|
|
|
2018-06-25 20:41:28 +02:00
|
|
|
#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)
|
2020-01-31 21:25:15 +01:00
|
|
|
|
2018-06-25 20:41:28 +02:00
|
|
|
#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)
|
2020-01-31 21:25:15 +01:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
# define SYS_sched_getcpu (CONFIG_SYS_RESERVED + 13)
|
|
|
|
# define __SYS_set_errno (CONFIG_SYS_RESERVED + 14)
|
|
|
|
#else
|
|
|
|
# define __SYS_set_errno (CONFIG_SYS_RESERVED + 13)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define SYS_set_errno (__SYS_set_errno + 0)
|
|
|
|
#define SYS_uname (__SYS_set_errno + 1)
|
|
|
|
#define __SYS_uid (__SYS_set_errno + 2)
|
2019-08-06 22:13:43 +02:00
|
|
|
|
|
|
|
/* 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
|
|
|
|
#endif
|
2014-09-28 20:19:01 +02:00
|
|
|
|
|
|
|
/* Semaphores */
|
|
|
|
|
2019-08-06 22:13:43 +02:00
|
|
|
#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)
|
2014-09-28 20:19:01 +02:00
|
|
|
|
2016-11-02 16:05:18 +01:00
|
|
|
#ifdef CONFIG_PRIORITY_INHERITANCE
|
2019-08-06 22:13:43 +02:00
|
|
|
# define SYS_sem_setprotocol (__SYS_sem + 5)
|
|
|
|
# define __SYS_named_sem (__SYS_sem + 6)
|
2016-11-02 16:05:18 +01:00
|
|
|
#else
|
2019-08-06 22:13:43 +02:00
|
|
|
# define __SYS_named_sem (__SYS_sem + 5)
|
2016-11-02 16:05:18 +01:00
|
|
|
#endif
|
|
|
|
|
2014-09-28 20:19:01 +02:00
|
|
|
/* Named semaphores */
|
|
|
|
|
|
|
|
#ifdef CONFIG_FS_NAMED_SEMAPHORES
|
2016-11-02 16:05:18 +01:00
|
|
|
# define SYS_sem_open __SYS_named_sem
|
2018-06-25 20:41:28 +02:00
|
|
|
# define SYS_sem_close (__SYS_named_sem + 1)
|
|
|
|
# define SYS_sem_unlink (__SYS_named_sem + 2)
|
|
|
|
# define __SYS_task_create (__SYS_named_sem + 3)
|
2014-10-09 14:58:23 +02:00
|
|
|
#else
|
2016-11-02 16:05:18 +01:00
|
|
|
# define __SYS_task_create __SYS_named_sem
|
2014-09-28 20:19:01 +02:00
|
|
|
#endif
|
2014-08-27 22:19:41 +02:00
|
|
|
|
2014-09-02 16:29:44 +02:00
|
|
|
/* Task creation APIs based on global entry points cannot be use with
|
|
|
|
* address environments.
|
|
|
|
*/
|
|
|
|
|
2014-09-16 23:37:05 +02:00
|
|
|
#ifndef CONFIG_BUILD_KERNEL
|
2014-09-28 20:19:01 +02:00
|
|
|
# define SYS_task_create __SYS_task_create
|
2019-08-28 00:41:07 +02:00
|
|
|
#ifdef CONFIG_BUILD_PROTECTED
|
2019-08-23 21:20:52 +02:00
|
|
|
# define SYS_nx_task_spawn (__SYS_task_create + 1)
|
|
|
|
# define __SYS_task_delete (__SYS_task_create + 2)
|
2019-08-28 00:41:07 +02:00
|
|
|
#else
|
|
|
|
# define __SYS_task_delete (__SYS_task_create + 1)
|
|
|
|
#endif
|
2014-09-02 16:29:44 +02:00
|
|
|
|
|
|
|
/* pgalloc() is only available with address environments with the page
|
|
|
|
* allocator selected. MMU support from the CPU is also required.
|
|
|
|
*/
|
|
|
|
|
2014-09-16 23:37:05 +02:00
|
|
|
#else
|
2014-09-28 20:19:01 +02:00
|
|
|
# define SYS_pgalloc __SYS_task_create
|
2018-06-25 20:41:28 +02:00
|
|
|
# define __SYS_task_delete (__SYS_task_create + 1)
|
2014-08-27 22:19:41 +02:00
|
|
|
#endif
|
2011-04-04 04:28:29 +02:00
|
|
|
|
2014-09-02 16:29:44 +02:00
|
|
|
# define SYS_task_delete __SYS_task_delete
|
2018-06-25 20:41:28 +02:00
|
|
|
# define SYS_task_restart (__SYS_task_delete + 1)
|
|
|
|
# define SYS_task_setcancelstate (__SYS_task_delete + 2)
|
|
|
|
# define SYS_up_assert (__SYS_task_delete + 3)
|
2016-12-10 23:06:14 +01:00
|
|
|
|
|
|
|
# ifdef CONFIG_CANCELLATION_POINTS
|
2018-06-25 20:41:28 +02:00
|
|
|
# define SYS_task_setcanceltype (__SYS_task_delete + 4)
|
|
|
|
# define SYS_task_testcancel (__SYS_task_delete + 5)
|
|
|
|
# define __SYS_vfork (__SYS_task_delete + 6)
|
2016-12-10 23:06:14 +01:00
|
|
|
# else
|
2018-06-25 20:41:28 +02:00
|
|
|
# define __SYS_vfork (__SYS_task_delete + 4)
|
2016-12-10 23:06:14 +01:00
|
|
|
# endif
|
2014-09-02 16:29:44 +02:00
|
|
|
|
2011-04-04 04:28:29 +02:00
|
|
|
/* The following can be individually enabled */
|
|
|
|
|
2019-07-10 15:25:00 +02:00
|
|
|
#if defined(CONFIG_SCHED_WAITPID) && defined(CONFIG_ARCH_HAVE_VFORK)
|
2013-03-06 20:56:32 +01:00
|
|
|
# define SYS_vfork __SYS_vfork
|
2018-06-25 20:41:28 +02:00
|
|
|
# define __SYS_atexit (__SYS_vfork + 1)
|
2013-03-06 20:56:32 +01:00
|
|
|
#else
|
2013-05-17 22:45:21 +02:00
|
|
|
# define __SYS_atexit __SYS_vfork
|
2013-03-06 20:56:32 +01:00
|
|
|
#endif
|
|
|
|
|
2011-04-04 14:43:35 +02:00
|
|
|
#ifdef CONFIG_SCHED_ATEXIT
|
2011-04-04 04:28:29 +02:00
|
|
|
# define SYS_atexit __SYS_atexit
|
2018-06-25 20:41:28 +02:00
|
|
|
# define __SYS_on_exit (__SYS_atexit + 1)
|
2011-04-04 04:28:29 +02:00
|
|
|
#else
|
2013-05-17 22:45:21 +02:00
|
|
|
# define __SYS_on_exit __SYS_atexit
|
2012-08-01 19:47:54 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_SCHED_ONEXIT
|
2013-05-17 22:45:21 +02:00
|
|
|
# define SYS_on_exit __SYS_on_exit
|
2018-06-25 20:41:28 +02:00
|
|
|
# define __SYS_waitpid (__SYS_on_exit + 1)
|
2012-08-01 19:47:54 +02:00
|
|
|
#else
|
2013-05-17 22:45:21 +02:00
|
|
|
# define __SYS_waitpid __SYS_on_exit
|
2011-04-04 04:28:29 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_SCHED_WAITPID
|
2013-03-06 20:56:32 +01:00
|
|
|
# define SYS_waitpid __SYS_waitpid
|
|
|
|
# ifdef CONFIG_SCHED_HAVE_PARENT
|
2018-06-25 20:41:28 +02:00
|
|
|
# define SYS_wait (__SYS_waitpid + 1)
|
|
|
|
# define SYS_waitid (__SYS_waitpid + 2)
|
|
|
|
# define __SYS_insmod (__SYS_waitpid + 3)
|
2013-03-06 20:56:32 +01:00
|
|
|
# else
|
2018-06-25 20:41:28 +02:00
|
|
|
# define __SYS_insmod (__SYS_waitpid + 1)
|
2013-03-06 20:56:32 +01:00
|
|
|
#endif
|
2011-04-04 04:28:29 +02:00
|
|
|
#else
|
2015-12-12 18:11:09 +01:00
|
|
|
# define __SYS_insmod __SYS_waitpid
|
|
|
|
#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
|
2018-06-25 20:41:28 +02:00
|
|
|
# define SYS_rmmod (__SYS_insmod + 1)
|
|
|
|
# define SYS_modhandle (__SYS_insmod + 2)
|
|
|
|
# define __SYS_exec (__SYS_insmod + 3)
|
2015-12-12 18:11:09 +01:00
|
|
|
#else
|
2017-10-03 15:09:35 +02:00
|
|
|
# define __SYS_exec __SYS_insmod
|
2013-03-06 20:56:32 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following can only be defined if we are configured to execute
|
|
|
|
* programs from a file system.
|
|
|
|
*/
|
|
|
|
|
2017-10-03 15:09:35 +02:00
|
|
|
#ifndef CONFIG_BINFMT_DISABLE
|
|
|
|
# ifndef CONFIG_BUILD_KERNEL
|
|
|
|
# define SYS_exec __SYS_exec
|
2018-06-25 20:41:28 +02:00
|
|
|
# define __SYS_posix_spawn (__SYS_exec + 1)
|
2013-03-06 20:56:32 +01:00
|
|
|
# else
|
2017-10-03 15:09:35 +02:00
|
|
|
# define __SYS_posix_spawn __SYS_exec
|
|
|
|
# endif
|
|
|
|
# ifdef CONFIG_LIBC_EXECFUNCS
|
2018-11-08 14:27:14 +01:00
|
|
|
# ifdef CONFIG_LIB_ENVPATH
|
2017-10-03 15:09:35 +02:00
|
|
|
# define SYS_posix_spawnp __SYS_posix_spawn
|
|
|
|
# else
|
|
|
|
# define SYS_posix_spawn __SYS_posix_spawn
|
|
|
|
# endif
|
2018-06-25 20:41:28 +02:00
|
|
|
# define SYS_execv (__SYS_posix_spawn + 1)
|
|
|
|
# define __SYS_signals (__SYS_posix_spawn + 2)
|
2017-10-03 15:09:35 +02:00
|
|
|
# else
|
|
|
|
# define __SYS_signals __SYS_posix_spawn
|
2013-03-06 20:56:32 +01:00
|
|
|
# endif
|
|
|
|
#else
|
2017-10-03 15:09:35 +02:00
|
|
|
# define __SYS_signals __SYS_exec
|
2011-04-04 04:28:29 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following are only defined is signals are supported in the NuttX
|
|
|
|
* configuration.
|
|
|
|
*/
|
|
|
|
|
2019-04-29 22:52:05 +02:00
|
|
|
#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)
|
2011-04-04 04:28:29 +02:00
|
|
|
|
|
|
|
/* The following are only defined if the system clock is enabled in the
|
|
|
|
* NuttX configuration.
|
|
|
|
*/
|
|
|
|
|
2018-06-25 20:41:28 +02:00
|
|
|
#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)
|
2016-07-11 14:54:02 +02:00
|
|
|
#ifdef CONFIG_CLOCK_TIMEKEEPING
|
2019-11-14 22:10:04 +01:00
|
|
|
# define SYS_adjtime (__SYS_clock + 4)
|
|
|
|
# define __SYS_timers (__SYS_clock + 5)
|
2016-07-11 00:55:32 +02:00
|
|
|
#else
|
2019-11-14 22:10:04 +01:00
|
|
|
# define __SYS_timers (__SYS_clock + 4)
|
2016-07-11 00:55:32 +02:00
|
|
|
#endif
|
2011-04-04 04:28:29 +02:00
|
|
|
|
|
|
|
/* The following are defined only if POSIX timers are supported */
|
|
|
|
|
|
|
|
#ifndef CONFIG_DISABLE_POSIX_TIMERS
|
2018-06-25 20:41:28 +02:00
|
|
|
# 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)
|
2019-11-14 22:10:04 +01:00
|
|
|
# define SYS_getitimer (__SYS_timers + 5)
|
|
|
|
# define SYS_setitimer (__SYS_timers + 6)
|
|
|
|
# define __SYS_syslog (__SYS_timers + 7)
|
2011-04-04 04:28:29 +02:00
|
|
|
#else
|
2016-06-19 15:03:44 +02:00
|
|
|
# define __SYS_syslog __SYS_timers
|
2011-04-04 04:28:29 +02:00
|
|
|
#endif
|
|
|
|
|
2016-06-19 15:03:44 +02:00
|
|
|
/* Unconditional system logging */
|
|
|
|
|
2018-06-25 20:41:28 +02:00
|
|
|
#define SYS_nx_vsyslog (__SYS_syslog + 0)
|
|
|
|
#define __SYS_descriptors (__SYS_syslog + 1)
|
2016-06-19 15:03:44 +02:00
|
|
|
|
2011-04-04 04:28:29 +02:00
|
|
|
/* The following are defined if either file or socket descriptor are
|
|
|
|
* enabled.
|
|
|
|
*/
|
|
|
|
|
2019-02-11 19:09:26 +01:00
|
|
|
#define SYS_close (__SYS_descriptors + 0)
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_IOCTL_VARIADIC
|
|
|
|
# define SYS_fs_ioctl (__SYS_descriptors + 1)
|
|
|
|
#else
|
|
|
|
# define SYS_ioctl (__SYS_descriptors + 1)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
2019-05-22 02:57:54 +02:00
|
|
|
#define SYS_poll __SYS_poll
|
|
|
|
#define SYS_select (__SYS_poll + 1)
|
|
|
|
#define SYS_ppoll (__SYS_poll + 2)
|
|
|
|
#define SYS_pselect (__SYS_poll + 3)
|
|
|
|
#define __SYS_ifindex (__SYS_poll + 4)
|
2019-02-11 19:09:26 +01:00
|
|
|
|
|
|
|
#ifdef CONFIG_NETDEV_IFINDEX
|
|
|
|
# define SYS_if_indextoname __SYS_ifindex
|
|
|
|
# define SYS_if_nametoindex (__SYS_ifindex + 1)
|
|
|
|
# define __SYS_termios (__SYS_ifindex + 2)
|
|
|
|
#else
|
|
|
|
# define __SYS_termios __SYS_ifindex
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_SERIAL_TERMIOS
|
|
|
|
# define SYS_tcdrain __SYS_termios
|
|
|
|
# define __SYS_boardctl (__SYS_termios + 1)
|
|
|
|
#else
|
|
|
|
# define __SYS_boardctl __SYS_termios
|
2015-03-31 19:25:52 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Board support */
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIB_BOARDCTL
|
|
|
|
# define SYS_boardctl __SYS_boardctl
|
2018-06-25 20:41:28 +02:00
|
|
|
# define __SYS_filedesc (__SYS_boardctl + 1)
|
2015-03-31 19:25:52 +02:00
|
|
|
#else
|
|
|
|
# define __SYS_filedesc __SYS_boardctl
|
2011-04-04 04:28:29 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following are defined if file descriptors are enabled */
|
|
|
|
|
2019-02-11 19:09:26 +01:00
|
|
|
#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)
|
2019-04-05 04:37:32 +02:00
|
|
|
#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
|
2019-02-11 19:09:26 +01:00
|
|
|
|
|
|
|
#if defined(CONFIG_PSEUDOFS_SOFTLINKS)
|
2019-04-05 04:37:32 +02:00
|
|
|
# define SYS_link (__SYS_link + 0)
|
|
|
|
# define SYS_readlink (__SYS_link + 1)
|
|
|
|
# define __SYS_pipes (__SYS_link + 2)
|
2019-02-11 19:09:26 +01:00
|
|
|
#else
|
2019-04-05 04:37:32 +02:00
|
|
|
# define __SYS_pipes __SYS_link
|
2019-02-11 19:09:26 +01:00
|
|
|
#endif
|
2016-07-20 23:26:54 +02:00
|
|
|
|
2019-02-11 19:09:26 +01:00
|
|
|
#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
|
|
|
|
# define SYS_pipe2 (__SYS_pipes + 0)
|
|
|
|
# define __SYS_mkfifo2 (__SYS_pipes + 1)
|
|
|
|
#else
|
|
|
|
# define __SYS_mkfifo2 (__SYS_pipes + 0)
|
|
|
|
#endif
|
2011-04-05 03:46:55 +02:00
|
|
|
|
2019-02-11 19:09:26 +01:00
|
|
|
#if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0
|
|
|
|
# define SYS_mkfifo2 (__SYS_mkfifo2 + 0)
|
|
|
|
# define __SYS_fs_fdopen (__SYS_mkfifo2 + 1)
|
|
|
|
#else
|
|
|
|
# define __SYS_fs_fdopen (__SYS_mkfifo2 + 0)
|
|
|
|
#endif
|
2013-09-28 22:47:49 +02:00
|
|
|
|
2019-02-11 19:09:26 +01:00
|
|
|
#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
|
2011-04-05 03:46:55 +02:00
|
|
|
|
2019-02-11 19:09:26 +01:00
|
|
|
#if defined(CONFIG_NET_SENDFILE)
|
|
|
|
# define SYS_sendfile, __SYS_sendfile
|
|
|
|
# define __SYS_mountpoint (__SYS_sendfile + 1)
|
|
|
|
#else
|
|
|
|
# define __SYS_mountpoint __SYS_sendfile
|
|
|
|
#endif
|
2011-04-05 03:46:55 +02:00
|
|
|
|
2019-02-11 19:09:26 +01:00
|
|
|
#if !defined(CONFIG_DISABLE_MOUNTPOINT)
|
|
|
|
#if defined(CONFIG_FS_READABLE)
|
2019-07-13 18:15:52 +02:00
|
|
|
# define SYS_mount (__SYS_mountpoint + 0)
|
|
|
|
# define __SYS_fs (__SYS_mountpoint + 1)
|
|
|
|
#else
|
|
|
|
# define __SYS_fs (__SYS_mountpoint + 0)
|
2019-02-11 19:09:26 +01:00
|
|
|
#endif
|
2019-07-13 18:15:52 +02:00
|
|
|
# define SYS_fsync (__SYS_fs + 0)
|
|
|
|
# define SYS_ftruncate (__SYS_fs + 1)
|
|
|
|
# define SYS_mkdir (__SYS_fs + 2)
|
|
|
|
# define SYS_rename (__SYS_fs + 3)
|
|
|
|
# define SYS_rmdir (__SYS_fs + 4)
|
|
|
|
# define SYS_umount2 (__SYS_fs + 5)
|
|
|
|
# define SYS_unlink (__SYS_fs + 6)
|
|
|
|
# define __SYS_shm (__SYS_fs + 7)
|
2011-04-04 04:28:29 +02:00
|
|
|
#else
|
2019-02-11 19:09:26 +01:00
|
|
|
# define __SYS_shm __SYS_mountpoint
|
2014-09-22 23:24:09 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Shared memory interfaces */
|
|
|
|
|
|
|
|
#ifdef CONFIG_MM_SHM
|
2019-07-13 18:15:52 +02:00
|
|
|
# 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)
|
2014-09-22 23:24:09 +02:00
|
|
|
#else
|
|
|
|
# define __SYS_pthread __SYS_shm
|
2011-04-04 04:28:29 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following are defined if pthreads are enabled */
|
|
|
|
|
|
|
|
#ifndef CONFIG_DISABLE_PTHREAD
|
2018-06-25 20:41:28 +02:00
|
|
|
# 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)
|
2019-04-04 18:30:46 +02:00
|
|
|
# define SYS_pthread_get_stackaddr_np (__SYS_pthread + 7)
|
|
|
|
# define SYS_pthread_get_stacksize_np (__SYS_pthread + 8)
|
|
|
|
# define SYS_pthread_getschedparam (__SYS_pthread + 9)
|
|
|
|
# define SYS_pthread_getspecific (__SYS_pthread + 10)
|
|
|
|
# define SYS_pthread_join (__SYS_pthread + 11)
|
|
|
|
# define SYS_pthread_key_create (__SYS_pthread + 12)
|
|
|
|
# define SYS_pthread_key_delete (__SYS_pthread + 13)
|
|
|
|
# define SYS_pthread_mutex_destroy (__SYS_pthread + 14)
|
|
|
|
# define SYS_pthread_mutex_init (__SYS_pthread + 15)
|
|
|
|
# define SYS_pthread_mutex_timedlock (__SYS_pthread + 16)
|
|
|
|
# define SYS_pthread_mutex_trylock (__SYS_pthread + 17)
|
|
|
|
# define SYS_pthread_mutex_unlock (__SYS_pthread + 18)
|
2017-03-27 17:36:03 +02:00
|
|
|
|
|
|
|
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
|
2019-04-04 18:30:46 +02:00
|
|
|
# define SYS_pthread_mutex_consistent (__SYS_pthread + 19)
|
|
|
|
# define __SYS_pthread_setschedparam (__SYS_pthread + 20)
|
2017-03-27 17:36:03 +02:00
|
|
|
#else
|
2019-04-04 18:30:46 +02:00
|
|
|
# define __SYS_pthread_setschedparam (__SYS_pthread + 19)
|
2017-03-27 17:36:03 +02:00
|
|
|
#endif
|
|
|
|
|
2018-06-25 20:41:28 +02:00
|
|
|
# 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)
|
2011-04-05 03:46:55 +02:00
|
|
|
|
2016-12-08 16:27:13 +01:00
|
|
|
# ifdef CONFIG_SMP
|
2018-06-25 20:41:28 +02:00
|
|
|
# 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)
|
2016-02-20 01:13:06 +01:00
|
|
|
# else
|
2016-12-10 14:40:48 +01:00
|
|
|
# define __SYS_pthread_signals __SYS_pthread_smp
|
2016-02-20 01:13:06 +01:00
|
|
|
# endif
|
|
|
|
|
2019-04-29 22:52:05 +02:00
|
|
|
# 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)
|
2016-12-08 16:27:13 +01:00
|
|
|
|
|
|
|
# ifdef CONFIG_PTHREAD_CLEANUP
|
2019-08-14 00:12:58 +02:00
|
|
|
# define SYS_pthread_cleanup_push (__SYS_pthread_cleanup + 0)
|
|
|
|
# define SYS_pthread_cleanup_pop (__SYS_pthread_cleanup + 1)
|
2018-06-25 20:41:28 +02:00
|
|
|
# define __SYS_mqueue (__SYS_pthread_cleanup + 2)
|
2016-12-08 16:27:13 +01:00
|
|
|
# else
|
|
|
|
# define __SYS_mqueue __SYS_pthread_cleanup
|
2011-04-04 04:28:29 +02:00
|
|
|
# endif
|
2011-04-05 03:46:55 +02:00
|
|
|
|
2011-04-04 04:28:29 +02:00
|
|
|
#else
|
|
|
|
# define __SYS_mqueue __SYS_pthread
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following are defined only if message queues are enabled */
|
|
|
|
|
|
|
|
#ifndef CONFIG_DISABLE_MQUEUE
|
2018-06-25 20:41:28 +02:00
|
|
|
# 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)
|
2011-04-04 04:28:29 +02:00
|
|
|
#else
|
|
|
|
# define __SYS_environ __SYS_mqueue
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following are defined only if environment variables are supported */
|
|
|
|
|
|
|
|
#ifndef CONFIG_DISABLE_ENVIRON
|
2018-06-25 20:41:28 +02:00
|
|
|
# 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)
|
2011-04-04 04:28:29 +02:00
|
|
|
#else
|
2015-07-10 23:41:20 +02:00
|
|
|
# define __SYS_netdb __SYS_environ
|
2011-04-04 04:28:29 +02:00
|
|
|
#endif
|
|
|
|
|
2015-07-10 23:41:20 +02:00
|
|
|
/* The following are defined if netdb is supported */
|
2015-07-05 16:40:56 +02:00
|
|
|
|
2015-07-10 23:41:20 +02:00
|
|
|
#ifdef CONFIG_LIBC_NETDB
|
2018-06-25 20:41:28 +02:00
|
|
|
# define SYS_sethostname (__SYS_netdb + 0)
|
|
|
|
# define __SYS_network (__SYS_netdb + 1)
|
2015-07-10 23:41:20 +02:00
|
|
|
#else
|
|
|
|
# define __SYS_network __SYS_netdb
|
|
|
|
#endif
|
2015-07-05 16:40:56 +02:00
|
|
|
|
2011-04-04 04:28:29 +02:00
|
|
|
/* The following are defined only if networking AND sockets are supported */
|
|
|
|
|
2019-02-11 22:47:25 +01:00
|
|
|
#ifdef CONFIG_NET
|
2018-06-25 20:41:28 +02:00
|
|
|
# define SYS_accept (__SYS_network + 0)
|
|
|
|
# define SYS_bind (__SYS_network + 1)
|
|
|
|
# define SYS_connect (__SYS_network + 2)
|
2018-07-19 15:30:01 +02:00
|
|
|
# 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)
|
2011-04-04 04:28:29 +02:00
|
|
|
#else
|
2018-07-26 15:37:44 +02:00
|
|
|
# define SYS_socket __SYS_network
|
2012-04-26 17:00:35 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following is defined only if CONFIG_TASK_NAME_SIZE > 0 */
|
|
|
|
|
|
|
|
#if CONFIG_TASK_NAME_SIZE > 0
|
2018-07-26 15:37:44 +02:00
|
|
|
# define SYS_prctl (SYS_socket + 1)
|
2012-04-26 17:00:35 +02:00
|
|
|
#else
|
2018-07-26 15:37:44 +02:00
|
|
|
# define SYS_prctl SYS_socket
|
2017-03-30 15:38:37 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The following is defined only if entropy pool random number generator
|
2019-11-13 15:00:45 +01:00
|
|
|
* is enabled.
|
|
|
|
*/
|
2017-03-30 15:38:37 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_CRYPTO_RANDOM_POOL
|
2018-06-25 20:41:28 +02:00
|
|
|
# define SYS_getrandom (SYS_prctl + 1)
|
|
|
|
# define SYS_maxsyscall (SYS_prctl + 2)
|
2017-03-30 15:38:37 +02:00
|
|
|
#else
|
2018-07-25 06:26:12 +02:00
|
|
|
# define SYS_maxsyscall (SYS_prctl + 1)
|
2011-04-04 04:28:29 +02:00
|
|
|
#endif
|
2011-03-28 23:21:11 +02:00
|
|
|
|
2011-04-06 17:04:57 +02:00
|
|
|
/* 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)
|
|
|
|
|
2011-03-28 23:21:11 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Type Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2011-04-04 14:43:35 +02:00
|
|
|
* Public Data
|
2011-03-28 23:21:11 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2013-03-06 20:56:32 +01:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2011-03-28 23:21:11 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
2015-06-13 03:26:01 +02:00
|
|
|
extern "C"
|
|
|
|
{
|
2011-03-28 23:21:11 +02:00
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2013-03-06 20:56:32 +01:00
|
|
|
#ifdef __KERNEL__
|
|
|
|
|
|
|
|
/* Function lookup tables. This table is indexed by the system call numbers
|
|
|
|
* defined above. Given the system call number, this table provides the
|
|
|
|
* address of the corresponding system function.
|
|
|
|
*
|
|
|
|
* This table is only available during the kernel phase of a kernel build.
|
|
|
|
*/
|
|
|
|
|
|
|
|
EXTERN const uintptr_t g_funclookup[SYS_nsyscalls];
|
|
|
|
|
|
|
|
/* Given the system call number, the corresponding entry in this table
|
|
|
|
* provides the address of the stub function.
|
|
|
|
*
|
|
|
|
* This table is only available during the kernel phase of a kernel build.
|
|
|
|
*/
|
|
|
|
|
|
|
|
EXTERN const uintptr_t g_stublookup[SYS_nsyscalls];
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Given the system call number, the corresponding entry in this table
|
|
|
|
* provides the number of parameters needed by the function.
|
2011-04-04 14:43:35 +02:00
|
|
|
*/
|
|
|
|
|
2013-03-06 20:56:32 +01:00
|
|
|
EXTERN const uint8_t g_funcnparms[SYS_nsyscalls];
|
2011-04-04 14:43:35 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2011-03-28 23:21:11 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-04-06 17:04:57 +02:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2014-08-29 22:47:22 +02:00
|
|
|
#endif /* CONFIG_LIB_SYSCALL */
|
2011-03-28 23:21:11 +02:00
|
|
|
#endif /* __INCLUDE_SYS_SYSCALL_H */
|