syscalls.h 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  1. /*
  2. * syscalls.h - Linux syscall interfaces (non-arch-specific)
  3. *
  4. * Copyright (c) 2004 Randy Dunlap
  5. * Copyright (c) 2004 Open Source Development Labs
  6. *
  7. * This file is released under the GPLv2.
  8. * See the file COPYING for more details.
  9. */
  10. #ifndef _LINUX_SYSCALLS_H
  11. #define _LINUX_SYSCALLS_H
  12. struct epoll_event;
  13. struct iattr;
  14. struct inode;
  15. struct iocb;
  16. struct io_event;
  17. struct iovec;
  18. struct itimerspec;
  19. struct itimerval;
  20. struct kexec_segment;
  21. struct linux_dirent;
  22. struct linux_dirent64;
  23. struct list_head;
  24. struct mmap_arg_struct;
  25. struct msgbuf;
  26. struct user_msghdr;
  27. struct mmsghdr;
  28. struct msqid_ds;
  29. struct new_utsname;
  30. struct nfsctl_arg;
  31. struct __old_kernel_stat;
  32. struct oldold_utsname;
  33. struct old_utsname;
  34. struct pollfd;
  35. struct rlimit;
  36. struct rlimit64;
  37. struct rusage;
  38. struct sched_param;
  39. struct sched_attr;
  40. struct sel_arg_struct;
  41. struct semaphore;
  42. struct sembuf;
  43. struct shmid_ds;
  44. struct sockaddr;
  45. struct stat;
  46. struct stat64;
  47. struct statfs;
  48. struct statfs64;
  49. struct statx;
  50. struct __sysctl_args;
  51. struct sysinfo;
  52. struct timespec;
  53. struct timeval;
  54. struct timex;
  55. struct timezone;
  56. struct tms;
  57. struct utimbuf;
  58. struct mq_attr;
  59. struct compat_stat;
  60. struct compat_timeval;
  61. struct robust_list_head;
  62. struct getcpu_cache;
  63. struct old_linux_dirent;
  64. struct perf_event_attr;
  65. struct file_handle;
  66. struct sigaltstack;
  67. union bpf_attr;
  68. #include <linux/types.h>
  69. #include <linux/aio_abi.h>
  70. #include <linux/capability.h>
  71. #include <linux/signal.h>
  72. #include <linux/list.h>
  73. #include <linux/bug.h>
  74. #include <linux/sem.h>
  75. #include <asm/siginfo.h>
  76. #include <linux/unistd.h>
  77. #include <linux/quota.h>
  78. #include <linux/key.h>
  79. #include <trace/syscall.h>
  80. /*
  81. * __MAP - apply a macro to syscall arguments
  82. * __MAP(n, m, t1, a1, t2, a2, ..., tn, an) will expand to
  83. * m(t1, a1), m(t2, a2), ..., m(tn, an)
  84. * The first argument must be equal to the amount of type/name
  85. * pairs given. Note that this list of pairs (i.e. the arguments
  86. * of __MAP starting at the third one) is in the same format as
  87. * for SYSCALL_DEFINE<n>/COMPAT_SYSCALL_DEFINE<n>
  88. */
  89. #define __MAP0(m,...)
  90. #define __MAP1(m,t,a) m(t,a)
  91. #define __MAP2(m,t,a,...) m(t,a), __MAP1(m,__VA_ARGS__)
  92. #define __MAP3(m,t,a,...) m(t,a), __MAP2(m,__VA_ARGS__)
  93. #define __MAP4(m,t,a,...) m(t,a), __MAP3(m,__VA_ARGS__)
  94. #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
  95. #define __MAP6(m,t,a,...) m(t,a), __MAP5(m,__VA_ARGS__)
  96. #define __MAP(n,...) __MAP##n(__VA_ARGS__)
  97. #define __SC_DECL(t, a) t a
  98. #define __TYPE_AS(t, v) __same_type((__force t)0, v)
  99. #define __TYPE_IS_L(t) (__TYPE_AS(t, 0L))
  100. #define __TYPE_IS_UL(t) (__TYPE_AS(t, 0UL))
  101. #define __TYPE_IS_LL(t) (__TYPE_AS(t, 0LL) || __TYPE_AS(t, 0ULL))
  102. #define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a
  103. #define __SC_CAST(t, a) (__force t) a
  104. #define __SC_ARGS(t, a) a
  105. #define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long))
  106. #ifdef CONFIG_FTRACE_SYSCALLS
  107. #define __SC_STR_ADECL(t, a) #a
  108. #define __SC_STR_TDECL(t, a) #t
  109. extern struct trace_event_class event_class_syscall_enter;
  110. extern struct trace_event_class event_class_syscall_exit;
  111. extern struct trace_event_functions enter_syscall_print_funcs;
  112. extern struct trace_event_functions exit_syscall_print_funcs;
  113. #define SYSCALL_TRACE_ENTER_EVENT(sname) \
  114. static struct syscall_metadata __syscall_meta_##sname; \
  115. static struct trace_event_call __used \
  116. event_enter_##sname = { \
  117. .class = &event_class_syscall_enter, \
  118. { \
  119. .name = "sys_enter"#sname, \
  120. }, \
  121. .event.funcs = &enter_syscall_print_funcs, \
  122. .data = (void *)&__syscall_meta_##sname,\
  123. .flags = TRACE_EVENT_FL_CAP_ANY, \
  124. }; \
  125. static struct trace_event_call __used \
  126. __attribute__((section("_ftrace_events"))) \
  127. *__event_enter_##sname = &event_enter_##sname;
  128. #define SYSCALL_TRACE_EXIT_EVENT(sname) \
  129. static struct syscall_metadata __syscall_meta_##sname; \
  130. static struct trace_event_call __used \
  131. event_exit_##sname = { \
  132. .class = &event_class_syscall_exit, \
  133. { \
  134. .name = "sys_exit"#sname, \
  135. }, \
  136. .event.funcs = &exit_syscall_print_funcs, \
  137. .data = (void *)&__syscall_meta_##sname,\
  138. .flags = TRACE_EVENT_FL_CAP_ANY, \
  139. }; \
  140. static struct trace_event_call __used \
  141. __attribute__((section("_ftrace_events"))) \
  142. *__event_exit_##sname = &event_exit_##sname;
  143. #define SYSCALL_METADATA(sname, nb, ...) \
  144. static const char *types_##sname[] = { \
  145. __MAP(nb,__SC_STR_TDECL,__VA_ARGS__) \
  146. }; \
  147. static const char *args_##sname[] = { \
  148. __MAP(nb,__SC_STR_ADECL,__VA_ARGS__) \
  149. }; \
  150. SYSCALL_TRACE_ENTER_EVENT(sname); \
  151. SYSCALL_TRACE_EXIT_EVENT(sname); \
  152. static struct syscall_metadata __used \
  153. __syscall_meta_##sname = { \
  154. .name = "sys"#sname, \
  155. .syscall_nr = -1, /* Filled in at boot */ \
  156. .nb_args = nb, \
  157. .types = nb ? types_##sname : NULL, \
  158. .args = nb ? args_##sname : NULL, \
  159. .enter_event = &event_enter_##sname, \
  160. .exit_event = &event_exit_##sname, \
  161. .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
  162. }; \
  163. static struct syscall_metadata __used \
  164. __attribute__((section("__syscalls_metadata"))) \
  165. *__p_syscall_meta_##sname = &__syscall_meta_##sname;
  166. static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
  167. {
  168. return tp_event->class == &event_class_syscall_enter ||
  169. tp_event->class == &event_class_syscall_exit;
  170. }
  171. #else
  172. #define SYSCALL_METADATA(sname, nb, ...)
  173. static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
  174. {
  175. return 0;
  176. }
  177. #endif
  178. #define SYSCALL_DEFINE0(sname) \
  179. SYSCALL_METADATA(_##sname, 0); \
  180. asmlinkage long sys_##sname(void)
  181. #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
  182. #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
  183. #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
  184. #define SYSCALL_DEFINE4(name, ...) SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
  185. #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
  186. #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
  187. #define SYSCALL_DEFINE_MAXARGS 6
  188. #define SYSCALL_DEFINEx(x, sname, ...) \
  189. SYSCALL_METADATA(sname, x, __VA_ARGS__) \
  190. __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  191. #define __PROTECT(...) asmlinkage_protect(__VA_ARGS__)
  192. #define __SYSCALL_DEFINEx(x, name, ...) \
  193. asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
  194. __attribute__((alias(__stringify(SyS##name)))); \
  195. static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
  196. asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
  197. asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
  198. { \
  199. long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \
  200. __MAP(x,__SC_TEST,__VA_ARGS__); \
  201. __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
  202. return ret; \
  203. } \
  204. static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
  205. /*
  206. * Called before coming back to user-mode. Returning to user-mode with an
  207. * address limit different than USER_DS can allow to overwrite kernel memory.
  208. */
  209. static inline void addr_limit_user_check(void)
  210. {
  211. #ifdef TIF_FSCHECK
  212. if (!test_thread_flag(TIF_FSCHECK))
  213. return;
  214. #endif
  215. if (CHECK_DATA_CORRUPTION(!segment_eq(get_fs(), USER_DS),
  216. "Invalid address limit on user-mode return"))
  217. force_sig(SIGKILL, current);
  218. #ifdef TIF_FSCHECK
  219. clear_thread_flag(TIF_FSCHECK);
  220. #endif
  221. }
  222. /*
  223. * These syscall function prototypes are kept in the same order as
  224. * include/uapi/asm-generic/unistd.h. Architecture specific entries go below,
  225. * followed by deprecated or obsolete system calls.
  226. *
  227. * Please note that these prototypes here are only provided for information
  228. * purposes, for static analysis, and for linking from the syscall table.
  229. * These functions should not be called elsewhere from kernel code.
  230. */
  231. asmlinkage long sys_io_setup(unsigned nr_reqs, aio_context_t __user *ctx);
  232. asmlinkage long sys_io_destroy(aio_context_t ctx);
  233. asmlinkage long sys_io_submit(aio_context_t, long,
  234. struct iocb __user * __user *);
  235. asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
  236. struct io_event __user *result);
  237. asmlinkage long sys_io_getevents(aio_context_t ctx_id,
  238. long min_nr,
  239. long nr,
  240. struct io_event __user *events,
  241. struct timespec __user *timeout);
  242. /* fs/xattr.c */
  243. asmlinkage long sys_setxattr(const char __user *path, const char __user *name,
  244. const void __user *value, size_t size, int flags);
  245. asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name,
  246. const void __user *value, size_t size, int flags);
  247. asmlinkage long sys_fsetxattr(int fd, const char __user *name,
  248. const void __user *value, size_t size, int flags);
  249. asmlinkage long sys_getxattr(const char __user *path, const char __user *name,
  250. void __user *value, size_t size);
  251. asmlinkage long sys_lgetxattr(const char __user *path, const char __user *name,
  252. void __user *value, size_t size);
  253. asmlinkage long sys_fgetxattr(int fd, const char __user *name,
  254. void __user *value, size_t size);
  255. asmlinkage long sys_listxattr(const char __user *path, char __user *list,
  256. size_t size);
  257. asmlinkage long sys_llistxattr(const char __user *path, char __user *list,
  258. size_t size);
  259. asmlinkage long sys_flistxattr(int fd, char __user *list, size_t size);
  260. asmlinkage long sys_removexattr(const char __user *path,
  261. const char __user *name);
  262. asmlinkage long sys_lremovexattr(const char __user *path,
  263. const char __user *name);
  264. asmlinkage long sys_fremovexattr(int fd, const char __user *name);
  265. /* fs/dcache.c */
  266. asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
  267. /* fs/cookies.c */
  268. asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user *buf, size_t len);
  269. /* fs/eventfd.c */
  270. asmlinkage long sys_eventfd2(unsigned int count, int flags);
  271. /* fs/eventpoll.c */
  272. asmlinkage long sys_epoll_create1(int flags);
  273. asmlinkage long sys_epoll_ctl(int epfd, int op, int fd,
  274. struct epoll_event __user *event);
  275. asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
  276. int maxevents, int timeout,
  277. const sigset_t __user *sigmask,
  278. size_t sigsetsize);
  279. /* fs/fcntl.c */
  280. asmlinkage long sys_dup(unsigned int fildes);
  281. asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags);
  282. asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
  283. #if BITS_PER_LONG == 32
  284. asmlinkage long sys_fcntl64(unsigned int fd,
  285. unsigned int cmd, unsigned long arg);
  286. #endif
  287. /* fs/inotify_user.c */
  288. asmlinkage long sys_inotify_init1(int flags);
  289. asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
  290. u32 mask);
  291. asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
  292. /* fs/ioctl.c */
  293. asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd,
  294. unsigned long arg);
  295. /* fs/ioprio.c */
  296. asmlinkage long sys_ioprio_set(int which, int who, int ioprio);
  297. asmlinkage long sys_ioprio_get(int which, int who);
  298. /* fs/locks.c */
  299. asmlinkage long sys_flock(unsigned int fd, unsigned int cmd);
  300. /* fs/namei.c */
  301. asmlinkage long sys_mknodat(int dfd, const char __user * filename, umode_t mode,
  302. unsigned dev);
  303. asmlinkage long sys_mkdirat(int dfd, const char __user * pathname, umode_t mode);
  304. asmlinkage long sys_unlinkat(int dfd, const char __user * pathname, int flag);
  305. asmlinkage long sys_symlinkat(const char __user * oldname,
  306. int newdfd, const char __user * newname);
  307. asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
  308. int newdfd, const char __user *newname, int flags);
  309. asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
  310. int newdfd, const char __user * newname);
  311. /* fs/namespace.c */
  312. asmlinkage long sys_umount(char __user *name, int flags);
  313. asmlinkage long sys_mount(char __user *dev_name, char __user *dir_name,
  314. char __user *type, unsigned long flags,
  315. void __user *data);
  316. asmlinkage long sys_pivot_root(const char __user *new_root,
  317. const char __user *put_old);
  318. /* fs/nfsctl.c */
  319. /* fs/open.c */
  320. asmlinkage long sys_statfs(const char __user * path,
  321. struct statfs __user *buf);
  322. asmlinkage long sys_statfs64(const char __user *path, size_t sz,
  323. struct statfs64 __user *buf);
  324. asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user *buf);
  325. asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz,
  326. struct statfs64 __user *buf);
  327. asmlinkage long sys_truncate(const char __user *path, long length);
  328. asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
  329. #if BITS_PER_LONG == 32
  330. asmlinkage long sys_truncate64(const char __user *path, loff_t length);
  331. asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
  332. #endif
  333. asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
  334. asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
  335. asmlinkage long sys_chdir(const char __user *filename);
  336. asmlinkage long sys_fchdir(unsigned int fd);
  337. asmlinkage long sys_chroot(const char __user *filename);
  338. asmlinkage long sys_fchmod(unsigned int fd, umode_t mode);
  339. asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
  340. umode_t mode);
  341. asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
  342. gid_t group, int flag);
  343. asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group);
  344. asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
  345. umode_t mode);
  346. asmlinkage long sys_close(unsigned int fd);
  347. asmlinkage long sys_vhangup(void);
  348. /* fs/pipe.c */
  349. asmlinkage long sys_pipe2(int __user *fildes, int flags);
  350. /* fs/quota.c */
  351. asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special,
  352. qid_t id, void __user *addr);
  353. /* fs/readdir.c */
  354. asmlinkage long sys_getdents64(unsigned int fd,
  355. struct linux_dirent64 __user *dirent,
  356. unsigned int count);
  357. /* fs/read_write.c */
  358. asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
  359. unsigned long offset_low, loff_t __user *result,
  360. unsigned int whence);
  361. asmlinkage long sys_lseek(unsigned int fd, off_t offset,
  362. unsigned int whence);
  363. asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
  364. asmlinkage long sys_write(unsigned int fd, const char __user *buf,
  365. size_t count);
  366. asmlinkage long sys_readv(unsigned long fd,
  367. const struct iovec __user *vec,
  368. unsigned long vlen);
  369. asmlinkage long sys_writev(unsigned long fd,
  370. const struct iovec __user *vec,
  371. unsigned long vlen);
  372. asmlinkage long sys_pread64(unsigned int fd, char __user *buf,
  373. size_t count, loff_t pos);
  374. asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf,
  375. size_t count, loff_t pos);
  376. asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec,
  377. unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
  378. asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec,
  379. unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
  380. /* fs/sendfile.c */
  381. asmlinkage long sys_sendfile64(int out_fd, int in_fd,
  382. loff_t __user *offset, size_t count);
  383. /* fs/select.c */
  384. asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
  385. fd_set __user *, struct timespec __user *,
  386. void __user *);
  387. asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
  388. struct timespec __user *, const sigset_t __user *,
  389. size_t);
  390. /* fs/signalfd.c */
  391. asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, size_t sizemask, int flags);
  392. /* fs/splice.c */
  393. asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
  394. unsigned long nr_segs, unsigned int flags);
  395. asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
  396. int fd_out, loff_t __user *off_out,
  397. size_t len, unsigned int flags);
  398. asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags);
  399. /* fs/stat.c */
  400. asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
  401. int bufsiz);
  402. asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
  403. struct stat __user *statbuf, int flag);
  404. asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
  405. #if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
  406. asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
  407. asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
  408. struct stat64 __user *statbuf, int flag);
  409. #endif
  410. /* fs/sync.c */
  411. asmlinkage long sys_sync(void);
  412. asmlinkage long sys_fsync(unsigned int fd);
  413. asmlinkage long sys_fdatasync(unsigned int fd);
  414. asmlinkage long sys_sync_file_range2(int fd, unsigned int flags,
  415. loff_t offset, loff_t nbytes);
  416. asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
  417. unsigned int flags);
  418. /* fs/timerfd.c */
  419. asmlinkage long sys_timerfd_create(int clockid, int flags);
  420. asmlinkage long sys_timerfd_settime(int ufd, int flags,
  421. const struct itimerspec __user *utmr,
  422. struct itimerspec __user *otmr);
  423. asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
  424. /* fs/utimes.c */
  425. asmlinkage long sys_utimensat(int dfd, const char __user *filename,
  426. struct timespec __user *utimes, int flags);
  427. /* kernel/acct.c */
  428. asmlinkage long sys_acct(const char __user *name);
  429. /* kernel/capability.c */
  430. asmlinkage long sys_capget(cap_user_header_t header,
  431. cap_user_data_t dataptr);
  432. asmlinkage long sys_capset(cap_user_header_t header,
  433. const cap_user_data_t data);
  434. /* kernel/exec_domain.c */
  435. asmlinkage long sys_personality(unsigned int personality);
  436. /* kernel/exit.c */
  437. asmlinkage long sys_exit(int error_code);
  438. asmlinkage long sys_exit_group(int error_code);
  439. asmlinkage long sys_waitid(int which, pid_t pid,
  440. struct siginfo __user *infop,
  441. int options, struct rusage __user *ru);
  442. /* kernel/fork.c */
  443. asmlinkage long sys_set_tid_address(int __user *tidptr);
  444. asmlinkage long sys_unshare(unsigned long unshare_flags);
  445. /* kernel/futex.c */
  446. asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
  447. struct timespec __user *utime, u32 __user *uaddr2,
  448. u32 val3);
  449. asmlinkage long sys_get_robust_list(int pid,
  450. struct robust_list_head __user * __user *head_ptr,
  451. size_t __user *len_ptr);
  452. asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
  453. size_t len);
  454. /* kernel/hrtimer.c */
  455. asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp);
  456. /* kernel/itimer.c */
  457. asmlinkage long sys_getitimer(int which, struct itimerval __user *value);
  458. asmlinkage long sys_setitimer(int which,
  459. struct itimerval __user *value,
  460. struct itimerval __user *ovalue);
  461. /* kernel/kexec.c */
  462. asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
  463. struct kexec_segment __user *segments,
  464. unsigned long flags);
  465. /* kernel/module.c */
  466. asmlinkage long sys_init_module(void __user *umod, unsigned long len,
  467. const char __user *uargs);
  468. asmlinkage long sys_delete_module(const char __user *name_user,
  469. unsigned int flags);
  470. /* kernel/posix-timers.c */
  471. asmlinkage long sys_timer_create(clockid_t which_clock,
  472. struct sigevent __user *timer_event_spec,
  473. timer_t __user * created_timer_id);
  474. asmlinkage long sys_timer_gettime(timer_t timer_id,
  475. struct itimerspec __user *setting);
  476. asmlinkage long sys_timer_getoverrun(timer_t timer_id);
  477. asmlinkage long sys_timer_settime(timer_t timer_id, int flags,
  478. const struct itimerspec __user *new_setting,
  479. struct itimerspec __user *old_setting);
  480. asmlinkage long sys_timer_delete(timer_t timer_id);
  481. asmlinkage long sys_clock_settime(clockid_t which_clock,
  482. const struct timespec __user *tp);
  483. asmlinkage long sys_clock_gettime(clockid_t which_clock,
  484. struct timespec __user *tp);
  485. asmlinkage long sys_clock_getres(clockid_t which_clock,
  486. struct timespec __user *tp);
  487. asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags,
  488. const struct timespec __user *rqtp,
  489. struct timespec __user *rmtp);
  490. /* kernel/printk.c */
  491. asmlinkage long sys_syslog(int type, char __user *buf, int len);
  492. /* kernel/ptrace.c */
  493. asmlinkage long sys_ptrace(long request, long pid, unsigned long addr,
  494. unsigned long data);
  495. /* kernel/sched/core.c */
  496. asmlinkage long sys_sched_setparam(pid_t pid,
  497. struct sched_param __user *param);
  498. asmlinkage long sys_sched_setscheduler(pid_t pid, int policy,
  499. struct sched_param __user *param);
  500. asmlinkage long sys_sched_getscheduler(pid_t pid);
  501. asmlinkage long sys_sched_getparam(pid_t pid,
  502. struct sched_param __user *param);
  503. asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
  504. unsigned long __user *user_mask_ptr);
  505. asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
  506. unsigned long __user *user_mask_ptr);
  507. asmlinkage long sys_sched_yield(void);
  508. asmlinkage long sys_sched_get_priority_max(int policy);
  509. asmlinkage long sys_sched_get_priority_min(int policy);
  510. asmlinkage long sys_sched_rr_get_interval(pid_t pid,
  511. struct timespec __user *interval);
  512. /* kernel/signal.c */
  513. asmlinkage long sys_restart_syscall(void);
  514. asmlinkage long sys_kill(pid_t pid, int sig);
  515. asmlinkage long sys_tkill(pid_t pid, int sig);
  516. asmlinkage long sys_tgkill(pid_t tgid, pid_t pid, int sig);
  517. asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss,
  518. struct sigaltstack __user *uoss);
  519. asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
  520. #ifndef CONFIG_ODD_RT_SIGACTION
  521. asmlinkage long sys_rt_sigaction(int,
  522. const struct sigaction __user *,
  523. struct sigaction __user *,
  524. size_t);
  525. #endif
  526. asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set,
  527. sigset_t __user *oset, size_t sigsetsize);
  528. asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize);
  529. asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese,
  530. siginfo_t __user *uinfo,
  531. const struct timespec __user *uts,
  532. size_t sigsetsize);
  533. asmlinkage long sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo);
  534. /* kernel/sys.c */
  535. asmlinkage long sys_setpriority(int which, int who, int niceval);
  536. asmlinkage long sys_getpriority(int which, int who);
  537. asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd,
  538. void __user *arg);
  539. asmlinkage long sys_setregid(gid_t rgid, gid_t egid);
  540. asmlinkage long sys_setgid(gid_t gid);
  541. asmlinkage long sys_setreuid(uid_t ruid, uid_t euid);
  542. asmlinkage long sys_setuid(uid_t uid);
  543. asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid);
  544. asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid);
  545. asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid);
  546. asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid);
  547. asmlinkage long sys_setfsuid(uid_t uid);
  548. asmlinkage long sys_setfsgid(gid_t gid);
  549. asmlinkage long sys_times(struct tms __user *tbuf);
  550. asmlinkage long sys_setpgid(pid_t pid, pid_t pgid);
  551. asmlinkage long sys_getpgid(pid_t pid);
  552. asmlinkage long sys_getsid(pid_t pid);
  553. asmlinkage long sys_setsid(void);
  554. asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist);
  555. asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist);
  556. asmlinkage long sys_newuname(struct new_utsname __user *name);
  557. asmlinkage long sys_sethostname(char __user *name, int len);
  558. asmlinkage long sys_setdomainname(char __user *name, int len);
  559. asmlinkage long sys_getrlimit(unsigned int resource,
  560. struct rlimit __user *rlim);
  561. asmlinkage long sys_setrlimit(unsigned int resource,
  562. struct rlimit __user *rlim);
  563. asmlinkage long sys_getrusage(int who, struct rusage __user *ru);
  564. asmlinkage long sys_umask(int mask);
  565. asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
  566. unsigned long arg4, unsigned long arg5);
  567. asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
  568. /* kernel/time.c */
  569. asmlinkage long sys_gettimeofday(struct timeval __user *tv,
  570. struct timezone __user *tz);
  571. asmlinkage long sys_settimeofday(struct timeval __user *tv,
  572. struct timezone __user *tz);
  573. asmlinkage long sys_adjtimex(struct timex __user *txc_p);
  574. /* kernel/timer.c */
  575. asmlinkage long sys_getpid(void);
  576. asmlinkage long sys_getppid(void);
  577. asmlinkage long sys_getuid(void);
  578. asmlinkage long sys_geteuid(void);
  579. asmlinkage long sys_getgid(void);
  580. asmlinkage long sys_getegid(void);
  581. asmlinkage long sys_gettid(void);
  582. asmlinkage long sys_sysinfo(struct sysinfo __user *info);
  583. /* ipc/mqueue.c */
  584. asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr);
  585. asmlinkage long sys_mq_unlink(const char __user *name);
  586. asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
  587. asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
  588. asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
  589. asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
  590. /* ipc/msg.c */
  591. asmlinkage long sys_msgget(key_t key, int msgflg);
  592. asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf);
  593. asmlinkage long sys_msgrcv(int msqid, struct msgbuf __user *msgp,
  594. size_t msgsz, long msgtyp, int msgflg);
  595. asmlinkage long sys_msgsnd(int msqid, struct msgbuf __user *msgp,
  596. size_t msgsz, int msgflg);
  597. /* ipc/sem.c */
  598. asmlinkage long sys_semget(key_t key, int nsems, int semflg);
  599. asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg);
  600. asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,
  601. unsigned nsops,
  602. const struct timespec __user *timeout);
  603. asmlinkage long sys_semop(int semid, struct sembuf __user *sops,
  604. unsigned nsops);
  605. /* ipc/shm.c */
  606. asmlinkage long sys_shmget(key_t key, size_t size, int flag);
  607. asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf);
  608. asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg);
  609. asmlinkage long sys_shmdt(char __user *shmaddr);
  610. /* net/socket.c */
  611. asmlinkage long sys_socket(int, int, int);
  612. asmlinkage long sys_socketpair(int, int, int, int __user *);
  613. asmlinkage long sys_bind(int, struct sockaddr __user *, int);
  614. asmlinkage long sys_listen(int, int);
  615. asmlinkage long sys_accept(int, struct sockaddr __user *, int __user *);
  616. asmlinkage long sys_connect(int, struct sockaddr __user *, int);
  617. asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *);
  618. asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *);
  619. asmlinkage long sys_sendto(int, void __user *, size_t, unsigned,
  620. struct sockaddr __user *, int);
  621. asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned,
  622. struct sockaddr __user *, int __user *);
  623. asmlinkage long sys_setsockopt(int fd, int level, int optname,
  624. char __user *optval, int optlen);
  625. asmlinkage long sys_getsockopt(int fd, int level, int optname,
  626. char __user *optval, int __user *optlen);
  627. asmlinkage long sys_shutdown(int, int);
  628. asmlinkage long sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
  629. asmlinkage long sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
  630. /* mm/filemap.c */
  631. asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
  632. /* mm/nommu.c, also with MMU */
  633. asmlinkage long sys_brk(unsigned long brk);
  634. asmlinkage long sys_munmap(unsigned long addr, size_t len);
  635. asmlinkage long sys_mremap(unsigned long addr,
  636. unsigned long old_len, unsigned long new_len,
  637. unsigned long flags, unsigned long new_addr);
  638. /* security/keys/keyctl.c */
  639. asmlinkage long sys_add_key(const char __user *_type,
  640. const char __user *_description,
  641. const void __user *_payload,
  642. size_t plen,
  643. key_serial_t destringid);
  644. asmlinkage long sys_request_key(const char __user *_type,
  645. const char __user *_description,
  646. const char __user *_callout_info,
  647. key_serial_t destringid);
  648. asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3,
  649. unsigned long arg4, unsigned long arg5);
  650. /* arch/example/kernel/sys_example.c */
  651. #ifdef CONFIG_CLONE_BACKWARDS
  652. asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, unsigned long,
  653. int __user *);
  654. #else
  655. #ifdef CONFIG_CLONE_BACKWARDS3
  656. asmlinkage long sys_clone(unsigned long, unsigned long, int, int __user *,
  657. int __user *, unsigned long);
  658. #else
  659. asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,
  660. int __user *, unsigned long);
  661. #endif
  662. #endif
  663. asmlinkage long sys_execve(const char __user *filename,
  664. const char __user *const __user *argv,
  665. const char __user *const __user *envp);
  666. /* mm/fadvise.c */
  667. asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
  668. /* mm/, CONFIG_MMU only */
  669. asmlinkage long sys_swapon(const char __user *specialfile, int swap_flags);
  670. asmlinkage long sys_swapoff(const char __user *specialfile);
  671. asmlinkage long sys_mprotect(unsigned long start, size_t len,
  672. unsigned long prot);
  673. asmlinkage long sys_msync(unsigned long start, size_t len, int flags);
  674. asmlinkage long sys_mlock(unsigned long start, size_t len);
  675. asmlinkage long sys_munlock(unsigned long start, size_t len);
  676. asmlinkage long sys_mlockall(int flags);
  677. asmlinkage long sys_munlockall(void);
  678. asmlinkage long sys_mincore(unsigned long start, size_t len,
  679. unsigned char __user * vec);
  680. asmlinkage long sys_madvise(unsigned long start, size_t len, int behavior);
  681. asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
  682. unsigned long prot, unsigned long pgoff,
  683. unsigned long flags);
  684. asmlinkage long sys_mbind(unsigned long start, unsigned long len,
  685. unsigned long mode,
  686. const unsigned long __user *nmask,
  687. unsigned long maxnode,
  688. unsigned flags);
  689. asmlinkage long sys_get_mempolicy(int __user *policy,
  690. unsigned long __user *nmask,
  691. unsigned long maxnode,
  692. unsigned long addr, unsigned long flags);
  693. asmlinkage long sys_set_mempolicy(int mode, const unsigned long __user *nmask,
  694. unsigned long maxnode);
  695. asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
  696. const unsigned long __user *from,
  697. const unsigned long __user *to);
  698. asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
  699. const void __user * __user *pages,
  700. const int __user *nodes,
  701. int __user *status,
  702. int flags);
  703. asmlinkage long sys_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
  704. siginfo_t __user *uinfo);
  705. asmlinkage long sys_perf_event_open(
  706. struct perf_event_attr __user *attr_uptr,
  707. pid_t pid, int cpu, int group_fd, unsigned long flags);
  708. asmlinkage long sys_accept4(int, struct sockaddr __user *, int __user *, int);
  709. asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg,
  710. unsigned int vlen, unsigned flags,
  711. struct timespec __user *timeout);
  712. asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr,
  713. int options, struct rusage __user *ru);
  714. asmlinkage long sys_prlimit64(pid_t pid, unsigned int resource,
  715. const struct rlimit64 __user *new_rlim,
  716. struct rlimit64 __user *old_rlim);
  717. asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags);
  718. asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
  719. u64 mask, int fd,
  720. const char __user *pathname);
  721. asmlinkage long sys_name_to_handle_at(int dfd, const char __user *name,
  722. struct file_handle __user *handle,
  723. int __user *mnt_id, int flag);
  724. asmlinkage long sys_open_by_handle_at(int mountdirfd,
  725. struct file_handle __user *handle,
  726. int flags);
  727. asmlinkage long sys_clock_adjtime(clockid_t which_clock,
  728. struct timex __user *tx);
  729. asmlinkage long sys_syncfs(int fd);
  730. asmlinkage long sys_setns(int fd, int nstype);
  731. asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg,
  732. unsigned int vlen, unsigned flags);
  733. asmlinkage long sys_process_vm_readv(pid_t pid,
  734. const struct iovec __user *lvec,
  735. unsigned long liovcnt,
  736. const struct iovec __user *rvec,
  737. unsigned long riovcnt,
  738. unsigned long flags);
  739. asmlinkage long sys_process_vm_writev(pid_t pid,
  740. const struct iovec __user *lvec,
  741. unsigned long liovcnt,
  742. const struct iovec __user *rvec,
  743. unsigned long riovcnt,
  744. unsigned long flags);
  745. asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type,
  746. unsigned long idx1, unsigned long idx2);
  747. asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags);
  748. asmlinkage long sys_sched_setattr(pid_t pid,
  749. struct sched_attr __user *attr,
  750. unsigned int flags);
  751. asmlinkage long sys_sched_getattr(pid_t pid,
  752. struct sched_attr __user *attr,
  753. unsigned int size,
  754. unsigned int flags);
  755. asmlinkage long sys_renameat2(int olddfd, const char __user *oldname,
  756. int newdfd, const char __user *newname,
  757. unsigned int flags);
  758. asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
  759. const char __user *uargs);
  760. asmlinkage long sys_getrandom(char __user *buf, size_t count,
  761. unsigned int flags);
  762. asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags);
  763. asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size);
  764. asmlinkage long sys_execveat(int dfd, const char __user *filename,
  765. const char __user *const __user *argv,
  766. const char __user *const __user *envp, int flags);
  767. asmlinkage long sys_userfaultfd(int flags);
  768. asmlinkage long sys_membarrier(int cmd, int flags);
  769. asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags);
  770. asmlinkage long sys_copy_file_range(int fd_in, loff_t __user *off_in,
  771. int fd_out, loff_t __user *off_out,
  772. size_t len, unsigned int flags);
  773. asmlinkage long sys_preadv2(unsigned long fd, const struct iovec __user *vec,
  774. unsigned long vlen, unsigned long pos_l, unsigned long pos_h,
  775. rwf_t flags);
  776. asmlinkage long sys_pwritev2(unsigned long fd, const struct iovec __user *vec,
  777. unsigned long vlen, unsigned long pos_l, unsigned long pos_h,
  778. rwf_t flags);
  779. asmlinkage long sys_pkey_mprotect(unsigned long start, size_t len,
  780. unsigned long prot, int pkey);
  781. asmlinkage long sys_pkey_alloc(unsigned long flags, unsigned long init_val);
  782. asmlinkage long sys_pkey_free(int pkey);
  783. asmlinkage long sys_statx(int dfd, const char __user *path, unsigned flags,
  784. unsigned mask, struct statx __user *buffer);
  785. /*
  786. * Architecture-specific system calls
  787. */
  788. /* arch/x86/kernel/ioport.c */
  789. asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on);
  790. /* pciconfig: alpha, arm, arm64, ia64, sparc */
  791. asmlinkage long sys_pciconfig_read(unsigned long bus, unsigned long dfn,
  792. unsigned long off, unsigned long len,
  793. void __user *buf);
  794. asmlinkage long sys_pciconfig_write(unsigned long bus, unsigned long dfn,
  795. unsigned long off, unsigned long len,
  796. void __user *buf);
  797. asmlinkage long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn);
  798. /* powerpc */
  799. asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
  800. __u32 __user *ustatus);
  801. asmlinkage long sys_spu_create(const char __user *name,
  802. unsigned int flags, umode_t mode, int fd);
  803. /*
  804. * Deprecated system calls which are still defined in
  805. * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
  806. */
  807. /* __ARCH_WANT_SYSCALL_NO_AT */
  808. asmlinkage long sys_open(const char __user *filename,
  809. int flags, umode_t mode);
  810. asmlinkage long sys_link(const char __user *oldname,
  811. const char __user *newname);
  812. asmlinkage long sys_unlink(const char __user *pathname);
  813. asmlinkage long sys_mknod(const char __user *filename, umode_t mode,
  814. unsigned dev);
  815. asmlinkage long sys_chmod(const char __user *filename, umode_t mode);
  816. asmlinkage long sys_chown(const char __user *filename,
  817. uid_t user, gid_t group);
  818. asmlinkage long sys_mkdir(const char __user *pathname, umode_t mode);
  819. asmlinkage long sys_rmdir(const char __user *pathname);
  820. asmlinkage long sys_lchown(const char __user *filename,
  821. uid_t user, gid_t group);
  822. asmlinkage long sys_access(const char __user *filename, int mode);
  823. asmlinkage long sys_rename(const char __user *oldname,
  824. const char __user *newname);
  825. asmlinkage long sys_symlink(const char __user *old, const char __user *new);
  826. asmlinkage long sys_utimes(char __user *filename,
  827. struct timeval __user *utimes);
  828. #if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
  829. asmlinkage long sys_stat64(const char __user *filename,
  830. struct stat64 __user *statbuf);
  831. asmlinkage long sys_lstat64(const char __user *filename,
  832. struct stat64 __user *statbuf);
  833. #endif
  834. /* __ARCH_WANT_SYSCALL_NO_FLAGS */
  835. asmlinkage long sys_pipe(int __user *fildes);
  836. asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
  837. asmlinkage long sys_epoll_create(int size);
  838. asmlinkage long sys_inotify_init(void);
  839. asmlinkage long sys_eventfd(unsigned int count);
  840. asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask);
  841. /* __ARCH_WANT_SYSCALL_OFF_T */
  842. asmlinkage long sys_sendfile(int out_fd, int in_fd,
  843. off_t __user *offset, size_t count);
  844. asmlinkage long sys_newstat(const char __user *filename,
  845. struct stat __user *statbuf);
  846. asmlinkage long sys_newlstat(const char __user *filename,
  847. struct stat __user *statbuf);
  848. asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice);
  849. /* __ARCH_WANT_SYSCALL_DEPRECATED */
  850. asmlinkage long sys_alarm(unsigned int seconds);
  851. asmlinkage long sys_getpgrp(void);
  852. asmlinkage long sys_pause(void);
  853. asmlinkage long sys_time(time_t __user *tloc);
  854. asmlinkage long sys_utime(char __user *filename,
  855. struct utimbuf __user *times);
  856. asmlinkage long sys_creat(const char __user *pathname, umode_t mode);
  857. asmlinkage long sys_getdents(unsigned int fd,
  858. struct linux_dirent __user *dirent,
  859. unsigned int count);
  860. asmlinkage long sys_futimesat(int dfd, const char __user *filename,
  861. struct timeval __user *utimes);
  862. asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
  863. fd_set __user *exp, struct timeval __user *tvp);
  864. asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
  865. int timeout);
  866. asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
  867. int maxevents, int timeout);
  868. asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
  869. asmlinkage long sys_vfork(void);
  870. asmlinkage long sys_recv(int, void __user *, size_t, unsigned);
  871. asmlinkage long sys_send(int, void __user *, size_t, unsigned);
  872. asmlinkage long sys_bdflush(int func, long data);
  873. asmlinkage long sys_oldumount(char __user *name);
  874. asmlinkage long sys_uselib(const char __user *library);
  875. asmlinkage long sys_sysctl(struct __sysctl_args __user *args);
  876. asmlinkage long sys_sysfs(int option,
  877. unsigned long arg1, unsigned long arg2);
  878. asmlinkage long sys_fork(void);
  879. /* obsolete: kernel/time/time.c */
  880. asmlinkage long sys_stime(time_t __user *tptr);
  881. /* obsolete: kernel/signal.c */
  882. asmlinkage long sys_sigpending(old_sigset_t __user *uset);
  883. asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
  884. old_sigset_t __user *oset);
  885. #ifdef CONFIG_OLD_SIGSUSPEND
  886. asmlinkage long sys_sigsuspend(old_sigset_t mask);
  887. #endif
  888. #ifdef CONFIG_OLD_SIGSUSPEND3
  889. asmlinkage long sys_sigsuspend(int unused1, int unused2, old_sigset_t mask);
  890. #endif
  891. #ifdef CONFIG_OLD_SIGACTION
  892. asmlinkage long sys_sigaction(int, const struct old_sigaction __user *,
  893. struct old_sigaction __user *);
  894. #endif
  895. asmlinkage long sys_sgetmask(void);
  896. asmlinkage long sys_ssetmask(int newmask);
  897. asmlinkage long sys_signal(int sig, __sighandler_t handler);
  898. /* obsolete: kernel/sched/core.c */
  899. asmlinkage long sys_nice(int increment);
  900. /* obsolete: kernel/kexec_file.c */
  901. asmlinkage long sys_kexec_file_load(int kernel_fd, int initrd_fd,
  902. unsigned long cmdline_len,
  903. const char __user *cmdline_ptr,
  904. unsigned long flags);
  905. /* obsolete: kernel/exit.c */
  906. asmlinkage long sys_waitpid(pid_t pid, int __user *stat_addr, int options);
  907. /* obsolete: kernel/uid16.c */
  908. #ifdef CONFIG_HAVE_UID16
  909. asmlinkage long sys_chown16(const char __user *filename,
  910. old_uid_t user, old_gid_t group);
  911. asmlinkage long sys_lchown16(const char __user *filename,
  912. old_uid_t user, old_gid_t group);
  913. asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group);
  914. asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid);
  915. asmlinkage long sys_setgid16(old_gid_t gid);
  916. asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid);
  917. asmlinkage long sys_setuid16(old_uid_t uid);
  918. asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid);
  919. asmlinkage long sys_getresuid16(old_uid_t __user *ruid,
  920. old_uid_t __user *euid, old_uid_t __user *suid);
  921. asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid);
  922. asmlinkage long sys_getresgid16(old_gid_t __user *rgid,
  923. old_gid_t __user *egid, old_gid_t __user *sgid);
  924. asmlinkage long sys_setfsuid16(old_uid_t uid);
  925. asmlinkage long sys_setfsgid16(old_gid_t gid);
  926. asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user *grouplist);
  927. asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist);
  928. asmlinkage long sys_getuid16(void);
  929. asmlinkage long sys_geteuid16(void);
  930. asmlinkage long sys_getgid16(void);
  931. asmlinkage long sys_getegid16(void);
  932. #endif
  933. /* obsolete: net/socket.c */
  934. asmlinkage long sys_socketcall(int call, unsigned long __user *args);
  935. /* obsolete: fs/stat.c */
  936. asmlinkage long sys_stat(const char __user *filename,
  937. struct __old_kernel_stat __user *statbuf);
  938. asmlinkage long sys_lstat(const char __user *filename,
  939. struct __old_kernel_stat __user *statbuf);
  940. asmlinkage long sys_fstat(unsigned int fd,
  941. struct __old_kernel_stat __user *statbuf);
  942. asmlinkage long sys_readlink(const char __user *path,
  943. char __user *buf, int bufsiz);
  944. /* obsolete: fs/select.c */
  945. asmlinkage long sys_old_select(struct sel_arg_struct __user *arg);
  946. /* obsolete: fs/readdir.c */
  947. asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int);
  948. /* obsolete: kernel/sys.c */
  949. asmlinkage long sys_gethostname(char __user *name, int len);
  950. asmlinkage long sys_uname(struct old_utsname __user *);
  951. asmlinkage long sys_olduname(struct oldold_utsname __user *);
  952. #ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
  953. asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim);
  954. #endif
  955. /* obsolete: ipc */
  956. asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
  957. unsigned long third, void __user *ptr, long fifth);
  958. /* obsolete: mm/ */
  959. asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len,
  960. unsigned long prot, unsigned long flags,
  961. unsigned long fd, unsigned long pgoff);
  962. asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg);
  963. /*
  964. * Not a real system call, but a placeholder for syscalls which are
  965. * not implemented -- see kernel/sys_ni.c
  966. */
  967. asmlinkage long sys_ni_syscall(void);
  968. /*
  969. * Kernel code should not call syscalls (i.e., sys_xyzyyz()) directly.
  970. * Instead, use one of the functions which work equivalently, such as
  971. * the ksys_xyzyyz() functions prototyped below.
  972. */
  973. int ksys_mount(char __user *dev_name, char __user *dir_name, char __user *type,
  974. unsigned long flags, void __user *data);
  975. int ksys_umount(char __user *name, int flags);
  976. int ksys_dup(unsigned int fildes);
  977. int ksys_chroot(const char __user *filename);
  978. ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count);
  979. int ksys_chdir(const char __user *filename);
  980. int ksys_fchmod(unsigned int fd, umode_t mode);
  981. int ksys_fchown(unsigned int fd, uid_t user, gid_t group);
  982. int ksys_getdents64(unsigned int fd, struct linux_dirent64 __user *dirent,
  983. unsigned int count);
  984. int ksys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
  985. off_t ksys_lseek(unsigned int fd, off_t offset, unsigned int whence);
  986. ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count);
  987. void ksys_sync(void);
  988. int ksys_unshare(unsigned long unshare_flags);
  989. int ksys_setsid(void);
  990. int ksys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
  991. unsigned int flags);
  992. ssize_t ksys_pread64(unsigned int fd, char __user *buf, size_t count,
  993. loff_t pos);
  994. ssize_t ksys_pwrite64(unsigned int fd, const char __user *buf,
  995. size_t count, loff_t pos);
  996. int ksys_fallocate(int fd, int mode, loff_t offset, loff_t len);
  997. #ifdef CONFIG_ADVISE_SYSCALLS
  998. int ksys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
  999. #else
  1000. static inline int ksys_fadvise64_64(int fd, loff_t offset, loff_t len,
  1001. int advice)
  1002. {
  1003. return -EINVAL;
  1004. }
  1005. #endif
  1006. unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
  1007. unsigned long prot, unsigned long flags,
  1008. unsigned long fd, unsigned long pgoff);
  1009. ssize_t ksys_readahead(int fd, loff_t offset, size_t count);
  1010. /*
  1011. * The following kernel syscall equivalents are just wrappers to fs-internal
  1012. * functions. Therefore, provide stubs to be inlined at the callsites.
  1013. */
  1014. extern long do_unlinkat(int dfd, struct filename *name);
  1015. static inline long ksys_unlink(const char __user *pathname)
  1016. {
  1017. return do_unlinkat(AT_FDCWD, getname(pathname));
  1018. }
  1019. extern long do_rmdir(int dfd, const char __user *pathname);
  1020. static inline long ksys_rmdir(const char __user *pathname)
  1021. {
  1022. return do_rmdir(AT_FDCWD, pathname);
  1023. }
  1024. extern long do_mkdirat(int dfd, const char __user *pathname, umode_t mode);
  1025. static inline long ksys_mkdir(const char __user *pathname, umode_t mode)
  1026. {
  1027. return do_mkdirat(AT_FDCWD, pathname, mode);
  1028. }
  1029. extern long do_symlinkat(const char __user *oldname, int newdfd,
  1030. const char __user *newname);
  1031. static inline long ksys_symlink(const char __user *oldname,
  1032. const char __user *newname)
  1033. {
  1034. return do_symlinkat(oldname, AT_FDCWD, newname);
  1035. }
  1036. extern long do_mknodat(int dfd, const char __user *filename, umode_t mode,
  1037. unsigned int dev);
  1038. static inline long ksys_mknod(const char __user *filename, umode_t mode,
  1039. unsigned int dev)
  1040. {
  1041. return do_mknodat(AT_FDCWD, filename, mode, dev);
  1042. }
  1043. extern int do_linkat(int olddfd, const char __user *oldname, int newdfd,
  1044. const char __user *newname, int flags);
  1045. static inline long ksys_link(const char __user *oldname,
  1046. const char __user *newname)
  1047. {
  1048. return do_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
  1049. }
  1050. extern int do_fchmodat(int dfd, const char __user *filename, umode_t mode);
  1051. static inline int ksys_chmod(const char __user *filename, umode_t mode)
  1052. {
  1053. return do_fchmodat(AT_FDCWD, filename, mode);
  1054. }
  1055. extern long do_faccessat(int dfd, const char __user *filename, int mode);
  1056. static inline long ksys_access(const char __user *filename, int mode)
  1057. {
  1058. return do_faccessat(AT_FDCWD, filename, mode);
  1059. }
  1060. extern int do_fchownat(int dfd, const char __user *filename, uid_t user,
  1061. gid_t group, int flag);
  1062. static inline long ksys_chown(const char __user *filename, uid_t user,
  1063. gid_t group)
  1064. {
  1065. return do_fchownat(AT_FDCWD, filename, user, group, 0);
  1066. }
  1067. static inline long ksys_lchown(const char __user *filename, uid_t user,
  1068. gid_t group)
  1069. {
  1070. return do_fchownat(AT_FDCWD, filename, user, group,
  1071. AT_SYMLINK_NOFOLLOW);
  1072. }
  1073. extern long do_sys_ftruncate(unsigned int fd, loff_t length, int small);
  1074. static inline long ksys_ftruncate(unsigned int fd, unsigned long length)
  1075. {
  1076. return do_sys_ftruncate(fd, length, 1);
  1077. }
  1078. extern int __close_fd(struct files_struct *files, unsigned int fd);
  1079. /*
  1080. * In contrast to sys_close(), this stub does not check whether the syscall
  1081. * should or should not be restarted, but returns the raw error codes from
  1082. * __close_fd().
  1083. */
  1084. static inline int ksys_close(unsigned int fd)
  1085. {
  1086. return __close_fd(current->files, fd);
  1087. }
  1088. extern long do_sys_open(int dfd, const char __user *filename, int flags,
  1089. umode_t mode);
  1090. static inline long ksys_open(const char __user *filename, int flags,
  1091. umode_t mode)
  1092. {
  1093. if (force_o_largefile())
  1094. flags |= O_LARGEFILE;
  1095. return do_sys_open(AT_FDCWD, filename, flags, mode);
  1096. }
  1097. extern long do_sys_truncate(const char __user *pathname, loff_t length);
  1098. static inline long ksys_truncate(const char __user *pathname, loff_t length)
  1099. {
  1100. return do_sys_truncate(pathname, length);
  1101. }
  1102. #endif