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); 53*c870740eSJohn Baldwin int kern_accept(struct thread *td, int s, struct sockaddr **name, 54*c870740eSJohn Baldwin socklen_t *namelen); 558f19eb88SIan Dowse int kern_access(struct thread *td, char *path, enum uio_seg pathseg, 568f19eb88SIan Dowse int flags); 57b88ec951SJohn Baldwin int kern_adjtime(struct thread *td, struct timeval *delta, 58b88ec951SJohn Baldwin struct timeval *olddelta); 5976951d21SJohn Baldwin int kern_alternate_path(struct thread *td, const char *prefix, char *path, 6076951d21SJohn Baldwin enum uio_seg pathseg, char **pathbuf, int create); 6112e4397eSHajimu UMEMOTO int kern_bind(struct thread *td, int fd, struct sockaddr *sa); 628f19eb88SIan Dowse int kern_chdir(struct thread *td, char *path, enum uio_seg pathseg); 638f19eb88SIan Dowse int kern_chmod(struct thread *td, char *path, enum uio_seg pathseg, 648f19eb88SIan Dowse int mode); 658f19eb88SIan Dowse int kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid, 668f19eb88SIan Dowse int gid); 67f0b479cdSPaul Saab int kern_clock_getres(struct thread *td, clockid_t clock_id, 68f0b479cdSPaul Saab struct timespec *ts); 69f0b479cdSPaul Saab int kern_clock_gettime(struct thread *td, clockid_t clock_id, 70f0b479cdSPaul Saab struct timespec *ats); 71f0b479cdSPaul Saab int kern_clock_settime(struct thread *td, clockid_t clock_id, 72f0b479cdSPaul Saab struct timespec *ats); 73c1cccebeSJohn Baldwin int kern_close(struct thread *td, int fd); 7412e4397eSHajimu UMEMOTO int kern_connect(struct thread *td, int fd, struct sockaddr *sa); 75809f984bSJohn Baldwin int kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg, 76809f984bSJohn Baldwin int flags); 77610ecfe0SMaxim Sobolev int kern_execve(struct thread *td, struct image_args *args, 78c8837938SJohn Baldwin struct mac *mac_p); 7949c2ff15SIan Dowse int kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg); 8076951d21SJohn Baldwin int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); 8176951d21SJohn Baldwin int kern_fstat(struct thread *td, int fd, struct stat *sbp); 8276951d21SJohn Baldwin int kern_fstatfs(struct thread *td, int fd, struct statfs *buf); 838f19eb88SIan Dowse int kern_futimes(struct thread *td, int fd, struct timeval *tptr, 848f19eb88SIan Dowse enum uio_seg tptrseg); 853a996d6eSPawel Jakub Dawidek int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, 8613a82b96SPawel Jakub Dawidek enum uio_seg bufseg, int flags); 873cb83e71SJohn Baldwin int kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups); 8823af91dcSMaxim Sobolev int kern_getitimer(struct thread *, u_int, struct itimerval *); 89*c870740eSJohn Baldwin int kern_getpeername(struct thread *td, int fd, struct sockaddr **sa, 90*c870740eSJohn Baldwin socklen_t *alen); 9178c85e8dSJohn Baldwin int kern_getrusage(struct thread *td, int who, struct rusage *rup); 92*c870740eSJohn Baldwin int kern_getsockname(struct thread *td, int fd, struct sockaddr **sa, 93*c870740eSJohn Baldwin socklen_t *alen); 94e140eb43SDavid Malone int kern_getsockopt(struct thread *td, int s, int level, int name, 95e140eb43SDavid Malone void *optval, enum uio_seg valseg, socklen_t *valsize); 96d9f46233SJohn Baldwin int kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data); 97efe5becaSPaul Saab int kern_kevent(struct thread *td, int fd, int nchanges, int nevents, 98efe5becaSPaul Saab struct kevent_copyops *k_ops, const struct timespec *timeout); 99d5388587SJohn Baldwin int kern_kldload(struct thread *td, const char *file, int *fileid); 100d5388587SJohn Baldwin int kern_kldunload(struct thread *td, int fileid, int flags); 1018f19eb88SIan Dowse int kern_lchown(struct thread *td, char *path, enum uio_seg pathseg, 1028f19eb88SIan Dowse int uid, int gid); 1038f19eb88SIan Dowse int kern_link(struct thread *td, char *path, char *link, 1048f19eb88SIan Dowse enum uio_seg segflg); 10576951d21SJohn Baldwin int kern_lstat(struct thread *td, char *path, enum uio_seg pathseg, 10676951d21SJohn Baldwin struct stat *sbp); 1078f19eb88SIan Dowse int kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg, 1088f19eb88SIan Dowse struct timeval *tptr, enum uio_seg tptrseg); 1098f19eb88SIan Dowse int kern_mkdir(struct thread *td, char *path, enum uio_seg segflg, 1108f19eb88SIan Dowse int mode); 1118f19eb88SIan Dowse int kern_mkfifo(struct thread *td, char *path, enum uio_seg pathseg, 1128f19eb88SIan Dowse int mode); 1138f19eb88SIan Dowse int kern_mknod(struct thread *td, char *path, enum uio_seg pathseg, 1148f19eb88SIan Dowse int mode, int dev); 11576951d21SJohn Baldwin int kern_msgctl(struct thread *, int, int, struct msqid_ds *); 116efa42cbcSPaul Saab int kern_nanosleep(struct thread *td, struct timespec *rqt, 117efa42cbcSPaul Saab struct timespec *rmt); 1188f19eb88SIan Dowse int kern_open(struct thread *td, char *path, enum uio_seg pathseg, 1198f19eb88SIan Dowse int flags, int mode); 120fee4a6afSJohn Baldwin int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, 121fee4a6afSJohn Baldwin int name); 122bcd9e0ddSJohn Baldwin int kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset); 123012e544fSIan Dowse int kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, 124012e544fSIan Dowse int data); 125bcd9e0ddSJohn Baldwin int kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset); 1268f19eb88SIan Dowse int kern_readlink(struct thread *td, char *path, enum uio_seg pathseg, 1278f19eb88SIan Dowse char *buf, enum uio_seg bufseg, int count); 128b88ec951SJohn Baldwin int kern_readv(struct thread *td, int fd, struct uio *auio); 129*c870740eSJohn Baldwin int kern_recvit(struct thread *td, int s, struct msghdr *mp, 130*c870740eSJohn Baldwin enum uio_seg fromseg, struct mbuf **controlp); 1318f19eb88SIan Dowse int kern_rename(struct thread *td, char *from, char *to, 1328f19eb88SIan Dowse enum uio_seg pathseg); 1338f19eb88SIan Dowse int kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg); 134b88ec951SJohn Baldwin int kern_sched_rr_get_interval(struct thread *td, pid_t pid, 135b88ec951SJohn Baldwin struct timespec *ts); 13649d409a1SJohn Baldwin int kern_semctl(struct thread *td, int semid, int semnum, int cmd, 137b1ee5b65SJohn Baldwin union semun *arg, register_t *rval); 1388f19eb88SIan Dowse int kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, 1398f19eb88SIan Dowse fd_set *fd_ex, struct timeval *tvp); 140fa545f43SPaul Saab int kern_sendfile(struct thread *td, struct sendfile_args *uap, 141fa545f43SPaul Saab struct uio *hdr_uio, struct uio *trl_uio, int compat); 142710c5645SDavid Malone int kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags, 143a6886ef1SMaxim Sobolev struct mbuf *control, enum uio_seg segflg); 1443cb83e71SJohn Baldwin int kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups); 14523af91dcSMaxim Sobolev int kern_setitimer(struct thread *, u_int, struct itimerval *, 14623af91dcSMaxim Sobolev struct itimerval *); 147c8837938SJohn Baldwin int kern_setrlimit(struct thread *, u_int, struct rlimit *); 148e140eb43SDavid Malone int kern_setsockopt(struct thread *td, int s, int level, int name, 149e140eb43SDavid Malone void *optval, enum uio_seg valseg, socklen_t valsize); 150b88ec951SJohn Baldwin int kern_settimeofday(struct thread *td, struct timeval *tv, 151b88ec951SJohn Baldwin struct timezone *tzp); 152f130dcf2SMartin Blapp int kern_shmat(struct thread *td, int shmid, const void *shmaddr, 1532332251cSMax Khon int shmflg); 154f130dcf2SMartin Blapp int kern_shmctl(struct thread *td, int shmid, int cmd, void *buf, 1552332251cSMax Khon size_t *bufsz); 1568f19eb88SIan Dowse int kern_sigaction(struct thread *td, int sig, struct sigaction *act, 15723eeeff7SPeter Wemm struct sigaction *oact, int flags); 1588f19eb88SIan Dowse int kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss); 159e77daab1SJohn Baldwin int kern_sigprocmask(struct thread *td, int how, 160e77daab1SJohn Baldwin sigset_t *set, sigset_t *oset, int old); 1618f19eb88SIan Dowse int kern_sigsuspend(struct thread *td, sigset_t mask); 16276951d21SJohn Baldwin int kern_stat(struct thread *td, char *path, enum uio_seg pathseg, 16376951d21SJohn Baldwin struct stat *sbp); 16476951d21SJohn Baldwin int kern_statfs(struct thread *td, char *path, enum uio_seg pathseg, 16576951d21SJohn Baldwin struct statfs *buf); 1668f19eb88SIan Dowse int kern_symlink(struct thread *td, char *path, char *link, 1678f19eb88SIan Dowse enum uio_seg segflg); 1688f19eb88SIan Dowse int kern_truncate(struct thread *td, char *path, enum uio_seg pathseg, 1698f19eb88SIan Dowse off_t length); 1708f19eb88SIan Dowse int kern_unlink(struct thread *td, char *path, enum uio_seg pathseg); 1718f19eb88SIan Dowse int kern_utimes(struct thread *td, char *path, enum uio_seg pathseg, 1728f19eb88SIan Dowse struct timeval *tptr, enum uio_seg tptrseg); 173c8837938SJohn Baldwin int kern_wait(struct thread *td, pid_t pid, int *status, int options, 174c8837938SJohn Baldwin struct rusage *rup); 175b88ec951SJohn Baldwin int kern_writev(struct thread *td, int fd, struct uio *auio); 1768f19eb88SIan Dowse 17723eeeff7SPeter Wemm /* flags for kern_sigaction */ 17823eeeff7SPeter Wemm #define KSA_OSIGSET 0x0001 /* uses osigact_t */ 17923eeeff7SPeter Wemm #define KSA_FREEBSD4 0x0002 /* uses ucontext4 */ 18023eeeff7SPeter Wemm 1818f19eb88SIan Dowse #endif /* !_SYS_SYSCALLSUBR_H_ */ 182