syscallsubr.h revision 195458
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 195458 2009-07-08 15:23:18Z trasz $
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;
38141471Sjhbstruct itimerval;
39141471Sjhbstruct image_args;
40192895Sjamiestruct jail;
41135764Sjhbstruct mbuf;
42135764Sjhbstruct msghdr;
43141471Sjhbstruct msqid_ds;
44139739Sjhbstruct rlimit;
45136152Sjhbstruct rusage;
46159991Sjhbunion semun;
47110294Sumestruct sockaddr;
48141471Sjhbstruct stat;
49142933Spsstruct kevent;
50146950Spsstruct kevent_copyops;
51156114Spsstruct sendfile_args;
52170404Sjhbstruct thr_param;
53110294Sume
54102870Siedowseint	kern___getcwd(struct thread *td, u_char *buf, enum uio_seg bufseg,
55102870Siedowse	    u_int buflen);
56160249Sjhbint	kern_accept(struct thread *td, int s, struct sockaddr **name,
57160765Sjhb	    socklen_t *namelen, struct file **fp);
58102779Siedowseint	kern_access(struct thread *td, char *path, enum uio_seg pathseg,
59102779Siedowse	    int flags);
60177786Skibint	kern_accessat(struct thread *td, int fd, char *path,
61177786Skib	    enum uio_seg pathseg, int flags, int mode);
62144445Sjhbint	kern_adjtime(struct thread *td, struct timeval *delta,
63144445Sjhb	    struct timeval *olddelta);
64177997Skibint	kern_alternate_path(struct thread *td, const char *prefix, const char *path,
65177997Skib	    enum uio_seg pathseg, char **pathbuf, int create, int dirfd);
66110294Sumeint	kern_bind(struct thread *td, int fd, struct sockaddr *sa);
67102779Siedowseint	kern_chdir(struct thread *td, char *path, enum uio_seg pathseg);
68102779Siedowseint	kern_chmod(struct thread *td, char *path, enum uio_seg pathseg,
69102779Siedowse	    int mode);
70102779Siedowseint	kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid,
71102779Siedowse	    int gid);
72151357Spsint	kern_clock_getres(struct thread *td, clockid_t clock_id,
73151357Sps	    struct timespec *ts);
74151357Spsint	kern_clock_gettime(struct thread *td, clockid_t clock_id,
75151357Sps	    struct timespec *ats);
76151357Spsint	kern_clock_settime(struct thread *td, clockid_t clock_id,
77151357Sps	    struct timespec *ats);
78160190Sjhbint	kern_close(struct thread *td, int fd);
79110294Sumeint	kern_connect(struct thread *td, int fd, struct sockaddr *sa);
80155401Sjhbint	kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg,
81155401Sjhb	    int flags);
82140992Ssobomaxint	kern_execve(struct thread *td, struct image_args *args,
83139739Sjhb	    struct mac *mac_p);
84177786Skibint	kern_fchmodat(struct thread *td, int fd, char *path,
85177786Skib	    enum uio_seg pathseg, mode_t mode, int flag);
86177786Skibint	kern_fchownat(struct thread *td, int fd, char *path,
87177786Skib	    enum uio_seg pathseg, int uid, int gid, int flag);
88102868Siedowseint	kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg);
89141471Sjhbint	kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);
90141471Sjhbint	kern_fstat(struct thread *td, int fd, struct stat *sbp);
91141471Sjhbint	kern_fstatfs(struct thread *td, int fd, struct statfs *buf);
92175140Sjhbint	kern_ftruncate(struct thread *td, int fd, off_t length);
93102779Siedowseint	kern_futimes(struct thread *td, int fd, struct timeval *tptr,
94102779Siedowse	    enum uio_seg tptrseg);
95184183Sjhbint	kern_getdirentries(struct thread *td, int fd, char *buf, u_int count,
96184183Sjhb	    long *basep);
97147302Spjdint	kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
98147178Spjd	    enum uio_seg bufseg, int flags);
99160139Sjhbint	kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups);
100140836Ssobomaxint	kern_getitimer(struct thread *, u_int, struct itimerval *);
101160249Sjhbint	kern_getpeername(struct thread *td, int fd, struct sockaddr **sa,
102160249Sjhb	    socklen_t *alen);
103136152Sjhbint	kern_getrusage(struct thread *td, int who, struct rusage *rup);
104160249Sjhbint	kern_getsockname(struct thread *td, int fd, struct sockaddr **sa,
105160249Sjhb	    socklen_t *alen);
106132313Sdwmaloneint	kern_getsockopt(struct thread *td, int s, int level, int name,
107132313Sdwmalone	    void *optval, enum uio_seg valseg, socklen_t *valsize);
108160192Sjhbint	kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data);
109192895Sjamieint	kern_jail(struct thread *td, struct jail *j);
110191673Sjamieint	kern_jail_get(struct thread *td, struct uio *options, int flags);
111191673Sjamieint	kern_jail_set(struct thread *td, struct uio *options, int flags);
112146950Spsint	kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
113146950Sps	    struct kevent_copyops *k_ops, const struct timespec *timeout);
114159588Sjhbint	kern_kldload(struct thread *td, const char *file, int *fileid);
115159588Sjhbint	kern_kldunload(struct thread *td, int fileid, int flags);
116102779Siedowseint	kern_lchown(struct thread *td, char *path, enum uio_seg pathseg,
117102779Siedowse	    int uid, int gid);
118102779Siedowseint	kern_link(struct thread *td, char *path, char *link,
119102779Siedowse	    enum uio_seg segflg);
120177786Skibint	kern_linkat(struct thread *td, int fd1, int fd2, char *path1,
121177786Skib	    char *path2, enum uio_seg segflg, int follow);
122141471Sjhbint	kern_lstat(struct thread *td, char *path, enum uio_seg pathseg,
123141471Sjhb	    struct stat *sbp);
124102779Siedowseint	kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg,
125102779Siedowse	    struct timeval *tptr, enum uio_seg tptrseg);
126102779Siedowseint	kern_mkdir(struct thread *td, char *path, enum uio_seg segflg,
127102779Siedowse	    int mode);
128177786Skibint	kern_mkdirat(struct thread *td, int fd, char *path,
129177786Skib	    enum uio_seg segflg, int mode);
130102779Siedowseint	kern_mkfifo(struct thread *td, char *path, enum uio_seg pathseg,
131102779Siedowse	    int mode);
132177786Skibint	kern_mkfifoat(struct thread *td, int fd, char *path,
133177786Skib	    enum uio_seg pathseg, int mode);
134102779Siedowseint	kern_mknod(struct thread *td, char *path, enum uio_seg pathseg,
135102779Siedowse	    int mode, int dev);
136177786Skibint	kern_mknodat(struct thread *td, int fd, char *path,
137177786Skib	    enum uio_seg pathseg, int mode, int dev);
138141471Sjhbint	kern_msgctl(struct thread *, int, int, struct msqid_ds *);
139165403Sjkimint	kern_msgsnd(struct thread *, int, const void *, size_t, int, long);
140165403Sjkimint	kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *);
141140483Spsint     kern_nanosleep(struct thread *td, struct timespec *rqt,
142140483Sps	    struct timespec *rmt);
143102779Siedowseint	kern_open(struct thread *td, char *path, enum uio_seg pathseg,
144102779Siedowse	    int flags, int mode);
145177786Skibint	kern_openat(struct thread *td, int fd, char *path,
146177786Skib	    enum uio_seg pathseg, int flags, int mode);
147141484Sjhbint	kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg,
148195458Strasz	    int name, u_long flags);
149184849Sedint	kern_pipe(struct thread *td, int fildes[2]);
150147813Sjhbint	kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset);
151102946Siedowseint	kern_ptrace(struct thread *td, int req, pid_t pid, void *addr,
152102946Siedowse	    int data);
153147813Sjhbint	kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset);
154102779Siedowseint	kern_readlink(struct thread *td, char *path, enum uio_seg pathseg,
155176215Sru	    char *buf, enum uio_seg bufseg, size_t count);
156177786Skibint	kern_readlinkat(struct thread *td, int fd, char *path,
157177786Skib	    enum uio_seg pathseg, char *buf, enum uio_seg bufseg, size_t count);
158144445Sjhbint	kern_readv(struct thread *td, int fd, struct uio *auio);
159160249Sjhbint	kern_recvit(struct thread *td, int s, struct msghdr *mp,
160160249Sjhb	    enum uio_seg fromseg, struct mbuf **controlp);
161102779Siedowseint	kern_rename(struct thread *td, char *from, char *to,
162102779Siedowse	    enum uio_seg pathseg);
163177786Skibint	kern_renameat(struct thread *td, int oldfd, char *old, int newfd,
164177786Skib	    char *new, enum uio_seg pathseg);
165102779Siedowseint	kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);
166177786Skibint	kern_rmdirat(struct thread *td, int fd, char *path,
167177786Skib	    enum uio_seg pathseg);
168144445Sjhbint	kern_sched_rr_get_interval(struct thread *td, pid_t pid,
169144445Sjhb	    struct timespec *ts);
170159991Sjhbint	kern_semctl(struct thread *td, int semid, int semnum, int cmd,
171160187Sjhb	    union semun *arg, register_t *rval);
172102779Siedowseint	kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
173102779Siedowse	    fd_set *fd_ex, struct timeval *tvp);
174156114Spsint	kern_sendfile(struct thread *td, struct sendfile_args *uap,
175156114Sps	    struct uio *hdr_uio, struct uio *trl_uio, int compat);
176114749Sdwmaloneint	kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags,
177141029Ssobomax	    struct mbuf *control, enum uio_seg segflg);
178160139Sjhbint	kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups);
179140836Ssobomaxint	kern_setitimer(struct thread *, u_int, struct itimerval *,
180140836Ssobomax	    struct itimerval *);
181139739Sjhbint	kern_setrlimit(struct thread *, u_int, struct rlimit *);
182132313Sdwmaloneint	kern_setsockopt(struct thread *td, int s, int level, int name,
183132313Sdwmalone	    void *optval, enum uio_seg valseg, socklen_t valsize);
184144445Sjhbint	kern_settimeofday(struct thread *td, struct timeval *tv,
185144445Sjhb	    struct timezone *tzp);
186114724Smbrint	kern_shmat(struct thread *td, int shmid, const void *shmaddr,
187122088Sfjoe	    int shmflg);
188114724Smbrint	kern_shmctl(struct thread *td, int shmid, int cmd, void *buf,
189122088Sfjoe	    size_t *bufsz);
190102779Siedowseint	kern_sigaction(struct thread *td, int sig, struct sigaction *act,
191105950Speter	    struct sigaction *oact, int flags);
192102779Siedowseint	kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss);
193113685Sjhbint	kern_sigprocmask(struct thread *td, int how,
194113685Sjhb	    sigset_t *set, sigset_t *oset, int old);
195102779Siedowseint	kern_sigsuspend(struct thread *td, sigset_t mask);
196141471Sjhbint	kern_stat(struct thread *td, char *path, enum uio_seg pathseg,
197141471Sjhb	    struct stat *sbp);
198177786Skibint	kern_statat(struct thread *td, int flag, int fd, char *path,
199177786Skib	    enum uio_seg pathseg, struct stat *sbp);
200188849Sedint	kern_statat_vnhook(struct thread *td, int flag, int fd, char *path,
201188849Sed	    enum uio_seg pathseg, struct stat *sbp,
202188849Sed	    void (*hook)(struct vnode *vp, struct stat *sbp));
203141471Sjhbint	kern_statfs(struct thread *td, char *path, enum uio_seg pathseg,
204141471Sjhb	    struct statfs *buf);
205102779Siedowseint	kern_symlink(struct thread *td, char *path, char *link,
206102779Siedowse	    enum uio_seg segflg);
207177786Skibint	kern_symlinkat(struct thread *td, char *path1, int fd, char *path2,
208177786Skib	    enum uio_seg segflg);
209170404Sjhbint	kern_thr_new(struct thread *td, struct thr_param *param);
210170404Sjhbint	kern_thr_suspend(struct thread *td, struct timespec *tsp);
211102779Siedowseint	kern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
212102779Siedowse	    off_t length);
213102779Siedowseint	kern_unlink(struct thread *td, char *path, enum uio_seg pathseg);
214177786Skibint	kern_unlinkat(struct thread *td, int fd, char *path,
215177786Skib	    enum uio_seg pathseg);
216102779Siedowseint	kern_utimes(struct thread *td, char *path, enum uio_seg pathseg,
217102779Siedowse	    struct timeval *tptr, enum uio_seg tptrseg);
218177786Skibint	kern_utimesat(struct thread *td, int fd, char *path,
219177786Skib	    enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg);
220139739Sjhbint	kern_wait(struct thread *td, pid_t pid, int *status, int options,
221139739Sjhb	    struct rusage *rup);
222144445Sjhbint	kern_writev(struct thread *td, int fd, struct uio *auio);
223193167Sdchaginint	kern_socketpair(struct thread *td, int domain, int type, int protocol,
224193167Sdchagin	    int *rsv);
225102779Siedowse
226105950Speter/* flags for kern_sigaction */
227105950Speter#define	KSA_OSIGSET	0x0001	/* uses osigact_t */
228105950Speter#define	KSA_FREEBSD4	0x0002	/* uses ucontext4 */
229105950Speter
230102779Siedowse#endif /* !_SYS_SYSCALLSUBR_H_ */
231