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 37f30e89ceSJohn Baldwin struct file; 3876951d21SJohn Baldwin struct itimerval; 3976951d21SJohn Baldwin struct image_args; 400304c731SJamie Gritton struct jail; 41710c5645SDavid Malone struct mbuf; 428914e6f4SJohn Baldwin struct msghdr; 4376951d21SJohn Baldwin struct msqid_ds; 44c8837938SJohn Baldwin struct rlimit; 4578c85e8dSJohn Baldwin struct rusage; 4649d409a1SJohn Baldwin union semun; 478914e6f4SJohn Baldwin struct sockaddr; 4876951d21SJohn Baldwin struct stat; 49c1aa81b6SPaul Saab struct kevent; 50efe5becaSPaul Saab struct kevent_copyops; 5186665509SKonstantin Belousov struct kld_file_stat; 52fc0de8f0SJohn Baldwin struct ksiginfo; 53fa545f43SPaul Saab struct sendfile_args; 54a66fde8dSJohn Baldwin struct thr_param; 557332c129SKonstantin Belousov struct ogetdirentries_args; 5612e4397eSHajimu UMEMOTO 5748b52b7aSIan Dowse int kern___getcwd(struct thread *td, u_char *buf, enum uio_seg bufseg, 5848b52b7aSIan Dowse u_int buflen); 59c870740eSJohn Baldwin int kern_accept(struct thread *td, int s, struct sockaddr **name, 60f30e89ceSJohn Baldwin socklen_t *namelen, struct file **fp); 618f19eb88SIan Dowse int kern_access(struct thread *td, char *path, enum uio_seg pathseg, 628f19eb88SIan Dowse int flags); 63e4193f25SKonstantin Belousov int kern_accessat(struct thread *td, int fd, char *path, 64e4193f25SKonstantin Belousov enum uio_seg pathseg, int flags, int mode); 65b88ec951SJohn Baldwin int kern_adjtime(struct thread *td, struct timeval *delta, 66b88ec951SJohn Baldwin struct timeval *olddelta); 6748b05c3fSKonstantin Belousov int kern_alternate_path(struct thread *td, const char *prefix, const char *path, 6848b05c3fSKonstantin Belousov enum uio_seg pathseg, char **pathbuf, int create, int dirfd); 6912e4397eSHajimu UMEMOTO int kern_bind(struct thread *td, int fd, struct sockaddr *sa); 708f19eb88SIan Dowse int kern_chdir(struct thread *td, char *path, enum uio_seg pathseg); 718f19eb88SIan Dowse int kern_chmod(struct thread *td, char *path, enum uio_seg pathseg, 728f19eb88SIan Dowse int mode); 738f19eb88SIan Dowse int kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid, 748f19eb88SIan Dowse int gid); 75f0b479cdSPaul Saab int kern_clock_getres(struct thread *td, clockid_t clock_id, 76f0b479cdSPaul Saab struct timespec *ts); 77f0b479cdSPaul Saab int kern_clock_gettime(struct thread *td, clockid_t clock_id, 78f0b479cdSPaul Saab struct timespec *ats); 79f0b479cdSPaul Saab int kern_clock_settime(struct thread *td, clockid_t clock_id, 80f0b479cdSPaul Saab struct timespec *ats); 81c1cccebeSJohn Baldwin int kern_close(struct thread *td, int fd); 8212e4397eSHajimu UMEMOTO int kern_connect(struct thread *td, int fd, struct sockaddr *sa); 83809f984bSJohn Baldwin int kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg, 84809f984bSJohn Baldwin int flags); 85610ecfe0SMaxim Sobolev int kern_execve(struct thread *td, struct image_args *args, 86c8837938SJohn Baldwin struct mac *mac_p); 87e4193f25SKonstantin Belousov int kern_fchmodat(struct thread *td, int fd, char *path, 88e4193f25SKonstantin Belousov enum uio_seg pathseg, mode_t mode, int flag); 89e4193f25SKonstantin Belousov int kern_fchownat(struct thread *td, int fd, char *path, 90e4193f25SKonstantin Belousov enum uio_seg pathseg, int uid, int gid, int flag); 9149c2ff15SIan Dowse int kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg); 9276dcec5dSGleb Kurtsou int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf); 9376951d21SJohn Baldwin int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); 9476951d21SJohn Baldwin int kern_fstat(struct thread *td, int fd, struct stat *sbp); 9576951d21SJohn Baldwin int kern_fstatfs(struct thread *td, int fd, struct statfs *buf); 96e4650294SJohn Baldwin int kern_ftruncate(struct thread *td, int fd, off_t length); 978f19eb88SIan Dowse int kern_futimes(struct thread *td, int fd, struct timeval *tptr, 988f19eb88SIan Dowse enum uio_seg tptrseg); 9963f8fe9eSJohn Baldwin int kern_getdirentries(struct thread *td, int fd, char *buf, u_int count, 10076dcec5dSGleb Kurtsou long *basep, ssize_t *residp, enum uio_seg bufseg); 1013a996d6eSPawel Jakub Dawidek int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, 10213a82b96SPawel Jakub Dawidek enum uio_seg bufseg, int flags); 1033cb83e71SJohn Baldwin int kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups); 10423af91dcSMaxim Sobolev int kern_getitimer(struct thread *, u_int, struct itimerval *); 105c870740eSJohn Baldwin int kern_getpeername(struct thread *td, int fd, struct sockaddr **sa, 106c870740eSJohn Baldwin socklen_t *alen); 10778c85e8dSJohn Baldwin int kern_getrusage(struct thread *td, int who, struct rusage *rup); 108c870740eSJohn Baldwin int kern_getsockname(struct thread *td, int fd, struct sockaddr **sa, 109c870740eSJohn Baldwin socklen_t *alen); 110e140eb43SDavid Malone int kern_getsockopt(struct thread *td, int s, int level, int name, 111e140eb43SDavid Malone void *optval, enum uio_seg valseg, socklen_t *valsize); 112d9f46233SJohn Baldwin int kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data); 1130304c731SJamie Gritton int kern_jail(struct thread *td, struct jail *j); 114b38ff370SJamie Gritton int kern_jail_get(struct thread *td, struct uio *options, int flags); 115b38ff370SJamie Gritton int kern_jail_set(struct thread *td, struct uio *options, int flags); 116efe5becaSPaul Saab int kern_kevent(struct thread *td, int fd, int nchanges, int nevents, 117efe5becaSPaul Saab struct kevent_copyops *k_ops, const struct timespec *timeout); 118d5388587SJohn Baldwin int kern_kldload(struct thread *td, const char *file, int *fileid); 11986665509SKonstantin Belousov int kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat); 120d5388587SJohn Baldwin int kern_kldunload(struct thread *td, int fileid, int flags); 1218f19eb88SIan Dowse int kern_lchown(struct thread *td, char *path, enum uio_seg pathseg, 1228f19eb88SIan Dowse int uid, int gid); 1238f19eb88SIan Dowse int kern_link(struct thread *td, char *path, char *link, 1248f19eb88SIan Dowse enum uio_seg segflg); 125e4193f25SKonstantin Belousov int kern_linkat(struct thread *td, int fd1, int fd2, char *path1, 126e4193f25SKonstantin Belousov char *path2, enum uio_seg segflg, int follow); 12776951d21SJohn Baldwin int kern_lstat(struct thread *td, char *path, enum uio_seg pathseg, 12876951d21SJohn Baldwin struct stat *sbp); 1298f19eb88SIan Dowse int kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg, 1308f19eb88SIan Dowse struct timeval *tptr, enum uio_seg tptrseg); 1318f19eb88SIan Dowse int kern_mkdir(struct thread *td, char *path, enum uio_seg segflg, 1328f19eb88SIan Dowse int mode); 133e4193f25SKonstantin Belousov int kern_mkdirat(struct thread *td, int fd, char *path, 134e4193f25SKonstantin Belousov enum uio_seg segflg, int mode); 1358f19eb88SIan Dowse int kern_mkfifo(struct thread *td, char *path, enum uio_seg pathseg, 1368f19eb88SIan Dowse int mode); 137e4193f25SKonstantin Belousov int kern_mkfifoat(struct thread *td, int fd, char *path, 138e4193f25SKonstantin Belousov enum uio_seg pathseg, int mode); 1398f19eb88SIan Dowse int kern_mknod(struct thread *td, char *path, enum uio_seg pathseg, 1408f19eb88SIan Dowse int mode, int dev); 141e4193f25SKonstantin Belousov int kern_mknodat(struct thread *td, int fd, char *path, 142e4193f25SKonstantin Belousov enum uio_seg pathseg, int mode, int dev); 14376951d21SJohn Baldwin int kern_msgctl(struct thread *, int, int, struct msqid_ds *); 1444e4de5e4SJung-uk Kim int kern_msgsnd(struct thread *, int, const void *, size_t, int, long); 1454e4de5e4SJung-uk Kim int kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *); 146efa42cbcSPaul Saab int kern_nanosleep(struct thread *td, struct timespec *rqt, 147efa42cbcSPaul Saab struct timespec *rmt); 1487332c129SKonstantin Belousov int kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap, 1497332c129SKonstantin Belousov long *ploff); 1508f19eb88SIan Dowse int kern_open(struct thread *td, char *path, enum uio_seg pathseg, 1518f19eb88SIan Dowse int flags, int mode); 152e4193f25SKonstantin Belousov int kern_openat(struct thread *td, int fd, char *path, 153e4193f25SKonstantin Belousov enum uio_seg pathseg, int flags, int mode); 154fee4a6afSJohn Baldwin int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, 155c3889811SEdward Tomasz Napierala int name, u_long flags); 156ab0d10f6SEd Schouten int kern_pipe(struct thread *td, int fildes[2]); 1577edec621SJohn Baldwin int kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, 1587edec621SJohn Baldwin int advice); 1597edec621SJohn Baldwin int kern_posix_fallocate(struct thread *td, int fd, off_t offset, 1607edec621SJohn Baldwin off_t len); 161bcd9e0ddSJohn Baldwin int kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset); 162066d836bSKonstantin Belousov int kern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou, 163066d836bSKonstantin Belousov fd_set *ex, struct timeval *tvp, sigset_t *uset, int abi_nfdbits); 164012e544fSIan Dowse int kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, 165012e544fSIan Dowse int data); 166bcd9e0ddSJohn Baldwin int kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset); 1678f19eb88SIan Dowse int kern_readlink(struct thread *td, char *path, enum uio_seg pathseg, 1685f56182bSRuslan Ermilov char *buf, enum uio_seg bufseg, size_t count); 169e4193f25SKonstantin Belousov int kern_readlinkat(struct thread *td, int fd, char *path, 170e4193f25SKonstantin Belousov enum uio_seg pathseg, char *buf, enum uio_seg bufseg, size_t count); 171b88ec951SJohn Baldwin int kern_readv(struct thread *td, int fd, struct uio *auio); 172c870740eSJohn Baldwin int kern_recvit(struct thread *td, int s, struct msghdr *mp, 173c870740eSJohn Baldwin enum uio_seg fromseg, struct mbuf **controlp); 1748f19eb88SIan Dowse int kern_rename(struct thread *td, char *from, char *to, 1758f19eb88SIan Dowse enum uio_seg pathseg); 176e4193f25SKonstantin Belousov int kern_renameat(struct thread *td, int oldfd, char *old, int newfd, 177e4193f25SKonstantin Belousov char *new, enum uio_seg pathseg); 1788f19eb88SIan Dowse int kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg); 179e4193f25SKonstantin Belousov int kern_rmdirat(struct thread *td, int fd, char *path, 180e4193f25SKonstantin Belousov enum uio_seg pathseg); 181b88ec951SJohn Baldwin int kern_sched_rr_get_interval(struct thread *td, pid_t pid, 182b88ec951SJohn Baldwin struct timespec *ts); 18349d409a1SJohn Baldwin int kern_semctl(struct thread *td, int semid, int semnum, int cmd, 184b1ee5b65SJohn Baldwin union semun *arg, register_t *rval); 1858f19eb88SIan Dowse int kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, 186b55ef216SKonstantin Belousov fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits); 187fa545f43SPaul Saab int kern_sendfile(struct thread *td, struct sendfile_args *uap, 188fa545f43SPaul Saab struct uio *hdr_uio, struct uio *trl_uio, int compat); 189710c5645SDavid Malone int kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags, 190a6886ef1SMaxim Sobolev struct mbuf *control, enum uio_seg segflg); 1913cb83e71SJohn Baldwin int kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups); 19223af91dcSMaxim Sobolev int kern_setitimer(struct thread *, u_int, struct itimerval *, 19323af91dcSMaxim Sobolev struct itimerval *); 194c8837938SJohn Baldwin int kern_setrlimit(struct thread *, u_int, struct rlimit *); 195e140eb43SDavid Malone int kern_setsockopt(struct thread *td, int s, int level, int name, 196e140eb43SDavid Malone void *optval, enum uio_seg valseg, socklen_t valsize); 197b88ec951SJohn Baldwin int kern_settimeofday(struct thread *td, struct timeval *tv, 198b88ec951SJohn Baldwin struct timezone *tzp); 199f130dcf2SMartin Blapp int kern_shmat(struct thread *td, int shmid, const void *shmaddr, 2002332251cSMax Khon int shmflg); 201f130dcf2SMartin Blapp int kern_shmctl(struct thread *td, int shmid, int cmd, void *buf, 2022332251cSMax Khon size_t *bufsz); 2038f19eb88SIan Dowse int kern_sigaction(struct thread *td, int sig, struct sigaction *act, 20423eeeff7SPeter Wemm struct sigaction *oact, int flags); 2058f19eb88SIan Dowse int kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss); 206fc0de8f0SJohn Baldwin int kern_sigprocmask(struct thread *td, int how, 207fc0de8f0SJohn Baldwin sigset_t *set, sigset_t *oset, int flags); 2088f19eb88SIan Dowse int kern_sigsuspend(struct thread *td, sigset_t mask); 209fc0de8f0SJohn Baldwin int kern_sigtimedwait(struct thread *td, sigset_t waitset, 210fc0de8f0SJohn Baldwin struct ksiginfo *ksi, struct timespec *timeout); 21176951d21SJohn Baldwin int kern_stat(struct thread *td, char *path, enum uio_seg pathseg, 21276951d21SJohn Baldwin struct stat *sbp); 213e4193f25SKonstantin Belousov int kern_statat(struct thread *td, int flag, int fd, char *path, 214e4193f25SKonstantin Belousov enum uio_seg pathseg, struct stat *sbp); 2150eee862aSEd Schouten int kern_statat_vnhook(struct thread *td, int flag, int fd, char *path, 2160eee862aSEd Schouten enum uio_seg pathseg, struct stat *sbp, 2170eee862aSEd Schouten void (*hook)(struct vnode *vp, struct stat *sbp)); 21876951d21SJohn Baldwin int kern_statfs(struct thread *td, char *path, enum uio_seg pathseg, 21976951d21SJohn Baldwin struct statfs *buf); 2208f19eb88SIan Dowse int kern_symlink(struct thread *td, char *path, char *link, 2218f19eb88SIan Dowse enum uio_seg segflg); 222e4193f25SKonstantin Belousov int kern_symlinkat(struct thread *td, char *path1, int fd, char *path2, 223e4193f25SKonstantin Belousov enum uio_seg segflg); 224a66fde8dSJohn Baldwin int kern_thr_new(struct thread *td, struct thr_param *param); 225a66fde8dSJohn Baldwin int kern_thr_suspend(struct thread *td, struct timespec *tsp); 2268f19eb88SIan Dowse int kern_truncate(struct thread *td, char *path, enum uio_seg pathseg, 2278f19eb88SIan Dowse off_t length); 2288f19eb88SIan Dowse int kern_unlink(struct thread *td, char *path, enum uio_seg pathseg); 229e4193f25SKonstantin Belousov int kern_unlinkat(struct thread *td, int fd, char *path, 230e268f54cSKirk McKusick enum uio_seg pathseg, ino_t oldinum); 2318f19eb88SIan Dowse int kern_utimes(struct thread *td, char *path, enum uio_seg pathseg, 2328f19eb88SIan Dowse struct timeval *tptr, enum uio_seg tptrseg); 233e4193f25SKonstantin Belousov int kern_utimesat(struct thread *td, int fd, char *path, 234e4193f25SKonstantin Belousov enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg); 235c8837938SJohn Baldwin int kern_wait(struct thread *td, pid_t pid, int *status, int options, 236c8837938SJohn Baldwin struct rusage *rup); 237b88ec951SJohn Baldwin int kern_writev(struct thread *td, int fd, struct uio *auio); 2384202e1beSDmitry Chagin int kern_socketpair(struct thread *td, int domain, int type, int protocol, 2394202e1beSDmitry Chagin int *rsv); 2408f19eb88SIan Dowse 24123eeeff7SPeter Wemm /* flags for kern_sigaction */ 24223eeeff7SPeter Wemm #define KSA_OSIGSET 0x0001 /* uses osigact_t */ 24323eeeff7SPeter Wemm #define KSA_FREEBSD4 0x0002 /* uses ucontext4 */ 24423eeeff7SPeter Wemm 2458f19eb88SIan Dowse #endif /* !_SYS_SYSCALLSUBR_H_ */ 246