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/11/sys/sys/syscallsubr.h 366281 2020-09-30 02:28:46Z 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> 36315555Strasz#include <sys/_cpuset.h> 37102779Siedowse 38160765Sjhbstruct file; 39286021Sedstruct filecaps; 40243134Skibenum idtype; 41141471Sjhbstruct itimerval; 42141471Sjhbstruct image_args; 43192895Sjamiestruct jail; 44243134Skibstruct kevent; 45243134Skibstruct kevent_copyops; 46243134Skibstruct kld_file_stat; 47243134Skibstruct ksiginfo; 48135764Sjhbstruct mbuf; 49135764Sjhbstruct msghdr; 50141471Sjhbstruct msqid_ds; 51274462Sdchaginstruct pollfd; 52243134Skibstruct ogetdirentries_args; 53139739Sjhbstruct rlimit; 54136152Sjhbstruct rusage; 55159991Sjhbunion semun; 56243134Skibstruct sendfile_args; 57110294Sumestruct sockaddr; 58141471Sjhbstruct stat; 59170404Sjhbstruct thr_param; 60283377Sdchaginstruct sched_param; 61243134Skibstruct __wrusage; 62366281Skibstruct vmspace; 63110294Sume 64356634Skevanstypedef int (*mmap_check_fp_fn)(struct file *, int, int, int); 65356634Skevans 66276654Sdchaginint kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, 67281829Strasz u_int buflen, u_int path_max); 68160249Sjhbint kern_accept(struct thread *td, int s, struct sockaddr **name, 69160765Sjhb socklen_t *namelen, struct file **fp); 70250154Sjillesint kern_accept4(struct thread *td, int s, struct sockaddr **name, 71250154Sjilles socklen_t *namelen, int flags, struct file **fp); 72177786Skibint kern_accessat(struct thread *td, int fd, char *path, 73177786Skib enum uio_seg pathseg, int flags, int mode); 74144445Sjhbint kern_adjtime(struct thread *td, struct timeval *delta, 75144445Sjhb struct timeval *olddelta); 76177997Skibint kern_alternate_path(struct thread *td, const char *prefix, const char *path, 77177997Skib enum uio_seg pathseg, char **pathbuf, int create, int dirfd); 78274476Skibint kern_bindat(struct thread *td, int dirfd, int fd, struct sockaddr *sa); 79254481Spjdint kern_cap_ioctls_limit(struct thread *td, int fd, u_long *cmds, 80254481Spjd size_t ncmds); 81286618Sedint kern_cap_rights_limit(struct thread *td, int fd, cap_rights_t *rights); 82102779Siedowseint kern_chdir(struct thread *td, char *path, enum uio_seg pathseg); 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); 89317618Svangyzenint kern_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags, 90317618Svangyzen const struct timespec *rqtp, struct timespec *rmtp); 91151357Spsint kern_clock_settime(struct thread *td, clockid_t clock_id, 92151357Sps struct timespec *ats); 93160190Sjhbint kern_close(struct thread *td, int fd); 94274476Skibint kern_connectat(struct thread *td, int dirfd, int fd, 95274476Skib struct sockaddr *sa); 96315555Straszint kern_cpuset_getaffinity(struct thread *td, cpulevel_t level, 97315555Strasz cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *maskp); 98315555Straszint kern_cpuset_setaffinity(struct thread *td, cpulevel_t level, 99315555Strasz cpuwhich_t which, id_t id, size_t cpusetsize, 100315555Strasz const cpuset_t *maskp); 101315554Straszint kern_cpuset_getid(struct thread *td, cpulevel_t level, 102315554Strasz cpuwhich_t which, id_t id, cpusetid_t *setid); 103315554Straszint kern_cpuset_setid(struct thread *td, cpuwhich_t which, 104315554Strasz id_t id, cpusetid_t setid); 105285356Smjgint kern_dup(struct thread *td, u_int mode, int flags, int old, int new); 106140992Ssobomaxint kern_execve(struct thread *td, struct image_args *args, 107366281Skib struct mac *mac_p, struct vmspace *oldvmspace); 108177786Skibint kern_fchmodat(struct thread *td, int fd, char *path, 109177786Skib enum uio_seg pathseg, mode_t mode, int flag); 110177786Skibint kern_fchownat(struct thread *td, int fd, char *path, 111177786Skib enum uio_seg pathseg, int uid, int gid, int flag); 112102868Siedowseint kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg); 113272132Skibint kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg); 114235886Sglebint kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf); 115141471Sjhbint kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); 116328298Sjhbint kern_fpathconf(struct thread *td, int fd, int name); 117141471Sjhbint kern_fstat(struct thread *td, int fd, struct stat *sbp); 118141471Sjhbint kern_fstatfs(struct thread *td, int fd, struct statfs *buf); 119304987Skibint kern_fsync(struct thread *td, int fd, bool fullsync); 120175140Sjhbint kern_ftruncate(struct thread *td, int fd, off_t length); 121102779Siedowseint kern_futimes(struct thread *td, int fd, struct timeval *tptr, 122102779Siedowse enum uio_seg tptrseg); 123277610Sjillesint kern_futimens(struct thread *td, int fd, struct timespec *tptr, 124277610Sjilles enum uio_seg tptrseg); 125184183Sjhbint kern_getdirentries(struct thread *td, int fd, char *buf, u_int count, 126235886Sgleb long *basep, ssize_t *residp, enum uio_seg bufseg); 127147302Spjdint kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, 128313450Sjhb size_t *countp, enum uio_seg bufseg, int mode); 129140836Ssobomaxint kern_getitimer(struct thread *, u_int, struct itimerval *); 130270444Smjgint kern_getppid(struct thread *); 131160249Sjhbint kern_getpeername(struct thread *td, int fd, struct sockaddr **sa, 132160249Sjhb socklen_t *alen); 133136152Sjhbint kern_getrusage(struct thread *td, int who, struct rusage *rup); 134160249Sjhbint kern_getsockname(struct thread *td, int fd, struct sockaddr **sa, 135160249Sjhb socklen_t *alen); 136132313Sdwmaloneint kern_getsockopt(struct thread *td, int s, int level, int name, 137132313Sdwmalone void *optval, enum uio_seg valseg, socklen_t *valsize); 138160192Sjhbint kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data); 139192895Sjamieint kern_jail(struct thread *td, struct jail *j); 140191673Sjamieint kern_jail_get(struct thread *td, struct uio *options, int flags); 141191673Sjamieint kern_jail_set(struct thread *td, struct uio *options, int flags); 142146950Spsint kern_kevent(struct thread *td, int fd, int nchanges, int nevents, 143146950Sps struct kevent_copyops *k_ops, const struct timespec *timeout); 144286631Sedint kern_kevent_anonymous(struct thread *td, int nevents, 145286631Sed struct kevent_copyops *k_ops); 146283440Sdchaginint kern_kevent_fp(struct thread *td, struct file *fp, int nchanges, 147283440Sdchagin int nevents, struct kevent_copyops *k_ops, 148283440Sdchagin const struct timespec *timeout); 149286309Sedint kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps); 150159588Sjhbint kern_kldload(struct thread *td, const char *file, int *fileid); 151220158Skibint kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat); 152159588Sjhbint kern_kldunload(struct thread *td, int fileid, int flags); 153177786Skibint kern_linkat(struct thread *td, int fd1, int fd2, char *path1, 154177786Skib char *path2, enum uio_seg segflg, int follow); 155315549Straszint kern_listen(struct thread *td, int s, int backlog); 156315549Straszint kern_lseek(struct thread *td, int fd, off_t offset, int whence); 157102779Siedowseint kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg, 158102779Siedowse struct timeval *tptr, enum uio_seg tptrseg); 159314334Skibint kern_madvise(struct thread *td, uintptr_t addr, size_t len, int behav); 160317588Sdchaginint kern_mincore(struct thread *td, uintptr_t addr, size_t len, char *vec); 161177786Skibint kern_mkdirat(struct thread *td, int fd, char *path, 162177786Skib enum uio_seg segflg, int mode); 163177786Skibint kern_mkfifoat(struct thread *td, int fd, char *path, 164177786Skib enum uio_seg pathseg, int mode); 165177786Skibint kern_mknodat(struct thread *td, int fd, char *path, 166177786Skib enum uio_seg pathseg, int mode, int dev); 167314334Skibint kern_mlock(struct proc *proc, struct ucred *cred, uintptr_t addr, 168314334Skib size_t len); 169314334Skibint kern_mmap(struct thread *td, uintptr_t addr, size_t size, int prot, 170314334Skib int flags, int fd, off_t pos); 171356634Skevansint kern_mmap_fpcheck(struct thread *td, uintptr_t addr, size_t len, 172356634Skevans int prot, int flags, int fd, off_t pos, 173356634Skevans mmap_check_fp_fn check_fp_fn); 174314334Skibint kern_mprotect(struct thread *td, uintptr_t addr, size_t size, int prot); 175141471Sjhbint kern_msgctl(struct thread *, int, int, struct msqid_ds *); 176313843Skibint kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *); 177165403Sjkimint kern_msgsnd(struct thread *, int, const void *, size_t, int, long); 178314334Skibint kern_msync(struct thread *td, uintptr_t addr, size_t size, int flags); 179314334Skibint kern_munlock(struct thread *td, uintptr_t addr, size_t size); 180314334Skibint kern_munmap(struct thread *td, uintptr_t addr, size_t size); 181140483Spsint kern_nanosleep(struct thread *td, struct timespec *rqt, 182140483Sps struct timespec *rmt); 183220238Skibint kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap, 184220238Skib long *ploff); 185177786Skibint kern_openat(struct thread *td, int fd, char *path, 186177786Skib enum uio_seg pathseg, int flags, int mode); 187141484Sjhbint kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, 188195458Strasz int name, u_long flags); 189286021Sedint kern_pipe(struct thread *td, int fildes[2], int flags, 190286021Sed struct filecaps *fcaps1, struct filecaps *fcaps2); 191274462Sdchaginint kern_poll(struct thread *td, struct pollfd *fds, u_int nfds, 192274462Sdchagin struct timespec *tsp, sigset_t *uset); 193296060Smarkjint kern_posix_error(struct thread *td, int error); 194227502Sjhbint kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, 195227502Sjhb int advice); 196227502Sjhbint kern_posix_fallocate(struct thread *td, int fd, off_t offset, 197227502Sjhb off_t len); 198255708Sjhbint kern_procctl(struct thread *td, enum idtype idtype, id_t id, int com, 199255708Sjhb void *data); 200315553Straszint kern_pread(struct thread *td, int fd, void *buf, size_t nbyte, 201315553Strasz off_t offset); 202147813Sjhbint kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset); 203198508Skibint kern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou, 204198508Skib fd_set *ex, struct timeval *tvp, sigset_t *uset, int abi_nfdbits); 205102946Siedowseint kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, 206102946Siedowse int data); 207315553Straszint kern_pwrite(struct thread *td, int fd, const void *buf, size_t nbyte, 208315553Strasz off_t offset); 209147813Sjhbint kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset); 210177786Skibint kern_readlinkat(struct thread *td, int fd, char *path, 211177786Skib enum uio_seg pathseg, char *buf, enum uio_seg bufseg, size_t count); 212144445Sjhbint kern_readv(struct thread *td, int fd, struct uio *auio); 213160249Sjhbint kern_recvit(struct thread *td, int s, struct msghdr *mp, 214160249Sjhb enum uio_seg fromseg, struct mbuf **controlp); 215177786Skibint kern_renameat(struct thread *td, int oldfd, char *old, int newfd, 216177786Skib char *new, enum uio_seg pathseg); 217177786Skibint kern_rmdirat(struct thread *td, int fd, char *path, 218177786Skib enum uio_seg pathseg); 219283377Sdchaginint kern_sched_getparam(struct thread *td, struct thread *targettd, 220283377Sdchagin struct sched_param *param); 221283377Sdchaginint kern_sched_getscheduler(struct thread *td, struct thread *targettd, 222283377Sdchagin int *policy); 223283377Sdchaginint kern_sched_setparam(struct thread *td, struct thread *targettd, 224283377Sdchagin struct sched_param *param); 225283377Sdchaginint kern_sched_setscheduler(struct thread *td, struct thread *targettd, 226283377Sdchagin int policy, struct sched_param *param); 227144445Sjhbint kern_sched_rr_get_interval(struct thread *td, pid_t pid, 228144445Sjhb struct timespec *ts); 229283374Sdchaginint kern_sched_rr_get_interval_td(struct thread *td, struct thread *targettd, 230283374Sdchagin struct timespec *ts); 231159991Sjhbint kern_semctl(struct thread *td, int semid, int semnum, int cmd, 232160187Sjhb union semun *arg, register_t *rval); 233102779Siedowseint kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, 234197049Skib fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits); 235156114Spsint kern_sendfile(struct thread *td, struct sendfile_args *uap, 236156114Sps struct uio *hdr_uio, struct uio *trl_uio, int compat); 237114749Sdwmaloneint kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags, 238141029Ssobomax struct mbuf *control, enum uio_seg segflg); 239160139Sjhbint kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups); 240140836Ssobomaxint kern_setitimer(struct thread *, u_int, struct itimerval *, 241140836Ssobomax struct itimerval *); 242139739Sjhbint kern_setrlimit(struct thread *, u_int, struct rlimit *); 243132313Sdwmaloneint kern_setsockopt(struct thread *td, int s, int level, int name, 244132313Sdwmalone void *optval, enum uio_seg valseg, socklen_t valsize); 245144445Sjhbint kern_settimeofday(struct thread *td, struct timeval *tv, 246144445Sjhb struct timezone *tzp); 247286146Sedint kern_shm_open(struct thread *td, const char *userpath, int flags, 248286146Sed mode_t mode, struct filecaps *fcaps); 249114724Smbrint kern_shmat(struct thread *td, int shmid, const void *shmaddr, 250122088Sfjoe int shmflg); 251114724Smbrint kern_shmctl(struct thread *td, int shmid, int cmd, void *buf, 252122088Sfjoe size_t *bufsz); 253315549Straszint kern_shutdown(struct thread *td, int s, int how); 254285358Sedint kern_sigaction(struct thread *td, int sig, const struct sigaction *act, 255105950Speter struct sigaction *oact, int flags); 256102779Siedowseint kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss); 257209613Sjhbint kern_sigprocmask(struct thread *td, int how, 258209613Sjhb sigset_t *set, sigset_t *oset, int flags); 259102779Siedowseint kern_sigsuspend(struct thread *td, sigset_t mask); 260209613Sjhbint kern_sigtimedwait(struct thread *td, sigset_t waitset, 261209613Sjhb struct ksiginfo *ksi, struct timespec *timeout); 262318244Sbrooksint kern_sigqueue(struct thread *td, pid_t pid, int signum, 263318244Sbrooks union sigval *value); 264315549Straszint kern_socket(struct thread *td, int domain, int type, int protocol); 265177786Skibint kern_statat(struct thread *td, int flag, int fd, char *path, 266188849Sed enum uio_seg pathseg, struct stat *sbp, 267188849Sed void (*hook)(struct vnode *vp, struct stat *sbp)); 268141471Sjhbint kern_statfs(struct thread *td, char *path, enum uio_seg pathseg, 269141471Sjhb struct statfs *buf); 270177786Skibint kern_symlinkat(struct thread *td, char *path1, int fd, char *path2, 271177786Skib enum uio_seg segflg); 272253530Skibint kern_ktimer_create(struct thread *td, clockid_t clock_id, 273253530Skib struct sigevent *evp, int *timerid, int preset_id); 274253530Skibint kern_ktimer_delete(struct thread *, int); 275253530Skibint kern_ktimer_settime(struct thread *td, int timer_id, int flags, 276253530Skib struct itimerspec *val, struct itimerspec *oval); 277253530Skibint kern_ktimer_gettime(struct thread *td, int timer_id, 278253530Skib struct itimerspec *val); 279269669Sbzint kern_ktimer_getoverrun(struct thread *td, int timer_id); 280283373Sdchaginint kern_thr_alloc(struct proc *, int pages, struct thread **); 281283372Sdchaginint kern_thr_exit(struct thread *td); 282170404Sjhbint kern_thr_new(struct thread *td, struct thr_param *param); 283170404Sjhbint kern_thr_suspend(struct thread *td, struct timespec *tsp); 284102779Siedowseint kern_truncate(struct thread *td, char *path, enum uio_seg pathseg, 285102779Siedowse off_t length); 286177786Skibint kern_unlinkat(struct thread *td, int fd, char *path, 287202113Smckusick enum uio_seg pathseg, ino_t oldinum); 288177786Skibint kern_utimesat(struct thread *td, int fd, char *path, 289177786Skib enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg); 290277610Sjillesint kern_utimensat(struct thread *td, int fd, char *path, 291277610Sjilles enum uio_seg pathseg, struct timespec *tptr, enum uio_seg tptrseg, 292277610Sjilles int follow); 293139739Sjhbint kern_wait(struct thread *td, pid_t pid, int *status, int options, 294139739Sjhb struct rusage *rup); 295243135Skibint kern_wait6(struct thread *td, enum idtype idtype, id_t id, int *status, 296242958Skib int options, struct __wrusage *wrup, siginfo_t *sip); 297144445Sjhbint kern_writev(struct thread *td, int fd, struct uio *auio); 298193167Sdchaginint kern_socketpair(struct thread *td, int domain, int type, int protocol, 299193167Sdchagin int *rsv); 300102779Siedowse 301105950Speter/* flags for kern_sigaction */ 302105950Speter#define KSA_OSIGSET 0x0001 /* uses osigact_t */ 303105950Speter#define KSA_FREEBSD4 0x0002 /* uses ucontext4 */ 304105950Speter 305102779Siedowse#endif /* !_SYS_SYSCALLSUBR_H_ */ 306