syscall.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /****************************************************************************
  2. * include/sys/syscall.h
  3. * This file contains the system call numbers.
  4. *
  5. * Licensed to the Apache Software Foundation (ASF) under one or more
  6. * contributor license agreements. See the NOTICE file distributed with
  7. * this work for additional information regarding copyright ownership. The
  8. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  9. * "License"); you may not use this file except in compliance with the
  10. * License. You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  16. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  17. * License for the specific language governing permissions and limitations
  18. * under the License.
  19. *
  20. ****************************************************************************/
  21. #ifndef __INCLUDE_SYS_SYSCALL_H
  22. #define __INCLUDE_SYS_SYSCALL_H
  23. /****************************************************************************
  24. * Included Files
  25. ****************************************************************************/
  26. #include <nuttx/config.h>
  27. #ifndef __ASSEMBLY__
  28. # include <stdint.h>
  29. #endif
  30. #ifdef CONFIG_LIB_SYSCALL
  31. /****************************************************************************
  32. * Pre-processor Definitions
  33. ****************************************************************************/
  34. /* Reserve the first system calls for platform-specific usage if so
  35. * configured.
  36. */
  37. #ifndef CONFIG_SYS_RESERVED
  38. # define CONFIG_SYS_RESERVED (0)
  39. #endif
  40. /* Note that the reported number of system calls does *NOT* include the
  41. * architecture-specific system calls. If the "real" total is required,
  42. * use SYS_maxsyscall.
  43. */
  44. #define SYS_nsyscalls (SYS_maxsyscall - CONFIG_SYS_RESERVED)
  45. #ifndef __ASSEMBLY__
  46. /****************************************************************************
  47. * Public Type Definitions
  48. ****************************************************************************/
  49. enum
  50. {
  51. # define SYSCALL_LOOKUP_(f) SYS_##f
  52. # define SYSCALL_LOOKUP1(f,n) SYSCALL_LOOKUP_(f) = CONFIG_SYS_RESERVED
  53. # define SYSCALL_LOOKUP(f,n) , SYSCALL_LOOKUP_(f)
  54. # include "syscall_lookup.h"
  55. , SYS_maxsyscall
  56. # undef SYSCALL_LOOKUP_
  57. # undef SYSCALL_LOOKUP1
  58. # undef SYSCALL_LOOKUP
  59. };
  60. /****************************************************************************
  61. * Public Data
  62. ****************************************************************************/
  63. #ifdef __cplusplus
  64. #define EXTERN extern "C"
  65. extern "C"
  66. {
  67. #else
  68. #define EXTERN extern
  69. #endif
  70. #ifdef CONFIG_LIB_SYSCALL
  71. /* Given the system call number, the corresponding entry in this table
  72. * provides the address of the stub function.
  73. *
  74. * This table is only available during the kernel phase of a kernel build.
  75. */
  76. EXTERN const uintptr_t g_stublookup[SYS_nsyscalls];
  77. #endif
  78. #ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
  79. /* Given the system call number, the corresponding entry in this table
  80. * provides the name of the function.
  81. */
  82. EXTERN const char *g_funcnames[SYS_nsyscalls];
  83. #endif
  84. /****************************************************************************
  85. * Public Function Prototypes
  86. ****************************************************************************/
  87. #undef EXTERN
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif /* __ASSEMBLY__ */
  92. #endif /* CONFIG_LIB_SYSCALL */
  93. #endif /* __INCLUDE_SYS_SYSCALL_H */