xref: /freebsd/sys/sys/syscallsubr.h (revision 3cb83e71)
160727d8bSWarner Losh /*-
28f19eb88SIan Dowse  * Copyright (c) 2002 Ian Dowse.  All rights reserved.
38f19eb88SIan Dowse  *
48f19eb88SIan Dowse  * Redistribution and use in source and binary forms, with or without
58f19eb88SIan Dowse  * modification, are permitted provided that the following conditions
68f19eb88SIan Dowse  * are met:
78f19eb88SIan Dowse  * 1. Redistributions of source code must retain the above copyright
88f19eb88SIan Dowse  *    notice, this list of conditions and the following disclaimer.
98f19eb88SIan Dowse  * 2. Redistributions in binary form must reproduce the above copyright
108f19eb88SIan Dowse  *    notice, this list of conditions and the following disclaimer in the
118f19eb88SIan Dowse  *    documentation and/or other materials provided with the distribution.
128f19eb88SIan Dowse  *
138f19eb88SIan Dowse  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
148f19eb88SIan Dowse  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
158f19eb88SIan Dowse  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
168f19eb88SIan Dowse  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
178f19eb88SIan Dowse  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
188f19eb88SIan Dowse  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
198f19eb88SIan Dowse  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
208f19eb88SIan Dowse  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
218f19eb88SIan Dowse  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
228f19eb88SIan Dowse  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
238f19eb88SIan Dowse  * SUCH DAMAGE.
248f19eb88SIan Dowse  *
258f19eb88SIan Dowse  * $FreeBSD$
268f19eb88SIan Dowse  */
278f19eb88SIan Dowse 
288f19eb88SIan Dowse #ifndef _SYS_SYSCALLSUBR_H_
298f19eb88SIan Dowse #define _SYS_SYSCALLSUBR_H_
308f19eb88SIan Dowse 
318f19eb88SIan Dowse #include <sys/signal.h>
328f19eb88SIan Dowse #include <sys/uio.h>
33e140eb43SDavid Malone #include <sys/socket.h>
3484e0b075SDavid Xu #include <sys/mac.h>
3576951d21SJohn Baldwin #include <sys/mount.h>
368f19eb88SIan Dowse 
3776951d21SJohn Baldwin struct itimerval;
3876951d21SJohn Baldwin struct image_args;
39710c5645SDavid Malone struct mbuf;
408914e6f4SJohn Baldwin struct msghdr;
4176951d21SJohn Baldwin struct msqid_ds;
42c8837938SJohn Baldwin struct rlimit;
4378c85e8dSJohn Baldwin struct rusage;
4449d409a1SJohn Baldwin union semun;
458914e6f4SJohn Baldwin struct sockaddr;
4676951d21SJohn Baldwin struct stat;
47c1aa81b6SPaul Saab struct kevent;
48efe5becaSPaul Saab struct kevent_copyops;
49fa545f43SPaul Saab struct sendfile_args;
5012e4397eSHajimu UMEMOTO 
5148b52b7aSIan Dowse int	kern___getcwd(struct thread *td, u_char *buf, enum uio_seg bufseg,
5248b52b7aSIan Dowse 	    u_int buflen);
538f19eb88SIan Dowse int	kern_access(struct thread *td, char *path, enum uio_seg pathseg,
548f19eb88SIan Dowse 	    int flags);
55b88ec951SJohn Baldwin int	kern_adjtime(struct thread *td, struct timeval *delta,
56b88ec951SJohn Baldwin 	    struct timeval *olddelta);
5776951d21SJohn Baldwin int	kern_alternate_path(struct thread *td, const char *prefix, char *path,
5876951d21SJohn Baldwin 	    enum uio_seg pathseg, char **pathbuf, int create);
5912e4397eSHajimu UMEMOTO int	kern_bind(struct thread *td, int fd, struct sockaddr *sa);
608f19eb88SIan Dowse int	kern_chdir(struct thread *td, char *path, enum uio_seg pathseg);
618f19eb88SIan Dowse int	kern_chmod(struct thread *td, char *path, enum uio_seg pathseg,
628f19eb88SIan Dowse 	    int mode);
638f19eb88SIan Dowse int	kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid,
648f19eb88SIan Dowse 	    int gid);
65f0b479cdSPaul Saab int	kern_clock_getres(struct thread *td, clockid_t clock_id,
66f0b479cdSPaul Saab 	    struct timespec *ts);
67f0b479cdSPaul Saab int	kern_clock_gettime(struct thread *td, clockid_t clock_id,
68f0b479cdSPaul Saab 	    struct timespec *ats);
69f0b479cdSPaul Saab int	kern_clock_settime(struct thread *td, clockid_t clock_id,
70f0b479cdSPaul Saab 	    struct timespec *ats);
7112e4397eSHajimu UMEMOTO int	kern_connect(struct thread *td, int fd, struct sockaddr *sa);
72809f984bSJohn Baldwin int	kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg,
73809f984bSJohn Baldwin 	    int flags);
74610ecfe0SMaxim Sobolev int	kern_execve(struct thread *td, struct image_args *args,
75c8837938SJohn Baldwin 	    struct mac *mac_p);
7649c2ff15SIan Dowse int	kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg);
7776951d21SJohn Baldwin int	kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);
7876951d21SJohn Baldwin int	kern_fstat(struct thread *td, int fd, struct stat *sbp);
7976951d21SJohn Baldwin int	kern_fstatfs(struct thread *td, int fd, struct statfs *buf);
808f19eb88SIan Dowse int	kern_futimes(struct thread *td, int fd, struct timeval *tptr,
818f19eb88SIan Dowse 	    enum uio_seg tptrseg);
823a996d6eSPawel Jakub Dawidek int	kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
8313a82b96SPawel Jakub Dawidek 	    enum uio_seg bufseg, int flags);
843cb83e71SJohn Baldwin int	kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups);
8523af91dcSMaxim Sobolev int	kern_getitimer(struct thread *, u_int, struct itimerval *);
8678c85e8dSJohn Baldwin int	kern_getrusage(struct thread *td, int who, struct rusage *rup);
87e140eb43SDavid Malone int	kern_getsockopt(struct thread *td, int s, int level, int name,
88e140eb43SDavid Malone 	    void *optval, enum uio_seg valseg, socklen_t *valsize);
89efe5becaSPaul Saab int	kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
90efe5becaSPaul Saab 	    struct kevent_copyops *k_ops, const struct timespec *timeout);
91d5388587SJohn Baldwin int	kern_kldload(struct thread *td, const char *file, int *fileid);
92d5388587SJohn Baldwin int	kern_kldunload(struct thread *td, int fileid, int flags);
938f19eb88SIan Dowse int	kern_lchown(struct thread *td, char *path, enum uio_seg pathseg,
948f19eb88SIan Dowse 	    int uid, int gid);
958f19eb88SIan Dowse int	kern_link(struct thread *td, char *path, char *link,
968f19eb88SIan Dowse 	    enum uio_seg segflg);
9776951d21SJohn Baldwin int	kern_lstat(struct thread *td, char *path, enum uio_seg pathseg,
9876951d21SJohn Baldwin 	    struct stat *sbp);
998f19eb88SIan Dowse int	kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg,
1008f19eb88SIan Dowse 	    struct timeval *tptr, enum uio_seg tptrseg);
1018f19eb88SIan Dowse int	kern_mkdir(struct thread *td, char *path, enum uio_seg segflg,
1028f19eb88SIan Dowse 	    int mode);
1038f19eb88SIan Dowse int	kern_mkfifo(struct thread *td, char *path, enum uio_seg pathseg,
1048f19eb88SIan Dowse 	    int mode);
1058f19eb88SIan Dowse int	kern_mknod(struct thread *td, char *path, enum uio_seg pathseg,
1068f19eb88SIan Dowse 	    int mode, int dev);
10776951d21SJohn Baldwin int	kern_msgctl(struct thread *, int, int, struct msqid_ds *);
108efa42cbcSPaul Saab int     kern_nanosleep(struct thread *td, struct timespec *rqt,
109efa42cbcSPaul Saab 	    struct timespec *rmt);
1108f19eb88SIan Dowse int	kern_open(struct thread *td, char *path, enum uio_seg pathseg,
1118f19eb88SIan Dowse 	    int flags, int mode);
112fee4a6afSJohn Baldwin int	kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg,
113fee4a6afSJohn Baldwin 	    int name);
114bcd9e0ddSJohn Baldwin int	kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset);
115012e544fSIan Dowse int	kern_ptrace(struct thread *td, int req, pid_t pid, void *addr,
116012e544fSIan Dowse 	    int data);
117bcd9e0ddSJohn Baldwin int	kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset);
1188f19eb88SIan Dowse int	kern_readlink(struct thread *td, char *path, enum uio_seg pathseg,
1198f19eb88SIan Dowse 	    char *buf, enum uio_seg bufseg, int count);
120b88ec951SJohn Baldwin int	kern_readv(struct thread *td, int fd, struct uio *auio);
121a372f822SPaul Saab int	kern_recvit(struct thread *td, int s, struct msghdr *mp, void *namelenp,
122ecc44de7SPaul Saab 	    enum uio_seg segflg, struct mbuf **controlp);
1238f19eb88SIan Dowse int	kern_rename(struct thread *td, char *from, char *to,
1248f19eb88SIan Dowse 	    enum uio_seg pathseg);
1258f19eb88SIan Dowse int	kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);
126b88ec951SJohn Baldwin int	kern_sched_rr_get_interval(struct thread *td, pid_t pid,
127b88ec951SJohn Baldwin 	    struct timespec *ts);
12849d409a1SJohn Baldwin int	kern_semctl(struct thread *td, int semid, int semnum, int cmd,
12949d409a1SJohn Baldwin 	    union semun *arg, enum uio_seg bufseg);
1308f19eb88SIan Dowse int	kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
1318f19eb88SIan Dowse 	    fd_set *fd_ex, struct timeval *tvp);
132fa545f43SPaul Saab int	kern_sendfile(struct thread *td, struct sendfile_args *uap,
133fa545f43SPaul Saab 	    struct uio *hdr_uio, struct uio *trl_uio, int compat);
134710c5645SDavid Malone int	kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags,
135a6886ef1SMaxim Sobolev 	    struct mbuf *control, enum uio_seg segflg);
1363cb83e71SJohn Baldwin int	kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups);
13723af91dcSMaxim Sobolev int	kern_setitimer(struct thread *, u_int, struct itimerval *,
13823af91dcSMaxim Sobolev 	    struct itimerval *);
139c8837938SJohn Baldwin int	kern_setrlimit(struct thread *, u_int, struct rlimit *);
140e140eb43SDavid Malone int	kern_setsockopt(struct thread *td, int s, int level, int name,
141e140eb43SDavid Malone 	    void *optval, enum uio_seg valseg, socklen_t valsize);
142b88ec951SJohn Baldwin int	kern_settimeofday(struct thread *td, struct timeval *tv,
143b88ec951SJohn Baldwin 	    struct timezone *tzp);
144f130dcf2SMartin Blapp int	kern_shmat(struct thread *td, int shmid, const void *shmaddr,
1452332251cSMax Khon 	    int shmflg);
146f130dcf2SMartin Blapp int	kern_shmctl(struct thread *td, int shmid, int cmd, void *buf,
1472332251cSMax Khon 	    size_t *bufsz);
1488f19eb88SIan Dowse int	kern_sigaction(struct thread *td, int sig, struct sigaction *act,
14923eeeff7SPeter Wemm 	    struct sigaction *oact, int flags);
1508f19eb88SIan Dowse int	kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss);
151e77daab1SJohn Baldwin int	kern_sigprocmask(struct thread *td, int how,
152e77daab1SJohn Baldwin 	    sigset_t *set, sigset_t *oset, int old);
1538f19eb88SIan Dowse int	kern_sigsuspend(struct thread *td, sigset_t mask);
15476951d21SJohn Baldwin int	kern_stat(struct thread *td, char *path, enum uio_seg pathseg,
15576951d21SJohn Baldwin 	    struct stat *sbp);
15676951d21SJohn Baldwin int	kern_statfs(struct thread *td, char *path, enum uio_seg pathseg,
15776951d21SJohn Baldwin 	    struct statfs *buf);
1588f19eb88SIan Dowse int	kern_symlink(struct thread *td, char *path, char *link,
1598f19eb88SIan Dowse 	    enum uio_seg segflg);
1608f19eb88SIan Dowse int	kern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
1618f19eb88SIan Dowse 	    off_t length);
1628f19eb88SIan Dowse int	kern_unlink(struct thread *td, char *path, enum uio_seg pathseg);
1638f19eb88SIan Dowse int	kern_utimes(struct thread *td, char *path, enum uio_seg pathseg,
1648f19eb88SIan Dowse 	    struct timeval *tptr, enum uio_seg tptrseg);
165c8837938SJohn Baldwin int	kern_wait(struct thread *td, pid_t pid, int *status, int options,
166c8837938SJohn Baldwin 	    struct rusage *rup);
167b88ec951SJohn Baldwin int	kern_writev(struct thread *td, int fd, struct uio *auio);
1688f19eb88SIan Dowse 
16923eeeff7SPeter Wemm /* flags for kern_sigaction */
17023eeeff7SPeter Wemm #define	KSA_OSIGSET	0x0001	/* uses osigact_t */
17123eeeff7SPeter Wemm #define	KSA_FREEBSD4	0x0002	/* uses ucontext4 */
17223eeeff7SPeter Wemm 
1738f19eb88SIan Dowse #endif /* !_SYS_SYSCALLSUBR_H_ */
174