summaryrefslogtreecommitdiff
path: root/nuttx/include/sys/syscall.h
blob: 67471e897fcea0e0539d4ec9642a809f39310005 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
/****************************************************************************
 * include/sys/syscall.h
 * This file contains the system call numbers.
 *
 *   Copyright (C) 2011 Gregory Nutt. All rights reserved.
 *   Author: Gregory Nutt <spudmonkey@racsa.co.cr>
 *
 * 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
 ****************************************************************************/

#include <nuttx/config.h>

/****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

/* Reserve the first system calls for platform-specific usage */

#ifndef CONFIG_CONFIG_SYS_RESERVED
#  define CONFIG_SYS_RESERVED          (32)
#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_sem_close                  (CONFIG_SYS_RESERVED+13)
#define SYS_sem_destroy                (CONFIG_SYS_RESERVED+14)
#define SYS_sem_open                   (CONFIG_SYS_RESERVED+15)
#define SYS_sem_post                   (CONFIG_SYS_RESERVED+16)
#define SYS_sem_trywait                (CONFIG_SYS_RESERVED+17)
#define SYS_sem_unlink                 (CONFIG_SYS_RESERVED+18)
#define SYS_sem_wait                   (CONFIG_SYS_RESERVED+19)
#define SYS_set_errno                  (CONFIG_SYS_RESERVED+20)
#define SYS_task_create                (CONFIG_SYS_RESERVED+21)
#define SYS_task_delete                (CONFIG_SYS_RESERVED+22)
#define SYS_task_restart               (CONFIG_SYS_RESERVED+23)
#define SYS_up_assert                  (CONFIG_SYS_RESERVED+24)
#define SYS_up_assert_code             (CONFIG_SYS_RESERVED+25)
#define __SYS_atexit                   (CONFIG_SYS_RESERVED+26)

/* The following can be individually enabled */

#ifdef CONFIG_SCHED_ATEXT
#  define SYS_atexit                   __SYS_atexit
#  define __SYS_waitpaid               (__SYS_atexit+1)
#else
#  define __SYS_waitpaid               __SYS_atexit
#endif

#ifdef CONFIG_SCHED_WAITPID
#  define SYS_waitpid                  __SYS_waitpaid
#  define __SYS_signals               (__SYS_waitpaid+1)
#else
#  define __SYS_signals                __SYS_waitpaid
#endif

/* The following are only defined is signals are supported in the NuttX
 * configuration.
 */

#ifndef CONFIG_DISABLE_SIGNALS
#  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_sleep                    (__SYS_signals+8)
#  define SYS_usleep                   (__SYS_signals+9)
#  define __SYS_clock                  (__SYS_signals+10)
#else
#  define __SYS_clock                  __SYS_signals
#endif

/* The following are only defined if the system clock is enabled in the
 * NuttX configuration.
 */

#ifndef CONFIG_DISABLE_CLOCK
#  define SYS_clock_getres             (__SYS_clock+0)
#  define SYS_clock_gettime            (__SYS_clock+1)
#  define SYS_clock_settime            (__SYS_clock+2)
#  define SYS_gettimeofday             (__SYS_clock+3)
#  define __SYS_timers                 (__SYS_clock+4)
#else
#  define __SYS_timers                 __SYS_clock
#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_descriptors            (__SYS_timers+5)
#else
#  define __SYS_descriptors             __SYS_timers
#endif

/* The following are defined if either file or socket descriptor are
 * enabled.
 */

#ifndef CONFIG_NET
#  undef CONFIG_NSOCKET_DESCRIPTORS
#  define CONFIG_NSOCKET_DESCRIPTORS 0
#endif

#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0 
#  define SYS_close                    (__SYS_descriptors+0)
#  define SYS_ioctl                    (__SYS_descriptors+1)
#  define SYS_poll                     (__SYS_descriptors+2)
#  define SYS_read                     (__SYS_descriptors+3)
#  define SYS_select                   (__SYS_descriptors+4)
#  define SYS_write                    (__SYS_descriptors+5)
#  define __SYS_filedesc               (__SYS_descriptors+6)
#else
#  define __SYS_filedesc               __SYS_descriptors
#endif

/* The following are defined if file descriptors are enabled */

#if CONFIG_NFILE_DESCRIPTORS > 0
#  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_mkfifo                   (__SYS_filedesc+5)
#  define SYS_mmap                     (__SYS_filedesc+6)
#  define SYS_open                     (__SYS_filedesc+7)
#  define SYS_opendir                  (__SYS_filedesc+8)
#  define SYS_pipe                     (__SYS_filedesc+9)
#  define SYS_readdir                  (__SYS_filedesc+10)
#  define SYS_rewinddir                (__SYS_filedesc+11)
#  define SYS_seekdir                  (__SYS_filedesc+12)
#  define SYS_stat                     (__SYS_filedesc+13)
#  define SYS_statfs                   (__SYS_filedesc+14)
#  define SYS_telldir                  (__SYS_filedesc+15)
#  if !defined(CONFIG_DISABLE_MOUNTPOINT)
#    define SYS_fsync                  (__SYS_filedesc+16)
#    define SYS_mkdir                  (__SYS_filedesc+17)
#    define SYS_mount                  (__SYS_filedesc+18)
#    define SYS_rename                 (__SYS_filedesc+19)
#    define SYS_rmdir                  (__SYS_filedesc+20)
#    define SYS_umount                 (__SYS_filedesc+21)
#    define SYS_unlink                 (__SYS_filedesc+22)
#    define __SYS_pthread              (__SYS_filedesc+23)
#  else
#    define __SYS_pthread              (__SYS_filedesc+16)
#  endif
#else
#  define __SYS_pthread                __SYS_filedesc
#endif

