syscallsubr.h revision 253494
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: head/sys/sys/syscallsubr.h 253494 2013-07-20 13:39:41Z kib $
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;
49243134Skibstruct ogetdirentries_args;
50139739Sjhbstruct rlimit;
51136152Sjhbstruct rusage;
52159991Sjhbunion semun;
53243134Skibstruct sendfile_args;
54110294Sumestruct sockaddr;
55141471Sjhbstruct stat;
56170404Sjhbstruct thr_param;
57243134Skibstruct __wrusage;
58110294Sume
59102870Siedowseint	kern___getcwd(struct thread *td, u_char *buf, enum uio_seg bufseg,
60102870Siedowse	    u_int buflen);
61160249Sjhbint	kern_accept(struct thread *td, int s, struct sockaddr **name,
62160765Sjhb	    socklen_t *namelen, struct file **fp);
63250154Sjillesint	kern_accept4(struct thread *td, int s, struct sockaddr **name,
64250154Sjilles	    socklen_t *namelen, int flags, struct file **fp);
65102779Siedowseint	kern_access(struct thread *td, char *path, enum uio_seg pathseg,
66102779Siedowse	    int flags);
67177786Skibint	kern_accessat(struct thread *td, int fd, char *path,
68177786Skib	    enum uio_seg pathseg, int flags, int mode);
69144445Sjhbint	kern_adjtime(struct thread *td, struct timeval *delta,
70144445Sjhb	    struct timeval *olddelta);
71177997Skibint	kern_alternate_path(struct thread *td, const char *prefix, const char *path,
72177997Skib	    enum uio_seg pathseg, char **pathbuf, int create, int dirfd);
73110294Sumeint	kern_bind(struct thread *td, int fd, struct sockaddr *sa);
74102779Siedowseint	kern_chdir(struct thread *td, char *path, enum uio_seg pathseg);
75102779Siedowseint	kern_chmod(struct thread *td, char *path, enum uio_seg pathseg,
76102779Siedowse	    int mode);
77102779Siedowseint	kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid,
78102779Siedowse	    int gid);
79253494Skibint	kern_clock_getcpuclockid2(struct thread *td, id_t id, int which,
80253494Skib	    clockid_t *clk_id);
81151357Spsint	kern_clock_getres(struct thread *td, clockid_t clock_id,
82151357Sps	    struct timespec *ts);
83151357Spsint	kern_clock_gettime(struct thread *td, clockid_t clock_id,
84151357Sps	    struct timespec *ats);
85151357Spsint	kern_clock_settime(struct thread *td, clockid_t clock_id,
86151357Sps	    struct timespec *ats);
87160190Sjhbint	kern_close(struct thread *td, int fd);
88110294Sumeint	kern_connect(struct thread *td, int fd, struct sockaddr *sa);
89155401Sjhbint	kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg,
90155401Sjhb	    int flags);
91140992Ssobomaxint	kern_execve(struct thread *td, struct image_args *args,
92139739Sjhb	    struct mac *mac_p);
93177786Skibint	kern_fchmodat(struct thread *td, int fd, char *path,
94177786Skib	    enum uio_seg pathseg, mode_t mode, int flag);
95177786Skibint	kern_fchownat(struct thread *td, int fd, char *path,
96177786Skib	    enum uio_seg pathseg, int uid, int gid, int flag);
97102868Siedowseint	kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg);
98235886Sglebint	kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf);
99141471Sjhbint	kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);
100141471Sjhbint	kern_fstat(struct thread *td, int fd, struct stat *sbp);
101141471Sjhbint	kern_fstatfs(struct thread *td, int fd, struct statfs *buf);
102175140Sjhbint	kern_ftruncate(struct thread *td, int fd, off_t length);
103102779Siedowseint	kern_futimes(struct thread *td, int fd, struct timeval *tptr,
104102779Siedowse	    enum uio_seg tptrseg);
105184183Sjhbint	kern_getdirentries(struct thread *td, int fd, char *buf, u_int count,
106235886Sgleb	    long *basep, ssize_t *residp, enum uio_seg bufseg);
107147302Spjdint	kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
108147178Spjd	    enum uio_seg bufseg, int flags);
109160139Sjhbint	kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups);
110140836Ssobomaxint	kern_getitimer(struct thread *, u_int, struct itimerval *);
111160249Sjhbint	kern_getpeername(struct thread *td, int fd, struct sockaddr **sa,
112160249Sjhb	    socklen_t *alen);
113136152Sjhbint	kern_getrusage(struct thread *td, int who, struct rusage *rup);
114160249Sjhbint	kern_getsockname(struct thread *td, int fd, struct sockaddr **sa,
115160249Sjhb	    socklen_t *alen);
116132313Sdwmaloneint	kern_getsockopt(struct thread *td, int s, int level, int name,
117132313Sdwmalone	    void *optval, enum uio_seg valseg, socklen_t *valsize);
118160192Sjhbint	kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data);
119192895Sjamieint	kern_jail(struct thread *td, struct jail *j);
120191673Sjamieint	kern_jail_get(struct thread *td, struct uio *options, int flags);
121191673Sjamieint	kern_jail_set(struct thread *td, struct uio *options, int flags);
122146950Spsint	kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
123146950Sps	    struct kevent_copyops *k_ops, const struct timespec *timeout);
124159588Sjhbint	kern_kldload(struct thread *td, const char *file, int *fileid);
125220158Skibint	kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat);
126159588Sjhbint	kern_kldunload(struct thread *td, int fileid, int flags);
127102779Siedowseint	kern_lchown(struct thread *td, char *path, enum uio_seg pathseg,
128102779Siedowse	    int uid, int gid);
129102779Siedowseint	kern_link(struct thread *td, char *path, char *link,
130102779Siedowse	    enum uio_seg segflg);
131177786Skibint	kern_linkat(struct thread *td, int fd1, int fd2, char *path1,
132177786Skib	    char *path2, enum uio_seg segflg, int follow);
133141471Sjhbint	kern_lstat(struct thread *td, char *path, enum uio_seg pathseg,
134141471Sjhb	    struct stat *sbp);
135102779Siedowseint	kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg,
136102779Siedowse	    struct timeval *tptr, enum uio_seg tptrseg);
137102779Siedowseint	kern_mkdir(struct thread *td, char *path, enum uio_seg segflg,
138102779Siedowse	    int mode);
139177786Skibint	kern_mkdirat(struct thread *td, int fd, char *path,
140177786Skib	    enum uio_seg segflg, int mode);
141102779Siedowseint	kern_mkfifo(struct thread *td, char *path, enum uio_seg pathseg,
142102779Siedowse	    int mode);
143177786Skibint	kern_mkfifoat(struct thread *td, int fd, char *path,
144177786Skib	    enum uio_seg pathseg, int mode);
145102779Siedowseint	kern_mknod(struct thread *td, char *path, enum uio_seg pathseg,
146102779Siedowse	    int mode, int dev);
147177786Skibint	kern_mknodat(struct thread *td, int fd, char *path,
148177786Skib	    enum uio_seg pathseg, int mode, int dev);
149141471Sjhbint	kern_msgctl(struct thread *, int, int, struct msqid_ds *);
150165403Sjkimint	kern_msgsnd(struct thread *, int, const void *, size_t, int, long);
151165403Sjkimint	kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *);
152140483Spsint     kern_nanosleep(struct thread *td, struct timespec *rqt,
153140483Sps	    struct timespec *rmt);
154220238Skibint	kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap,
155220238Skib	    long *ploff);
156102779Siedowseint	kern_open(struct thread *td, char *path, enum uio_seg pathseg,
157102779Siedowse	    int flags, int mode);
158177786Skibint	kern_openat(struct thread *td, int fd, char *path,
159177786Skib	    enum uio_seg pathseg, int flags, int mode);
160141484Sjhbint	kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg,
161195458Strasz	    int name, u_long flags);
162184849Sedint	kern_pipe(struct thread *td, int fildes[2]);
163248951Sjillesint	kern_pipe2(struct thread *td, int fildes[2], int flags);
164227502Sjhbint	kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len,
165227502Sjhb	    int advice);
166227502Sjhbint	kern_posix_fallocate(struct thread *td, int fd, off_t offset,
167227502Sjhb	    off_t len);
168147813Sjhbint	kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset);
169198508Skibint	kern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou,
170198508Skib	    fd_set *ex, struct timeval *tvp, sigset_t *uset, int abi_nfdbits);
171102946Siedowseint	kern_ptrace(struct thread *td, int req, pid_t pid, void *addr,
172102946Siedowse	    int data);
173147813Sjhbint	kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset);
174102779Siedowseint	kern_readlink(struct thread *td, char *path, enum uio_seg pathseg,
175176215Sru	    char *buf, enum uio_seg bufseg, size_t count);
176177786Skibint	kern_readlinkat(struct thread *td, int fd, char *path,
177177786Skib	    enum uio_seg pathseg, char *buf, enum uio_seg bufseg, size_t count);
178144445Sjhbint	kern_readv(struct thread *td, int fd, struct uio *auio);
179160249Sjhbint	kern_recvit(struct thread *td, int s, struct msghdr *mp,
180160249Sjhb	    enum uio_seg fromseg, struct mbuf **controlp);
181102779Siedowseint	kern_rename(struct thread *td, char *from, char *to,
182102779Siedowse	    enum uio_seg pathseg);
183177786Skibint	kern_renameat(struct thread *td, int oldfd, char *old, int newfd,
184177786Skib	    char *new, enum uio_seg pathseg);
185102779Siedowseint	kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);
186177786Skibint	kern_rmdirat(struct thread *td, int fd, char *path,
187177786Skib	    enum uio_seg pathseg);
188144445Sjhbint	kern_sched_rr_get_interval(struct thread *td, pid_t pid,
189144445Sjhb	    struct timespec *ts);
190159991Sjhbint	kern_semctl(struct thread *td, int semid, int semnum, int cmd,
191160187Sjhb	    union semun *arg, register_t *rval);
192102779Siedowseint	kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
193197049Skib	    fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits);
194156114Spsint	kern_sendfile(struct thread *td, struct sendfile_args *uap,
195156114Sps	    struct uio *hdr_uio, struct uio *trl_uio, int compat);
196114749Sdwmaloneint	kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags,
197141029Ssobomax	    struct mbuf *control, enum uio_seg segflg);
198160139Sjhbint	kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups);
199140836Ssobomaxint	kern_setitimer(struct thread *, u_int, struct itimerval *,
200140836Ssobomax	    struct itimerval *);
201139739Sjhbint	kern_setrlimit(struct thread *, u_int, struct rlimit *);
202132313Sdwmaloneint	kern_setsockopt(struct thread *td, int s, int level, int name,
203132313Sdwmalone	    void *optval, enum uio_seg valseg, socklen_t valsize);
204144445Sjhbint	kern_settimeofday(struct thread *td, struct timeval *tv,
205144445Sjhb	    struct timezone *tzp);
206114724Smbrint	kern_shmat(struct thread *td, int shmid, const void *shmaddr,
207122088Sfjoe	    int shmflg);
208114724Smbrint	kern_shmctl(struct thread *td, int shmid, int cmd, void *buf,
209122088Sfjoe	    size_t *bufsz);
210102779Siedowseint	kern_sigaction(struct thread *td, int sig, struct sigaction *act,
211105950Speter	    struct sigaction *oact, int flags);
212102779Siedowseint	kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss);
213209613Sjhbint	kern_sigprocmask(struct thread *td, int how,
214209613Sjhb	    sigset_t *set, sigset_t *oset, int flags);
215102779Siedowseint	kern_sigsuspend(struct thread *td, sigset_t mask);
216209613Sjhbint	kern_sigtimedwait(struct thread *td, sigset_t waitset,
217209613Sjhb	    struct ksiginfo *ksi, struct timespec *timeout);
218141471Sjhbint	kern_stat(struct thread *td, char *path, enum uio_seg pathseg,
219141471Sjhb	    struct stat *sbp);
220177786Skibint	kern_statat(struct thread *td, int flag, int fd, char *path,
221177786Skib	    enum uio_seg pathseg, struct stat *sbp);
222188849Sedint	kern_statat_vnhook(struct thread *td, int flag, int fd, char *path,
223188849Sed	    enum uio_seg pathseg, struct stat *sbp,
224188849Sed	    void (*hook)(struct vnode *vp, struct stat *sbp));
225141471Sjhbint	kern_statfs(struct thread *td, char *path, enum uio_seg pathseg,
226141471Sjhb	    struct statfs *buf);
227102779Siedowseint	kern_symlink(struct thread *td, char *path, char *link,
228102779Siedowse	    enum uio_seg segflg);
229177786Skibint	kern_symlinkat(struct thread *td, char *path1, int fd, char *path2,
230177786Skib	    enum uio_seg segflg);
231170404Sjhbint	kern_thr_new(struct thread *td, struct thr_param *param);
232170404Sjhbint	kern_thr_suspend(struct thread *td, struct timespec *tsp);
233102779Siedowseint	kern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
234102779Siedowse	    off_t length);
235102779Siedowseint	kern_unlink(struct thread *td, char *path, enum uio_seg pathseg);
236177786Skibint	kern_unlinkat(struct thread *td, int fd, char *path,
237202113Smckusick	    enum uio_seg pathseg, ino_t oldinum);
238102779Siedowseint	kern_utimes(struct thread *td, char *path, enum uio_seg pathseg,
239102779Siedowse	    struct timeval *tptr, enum uio_seg tptrseg);
240177786Skibint	kern_utimesat(struct thread *td, int fd, char *path,
241177786Skib	    enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg);
242139739Sjhbint	kern_wait(struct thread *td, pid_t pid, int *status, int options,
243139739Sjhb	    struct rusage *rup);
244243135Skibint	kern_wait6(struct thread *td, enum idtype idtype, id_t id, int *status,
245242958Skib	    int options, struct __wrusage *wrup, siginfo_t *sip);
246144445Sjhbint	kern_writev(struct thread *td, int fd, struct uio *auio);
247193167Sdchaginint	kern_socketpair(struct thread *td, int domain, int type, int protocol,
248193167Sdchagin	    int *rsv);
249102779Siedowse
250105950Speter/* flags for kern_sigaction */
251105950Speter#define	KSA_OSIGSET	0x0001	/* uses osigact_t */
252105950Speter#define	KSA_FREEBSD4	0x0002	/* uses ucontext4 */
253105950Speter
254102779Siedowse#endif /* !_SYS_SYSCALLSUBR_H_ */
255