1139825Simp/*-
2102779Siedowse * Copyright (c) 2002 Ian Dowse.  All rights reserved.
3102779Siedowse *
4102779Siedowse * Redistribution and use in source and binary forms, with or without
5102779Siedowse * modification, are permitted provided that the following conditions
6102779Siedowse * are met:
7102779Siedowse * 1. Redistributions of source code must retain the above copyright
8102779Siedowse *    notice, this list of conditions and the following disclaimer.
9102779Siedowse * 2. Redistributions in binary form must reproduce the above copyright
10102779Siedowse *    notice, this list of conditions and the following disclaimer in the
11102779Siedowse *    documentation and/or other materials provided with the distribution.
12102779Siedowse *
13102779Siedowse * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14102779Siedowse * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15102779Siedowse * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16102779Siedowse * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17102779Siedowse * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18102779Siedowse * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19102779Siedowse * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20102779Siedowse * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21102779Siedowse * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22102779Siedowse * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23102779Siedowse * SUCH DAMAGE.
24102779Siedowse *
25102779Siedowse * $FreeBSD: stable/10/sys/sys/syscallsubr.h 321009 2017-07-15 14:48:31Z dchagin $
26102779Siedowse */
27102779Siedowse
28102779Siedowse#ifndef _SYS_SYSCALLSUBR_H_
29102779Siedowse#define _SYS_SYSCALLSUBR_H_
30102779Siedowse
31102779Siedowse#include <sys/signal.h>
32102779Siedowse#include <sys/uio.h>
33132313Sdwmalone#include <sys/socket.h>
34136221Sdavidxu#include <sys/mac.h>
35141471Sjhb#include <sys/mount.h>
36102779Siedowse
37160765Sjhbstruct file;
38243134Skibenum idtype;
39141471Sjhbstruct itimerval;
40141471Sjhbstruct image_args;
41192895Sjamiestruct jail;
42243134Skibstruct kevent;
43243134Skibstruct kevent_copyops;
44243134Skibstruct kld_file_stat;
45243134Skibstruct ksiginfo;
46135764Sjhbstruct mbuf;
47135764Sjhbstruct msghdr;
48141471Sjhbstruct msqid_ds;
49275986Sdchaginstruct pollfd;
50243134Skibstruct ogetdirentries_args;
51139739Sjhbstruct rlimit;
52136152Sjhbstruct rusage;
53159991Sjhbunion semun;
54243134Skibstruct sendfile_args;
55110294Sumestruct sockaddr;
56141471Sjhbstruct stat;
57170404Sjhbstruct thr_param;
58293485Sdchaginstruct sched_param;
59243134Skibstruct __wrusage;
60110294Sume
61276955Sdchaginint	kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg,
62321009Sdchagin	    u_int buflen, u_int path_max);
63160249Sjhbint	kern_accept(struct thread *td, int s, struct sockaddr **name,
64160765Sjhb	    socklen_t *namelen, struct file **fp);
65250154Sjillesint	kern_accept4(struct thread *td, int s, struct sockaddr **name,
66250154Sjilles	    socklen_t *namelen, int flags, struct file **fp);
67102779Siedowseint	kern_access(struct thread *td, char *path, enum uio_seg pathseg,
68102779Siedowse	    int flags);
69177786Skibint	kern_accessat(struct thread *td, int fd, char *path,
70177786Skib	    enum uio_seg pathseg, int flags, int mode);
71144445Sjhbint	kern_adjtime(struct thread *td, struct timeval *delta,
72144445Sjhb	    struct timeval *olddelta);
73177997Skibint	kern_alternate_path(struct thread *td, const char *prefix, const char *path,
74177997Skib	    enum uio_seg pathseg, char **pathbuf, int create, int dirfd);
75110294Sumeint	kern_bind(struct thread *td, int fd, struct sockaddr *sa);
76254481Spjdint	kern_cap_ioctls_limit(struct thread *td, int fd, u_long *cmds,
77254481Spjd	    size_t ncmds);
78102779Siedowseint	kern_chdir(struct thread *td, char *path, enum uio_seg pathseg);
79102779Siedowseint	kern_chmod(struct thread *td, char *path, enum uio_seg pathseg,
80102779Siedowse	    int mode);
81102779Siedowseint	kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid,
82102779Siedowse	    int gid);
83253494Skibint	kern_clock_getcpuclockid2(struct thread *td, id_t id, int which,
84253494Skib	    clockid_t *clk_id);
85151357Spsint	kern_clock_getres(struct thread *td, clockid_t clock_id,
86151357Sps	    struct timespec *ts);
87151357Spsint	kern_clock_gettime(struct thread *td, clockid_t clock_id,
88151357Sps	    struct timespec *ats);
89151357Spsint	kern_clock_settime(struct thread *td, clockid_t clock_id,
90151357Sps	    struct timespec *ats);
91160190Sjhbint	kern_close(struct thread *td, int fd);
92110294Sumeint	kern_connect(struct thread *td, int fd, struct sockaddr *sa);
93155401Sjhbint	kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg,
94155401Sjhb	    int flags);
95140992Ssobomaxint	kern_execve(struct thread *td, struct image_args *args,
96139739Sjhb	    struct mac *mac_p);
97177786Skibint	kern_fchmodat(struct thread *td, int fd, char *path,
98177786Skib	    enum uio_seg pathseg, mode_t mode, int flag);
99177786Skibint	kern_fchownat(struct thread *td, int fd, char *path,
100177786Skib	    enum uio_seg pathseg, int uid, int gid, int flag);
101102868Siedowseint	kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg);
102272246Skibint	kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg);
103235886Sglebint	kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf);
104141471Sjhbint	kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);
105141471Sjhbint	kern_fstat(struct thread *td, int fd, struct stat *sbp);
106141471Sjhbint	kern_fstatfs(struct thread *td, int fd, struct statfs *buf);
107175140Sjhbint	kern_ftruncate(struct thread *td, int fd, off_t length);
108102779Siedowseint	kern_futimes(struct thread *td, int fd, struct timeval *tptr,
109102779Siedowse	    enum uio_seg tptrseg);
110293474Sdchaginint	kern_futimens(struct thread *td, int fd, struct timespec *tptr,
111293474Sdchagin	    enum uio_seg tptrseg);
112184183Sjhbint	kern_getdirentries(struct thread *td, int fd, char *buf, u_int count,
113235886Sgleb	    long *basep, ssize_t *residp, enum uio_seg bufseg);
114147302Spjdint	kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
115147178Spjd	    enum uio_seg bufseg, int flags);
116160139Sjhbint	kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups);
117140836Ssobomaxint	kern_getitimer(struct thread *, u_int, struct itimerval *);
118160249Sjhbint	kern_getpeername(struct thread *td, int fd, struct sockaddr **sa,
119160249Sjhb	    socklen_t *alen);
120136152Sjhbint	kern_getrusage(struct thread *td, int who, struct rusage *rup);
121160249Sjhbint	kern_getsockname(struct thread *td, int fd, struct sockaddr **sa,
122160249Sjhb	    socklen_t *alen);
123132313Sdwmaloneint	kern_getsockopt(struct thread *td, int s, int level, int name,
124132313Sdwmalone	    void *optval, enum uio_seg valseg, socklen_t *valsize);
125160192Sjhbint	kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data);
126192895Sjamieint	kern_jail(struct thread *td, struct jail *j);
127191673Sjamieint	kern_jail_get(struct thread *td, struct uio *options, int flags);
128191673Sjamieint	kern_jail_set(struct thread *td, struct uio *options, int flags);
129146950Spsint	kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
130146950Sps	    struct kevent_copyops *k_ops, const struct timespec *timeout);
131293545Sdchaginint	kern_kevent_fp(struct thread *td, struct file *fp, int nchanges,
132293545Sdchagin	    int nevents, struct kevent_copyops *k_ops,
133293545Sdchagin	    const struct timespec *timeout);
134293545Sdchaginint	kern_kqueue(struct thread *td, int flags);
135159588Sjhbint	kern_kldload(struct thread *td, const char *file, int *fileid);
136220158Skibint	kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat);
137159588Sjhbint	kern_kldunload(struct thread *td, int fileid, int flags);
138102779Siedowseint	kern_lchown(struct thread *td, char *path, enum uio_seg pathseg,
139102779Siedowse	    int uid, int gid);
140102779Siedowseint	kern_link(struct thread *td, char *path, char *link,
141102779Siedowse	    enum uio_seg segflg);
142177786Skibint	kern_linkat(struct thread *td, int fd1, int fd2, char *path1,
143177786Skib	    char *path2, enum uio_seg segflg, int follow);
144141471Sjhbint	kern_lstat(struct thread *td, char *path, enum uio_seg pathseg,
145141471Sjhb	    struct stat *sbp);
146102779Siedowseint	kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg,
147102779Siedowse	    struct timeval *tptr, enum uio_seg tptrseg);
148102779Siedowseint	kern_mkdir(struct thread *td, char *path, enum uio_seg segflg,
149102779Siedowse	    int mode);
150177786Skibint	kern_mkdirat(struct thread *td, int fd, char *path,
151177786Skib	    enum uio_seg segflg, int mode);
152102779Siedowseint	kern_mkfifo(struct thread *td, char *path, enum uio_seg pathseg,
153102779Siedowse	    int mode);
154177786Skibint	kern_mkfifoat(struct thread *td, int fd, char *path,
155177786Skib	    enum uio_seg pathseg, int mode);
156102779Siedowseint	kern_mknod(struct thread *td, char *path, enum uio_seg pathseg,
157102779Siedowse	    int mode, int dev);
158177786Skibint	kern_mknodat(struct thread *td, int fd, char *path,
159177786Skib	    enum uio_seg pathseg, int mode, int dev);
160141471Sjhbint	kern_msgctl(struct thread *, int, int, struct msqid_ds *);
161313844Skibint	kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *);
162165403Sjkimint	kern_msgsnd(struct thread *, int, const void *, size_t, int, long);
163140483Spsint     kern_nanosleep(struct thread *td, struct timespec *rqt,
164140483Sps	    struct timespec *rmt);
165220238Skibint	kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap,
166220238Skib	    long *ploff);
167102779Siedowseint	kern_open(struct thread *td, char *path, enum uio_seg pathseg,
168102779Siedowse	    int flags, int mode);
169177786Skibint	kern_openat(struct thread *td, int fd, char *path,
170177786Skib	    enum uio_seg pathseg, int flags, int mode);
171141484Sjhbint	kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg,
172195458Strasz	    int name, u_long flags);
173184849Sedint	kern_pipe(struct thread *td, int fildes[2]);
174248951Sjillesint	kern_pipe2(struct thread *td, int fildes[2], int flags);
175275986Sdchaginint	kern_poll(struct thread *td, struct pollfd *fds, u_int nfds,
176275986Sdchagin	    struct timespec *tsp, sigset_t *uset);
177227502Sjhbint	kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len,
178227502Sjhb	    int advice);
179227502Sjhbint	kern_posix_fallocate(struct thread *td, int fd, off_t offset,
180227502Sjhb	    off_t len);
181255708Sjhbint	kern_procctl(struct thread *td, enum idtype idtype, id_t id, int com,
182255708Sjhb	    void *data);
183147813Sjhbint	kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset);
184198508Skibint	kern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou,
185198508Skib	    fd_set *ex, struct timeval *tvp, sigset_t *uset, int abi_nfdbits);
186102946Siedowseint	kern_ptrace(struct thread *td, int req, pid_t pid, void *addr,
187102946Siedowse	    int data);
188147813Sjhbint	kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset);
189102779Siedowseint	kern_readlink(struct thread *td, char *path, enum uio_seg pathseg,
190176215Sru	    char *buf, enum uio_seg bufseg, size_t count);
191177786Skibint	kern_readlinkat(struct thread *td, int fd, char *path,
192177786Skib	    enum uio_seg pathseg, char *buf, enum uio_seg bufseg, size_t count);
193144445Sjhbint	kern_readv(struct thread *td, int fd, struct uio *auio);
194160249Sjhbint	kern_recvit(struct thread *td, int s, struct msghdr *mp,
195160249Sjhb	    enum uio_seg fromseg, struct mbuf **controlp);
196102779Siedowseint	kern_rename(struct thread *td, char *from, char *to,
197102779Siedowse	    enum uio_seg pathseg);
198177786Skibint	kern_renameat(struct thread *td, int oldfd, char *old, int newfd,
199177786Skib	    char *new, enum uio_seg pathseg);
200102779Siedowseint	kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);
201177786Skibint	kern_rmdirat(struct thread *td, int fd, char *path,
202177786Skib	    enum uio_seg pathseg);
203293485Sdchaginint	kern_sched_getparam(struct thread *td, struct thread *targettd,
204293485Sdchagin	    struct sched_param *param);
205293485Sdchaginint	kern_sched_getscheduler(struct thread *td, struct thread *targettd,
206293485Sdchagin	    int *policy);
207293485Sdchaginint	kern_sched_setparam(struct thread *td, struct thread *targettd,
208293485Sdchagin	    struct sched_param *param);
209293485Sdchaginint	kern_sched_setscheduler(struct thread *td, struct thread *targettd,
210293485Sdchagin	    int policy, struct sched_param *param);
211144445Sjhbint	kern_sched_rr_get_interval(struct thread *td, pid_t pid,
212144445Sjhb	    struct timespec *ts);
213293482Sdchaginint	kern_sched_rr_get_interval_td(struct thread *td, struct thread *targettd,
214293482Sdchagin	    struct timespec *ts);
215159991Sjhbint	kern_semctl(struct thread *td, int semid, int semnum, int cmd,
216160187Sjhb	    union semun *arg, register_t *rval);
217102779Siedowseint	kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
218197049Skib	    fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits);
219156114Spsint	kern_sendfile(struct thread *td, struct sendfile_args *uap,
220156114Sps	    struct uio *hdr_uio, struct uio *trl_uio, int compat);
221114749Sdwmaloneint	kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags,
222141029Ssobomax	    struct mbuf *control, enum uio_seg segflg);
223160139Sjhbint	kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups);
224140836Ssobomaxint	kern_setitimer(struct thread *, u_int, struct itimerval *,
225140836Ssobomax	    struct itimerval *);
226139739Sjhbint	kern_setrlimit(struct thread *, u_int, struct rlimit *);
227132313Sdwmaloneint	kern_setsockopt(struct thread *td, int s, int level, int name,
228132313Sdwmalone	    void *optval, enum uio_seg valseg, socklen_t valsize);
229144445Sjhbint	kern_settimeofday(struct thread *td, struct timeval *tv,
230144445Sjhb	    struct timezone *tzp);
231114724Smbrint	kern_shmat(struct thread *td, int shmid, const void *shmaddr,
232122088Sfjoe	    int shmflg);
233114724Smbrint	kern_shmctl(struct thread *td, int shmid, int cmd, void *buf,
234122088Sfjoe	    size_t *bufsz);
235102779Siedowseint	kern_sigaction(struct thread *td, int sig, struct sigaction *act,
236105950Speter	    struct sigaction *oact, int flags);
237102779Siedowseint	kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss);
238209613Sjhbint	kern_sigprocmask(struct thread *td, int how,
239209613Sjhb	    sigset_t *set, sigset_t *oset, int flags);
240102779Siedowseint	kern_sigsuspend(struct thread *td, sigset_t mask);
241209613Sjhbint	kern_sigtimedwait(struct thread *td, sigset_t waitset,
242209613Sjhb	    struct ksiginfo *ksi, struct timespec *timeout);
243141471Sjhbint	kern_stat(struct thread *td, char *path, enum uio_seg pathseg,
244141471Sjhb	    struct stat *sbp);
245318323Sbrooksint	kern_sigqueue(struct thread *td, pid_t pid, int signum,
246318323Sbrooks	    union sigval *value);
247177786Skibint	kern_statat(struct thread *td, int flag, int fd, char *path,
248177786Skib	    enum uio_seg pathseg, struct stat *sbp);
249188849Sedint	kern_statat_vnhook(struct thread *td, int flag, int fd, char *path,
250188849Sed	    enum uio_seg pathseg, struct stat *sbp,
251188849Sed	    void (*hook)(struct vnode *vp, struct stat *sbp));
252141471Sjhbint	kern_statfs(struct thread *td, char *path, enum uio_seg pathseg,
253141471Sjhb	    struct statfs *buf);
254102779Siedowseint	kern_symlink(struct thread *td, char *path, char *link,
255102779Siedowse	    enum uio_seg segflg);
256177786Skibint	kern_symlinkat(struct thread *td, char *path1, int fd, char *path2,
257177786Skib	    enum uio_seg segflg);
258253530Skibint	kern_ktimer_create(struct thread *td, clockid_t clock_id,
259253530Skib	    struct sigevent *evp, int *timerid, int preset_id);
260253530Skibint	kern_ktimer_delete(struct thread *, int);
261253530Skibint	kern_ktimer_settime(struct thread *td, int timer_id, int flags,
262253530Skib	    struct itimerspec *val, struct itimerspec *oval);
263253530Skibint	kern_ktimer_gettime(struct thread *td, int timer_id,
264253530Skib	    struct itimerspec *val);
265270042Sbzint	kern_ktimer_getoverrun(struct thread *td, int timer_id);
266293481Sdchaginint	kern_thr_alloc(struct proc *, int pages, struct thread **);
267293480Sdchaginint	kern_thr_exit(struct thread *td);
268170404Sjhbint	kern_thr_new(struct thread *td, struct thr_param *param);
269170404Sjhbint	kern_thr_suspend(struct thread *td, struct timespec *tsp);
270102779Siedowseint	kern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
271102779Siedowse	    off_t length);
272102779Siedowseint	kern_unlink(struct thread *td, char *path, enum uio_seg pathseg);
273177786Skibint	kern_unlinkat(struct thread *td, int fd, char *path,
274202113Smckusick	    enum uio_seg pathseg, ino_t oldinum);
275102779Siedowseint	kern_utimes(struct thread *td, char *path, enum uio_seg pathseg,
276102779Siedowse	    struct timeval *tptr, enum uio_seg tptrseg);
277177786Skibint	kern_utimesat(struct thread *td, int fd, char *path,
278177786Skib	    enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg);
279293474Sdchaginint	kern_utimensat(struct thread *td, int fd, char *path,
280293474Sdchagin	    enum uio_seg pathseg, struct timespec *tptr, enum uio_seg tptrseg,
281293474Sdchagin	    int follow);
282139739Sjhbint	kern_wait(struct thread *td, pid_t pid, int *status, int options,
283139739Sjhb	    struct rusage *rup);
284243135Skibint	kern_wait6(struct thread *td, enum idtype idtype, id_t id, int *status,
285242958Skib	    int options, struct __wrusage *wrup, siginfo_t *sip);
286144445Sjhbint	kern_writev(struct thread *td, int fd, struct uio *auio);
287193167Sdchaginint	kern_socketpair(struct thread *td, int domain, int type, int protocol,
288193167Sdchagin	    int *rsv);
289102779Siedowse
290105950Speter/* flags for kern_sigaction */
291105950Speter#define	KSA_OSIGSET	0x0001	/* uses osigact_t */
292105950Speter#define	KSA_FREEBSD4	0x0002	/* uses ucontext4 */
293105950Speter
294102779Siedowse#endif /* !_SYS_SYSCALLSUBR_H_ */
295