/* The following are defined if pthreads are enabled */

#ifndef CONFIG_DISABLE_PTHREAD
#  define SYS_pthread_barrier_destroy  (__SYS_pthread+0)
#  define SYS_pthread_barrier_init     (__SYS_pthread+1)
#  define SYS_pthread_barrier_wait     (__SYS_pthread+2)
#  define SYS_pthread_cancel           (__SYS_pthread+3)
#  define SYS_pthread_cond_broadcast   (__SYS_pthread+4)
#  define SYS_pthread_cond_destroy     (__SYS_pthread+5)
#  define SYS_pthread_cond_init        (__SYS_pthread+6)
#  define SYS_pthread_cond_signal      (__SYS_pthread+7)
#  define SYS_pthread_cond_wait        (__SYS_pthread+8)
#  define SYS_pthread_create           (__SYS_pthread+9)
#  define SYS_pthread_detach           (__SYS_pthread+10)
#  define SYS_pthread_exit             (__SYS_pthread+11)
#  define SYS_pthread_getschedparam    (__SYS_pthread+12)
#  define SYS_pthread_getspecific      (__SYS_pthread+13)
#  define SYS_pthread_join             (__SYS_pthread+14)
#  define SYS_pthread_key_create       (__SYS_pthread+15)
#  define SYS_pthread_key_delete       (__SYS_pthread+16)
#  define SYS_pthread_mutex_destroy    (__SYS_pthread+17)
#  define SYS_pthread_mutex_init       (__SYS_pthread+18)
#  define SYS_pthread_mutex_lock       (__SYS_pthread+19)
#  define SYS_pthread_mutex_trylock    (__SYS_pthread+20)
#  define SYS_pthread_mutex_unlock     (__SYS_pthread+21)
#  define SYS_pthread_once             (__SYS_pthread+22)
#  define SYS_pthread_setcancelstate   (__SYS_pthread+23)
#  define SYS_pthread_setschedparam    (__SYS_pthread+24)
#  define SYS_pthread_setschedprio     (__SYS_pthread+25)
#  define SYS_pthread_setspecific      (__SYS_pthread+26)
#  define SYS_pthread_testcancel       (__SYS_pthread+27)
#  define SYS_pthread_yield            (__SYS_pthread+28)
#  ifndef CONFIG_DISABLE_SIGNAL
#    define SYS_pthread_cond_timedwait (__SYS_pthread+29)
#    define SYS_pthread_kill           (__SYS_pthread+30)
#    define SYS_pthread_sigmask        (__SYS_pthread+31)
#    define __SYS_mqueue               (__SYS_pthread+32)
#  else
#    define __SYS_mqueue               (__SYS_pthread+29)
#  endif
#else
#  define __SYS_mqueue                 __SYS_pthread
#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_notify                (__SYS_mqueue+1)
#  define SYS_mq_open                  (__SYS_mqueue+2)
#  define SYS_mq_receive               (__SYS_mqueue+3)
#  define SYS_mq_send                  (__SYS_mqueue+4)
#  define SYS_mq_timedreceive          (__SYS_mqueue+5)
#  define SYS_mq_timedsend             (__SYS_mqueue+6)
#  define SYS_mq_unlink                (__SYS_mqueue+7)
#  define __SYS_environ                (__SYS_mqueue+8)
#else
#  define __SYS_environ                __SYS_mqueue
#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_network                (__SYS_environ+5)
#else
#  define __SYS_network                __SYS_environ
#endif

/* The following are defined only if networking AND sockets are supported */

#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)
#  define SYS_accept                   (__SYS_network+0)
#  define SYS_bind                     (__SYS_network+1)
#  define SYS_connect                  (__SYS_network+2)
#  define SYS_getsockopt               (__SYS_network+3)
#  define SYS_listen                   (__SYS_network+4)
#  define SYS_recv                     (__SYS_network+5)
#  define SYS_recvfrom                 (__SYS_network+6)
#  define SYS_send                     (__SYS_network+7)
#  define SYS_sendto                   (__SYS_network+8)
#  define SYS_setsockopt               (__SYS_network+9)
#  define SYS_socket                   (__SYS_network+10)
#  define SYS_nsyscalls                (__SYS_network+11)
#else
#  define SYS_nsyscalls                __SYS_network
#endif

/****************************************************************************
 * Public Type Definitions
 ****************************************************************************/

/****************************************************************************
 * Public Functions
 ****************************************************************************/

#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif

#undef EXTERN
#ifdef __cplusplus
}
#endif

#endif /* __INCLUDE_SYS_SYSCALL_H */