update for new syscall args description mechanism
This commit is contained in:
parent
f0c1138373
commit
6b86130410
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: advnops.c,v 1.11 1994/10/06 18:41:26 chopps Exp $ */
|
||||
/* $NetBSD: advnops.c,v 1.12 1994/10/20 04:24:00 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christian E. Hopps
|
||||
|
@ -879,7 +879,7 @@ adosfs_pathconf(sp)
|
|||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
int *a_retval;
|
||||
register_t *a_retval;
|
||||
} */ *sp;
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cd9660_vnops.c,v 1.15 1994/08/19 11:36:56 mycroft Exp $ */
|
||||
/* $NetBSD: cd9660_vnops.c,v 1.16 1994/10/20 04:26:20 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994
|
||||
|
@ -957,7 +957,7 @@ cd9660_pathconf(ap)
|
|||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
int *a_retval;
|
||||
register_t *a_retval;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: init_main.c,v 1.67 1994/10/18 06:28:06 cgd Exp $ */
|
||||
/* $NetBSD: init_main.c,v 1.68 1994/10/20 04:22:35 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993
|
||||
|
@ -62,6 +62,8 @@
|
|||
#include <sys/reboot.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <ufs/ufs/quota.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
@ -105,7 +107,8 @@ main(framep)
|
|||
register struct filedesc0 *fdp;
|
||||
register struct pdevinit *pdev;
|
||||
register int i;
|
||||
int s, rval[2];
|
||||
int s;
|
||||
register_t rval[2];
|
||||
extern int (*mountroot) __P((void));
|
||||
extern struct pdevinit pdevinit[];
|
||||
extern void roundrobin __P((void *));
|
||||
|
@ -334,8 +337,13 @@ start_init(p, framep)
|
|||
void *framep;
|
||||
{
|
||||
vm_offset_t addr;
|
||||
struct execve_args args;
|
||||
int options, i, retval[2], error;
|
||||
struct execve_args /* {
|
||||
syscallarg(char *) path;
|
||||
syscallarg(char * *) argp;
|
||||
syscallarg(char * *) envp;
|
||||
} */ args;
|
||||
int options, i, error;
|
||||
register_t retval[2];
|
||||
char flags[4], *flagsp;
|
||||
char **pathp, *path, *ucp, **uap, *arg0, *arg1;
|
||||
|
||||
|
@ -409,7 +417,7 @@ start_init(p, framep)
|
|||
/*
|
||||
* Move out the arg pointers.
|
||||
*/
|
||||
uap = (char **)((int)ucp & ~(NBPW-1));
|
||||
uap = (char **)(ALIGN(ucp) - sizeof(char **));
|
||||
(void)suword((caddr_t)--uap, 0); /* terminator */
|
||||
if (options != 0)
|
||||
(void)suword((caddr_t)--uap, (long)arg1);
|
||||
|
@ -418,9 +426,9 @@ start_init(p, framep)
|
|||
/*
|
||||
* Point at the arguments.
|
||||
*/
|
||||
args.path = arg0;
|
||||
args.argp = uap;
|
||||
args.envp = NULL;
|
||||
SCARG(&args, path) = arg0;
|
||||
SCARG(&args, argp) = uap;
|
||||
SCARG(&args, envp) = NULL;
|
||||
|
||||
/*
|
||||
* Now try to exec the program. If can't for any reason
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_acct.c,v 1.32 1994/07/04 20:43:06 mycroft Exp $ */
|
||||
/* $NetBSD: kern_acct.c,v 1.33 1994/10/20 04:22:39 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
|
@ -42,6 +42,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/vnode.h>
|
||||
|
@ -55,6 +56,8 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
/*
|
||||
* The routines implemented in this file are described in:
|
||||
* Leffler, et al.: The Design and Implementation of the 4.3BSD
|
||||
|
@ -91,13 +94,12 @@ int acctchkfreq = 15; /* frequency (in seconds) to check space */
|
|||
* Accounting system call. Written based on the specification and
|
||||
* previous implementation done by Mark Tinguely.
|
||||
*/
|
||||
struct acct_args {
|
||||
char *path;
|
||||
};
|
||||
acct(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct acct_args *uap;
|
||||
int *retval;
|
||||
struct acct_args /* {
|
||||
syscallarg(char *) path;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct nameidata nd;
|
||||
int error;
|
||||
|
@ -110,8 +112,9 @@ acct(p, uap, retval)
|
|||
* If accounting is to be started to a file, open that file for
|
||||
* writing and make sure it's a 'normal'.
|
||||
*/
|
||||
if (uap->path != NULL) {
|
||||
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, p);
|
||||
if (SCARG(uap, path) != NULL) {
|
||||
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path),
|
||||
p);
|
||||
if (error = vn_open(&nd, FWRITE, 0))
|
||||
return (error);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
|
@ -131,7 +134,7 @@ acct(p, uap, retval)
|
|||
p->p_ucred, p);
|
||||
acctp = savacctp = NULLVP;
|
||||
}
|
||||
if (uap->path == NULL)
|
||||
if (SCARG(uap, path) == NULL)
|
||||
return (error);
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_descrip.c,v 1.24 1994/08/30 03:05:32 mycroft Exp $ */
|
||||
/* $NetBSD: kern_descrip.c,v 1.25 1994/10/20 04:22:41 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||
|
@ -57,6 +57,9 @@
|
|||
#include <sys/unistd.h>
|
||||
#include <sys/resourcevar.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
/*
|
||||
* Descriptor management.
|
||||
*/
|
||||
|
@ -69,10 +72,10 @@ int nfiles; /* actual number of open files */
|
|||
|
||||
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_ULTRIX) || defined(COMPAT_HPUX)
|
||||
/* ARGSUSED */
|
||||
ogetdtablesize(p, uap, retval)
|
||||
compat_43_getdtablesize(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*retval = min((int)p->p_rlimit[RLIMIT_NOFILE].rlim_cur, maxfiles);
|
||||
|
@ -83,24 +86,26 @@ ogetdtablesize(p, uap, retval)
|
|||
/*
|
||||
* Duplicate a file descriptor.
|
||||
*/
|
||||
struct dup_args {
|
||||
u_int fd;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
dup(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct dup_args *uap;
|
||||
int *retval;
|
||||
struct dup_args /* {
|
||||
syscallarg(u_int) fd;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct filedesc *fdp;
|
||||
u_int old;
|
||||
int new, error;
|
||||
|
||||
old = uap->fd;
|
||||
old = SCARG(uap, fd);
|
||||
/*
|
||||
* XXX Compatibility
|
||||
*/
|
||||
if (old &~ 077) { uap->fd &= 077; return (dup2(p, uap, retval)); }
|
||||
if (old &~ 077) {
|
||||
SCARG(uap, fd) &= 077;
|
||||
return (dup2(p, uap, retval));
|
||||
}
|
||||
|
||||
fdp = p->p_fd;
|
||||
if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL)
|
||||
|
@ -113,18 +118,17 @@ dup(p, uap, retval)
|
|||
/*
|
||||
* Duplicate a file descriptor to a particular value.
|
||||
*/
|
||||
struct dup2_args {
|
||||
u_int from;
|
||||
u_int to;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
dup2(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct dup2_args *uap;
|
||||
int *retval;
|
||||
struct dup2_args /* {
|
||||
syscallarg(u_int) from;
|
||||
syscallarg(u_int) to;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
register u_int old = uap->from, new = uap->to;
|
||||
register u_int old = SCARG(uap, from), new = SCARG(uap, to);
|
||||
int i, error;
|
||||
|
||||
if (old >= fdp->fd_nfiles ||
|
||||
|
@ -155,16 +159,15 @@ dup2(p, uap, retval)
|
|||
/*
|
||||
* The file control system call.
|
||||
*/
|
||||
struct fcntl_args {
|
||||
int fd;
|
||||
int cmd;
|
||||
int arg;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
fcntl(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct fcntl_args *uap;
|
||||
int *retval;
|
||||
register struct fcntl_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(int) cmd;
|
||||
syscallarg(int) arg;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
register struct file *fp;
|
||||
|
@ -174,27 +177,27 @@ fcntl(p, uap, retval)
|
|||
struct flock fl;
|
||||
u_int newmin;
|
||||
|
||||
if ((unsigned)uap->fd >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fd]) == NULL)
|
||||
if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
||||
return (EBADF);
|
||||
pop = &fdp->fd_ofileflags[uap->fd];
|
||||
switch (uap->cmd) {
|
||||
pop = &fdp->fd_ofileflags[SCARG(uap, fd)];
|
||||
switch (SCARG(uap, cmd)) {
|
||||
|
||||
case F_DUPFD:
|
||||
newmin = uap->arg;
|
||||
newmin = (long)SCARG(uap, arg);
|
||||
if (newmin >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur ||
|
||||
newmin >= maxfiles)
|
||||
return (EINVAL);
|
||||
if (error = fdalloc(p, newmin, &i))
|
||||
return (error);
|
||||
return (finishdup(fdp, uap->fd, i, retval));
|
||||
return (finishdup(fdp, SCARG(uap, fd), i, retval));
|
||||
|
||||
case F_GETFD:
|
||||
*retval = *pop & 1;
|
||||
return (0);
|
||||
|
||||
case F_SETFD:
|
||||
*pop = (*pop &~ 1) | (uap->arg & 1);
|
||||
*pop = (*pop &~ 1) | ((long)SCARG(uap, arg) & 1);
|
||||
return (0);
|
||||
|
||||
case F_GETFL:
|
||||
|
@ -203,7 +206,7 @@ fcntl(p, uap, retval)
|
|||
|
||||
case F_SETFL:
|
||||
fp->f_flag &= ~FCNTLFLAGS;
|
||||
fp->f_flag |= FFLAGS(uap->arg) & FCNTLFLAGS;
|
||||
fp->f_flag |= FFLAGS((long)SCARG(uap, arg)) & FCNTLFLAGS;
|
||||
tmp = fp->f_flag & FNONBLOCK;
|
||||
error = (*fp->f_ops->fo_ioctl)(fp, FIONBIO, (caddr_t)&tmp, p);
|
||||
if (error)
|
||||
|
@ -229,19 +232,20 @@ fcntl(p, uap, retval)
|
|||
|
||||
case F_SETOWN:
|
||||
if (fp->f_type == DTYPE_SOCKET) {
|
||||
((struct socket *)fp->f_data)->so_pgid = uap->arg;
|
||||
((struct socket *)fp->f_data)->so_pgid =
|
||||
(long)SCARG(uap, arg);
|
||||
return (0);
|
||||
}
|
||||
if (uap->arg <= 0) {
|
||||
uap->arg = -uap->arg;
|
||||
if ((long)SCARG(uap, arg) <= 0) {
|
||||
SCARG(uap, arg) = (void *)(-(long)SCARG(uap, arg));
|
||||
} else {
|
||||
struct proc *p1 = pfind(uap->arg);
|
||||
struct proc *p1 = pfind((long)SCARG(uap, arg));
|
||||
if (p1 == 0)
|
||||
return (ESRCH);
|
||||
uap->arg = p1->p_pgrp->pg_id;
|
||||
SCARG(uap, arg) = (void *)p1->p_pgrp->pg_id;
|
||||
}
|
||||
return ((*fp->f_ops->fo_ioctl)
|
||||
(fp, (int)TIOCSPGRP, (caddr_t)&uap->arg, p));
|
||||
(fp, (int)TIOCSPGRP, (caddr_t)&SCARG(uap, arg), p));
|
||||
|
||||
case F_SETLKW:
|
||||
flg |= F_WAIT;
|
||||
|
@ -252,7 +256,8 @@ fcntl(p, uap, retval)
|
|||
return (EBADF);
|
||||
vp = (struct vnode *)fp->f_data;
|
||||
/* Copy in the lock structure */
|
||||
error = copyin((caddr_t)uap->arg, (caddr_t)&fl, sizeof (fl));
|
||||
error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&fl,
|
||||
sizeof (fl));
|
||||
if (error)
|
||||
return (error);
|
||||
if (fl.l_whence == SEEK_CUR)
|
||||
|
@ -284,14 +289,16 @@ fcntl(p, uap, retval)
|
|||
return (EBADF);
|
||||
vp = (struct vnode *)fp->f_data;
|
||||
/* Copy in the lock structure */
|
||||
error = copyin((caddr_t)uap->arg, (caddr_t)&fl, sizeof (fl));
|
||||
error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&fl,
|
||||
sizeof (fl));
|
||||
if (error)
|
||||
return (error);
|
||||
if (fl.l_whence == SEEK_CUR)
|
||||
fl.l_start += fp->f_offset;
|
||||
if (error = VOP_ADVLOCK(vp, (caddr_t)p, F_GETLK, &fl, F_POSIX))
|
||||
return (error);
|
||||
return (copyout((caddr_t)&fl, (caddr_t)uap->arg, sizeof (fl)));
|
||||
return (copyout((caddr_t)&fl, (caddr_t)SCARG(uap, arg),
|
||||
sizeof (fl)));
|
||||
|
||||
default:
|
||||
return (EINVAL);
|
||||
|
@ -305,7 +312,8 @@ fcntl(p, uap, retval)
|
|||
int
|
||||
finishdup(fdp, old, new, retval)
|
||||
register struct filedesc *fdp;
|
||||
register int old, new, *retval;
|
||||
register int old, new;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct file *fp;
|
||||
|
||||
|
@ -322,18 +330,17 @@ finishdup(fdp, old, new, retval)
|
|||
/*
|
||||
* Close a file descriptor.
|
||||
*/
|
||||
struct close_args {
|
||||
int fd;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
close(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct close_args *uap;
|
||||
int *retval;
|
||||
struct close_args /* {
|
||||
syscallarg(int) fd;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
register struct file *fp;
|
||||
register int fd = uap->fd;
|
||||
register int fd = SCARG(uap, fd);
|
||||
register u_char *pf;
|
||||
|
||||
if ((unsigned)fd >= fdp->fd_nfiles ||
|
||||
|
@ -355,15 +362,14 @@ close(p, uap, retval)
|
|||
/*
|
||||
* Return status information about a file descriptor.
|
||||
*/
|
||||
struct ofstat_args {
|
||||
int fd;
|
||||
struct ostat *sb;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
ofstat(p, uap, retval)
|
||||
compat_43_fstat(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct ofstat_args *uap;
|
||||
int *retval;
|
||||
register struct compat_43_fstat_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(struct ostat *) sb;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
register struct file *fp;
|
||||
|
@ -371,8 +377,8 @@ ofstat(p, uap, retval)
|
|||
struct ostat oub;
|
||||
int error;
|
||||
|
||||
if ((unsigned)uap->fd >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fd]) == NULL)
|
||||
if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
||||
return (EBADF);
|
||||
switch (fp->f_type) {
|
||||
|
||||
|
@ -390,7 +396,8 @@ ofstat(p, uap, retval)
|
|||
}
|
||||
cvtstat(&ub, &oub);
|
||||
if (error == 0)
|
||||
error = copyout((caddr_t)&oub, (caddr_t)uap->sb, sizeof (oub));
|
||||
error = copyout((caddr_t)&oub, (caddr_t)SCARG(uap, sb),
|
||||
sizeof (oub));
|
||||
return (error);
|
||||
}
|
||||
#endif /* COMPAT_43 || COMPAT_SUNOS || COMPAT_IBCS2 */
|
||||
|
@ -398,23 +405,22 @@ ofstat(p, uap, retval)
|
|||
/*
|
||||
* Return status information about a file descriptor.
|
||||
*/
|
||||
struct fstat_args {
|
||||
int fd;
|
||||
struct stat *sb;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
fstat(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct fstat_args *uap;
|
||||
int *retval;
|
||||
register struct fstat_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(struct stat *) sb;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
register struct file *fp;
|
||||
struct stat ub;
|
||||
int error;
|
||||
|
||||
if ((unsigned)uap->fd >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fd]) == NULL)
|
||||
if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
||||
return (EBADF);
|
||||
switch (fp->f_type) {
|
||||
|
||||
|
@ -431,34 +437,34 @@ fstat(p, uap, retval)
|
|||
/*NOTREACHED*/
|
||||
}
|
||||
if (error == 0)
|
||||
error = copyout((caddr_t)&ub, (caddr_t)uap->sb, sizeof (ub));
|
||||
error = copyout((caddr_t)&ub, (caddr_t)SCARG(uap, sb),
|
||||
sizeof (ub));
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return pathconf information about a file descriptor.
|
||||
*/
|
||||
struct fpathconf_args {
|
||||
int fd;
|
||||
int name;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
fpathconf(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct fpathconf_args *uap;
|
||||
int *retval;
|
||||
register struct fpathconf_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(int) name;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct filedesc *fdp = p->p_fd;
|
||||
struct file *fp;
|
||||
struct vnode *vp;
|
||||
|
||||
if ((unsigned)uap->fd >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fd]) == NULL)
|
||||
if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
||||
return (EBADF);
|
||||
switch (fp->f_type) {
|
||||
|
||||
case DTYPE_SOCKET:
|
||||
if (uap->name != _PC_PIPE_BUF)
|
||||
if (SCARG(uap, name) != _PC_PIPE_BUF)
|
||||
return (EINVAL);
|
||||
*retval = PIPE_BUF;
|
||||
return (0);
|
||||
|
@ -466,7 +472,7 @@ fpathconf(p, uap, retval)
|
|||
case DTYPE_VNODE:
|
||||
vp = (struct vnode *)fp->f_data;
|
||||
#ifdef notyet
|
||||
return (VOP_PATHCONF(vp, uap->name, retval));
|
||||
return (VOP_PATHCONF(vp, SCARG(uap, name), retval));
|
||||
#else
|
||||
return (ENOSYS);
|
||||
#endif
|
||||
|
@ -792,23 +798,22 @@ closef(fp, p)
|
|||
* Just attempt to get a record lock of the requested type on
|
||||
* the entire file (l_whence = SEEK_SET, l_start = 0, l_len = 0).
|
||||
*/
|
||||
struct flock_args {
|
||||
int fd;
|
||||
int how;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
flock(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct flock_args *uap;
|
||||
int *retval;
|
||||
register struct flock_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(int) how;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
register struct file *fp;
|
||||
struct vnode *vp;
|
||||
struct flock lf;
|
||||
|
||||
if ((unsigned)uap->fd >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fd]) == NULL)
|
||||
if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
||||
return (EBADF);
|
||||
if (fp->f_type != DTYPE_VNODE)
|
||||
return (EOPNOTSUPP);
|
||||
|
@ -816,19 +821,19 @@ flock(p, uap, retval)
|
|||
lf.l_whence = SEEK_SET;
|
||||
lf.l_start = 0;
|
||||
lf.l_len = 0;
|
||||
if (uap->how & LOCK_UN) {
|
||||
if (SCARG(uap, how) & LOCK_UN) {
|
||||
lf.l_type = F_UNLCK;
|
||||
fp->f_flag &= ~FHASLOCK;
|
||||
return (VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK));
|
||||
}
|
||||
if (uap->how & LOCK_EX)
|
||||
if (SCARG(uap, how) & LOCK_EX)
|
||||
lf.l_type = F_WRLCK;
|
||||
else if (uap->how & LOCK_SH)
|
||||
else if (SCARG(uap, how) & LOCK_SH)
|
||||
lf.l_type = F_RDLCK;
|
||||
else
|
||||
return (EBADF);
|
||||
fp->f_flag |= FHASLOCK;
|
||||
if (uap->how & LOCK_NB)
|
||||
if (SCARG(uap, how) & LOCK_NB)
|
||||
return (VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, F_FLOCK));
|
||||
return (VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, F_FLOCK|F_WAIT));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_exec.c,v 1.55 1994/06/29 06:32:24 cgd Exp $ */
|
||||
/* $NetBSD: kern_exec.c,v 1.56 1994/10/20 04:22:43 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1993, 1994 Christopher G. Demetriou
|
||||
|
@ -51,6 +51,8 @@
|
|||
#include <sys/signalvar.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
|
||||
|
@ -201,8 +203,12 @@ bad1:
|
|||
/* ARGSUSED */
|
||||
execve(p, uap, retval)
|
||||
register struct proc *p;
|
||||
register struct execve_args *uap;
|
||||
int *retval;
|
||||
register struct execve_args /* {
|
||||
syscallarg(char *) path;
|
||||
syscallarg(char * *) argp;
|
||||
syscallarg(char * *) envp;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int error, i;
|
||||
struct exec_package pack;
|
||||
|
@ -230,12 +236,12 @@ execve(p, uap, retval)
|
|||
}
|
||||
|
||||
/* init the namei data to point the file user's program name */
|
||||
NDINIT(&nid, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, p);
|
||||
NDINIT(&nid, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
|
||||
|
||||
/*
|
||||
* initialize the fields of the exec package.
|
||||
*/
|
||||
pack.ep_name = uap->path;
|
||||
pack.ep_name = SCARG(uap, path);
|
||||
MALLOC(pack.ep_hdr, void *, exec_maxhdrsz, M_EXEC, M_WAITOK);
|
||||
pack.ep_hdrlen = exec_maxhdrsz;
|
||||
pack.ep_hdrvalid = 0;
|
||||
|
@ -281,7 +287,7 @@ execve(p, uap, retval)
|
|||
}
|
||||
|
||||
/* Now get argv & environment */
|
||||
if (!(cpp = uap->argp)) {
|
||||
if (!(cpp = SCARG(uap, argp))) {
|
||||
error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
|
@ -306,7 +312,7 @@ execve(p, uap, retval)
|
|||
}
|
||||
|
||||
envc = 0;
|
||||
if (cpp = uap->envp) { /* environment need not be there */
|
||||
if (cpp = SCARG(uap, envp)) { /* environment need not be there */
|
||||
while (1) {
|
||||
len = argp + ARG_MAX - dp;
|
||||
if (error = copyin(cpp, &sp, sizeof(sp)))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_exit.c,v 1.25 1994/08/30 03:05:33 mycroft Exp $ */
|
||||
/* $NetBSD: kern_exit.c,v 1.26 1994/10/20 04:22:45 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||
|
@ -59,6 +59,9 @@
|
|||
#include <sys/resourcevar.h>
|
||||
#include <sys/ptrace.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#ifdef COMPAT_43
|
||||
#include <machine/reg.h>
|
||||
|
@ -75,17 +78,16 @@ __dead void exit1 __P((struct proc *, int));
|
|||
* exit --
|
||||
* Death of process.
|
||||
*/
|
||||
struct exit_args {
|
||||
int rval;
|
||||
};
|
||||
__dead void
|
||||
exit(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct exit_args *uap;
|
||||
struct exit_args /* {
|
||||
syscallarg(int) rval;
|
||||
} */ *uap;
|
||||
int *retval;
|
||||
{
|
||||
|
||||
exit1(p, W_EXITCODE(uap->rval, 0));
|
||||
exit1(p, W_EXITCODE(SCARG(uap, rval), 0));
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
|
@ -270,16 +272,6 @@ exit1(p, rv)
|
|||
cpu_exit(p);
|
||||
}
|
||||
|
||||
struct wait_args {
|
||||
int pid;
|
||||
int *status;
|
||||
int options;
|
||||
struct rusage *rusage;
|
||||
#ifdef COMPAT_43
|
||||
int compat; /* pseudo */
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef COMPAT_43
|
||||
#ifdef m68k
|
||||
#include <machine/frame.h>
|
||||
|
@ -288,85 +280,106 @@ struct wait_args {
|
|||
#define GETPS(rp) (rp)[PS]
|
||||
#endif
|
||||
|
||||
owait(p, uap, retval)
|
||||
compat_43_wait(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct wait_args *uap;
|
||||
void *uap;
|
||||
int *retval;
|
||||
{
|
||||
struct wait4_args /* {
|
||||
syscallarg(int) pid;
|
||||
syscallarg(int *) status;
|
||||
syscallarg(int) options;
|
||||
syscallarg(struct rusage *) rusage;
|
||||
} */ a;
|
||||
|
||||
#ifdef PSL_ALLCC
|
||||
if ((GETPS(p->p_md.md_regs) & PSL_ALLCC) != PSL_ALLCC) {
|
||||
uap->options = 0;
|
||||
uap->rusage = NULL;
|
||||
SCARG(&a, options) = 0;
|
||||
SCARG(&a, rusage) = NULL;
|
||||
} else {
|
||||
uap->options = p->p_md.md_regs[R0];
|
||||
uap->rusage = (struct rusage *)p->p_md.md_regs[R1];
|
||||
SCARG(&a, options) = p->p_md.md_regs[R0];
|
||||
SCARG(&a, rusage) = (struct rusage *)p->p_md.md_regs[R1];
|
||||
}
|
||||
#else
|
||||
uap->options = 0;
|
||||
uap->rusage = NULL;
|
||||
SCARG(&a, options) = 0;
|
||||
SCARG(&a, rusage) = NULL;
|
||||
#endif
|
||||
uap->pid = WAIT_ANY;
|
||||
uap->status = NULL;
|
||||
uap->compat = 1;
|
||||
return (wait1(p, uap, retval));
|
||||
SCARG(&a, pid) = WAIT_ANY;
|
||||
SCARG(&a, status) = NULL;
|
||||
return (wait1(p, &a, retval, 1));
|
||||
}
|
||||
|
||||
wait4(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct wait_args *uap;
|
||||
struct wait4_args /* {
|
||||
syscallarg(int) pid;
|
||||
syscallarg(int *) status;
|
||||
syscallarg(int) options;
|
||||
syscallarg(struct rusage *) rusage;
|
||||
} */ *uap;
|
||||
int *retval;
|
||||
{
|
||||
|
||||
uap->compat = 0;
|
||||
return (wait1(p, uap, retval));
|
||||
return (wait1(p, uap, retval, 0));
|
||||
}
|
||||
#else
|
||||
#define wait1 wait4
|
||||
#endif
|
||||
|
||||
int
|
||||
wait1(q, uap, retval)
|
||||
wait1(q, uap, retval, compat)
|
||||
register struct proc *q;
|
||||
register struct wait_args *uap;
|
||||
int retval[];
|
||||
register struct wait4_args /* {
|
||||
syscallarg(int) pid;
|
||||
syscallarg(int *) status;
|
||||
syscallarg(int) options;
|
||||
syscallarg(struct rusage *) rusage;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
#ifdef COMPAT_43
|
||||
int compat;
|
||||
#endif
|
||||
{
|
||||
register int nfound;
|
||||
register struct proc *p, *t;
|
||||
int status, error;
|
||||
|
||||
#ifdef COMPAT_09
|
||||
uap->pid = (short) uap->pid;
|
||||
SCARG(uap, pid) = (short)SCARG(uap, pid);
|
||||
#endif
|
||||
|
||||
if (uap->pid == 0)
|
||||
uap->pid = -q->p_pgid;
|
||||
if (SCARG(uap, pid) == 0)
|
||||
SCARG(uap, pid) = -q->p_pgid;
|
||||
#ifdef notyet
|
||||
if (uap->options &~ (WUNTRACED|WNOHANG))
|
||||
if (SCARG(uap, options) &~ (WUNTRACED|WNOHANG))
|
||||
return (EINVAL);
|
||||
#endif
|
||||
loop:
|
||||
nfound = 0;
|
||||
for (p = q->p_children.lh_first; p != 0; p = p->p_sibling.le_next) {
|
||||
if (uap->pid != WAIT_ANY &&
|
||||
p->p_pid != uap->pid && p->p_pgid != -uap->pid)
|
||||
if (SCARG(uap, pid) != WAIT_ANY &&
|
||||
p->p_pid != SCARG(uap, pid) &&
|
||||
p->p_pgid != -SCARG(uap, pid))
|
||||
continue;
|
||||
nfound++;
|
||||
if (p->p_stat == SZOMB) {
|
||||
retval[0] = p->p_pid;
|
||||
#ifdef COMPAT_43
|
||||
if (uap->compat)
|
||||
if (compat)
|
||||
retval[1] = p->p_xstat;
|
||||
else
|
||||
#endif
|
||||
if (uap->status) {
|
||||
if (SCARG(uap, status)) {
|
||||
status = p->p_xstat; /* convert to int */
|
||||
if (error = copyout((caddr_t)&status,
|
||||
(caddr_t)uap->status, sizeof(status)))
|
||||
(caddr_t)SCARG(uap, status),
|
||||
sizeof(status)))
|
||||
return (error);
|
||||
}
|
||||
if (uap->rusage && (error = copyout((caddr_t)p->p_ru,
|
||||
(caddr_t)uap->rusage, sizeof (struct rusage))))
|
||||
if (SCARG(uap, rusage) &&
|
||||
(error = copyout((caddr_t)p->p_ru,
|
||||
(caddr_t)SCARG(uap, rusage),
|
||||
sizeof (struct rusage))))
|
||||
return (error);
|
||||
/*
|
||||
* If we got the child via a ptrace 'attach',
|
||||
|
@ -421,19 +434,20 @@ loop:
|
|||
return (0);
|
||||
}
|
||||
if (p->p_stat == SSTOP && (p->p_flag & P_WAITED) == 0 &&
|
||||
(p->p_flag & P_TRACED || uap->options & WUNTRACED)) {
|
||||
(p->p_flag & P_TRACED || SCARG(uap, options) & WUNTRACED)) {
|
||||
p->p_flag |= P_WAITED;
|
||||
retval[0] = p->p_pid;
|
||||
#ifdef COMPAT_43
|
||||
if (uap->compat) {
|
||||
if (compat) {
|
||||
retval[1] = W_STOPCODE(p->p_xstat);
|
||||
error = 0;
|
||||
} else
|
||||
#endif
|
||||
if (uap->status) {
|
||||
if (SCARG(uap, status)) {
|
||||
status = W_STOPCODE(p->p_xstat);
|
||||
error = copyout((caddr_t)&status,
|
||||
(caddr_t)uap->status, sizeof(status));
|
||||
(caddr_t)SCARG(uap, status),
|
||||
sizeof(status));
|
||||
} else
|
||||
error = 0;
|
||||
return (error);
|
||||
|
@ -441,7 +455,7 @@ loop:
|
|||
}
|
||||
if (nfound == 0)
|
||||
return (ECHILD);
|
||||
if (uap->options & WNOHANG) {
|
||||
if (SCARG(uap, options) & WNOHANG) {
|
||||
retval[0] = 0;
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_fork.c,v 1.21 1994/08/30 06:16:25 mycroft Exp $ */
|
||||
/* $NetBSD: kern_fork.c,v 1.22 1994/10/20 04:22:47 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||
|
@ -57,7 +57,7 @@
|
|||
fork(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int retval[];
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
return (fork1(p, 0, retval));
|
||||
|
@ -67,7 +67,7 @@ fork(p, uap, retval)
|
|||
vfork(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int retval[];
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
return (fork1(p, 1, retval));
|
||||
|
@ -77,7 +77,8 @@ int nprocs = 1; /* process 0 */
|
|||
|
||||
fork1(p1, isvfork, retval)
|
||||
register struct proc *p1;
|
||||
int isvfork, retval[];
|
||||
int isvfork;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct proc *p2;
|
||||
register uid_t uid;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_ktrace.c,v 1.12 1994/08/30 03:05:37 mycroft Exp $ */
|
||||
/* $NetBSD: kern_ktrace.c,v 1.13 1994/10/20 04:22:49 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -38,6 +38,7 @@
|
|||
#ifdef KTRACE
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/namei.h>
|
||||
|
@ -46,6 +47,9 @@
|
|||
#include <sys/malloc.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
struct ktr_header *
|
||||
ktrgetheader(type)
|
||||
int type;
|
||||
|
@ -62,13 +66,13 @@ ktrgetheader(type)
|
|||
return (kth);
|
||||
}
|
||||
|
||||
ktrsyscall(vp, code, narg, args)
|
||||
ktrsyscall(vp, code, narg, argsize, args)
|
||||
struct vnode *vp;
|
||||
int code, narg, args[];
|
||||
int code, narg, argsize, args[];
|
||||
{
|
||||
struct ktr_header *kth;
|
||||
struct ktr_syscall *ktp;
|
||||
register len = sizeof(struct ktr_syscall) + (narg * sizeof(int));
|
||||
register len = sizeof(struct ktr_syscall) + argsize;
|
||||
struct proc *p = curproc; /* XXX */
|
||||
int *argp, i;
|
||||
|
||||
|
@ -78,7 +82,7 @@ ktrsyscall(vp, code, narg, args)
|
|||
ktp->ktr_code = code;
|
||||
ktp->ktr_narg = narg;
|
||||
argp = (int *)((char *)ktp + sizeof(struct ktr_syscall));
|
||||
for (i = 0; i < narg; i++)
|
||||
for (i = 0; i < (argsize / sizeof *argp); i++)
|
||||
*argp++ = args[i];
|
||||
kth->ktr_buf = (caddr_t)ktp;
|
||||
kth->ktr_len = len;
|
||||
|
@ -217,24 +221,23 @@ ktrcsw(vp, out, user)
|
|||
/*
|
||||
* ktrace system call
|
||||
*/
|
||||
struct ktrace_args {
|
||||
char *fname;
|
||||
int ops;
|
||||
int facs;
|
||||
int pid;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
ktrace(curp, uap, retval)
|
||||
struct proc *curp;
|
||||
register struct ktrace_args *uap;
|
||||
int *retval;
|
||||
register struct ktrace_args /* {
|
||||
syscallarg(char *) fname;
|
||||
syscallarg(int) ops;
|
||||
syscallarg(int) facs;
|
||||
syscallarg(int) pid;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct vnode *vp = NULL;
|
||||
register struct proc *p;
|
||||
struct pgrp *pg;
|
||||
int facs = uap->facs & ~KTRFAC_ROOT;
|
||||
int ops = KTROP(uap->ops);
|
||||
int descend = uap->ops & KTRFLAG_DESCEND;
|
||||
int facs = SCARG(uap, facs) & ~KTRFAC_ROOT;
|
||||
int ops = KTROP(SCARG(uap, ops));
|
||||
int descend = SCARG(uap, ops) & KTRFLAG_DESCEND;
|
||||
int ret = 0;
|
||||
int error = 0;
|
||||
struct nameidata nd;
|
||||
|
@ -244,7 +247,8 @@ ktrace(curp, uap, retval)
|
|||
/*
|
||||
* an operation which requires a file argument.
|
||||
*/
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->fname, curp);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, fname),
|
||||
curp);
|
||||
if (error = vn_open(&nd, FREAD|FWRITE, 0)) {
|
||||
curp->p_traceflag &= ~KTRFAC_ACTIVE;
|
||||
return (error);
|
||||
|
@ -284,11 +288,11 @@ ktrace(curp, uap, retval)
|
|||
/*
|
||||
* do it
|
||||
*/
|
||||
if (uap->pid < 0) {
|
||||
if (SCARG(uap, pid) < 0) {
|
||||
/*
|
||||
* by process group
|
||||
*/
|
||||
pg = pgfind(-uap->pid);
|
||||
pg = pgfind(-SCARG(uap, pid));
|
||||
if (pg == NULL) {
|
||||
error = ESRCH;
|
||||
goto done;
|
||||
|
@ -303,7 +307,7 @@ ktrace(curp, uap, retval)
|
|||
/*
|
||||
* by pid
|
||||
*/
|
||||
p = pfind(uap->pid);
|
||||
p = pfind(SCARG(uap, pid));
|
||||
if (p == NULL) {
|
||||
error = ESRCH;
|
||||
goto done;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_lkm.c,v 1.19 1994/09/22 02:22:42 mycroft Exp $ */
|
||||
/* $NetBSD: kern_lkm.c,v 1.20 1994/10/20 04:22:50 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
|
@ -437,10 +437,13 @@ lkmioctl(dev, cmd, data, flag)
|
|||
* Place holder for system call slots reserved for loadable modules.
|
||||
*/
|
||||
int
|
||||
lkmnosys()
|
||||
lkmnosys(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
return (nosys());
|
||||
return (nosys(p, uap, retval));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_prot.c,v 1.18 1994/09/19 07:52:57 mycroft Exp $ */
|
||||
/* $NetBSD: kern_prot.c,v 1.19 1994/10/20 04:22:52 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
|
||||
|
@ -53,11 +53,14 @@
|
|||
#include <sys/times.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
/* ARGSUSED */
|
||||
getpid(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*retval = p->p_pid;
|
||||
|
@ -71,7 +74,7 @@ getpid(p, uap, retval)
|
|||
getppid(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*retval = p->p_pptr->p_pid;
|
||||
|
@ -82,7 +85,7 @@ getppid(p, uap, retval)
|
|||
getpgrp(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*retval = p->p_pgrp->pg_id;
|
||||
|
@ -93,7 +96,7 @@ getpgrp(p, uap, retval)
|
|||
getuid(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*retval = p->p_cred->p_ruid;
|
||||
|
@ -107,7 +110,7 @@ getuid(p, uap, retval)
|
|||
geteuid(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*retval = p->p_ucred->cr_uid;
|
||||
|
@ -118,7 +121,7 @@ geteuid(p, uap, retval)
|
|||
getgid(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*retval = p->p_cred->p_rgid;
|
||||
|
@ -137,27 +140,26 @@ getgid(p, uap, retval)
|
|||
getegid(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*retval = p->p_ucred->cr_groups[0];
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct getgroups_args {
|
||||
u_int gidsetsize;
|
||||
gid_t *gidset;
|
||||
};
|
||||
getgroups(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct getgroups_args *uap;
|
||||
int *retval;
|
||||
register struct getgroups_args /* {
|
||||
syscallarg(u_int) gidsetsize;
|
||||
syscallarg(gid_t *) gidset;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct pcred *pc = p->p_cred;
|
||||
register u_int ngrp;
|
||||
int error;
|
||||
|
||||
if ((ngrp = uap->gidsetsize) == 0) {
|
||||
if ((ngrp = SCARG(uap, gidsetsize)) == 0) {
|
||||
*retval = pc->pc_ucred->cr_ngroups;
|
||||
return (0);
|
||||
}
|
||||
|
@ -165,7 +167,7 @@ getgroups(p, uap, retval)
|
|||
return (EINVAL);
|
||||
ngrp = pc->pc_ucred->cr_ngroups;
|
||||
if (error = copyout((caddr_t)pc->pc_ucred->cr_groups,
|
||||
(caddr_t)uap->gidset, ngrp * sizeof(gid_t)))
|
||||
(caddr_t)SCARG(uap, gidset), ngrp * sizeof(gid_t)))
|
||||
return (error);
|
||||
*retval = ngrp;
|
||||
return (0);
|
||||
|
@ -175,7 +177,7 @@ getgroups(p, uap, retval)
|
|||
setsid(p, uap, retval)
|
||||
register struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
if (p->p_pgid == p->p_pid || pgfind(p->p_pid)) {
|
||||
|
@ -200,26 +202,25 @@ setsid(p, uap, retval)
|
|||
* there must exist some pid in same session having pgid (EPERM)
|
||||
* pid must not be session leader (EPERM)
|
||||
*/
|
||||
struct setpgid_args {
|
||||
int pid; /* target process id */
|
||||
int pgid; /* target pgrp id */
|
||||
};
|
||||
/* ARGSUSED */
|
||||
setpgid(curp, uap, retval)
|
||||
struct proc *curp;
|
||||
register struct setpgid_args *uap;
|
||||
int *retval;
|
||||
register struct setpgid_args /* {
|
||||
syscallarg(int) pid;
|
||||
syscallarg(int) pgid;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct proc *targp; /* target process */
|
||||
register struct pgrp *pgrp; /* target pgrp */
|
||||
|
||||
#ifdef COMPAT_09
|
||||
uap->pid = (short) uap->pid; /* XXX */
|
||||
uap->pgid = (short) uap->pgid; /* XXX */
|
||||
SCARG(uap, pid) = (short) SCARG(uap, pid); /* XXX */
|
||||
SCARG(uap, pgid) = (short) SCARG(uap, pgid); /* XXX */
|
||||
#endif
|
||||
|
||||
if (uap->pid != 0 && uap->pid != curp->p_pid) {
|
||||
if ((targp = pfind(uap->pid)) == 0 || !inferior(targp))
|
||||
if (SCARG(uap, pid) != 0 && SCARG(uap, pid) != curp->p_pid) {
|
||||
if ((targp = pfind(SCARG(uap, pid))) == 0 || !inferior(targp))
|
||||
return (ESRCH);
|
||||
if (targp->p_session != curp->p_session)
|
||||
return (EPERM);
|
||||
|
@ -229,32 +230,31 @@ setpgid(curp, uap, retval)
|
|||
targp = curp;
|
||||
if (SESS_LEADER(targp))
|
||||
return (EPERM);
|
||||
if (uap->pgid == 0)
|
||||
uap->pgid = targp->p_pid;
|
||||
else if (uap->pgid != targp->p_pid)
|
||||
if ((pgrp = pgfind(uap->pgid)) == 0 ||
|
||||
if (SCARG(uap, pgid) == 0)
|
||||
SCARG(uap, pgid) = targp->p_pid;
|
||||
else if (SCARG(uap, pgid) != targp->p_pid)
|
||||
if ((pgrp = pgfind(SCARG(uap, pgid))) == 0 ||
|
||||
pgrp->pg_session != curp->p_session)
|
||||
return (EPERM);
|
||||
return (enterpgrp(targp, uap->pgid, 0));
|
||||
return (enterpgrp(targp, SCARG(uap, pgid), 0));
|
||||
}
|
||||
|
||||
struct setuid_args {
|
||||
uid_t uid;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
setuid(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct setuid_args *uap;
|
||||
int *retval;
|
||||
struct setuid_args /* {
|
||||
syscallarg(uid_t) uid;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct pcred *pc = p->p_cred;
|
||||
register uid_t uid;
|
||||
int error;
|
||||
|
||||
#ifdef COMPAT_09 /* XXX */
|
||||
uid = (u_short)uap->uid;
|
||||
uid = (u_short)SCARG(uap, uid);
|
||||
#else
|
||||
uid = uap->uid;
|
||||
uid = SCARG(uap, uid);
|
||||
#endif
|
||||
if (uid != pc->p_ruid &&
|
||||
(error = suser(pc->pc_ucred, &p->p_acflag)))
|
||||
|
@ -274,23 +274,22 @@ setuid(p, uap, retval)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct seteuid_args {
|
||||
uid_t euid;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
seteuid(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct seteuid_args *uap;
|
||||
int *retval;
|
||||
struct seteuid_args /* {
|
||||
syscallarg(uid_t) euid;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct pcred *pc = p->p_cred;
|
||||
register uid_t euid;
|
||||
int error;
|
||||
|
||||
#ifdef COMPAT_09 /* XXX */
|
||||
euid = (u_short)uap->euid;
|
||||
euid = (u_short)SCARG(uap, euid);
|
||||
#else
|
||||
euid = uap->euid;
|
||||
euid = SCARG(uap, euid);
|
||||
#endif
|
||||
if (euid != pc->p_ruid && euid != pc->p_svuid &&
|
||||
(error = suser(pc->pc_ucred, &p->p_acflag)))
|
||||
|
@ -305,23 +304,22 @@ seteuid(p, uap, retval)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct setgid_args {
|
||||
gid_t gid;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
setgid(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct setgid_args *uap;
|
||||
int *retval;
|
||||
struct setgid_args /* {
|
||||
syscallarg(gid_t) gid;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct pcred *pc = p->p_cred;
|
||||
register gid_t gid;
|
||||
int error;
|
||||
|
||||
#ifdef COMPAT_09 /* XXX */
|
||||
gid = (u_short)uap->gid;
|
||||
gid = (u_short)SCARG(uap, gid);
|
||||
#else
|
||||
gid = uap->gid;
|
||||
gid = SCARG(uap, gid);
|
||||
#endif
|
||||
if (gid != pc->p_rgid && (error = suser(pc->pc_ucred, &p->p_acflag)))
|
||||
return (error);
|
||||
|
@ -333,23 +331,22 @@ setgid(p, uap, retval)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct setegid_args {
|
||||
gid_t egid;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
setegid(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct setegid_args *uap;
|
||||
int *retval;
|
||||
struct setegid_args /* {
|
||||
syscallarg(gid_t) egid;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct pcred *pc = p->p_cred;
|
||||
register gid_t egid;
|
||||
int error;
|
||||
|
||||
#ifdef COMPAT_09 /* XXX */
|
||||
egid = (u_short)uap->egid;
|
||||
egid = (u_short)SCARG(uap, egid);
|
||||
#else
|
||||
egid = uap->egid;
|
||||
egid = SCARG(uap, egid);
|
||||
#endif
|
||||
if (egid != pc->p_rgid && egid != pc->p_svgid &&
|
||||
(error = suser(pc->pc_ucred, &p->p_acflag)))
|
||||
|
@ -360,15 +357,14 @@ setegid(p, uap, retval)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct setgroups_args {
|
||||
u_int gidsetsize;
|
||||
gid_t *gidset;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
setgroups(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct setgroups_args *uap;
|
||||
int *retval;
|
||||
struct setgroups_args /* {
|
||||
syscallarg(u_int) gidsetsize;
|
||||
syscallarg(gid_t *) gidset;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct pcred *pc = p->p_cred;
|
||||
register u_int ngrp;
|
||||
|
@ -376,11 +372,11 @@ setgroups(p, uap, retval)
|
|||
|
||||
if (error = suser(pc->pc_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
ngrp = uap->gidsetsize;
|
||||
ngrp = SCARG(uap, gidsetsize);
|
||||
if (ngrp < 1 || ngrp > NGROUPS)
|
||||
return (EINVAL);
|
||||
pc->pc_ucred = crcopy(pc->pc_ucred);
|
||||
if (error = copyin((caddr_t)uap->gidset,
|
||||
if (error = copyin((caddr_t)SCARG(uap, gidset),
|
||||
(caddr_t)pc->pc_ucred->cr_groups, ngrp * sizeof(gid_t)))
|
||||
return (error);
|
||||
pc->pc_ucred->cr_ngroups = ngrp;
|
||||
|
@ -389,15 +385,14 @@ setgroups(p, uap, retval)
|
|||
}
|
||||
|
||||
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
|
||||
struct setreuid_args {
|
||||
int ruid;
|
||||
int euid;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
osetreuid(p, uap, retval)
|
||||
compat_43_setreuid(p, uap, retval)
|
||||
register struct proc *p;
|
||||
struct setreuid_args *uap;
|
||||
int *retval;
|
||||
struct compat_43_setreuid_args /* {
|
||||
syscallarg(int) ruid;
|
||||
syscallarg(int) euid;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct seteuid_args seuidargs;
|
||||
struct setuid_args suidargs;
|
||||
|
@ -415,29 +410,28 @@ osetreuid(p, uap, retval)
|
|||
* N, N: call setuid(N). This is correct emulation.
|
||||
* N, M: call setuid(N). This is close to correct emulation.
|
||||
*/
|
||||
if (uap->ruid == (uid_t)-1) {
|
||||
if (uap->euid == (uid_t)-1)
|
||||
if (SCARG(uap, ruid) == (uid_t)-1) {
|
||||
if (SCARG(uap, euid) == (uid_t)-1)
|
||||
return (0); /* -1, -1 */
|
||||
seuidargs.euid = uap->euid; /* -1, N */
|
||||
seuidargs.euid = SCARG(uap, euid); /* -1, N */
|
||||
return (seteuid(p, &seuidargs, retval));
|
||||
}
|
||||
if (uap->euid == (uid_t)-1) {
|
||||
seuidargs.euid = uap->ruid; /* N, -1 */
|
||||
if (SCARG(uap, euid) == (uid_t)-1) {
|
||||
seuidargs.euid = SCARG(uap, ruid); /* N, -1 */
|
||||
return (seteuid(p, &seuidargs, retval));
|
||||
}
|
||||
suidargs.uid = uap->ruid; /* N, N and N, M */
|
||||
suidargs.uid = SCARG(uap, ruid); /* N, N and N, M */
|
||||
return (setuid(p, &suidargs, retval));
|
||||
}
|
||||
|
||||
struct setregid_args {
|
||||
int rgid;
|
||||
int egid;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
osetregid(p, uap, retval)
|
||||
compat_43_setregid(p, uap, retval)
|
||||
register struct proc *p;
|
||||
struct setregid_args *uap;
|
||||
int *retval;
|
||||
struct compat_43_setregid_args /* {
|
||||
syscallarg(int) rgid;
|
||||
syscallarg(int) egid;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct setegid_args segidargs;
|
||||
struct setgid_args sgidargs;
|
||||
|
@ -445,17 +439,17 @@ osetregid(p, uap, retval)
|
|||
/*
|
||||
* There are five cases, described above in osetreuid()
|
||||
*/
|
||||
if (uap->rgid == (gid_t)-1) {
|
||||
if (uap->egid == (gid_t)-1)
|
||||
if (SCARG(uap, rgid) == (gid_t)-1) {
|
||||
if (SCARG(uap, egid) == (gid_t)-1)
|
||||
return (0); /* -1, -1 */
|
||||
segidargs.egid = uap->egid; /* -1, N */
|
||||
segidargs.egid = SCARG(uap, egid); /* -1, N */
|
||||
return (setegid(p, &segidargs, retval));
|
||||
}
|
||||
if (uap->egid == (gid_t)-1) {
|
||||
segidargs.egid = uap->rgid; /* N, -1 */
|
||||
if (SCARG(uap, egid) == (gid_t)-1) {
|
||||
segidargs.egid = SCARG(uap, rgid); /* N, -1 */
|
||||
return (setegid(p, &segidargs, retval));
|
||||
}
|
||||
sgidargs.gid = uap->rgid; /* N, N and N, M */
|
||||
sgidargs.gid = SCARG(uap, rgid); /* N, N and N, M */
|
||||
return (setgid(p, &sgidargs, retval));
|
||||
}
|
||||
#endif /* defined(COMPAT_43) || defined(COMPAT_SUNOS) */
|
||||
|
@ -560,40 +554,38 @@ crdup(cr)
|
|||
/*
|
||||
* Get login name, if available.
|
||||
*/
|
||||
struct getlogin_args {
|
||||
char *namebuf;
|
||||
u_int namelen;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
getlogin(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct getlogin_args *uap;
|
||||
int *retval;
|
||||
struct getlogin_args /* {
|
||||
syscallarg(char *) namebuf;
|
||||
syscallarg(u_int) namelen;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
if (uap->namelen > sizeof (p->p_pgrp->pg_session->s_login))
|
||||
uap->namelen = sizeof (p->p_pgrp->pg_session->s_login);
|
||||
if (SCARG(uap, namelen) > sizeof (p->p_pgrp->pg_session->s_login))
|
||||
SCARG(uap, namelen) = sizeof (p->p_pgrp->pg_session->s_login);
|
||||
return (copyout((caddr_t) p->p_pgrp->pg_session->s_login,
|
||||
(caddr_t) uap->namebuf, uap->namelen));
|
||||
(caddr_t) SCARG(uap, namebuf), SCARG(uap, namelen)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set login name.
|
||||
*/
|
||||
struct setlogin_args {
|
||||
char *namebuf;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
setlogin(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct setlogin_args *uap;
|
||||
int *retval;
|
||||
struct setlogin_args /* {
|
||||
syscallarg(char *) namebuf;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int error;
|
||||
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
error = copyinstr((caddr_t) uap->namebuf,
|
||||
error = copyinstr((caddr_t) SCARG(uap, namebuf),
|
||||
(caddr_t) p->p_pgrp->pg_session->s_login,
|
||||
sizeof (p->p_pgrp->pg_session->s_login) - 1, (u_int *)0);
|
||||
if (error == ENAMETOOLONG)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_resource.c,v 1.21 1994/08/30 03:05:40 mycroft Exp $ */
|
||||
/* $NetBSD: kern_resource.c,v 1.22 1994/10/20 04:22:54 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1991, 1993
|
||||
|
@ -41,37 +41,40 @@
|
|||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/resourcevar.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
/*
|
||||
* Resource controls and accounting.
|
||||
*/
|
||||
|
||||
struct getpriority_args {
|
||||
int which;
|
||||
int who;
|
||||
};
|
||||
getpriority(curp, uap, retval)
|
||||
struct proc *curp;
|
||||
register struct getpriority_args *uap;
|
||||
int *retval;
|
||||
register struct getpriority_args /* {
|
||||
syscallarg(int) which;
|
||||
syscallarg(int) who;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct proc *p;
|
||||
register int low = PRIO_MAX + 1;
|
||||
|
||||
switch (uap->which) {
|
||||
switch (SCARG(uap, which)) {
|
||||
|
||||
case PRIO_PROCESS:
|
||||
if (uap->who == 0)
|
||||
if (SCARG(uap, who) == 0)
|
||||
p = curp;
|
||||
else
|
||||
p = pfind(uap->who);
|
||||
p = pfind(SCARG(uap, who));
|
||||
if (p == 0)
|
||||
break;
|
||||
low = p->p_nice;
|
||||
|
@ -80,9 +83,9 @@ getpriority(curp, uap, retval)
|
|||
case PRIO_PGRP: {
|
||||
register struct pgrp *pg;
|
||||
|
||||
if (uap->who == 0)
|
||||
if (SCARG(uap, who) == 0)
|
||||
pg = curp->p_pgrp;
|
||||
else if ((pg = pgfind(uap->who)) == NULL)
|
||||
else if ((pg = pgfind(SCARG(uap, who))) == NULL)
|
||||
break;
|
||||
for (p = pg->pg_members.lh_first; p != 0; p = p->p_pglist.le_next) {
|
||||
if (p->p_nice < low)
|
||||
|
@ -92,10 +95,11 @@ getpriority(curp, uap, retval)
|
|||
}
|
||||
|
||||
case PRIO_USER:
|
||||
if (uap->who == 0)
|
||||
uap->who = curp->p_ucred->cr_uid;
|
||||
if (SCARG(uap, who) == 0)
|
||||
SCARG(uap, who) = curp->p_ucred->cr_uid;
|
||||
for (p = allproc.lh_first; p != 0; p = p->p_list.le_next)
|
||||
if (p->p_ucred->cr_uid == uap->who && p->p_nice < low)
|
||||
if (p->p_ucred->cr_uid == SCARG(uap, who) &&
|
||||
p->p_nice < low)
|
||||
low = p->p_nice;
|
||||
break;
|
||||
|
||||
|
@ -108,53 +112,53 @@ getpriority(curp, uap, retval)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct setpriority_args {
|
||||
int which;
|
||||
int who;
|
||||
int prio;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
setpriority(curp, uap, retval)
|
||||
struct proc *curp;
|
||||
register struct setpriority_args *uap;
|
||||
int *retval;
|
||||
register struct setpriority_args /* {
|
||||
syscallarg(int) which;
|
||||
syscallarg(int) who;
|
||||
syscallarg(int) prio;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct proc *p;
|
||||
int found = 0, error = 0;
|
||||
|
||||
switch (uap->which) {
|
||||
switch (SCARG(uap, which)) {
|
||||
|
||||
case PRIO_PROCESS:
|
||||
if (uap->who == 0)
|
||||
if (SCARG(uap, who) == 0)
|
||||
p = curp;
|
||||
else
|
||||
p = pfind(uap->who);
|
||||
p = pfind(SCARG(uap, who));
|
||||
if (p == 0)
|
||||
break;
|
||||
error = donice(curp, p, uap->prio);
|
||||
error = donice(curp, p, SCARG(uap, prio));
|
||||
found++;
|
||||
break;
|
||||
|
||||
case PRIO_PGRP: {
|
||||
register struct pgrp *pg;
|
||||
|
||||
if (uap->who == 0)
|
||||
if (SCARG(uap, who) == 0)
|
||||
pg = curp->p_pgrp;
|
||||
else if ((pg = pgfind(uap->who)) == NULL)
|
||||
else if ((pg = pgfind(SCARG(uap, who))) == NULL)
|
||||
break;
|
||||
for (p = pg->pg_members.lh_first; p != 0; p = p->p_pglist.le_next) {
|
||||
error = donice(curp, p, uap->prio);
|
||||
for (p = pg->pg_members.lh_first; p != 0;
|
||||
p = p->p_pglist.le_next) {
|
||||
error = donice(curp, p, SCARG(uap, prio));
|
||||
found++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PRIO_USER:
|
||||
if (uap->who == 0)
|
||||
uap->who = curp->p_ucred->cr_uid;
|
||||
if (SCARG(uap, who) == 0)
|
||||
SCARG(uap, who) = curp->p_ucred->cr_uid;
|
||||
for (p = allproc.lh_first; p != 0; p = p->p_list.le_next)
|
||||
if (p->p_ucred->cr_uid == uap->who) {
|
||||
error = donice(curp, p, uap->prio);
|
||||
if (p->p_ucred->cr_uid == SCARG(uap, who)) {
|
||||
error = donice(curp, p, SCARG(uap, prio));
|
||||
found++;
|
||||
}
|
||||
break;
|
||||
|
@ -189,69 +193,67 @@ donice(curp, chgp, n)
|
|||
}
|
||||
|
||||
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
|
||||
struct osetrlimit_args {
|
||||
u_int which;
|
||||
struct orlimit *lim;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
osetrlimit(p, uap, retval)
|
||||
compat_43_setrlimit(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct osetrlimit_args *uap;
|
||||
int *retval;
|
||||
struct compat_43_setrlimit_args /* {
|
||||
syscallarg(u_int) which;
|
||||
syscallarg(struct ogetrlimit *) rlp;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct orlimit olim;
|
||||
struct rlimit lim;
|
||||
int error;
|
||||
|
||||
if (error =
|
||||
copyin((caddr_t)uap->lim, (caddr_t)&olim, sizeof (struct orlimit)))
|
||||
if (error = copyin((caddr_t)SCARG(uap, rlp), (caddr_t)&olim,
|
||||
sizeof (struct orlimit)))
|
||||
return (error);
|
||||
lim.rlim_cur = olim.rlim_cur;
|
||||
lim.rlim_max = olim.rlim_max;
|
||||
return (dosetrlimit(p, uap->which, &lim));
|
||||
return (dosetrlimit(p, SCARG(uap, which), &lim));
|
||||
}
|
||||
|
||||
struct ogetrlimit_args {
|
||||
u_int which;
|
||||
struct orlimit *rlp;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
ogetrlimit(p, uap, retval)
|
||||
compat_43_getrlimit(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct ogetrlimit_args *uap;
|
||||
int *retval;
|
||||
register struct compat_43_getrlimit_args /* {
|
||||
syscallarg(u_int) which;
|
||||
syscallarg(struct ogetrlimit *) rlp;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct orlimit olim;
|
||||
|
||||
if (uap->which >= RLIM_NLIMITS)
|
||||
if (SCARG(uap, which) >= RLIM_NLIMITS)
|
||||
return (EINVAL);
|
||||
olim.rlim_cur = p->p_rlimit[uap->which].rlim_cur;
|
||||
olim.rlim_cur = p->p_rlimit[SCARG(uap, which)].rlim_cur;
|
||||
if (olim.rlim_cur == -1)
|
||||
olim.rlim_cur = 0x7fffffff;
|
||||
olim.rlim_max = p->p_rlimit[uap->which].rlim_max;
|
||||
olim.rlim_max = p->p_rlimit[SCARG(uap, which)].rlim_max;
|
||||
if (olim.rlim_max == -1)
|
||||
olim.rlim_max = 0x7fffffff;
|
||||
return (copyout((caddr_t)&olim, (caddr_t)uap->rlp, sizeof(olim)));
|
||||
return (copyout((caddr_t)&olim, (caddr_t)SCARG(uap, rlp),
|
||||
sizeof(olim)));
|
||||
}
|
||||
#endif /* COMPAT_43 || COMPAT_SUNOS */
|
||||
|
||||
struct setrlimit_args {
|
||||
u_int which;
|
||||
struct rlimit *lim;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
setrlimit(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct setrlimit_args *uap;
|
||||
int *retval;
|
||||
register struct setrlimit_args /* {
|
||||
syscallarg(u_int) which;
|
||||
syscallarg(struct rlimit *) rlp;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct rlimit alim;
|
||||
int error;
|
||||
|
||||
if (error =
|
||||
copyin((caddr_t)uap->lim, (caddr_t)&alim, sizeof (struct rlimit)))
|
||||
if (error = copyin((caddr_t)SCARG(uap, rlp), (caddr_t)&alim,
|
||||
sizeof (struct rlimit)))
|
||||
return (error);
|
||||
return (dosetrlimit(p, uap->which, &alim));
|
||||
return (dosetrlimit(p, SCARG(uap, which), &alim));
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -338,21 +340,20 @@ dosetrlimit(p, which, limp)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct getrlimit_args {
|
||||
u_int which;
|
||||
struct rlimit *rlp;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
getrlimit(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct getrlimit_args *uap;
|
||||
int *retval;
|
||||
register struct getrlimit_args /* {
|
||||
syscallarg(u_int) which;
|
||||
syscallarg(struct rlimit *) rlp;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
if (uap->which >= RLIM_NLIMITS)
|
||||
if (SCARG(uap, which) >= RLIM_NLIMITS)
|
||||
return (EINVAL);
|
||||
return (copyout((caddr_t)&p->p_rlimit[uap->which], (caddr_t)uap->rlp,
|
||||
sizeof (struct rlimit)));
|
||||
return (copyout((caddr_t)&p->p_rlimit[SCARG(uap, which)],
|
||||
(caddr_t)SCARG(uap, rlp), sizeof (struct rlimit)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -411,19 +412,18 @@ calcru(p, up, sp, ip)
|
|||
}
|
||||
}
|
||||
|
||||
struct getrusage_args {
|
||||
int who;
|
||||
struct rusage *rusage;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
getrusage(p, uap, retval)
|
||||
register struct proc *p;
|
||||
register struct getrusage_args *uap;
|
||||
int *retval;
|
||||
register struct getrusage_args /* {
|
||||
syscallarg(int) who;
|
||||
syscallarg(struct rusage *) rusage;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct rusage *rup;
|
||||
|
||||
switch (uap->who) {
|
||||
switch (SCARG(uap, who)) {
|
||||
|
||||
case RUSAGE_SELF:
|
||||
rup = &p->p_stats->p_ru;
|
||||
|
@ -437,7 +437,7 @@ getrusage(p, uap, retval)
|
|||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
return (copyout((caddr_t)rup, (caddr_t)uap->rusage,
|
||||
return (copyout((caddr_t)rup, (caddr_t)SCARG(uap, rusage),
|
||||
sizeof (struct rusage)));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_sig.c,v 1.31 1994/08/30 03:05:42 mycroft Exp $ */
|
||||
/* $NetBSD: kern_sig.c,v 1.32 1994/10/20 04:22:56 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||
|
@ -60,6 +60,9 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/core.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
@ -78,16 +81,15 @@ void stop __P((struct proc *p));
|
|||
(pc)->pc_ucred->cr_uid == (q)->p_ucred->cr_uid || \
|
||||
((signum) == SIGCONT && (q)->p_session == (p)->p_session))
|
||||
|
||||
struct sigaction_args {
|
||||
int signum;
|
||||
struct sigaction *nsa;
|
||||
struct sigaction *osa;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
sigaction(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct sigaction_args *uap;
|
||||
int *retval;
|
||||
register struct sigaction_args /* {
|
||||
syscallarg(int) signum;
|
||||
syscallarg(struct sigaction *) nsa;
|
||||
syscallarg(struct sigaction *) osa;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct sigaction vec;
|
||||
register struct sigaction *sa;
|
||||
|
@ -95,12 +97,12 @@ sigaction(p, uap, retval)
|
|||
register int signum;
|
||||
int bit, error;
|
||||
|
||||
signum = uap->signum;
|
||||
signum = SCARG(uap, signum);
|
||||
if (signum <= 0 || signum >= NSIG ||
|
||||
signum == SIGKILL || signum == SIGSTOP)
|
||||
return (EINVAL);
|
||||
sa = &vec;
|
||||
if (uap->osa) {
|
||||
if (SCARG(uap, osa)) {
|
||||
sa->sa_handler = ps->ps_sigact[signum];
|
||||
sa->sa_mask = ps->ps_catchmask[signum];
|
||||
bit = sigmask(signum);
|
||||
|
@ -111,12 +113,12 @@ sigaction(p, uap, retval)
|
|||
sa->sa_flags |= SA_RESTART;
|
||||
if (p->p_flag & P_NOCLDSTOP)
|
||||
sa->sa_flags |= SA_NOCLDSTOP;
|
||||
if (error = copyout((caddr_t)sa, (caddr_t)uap->osa,
|
||||
if (error = copyout((caddr_t)sa, (caddr_t)SCARG(uap, osa),
|
||||
sizeof (vec)))
|
||||
return (error);
|
||||
}
|
||||
if (uap->nsa) {
|
||||
if (error = copyin((caddr_t)uap->nsa, (caddr_t)sa,
|
||||
if (SCARG(uap, nsa)) {
|
||||
if (error = copyin((caddr_t)SCARG(uap, nsa), (caddr_t)sa,
|
||||
sizeof (vec)))
|
||||
return (error);
|
||||
setsigvec(p, signum, sa);
|
||||
|
@ -238,31 +240,30 @@ execsigs(p)
|
|||
* and return old mask as return value;
|
||||
* the library stub does the rest.
|
||||
*/
|
||||
struct sigprocmask_args {
|
||||
int how;
|
||||
sigset_t mask;
|
||||
};
|
||||
sigprocmask(p, uap, retval)
|
||||
register struct proc *p;
|
||||
struct sigprocmask_args *uap;
|
||||
int *retval;
|
||||
struct sigprocmask_args /* {
|
||||
syscallarg(int) how;
|
||||
syscallarg(sigset_t) mask;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
*retval = p->p_sigmask;
|
||||
(void) splhigh();
|
||||
|
||||
switch (uap->how) {
|
||||
switch (SCARG(uap, how)) {
|
||||
case SIG_BLOCK:
|
||||
p->p_sigmask |= uap->mask &~ sigcantmask;
|
||||
p->p_sigmask |= SCARG(uap, mask) &~ sigcantmask;
|
||||
break;
|
||||
|
||||
case SIG_UNBLOCK:
|
||||
p->p_sigmask &= ~uap->mask;
|
||||
p->p_sigmask &= ~SCARG(uap, mask);
|
||||
break;
|
||||
|
||||
case SIG_SETMASK:
|
||||
p->p_sigmask = uap->mask &~ sigcantmask;
|
||||
p->p_sigmask = SCARG(uap, mask) &~ sigcantmask;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -277,7 +278,7 @@ sigprocmask(p, uap, retval)
|
|||
sigpending(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*retval = p->p_siglist;
|
||||
|
@ -288,16 +289,15 @@ sigpending(p, uap, retval)
|
|||
/*
|
||||
* Generalized interface signal handler, 4.3-compatible.
|
||||
*/
|
||||
struct osigvec_args {
|
||||
int signum;
|
||||
struct sigvec *nsv;
|
||||
struct sigvec *osv;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
osigvec(p, uap, retval)
|
||||
compat_43_sigvec(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct osigvec_args *uap;
|
||||
int *retval;
|
||||
register struct compat_43_sigvec_args /* {
|
||||
syscallarg(int) signum;
|
||||
syscallarg(struct sigvec *) nsv;
|
||||
syscallarg(struct sigvec *) osv;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct sigvec vec;
|
||||
register struct sigacts *ps = p->p_sigacts;
|
||||
|
@ -305,12 +305,12 @@ osigvec(p, uap, retval)
|
|||
register int signum;
|
||||
int bit, error;
|
||||
|
||||
signum = uap->signum;
|
||||
signum = SCARG(uap, signum);
|
||||
if (signum <= 0 || signum >= NSIG ||
|
||||
signum == SIGKILL || signum == SIGSTOP)
|
||||
return (EINVAL);
|
||||
sv = &vec;
|
||||
if (uap->osv) {
|
||||
if (SCARG(uap, osv)) {
|
||||
*(sig_t *)&sv->sv_handler = ps->ps_sigact[signum];
|
||||
sv->sv_mask = ps->ps_catchmask[signum];
|
||||
bit = sigmask(signum);
|
||||
|
@ -324,12 +324,12 @@ osigvec(p, uap, retval)
|
|||
#endif
|
||||
if (p->p_flag & P_NOCLDSTOP)
|
||||
sv->sv_flags |= SA_NOCLDSTOP;
|
||||
if (error = copyout((caddr_t)sv, (caddr_t)uap->osv,
|
||||
if (error = copyout((caddr_t)sv, (caddr_t)SCARG(uap, osv),
|
||||
sizeof (vec)))
|
||||
return (error);
|
||||
}
|
||||
if (uap->nsv) {
|
||||
if (error = copyin((caddr_t)uap->nsv, (caddr_t)sv,
|
||||
if (SCARG(uap, nsv)) {
|
||||
if (error = copyin((caddr_t)SCARG(uap, nsv), (caddr_t)sv,
|
||||
sizeof (vec)))
|
||||
return (error);
|
||||
#ifdef COMPAT_SUNOS
|
||||
|
@ -350,35 +350,33 @@ osigvec(p, uap, retval)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct osigblock_args {
|
||||
int mask;
|
||||
};
|
||||
osigblock(p, uap, retval)
|
||||
compat_43_sigblock(p, uap, retval)
|
||||
register struct proc *p;
|
||||
struct osigblock_args *uap;
|
||||
int *retval;
|
||||
struct compat_43_sigblock_args /* {
|
||||
syscallarg(int) mask;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
(void) splhigh();
|
||||
*retval = p->p_sigmask;
|
||||
p->p_sigmask |= uap->mask &~ sigcantmask;
|
||||
p->p_sigmask |= SCARG(uap, mask) &~ sigcantmask;
|
||||
(void) spl0();
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct osigsetmask_args {
|
||||
int mask;
|
||||
};
|
||||
int
|
||||
osigsetmask(p, uap, retval)
|
||||
compat_43_sigsetmask(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct osigsetmask_args *uap;
|
||||
int *retval;
|
||||
struct compat_43_sigsetmask_args /* {
|
||||
syscallarg(int) mask;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
(void) splhigh();
|
||||
*retval = p->p_sigmask;
|
||||
p->p_sigmask = uap->mask &~ sigcantmask;
|
||||
p->p_sigmask = SCARG(uap, mask) &~ sigcantmask;
|
||||
(void) spl0();
|
||||
return (0);
|
||||
}
|
||||
|
@ -389,15 +387,14 @@ osigsetmask(p, uap, retval)
|
|||
* in the meantime. Note nonstandard calling convention:
|
||||
* libc stub passes mask, not pointer, to save a copyin.
|
||||
*/
|
||||
struct sigsuspend_args {
|
||||
sigset_t mask;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
sigsuspend(p, uap, retval)
|
||||
register struct proc *p;
|
||||
struct sigsuspend_args *uap;
|
||||
int *retval;
|
||||
struct sigsuspend_args /* {
|
||||
syscallarg(int) mask;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct sigacts *ps = p->p_sigacts;
|
||||
|
||||
|
@ -410,24 +407,24 @@ sigsuspend(p, uap, retval)
|
|||
*/
|
||||
ps->ps_oldmask = p->p_sigmask;
|
||||
ps->ps_flags |= SAS_OLDMASK;
|
||||
p->p_sigmask = uap->mask &~ sigcantmask;
|
||||
p->p_sigmask = SCARG(uap, mask) &~ sigcantmask;
|
||||
while (tsleep((caddr_t) ps, PPAUSE|PCATCH, "pause", 0) == 0)
|
||||
/* void */;
|
||||
/* always return EINTR rather than ERESTART... */
|
||||
return (EINTR);
|
||||
}
|
||||
|
||||
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_HPUX)
|
||||
struct osigstack_args {
|
||||
struct sigstack *nss;
|
||||
struct sigstack *oss;
|
||||
};
|
||||
#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_HPUX) || \
|
||||
defined(COMPAT_OSF1)
|
||||
/* ARGSUSED */
|
||||
int
|
||||
osigstack(p, uap, retval)
|
||||
compat_43_sigstack(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct osigstack_args *uap;
|
||||
int *retval;
|
||||
register struct compat_43_sigstack_args /* {
|
||||
syscallarg(struct sigstack *) nss;
|
||||
syscallarg(struct sigstack *) oss;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct sigstack ss;
|
||||
struct sigacts *psp;
|
||||
|
@ -436,11 +433,11 @@ osigstack(p, uap, retval)
|
|||
psp = p->p_sigacts;
|
||||
ss.ss_sp = psp->ps_sigstk.ss_base;
|
||||
ss.ss_onstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
|
||||
if (uap->oss && (error = copyout((caddr_t)&ss, (caddr_t)uap->oss,
|
||||
sizeof (struct sigstack))))
|
||||
if (SCARG(uap, oss) && (error = copyout((caddr_t)&ss,
|
||||
(caddr_t)SCARG(uap, oss), sizeof (struct sigstack))))
|
||||
return (error);
|
||||
if (uap->nss && (error = copyin((caddr_t)uap->nss, (caddr_t)&ss,
|
||||
sizeof (ss))) == 0) {
|
||||
if (SCARG(uap, nss) && (error = copyin((caddr_t)SCARG(uap, nss),
|
||||
(caddr_t)&ss, sizeof (ss))) == 0) {
|
||||
psp->ps_sigstk.ss_base = ss.ss_sp;
|
||||
psp->ps_sigstk.ss_size = 0;
|
||||
psp->ps_sigstk.ss_flags |= ss.ss_onstack & SA_ONSTACK;
|
||||
|
@ -450,15 +447,14 @@ osigstack(p, uap, retval)
|
|||
}
|
||||
#endif /* COMPAT_43 || COMPAT_SUNOS || COMPAT_HPUX */
|
||||
|
||||
struct sigaltstack_args {
|
||||
struct sigaltstack *nss;
|
||||
struct sigaltstack *oss;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
sigaltstack(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct sigaltstack_args *uap;
|
||||
int *retval;
|
||||
register struct sigaltstack_args /* {
|
||||
syscallarg(struct sigaltstack *) nss;
|
||||
syscallarg(struct sigaltstack *) oss;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct sigacts *psp;
|
||||
struct sigaltstack ss;
|
||||
|
@ -467,12 +463,13 @@ sigaltstack(p, uap, retval)
|
|||
psp = p->p_sigacts;
|
||||
if ((psp->ps_flags & SAS_ALTSTACK) == 0)
|
||||
psp->ps_sigstk.ss_flags |= SA_DISABLE;
|
||||
if (uap->oss && (error = copyout((caddr_t)&psp->ps_sigstk,
|
||||
(caddr_t)uap->oss, sizeof (struct sigaltstack))))
|
||||
if (SCARG(uap, oss) && (error = copyout((caddr_t)&psp->ps_sigstk,
|
||||
(caddr_t)SCARG(uap, oss), sizeof (struct sigaltstack))))
|
||||
return (error);
|
||||
if (uap->nss == 0)
|
||||
if (SCARG(uap, nss) == 0)
|
||||
return (0);
|
||||
if (error = copyin((caddr_t)uap->nss, (caddr_t)&ss, sizeof (ss)))
|
||||
if (error = copyin((caddr_t)SCARG(uap, nss), (caddr_t)&ss,
|
||||
sizeof (ss)))
|
||||
return (error);
|
||||
if (ss.ss_flags & SA_DISABLE) {
|
||||
if (psp->ps_sigstk.ss_flags & SA_ONSTACK)
|
||||
|
@ -488,66 +485,64 @@ sigaltstack(p, uap, retval)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct kill_args {
|
||||
pid_t pid;
|
||||
int signum;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
kill(cp, uap, retval)
|
||||
register struct proc *cp;
|
||||
register struct kill_args *uap;
|
||||
int *retval;
|
||||
register struct kill_args /* {
|
||||
syscallarg(int) pid;
|
||||
syscallarg(int) signum;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct proc *p;
|
||||
register struct pcred *pc = cp->p_cred;
|
||||
|
||||
#ifdef COMPAT_09
|
||||
uap->pid = (short) uap->pid;
|
||||
SCARG(uap, pid) = (short) SCARG(uap, pid);
|
||||
#endif
|
||||
|
||||
if ((u_int)uap->signum >= NSIG)
|
||||
if ((u_int)SCARG(uap, signum) >= NSIG)
|
||||
return (EINVAL);
|
||||
if (uap->pid > 0) {
|
||||
if (SCARG(uap, pid) > 0) {
|
||||
/* kill single process */
|
||||
if ((p = pfind(uap->pid)) == NULL)
|
||||
if ((p = pfind(SCARG(uap, pid))) == NULL)
|
||||
return (ESRCH);
|
||||
if (!CANSIGNAL(cp, pc, p, uap->signum))
|
||||
if (!CANSIGNAL(cp, pc, p, SCARG(uap, signum)))
|
||||
return (EPERM);
|
||||
if (uap->signum)
|
||||
psignal(p, uap->signum);
|
||||
if (SCARG(uap, signum))
|
||||
psignal(p, SCARG(uap, signum));
|
||||
return (0);
|
||||
}
|
||||
switch (uap->pid) {
|
||||
switch (SCARG(uap, pid)) {
|
||||
case -1: /* broadcast signal */
|
||||
return (killpg1(cp, uap->signum, 0, 1));
|
||||
return (killpg1(cp, SCARG(uap, signum), 0, 1));
|
||||
case 0: /* signal own process group */
|
||||
return (killpg1(cp, uap->signum, 0, 0));
|
||||
return (killpg1(cp, SCARG(uap, signum), 0, 0));
|
||||
default: /* negative explicit process group */
|
||||
return (killpg1(cp, uap->signum, -uap->pid, 0));
|
||||
return (killpg1(cp, SCARG(uap, signum), -SCARG(uap, pid), 0));
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
|
||||
struct okillpg_args {
|
||||
int pgid;
|
||||
int signum;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
okillpg(p, uap, retval)
|
||||
compat_43_killpg(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct okillpg_args *uap;
|
||||
int *retval;
|
||||
register struct compat_43_killpg_args /* {
|
||||
syscallarg(int) pgid;
|
||||
syscallarg(int) signum;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
#ifdef COMPAT_09
|
||||
uap->pgid = (short) uap->pgid;
|
||||
SCARG(uap, pgid) = (short) SCARG(uap, pgid);
|
||||
#endif
|
||||
|
||||
if ((u_int)uap->signum >= NSIG)
|
||||
if ((u_int)SCARG(uap, signum) >= NSIG)
|
||||
return (EINVAL);
|
||||
return (killpg1(p, uap->signum, uap->pgid, 0));
|
||||
return (killpg1(p, SCARG(uap, signum), SCARG(uap, pgid), 0));
|
||||
}
|
||||
#endif /* COMPAT_43 || COMPAT_SUNOS */
|
||||
|
||||
|
@ -1255,7 +1250,7 @@ int
|
|||
nosys(p, args, retval)
|
||||
struct proc *p;
|
||||
void *args;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
psignal(p, SIGSYS);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_sysctl.c,v 1.4 1994/09/16 23:57:22 deraadt Exp $ */
|
||||
/* $NetBSD: kern_sysctl.c,v 1.5 1994/10/20 04:22:57 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -56,6 +56,9 @@
|
|||
#include <vm/vm.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
sysctlfn kern_sysctl;
|
||||
sysctlfn hw_sysctl;
|
||||
#ifdef DEBUG
|
||||
|
@ -75,34 +78,34 @@ static struct sysctl_lock {
|
|||
int sl_locked;
|
||||
} memlock;
|
||||
|
||||
struct sysctl_args {
|
||||
int *name;
|
||||
u_int namelen;
|
||||
void *old;
|
||||
size_t *oldlenp;
|
||||
void *new;
|
||||
size_t newlen;
|
||||
};
|
||||
|
||||
int
|
||||
__sysctl(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct sysctl_args *uap;
|
||||
int *retval;
|
||||
register struct __sysctl_args /* {
|
||||
syscallarg(int *) name;
|
||||
syscallarg(u_int) namelen;
|
||||
syscallarg(void *) old;
|
||||
syscallarg(size_t *) oldlenp;
|
||||
syscallarg(void *) new;
|
||||
syscallarg(size_t) newlen;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int error, dolock = 1;
|
||||
u_int savelen, oldlen = 0;
|
||||
sysctlfn *fn;
|
||||
int name[CTL_MAXNAME];
|
||||
|
||||
if (uap->new != NULL && (error = suser(p->p_ucred, &p->p_acflag)))
|
||||
if (SCARG(uap, new) != NULL &&
|
||||
(error = suser(p->p_ucred, &p->p_acflag)))
|
||||
return (error);
|
||||
/*
|
||||
* all top-level sysctl names are non-terminal
|
||||
*/
|
||||
if (uap->namelen > CTL_MAXNAME || uap->namelen < 2)
|
||||
if (SCARG(uap, namelen) > CTL_MAXNAME || SCARG(uap, namelen) < 2)
|
||||
return (EINVAL);
|
||||
if (error = copyin(uap->name, &name, uap->namelen * sizeof(int)))
|
||||
if (error =
|
||||
copyin(SCARG(uap, name), &name, SCARG(uap, namelen) * sizeof(int)))
|
||||
return (error);
|
||||
|
||||
switch (name[0]) {
|
||||
|
@ -137,11 +140,11 @@ __sysctl(p, uap, retval)
|
|||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
if (uap->oldlenp &&
|
||||
(error = copyin(uap->oldlenp, &oldlen, sizeof(oldlen))))
|
||||
if (SCARG(uap, oldlenp) &&
|
||||
(error = copyin(SCARG(uap, oldlenp), &oldlen, sizeof(oldlen))))
|
||||
return (error);
|
||||
if (uap->old != NULL) {
|
||||
if (!useracc(uap->old, oldlen, B_WRITE))
|
||||
if (SCARG(uap, old) != NULL) {
|
||||
if (!useracc(SCARG(uap, old), oldlen, B_WRITE))
|
||||
return (EFAULT);
|
||||
while (memlock.sl_lock) {
|
||||
memlock.sl_want = 1;
|
||||
|
@ -150,14 +153,14 @@ __sysctl(p, uap, retval)
|
|||
}
|
||||
memlock.sl_lock = 1;
|
||||
if (dolock)
|
||||
vslock(uap->old, oldlen);
|
||||
vslock(SCARG(uap, old), oldlen);
|
||||
savelen = oldlen;
|
||||
}
|
||||
error = (*fn)(name + 1, uap->namelen - 1, uap->old, &oldlen,
|
||||
uap->new, uap->newlen, p);
|
||||
if (uap->old != NULL) {
|
||||
error = (*fn)(name + 1, SCARG(uap, namelen) - 1, SCARG(uap, old),
|
||||
&oldlen, SCARG(uap, new), SCARG(uap, newlen), p);
|
||||
if (SCARG(uap, old) != NULL) {
|
||||
if (dolock)
|
||||
vsunlock(uap->old, savelen, B_WRITE);
|
||||
vsunlock(SCARG(uap, old), savelen, B_WRITE);
|
||||
memlock.sl_lock = 0;
|
||||
if (memlock.sl_want) {
|
||||
memlock.sl_want = 0;
|
||||
|
@ -166,8 +169,8 @@ __sysctl(p, uap, retval)
|
|||
}
|
||||
if (error)
|
||||
return (error);
|
||||
if (uap->oldlenp)
|
||||
error = copyout(&oldlen, uap->oldlenp, sizeof(oldlen));
|
||||
if (SCARG(uap, oldlenp))
|
||||
error = copyout(&oldlen, SCARG(uap, oldlenp), sizeof(oldlen));
|
||||
*retval = oldlen;
|
||||
return (0);
|
||||
}
|
||||
|
@ -717,66 +720,71 @@ fill_eproc(p, ep)
|
|||
#define KINFO_LOADAVG (5<<8)
|
||||
#define KINFO_CLOCKRATE (6<<8)
|
||||
|
||||
struct getkerninfo_args {
|
||||
int op;
|
||||
char *where;
|
||||
int *size;
|
||||
int arg;
|
||||
};
|
||||
|
||||
ogetkerninfo(p, uap, retval)
|
||||
compat_43_getkerninfo(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct getkerninfo_args *uap;
|
||||
int *retval;
|
||||
register struct compat_43_getkerninfo_args /* {
|
||||
syscallarg(int) op;
|
||||
syscallarg(char *) where;
|
||||
syscallarg(int *) size;
|
||||
syscallarg(int) arg;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int error, name[5];
|
||||
u_int size;
|
||||
|
||||
if (uap->size &&
|
||||
(error = copyin((caddr_t)uap->size, (caddr_t)&size, sizeof(size))))
|
||||
if (SCARG(uap, size) && (error = copyin((caddr_t)SCARG(uap, size),
|
||||
(caddr_t)&size, sizeof(size))))
|
||||
return (error);
|
||||
|
||||
switch (uap->op & 0xff00) {
|
||||
switch (SCARG(uap, op) & 0xff00) {
|
||||
|
||||
case KINFO_RT:
|
||||
name[0] = PF_ROUTE;
|
||||
name[1] = 0;
|
||||
name[2] = (uap->op & 0xff0000) >> 16;
|
||||
name[3] = uap->op & 0xff;
|
||||
name[4] = uap->arg;
|
||||
error = net_sysctl(name, 5, uap->where, &size, NULL, 0, p);
|
||||
name[2] = (SCARG(uap, op) & 0xff0000) >> 16;
|
||||
name[3] = SCARG(uap, op) & 0xff;
|
||||
name[4] = SCARG(uap, arg);
|
||||
error =
|
||||
net_sysctl(name, 5, SCARG(uap, where), &size, NULL, 0, p);
|
||||
break;
|
||||
|
||||
case KINFO_VNODE:
|
||||
name[0] = KERN_VNODE;
|
||||
error = kern_sysctl(name, 1, uap->where, &size, NULL, 0, p);
|
||||
error =
|
||||
kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
|
||||
break;
|
||||
|
||||
case KINFO_PROC:
|
||||
name[0] = KERN_PROC;
|
||||
name[1] = uap->op & 0xff;
|
||||
name[2] = uap->arg;
|
||||
error = kern_sysctl(name, 3, uap->where, &size, NULL, 0, p);
|
||||
name[1] = SCARG(uap, op) & 0xff;
|
||||
name[2] = SCARG(uap, arg);
|
||||
error =
|
||||
kern_sysctl(name, 3, SCARG(uap, where), &size, NULL, 0, p);
|
||||
break;
|
||||
|
||||
case KINFO_FILE:
|
||||
name[0] = KERN_FILE;
|
||||
error = kern_sysctl(name, 1, uap->where, &size, NULL, 0, p);
|
||||
error =
|
||||
kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
|
||||
break;
|
||||
|
||||
case KINFO_METER:
|
||||
name[0] = VM_METER;
|
||||
error = vm_sysctl(name, 1, uap->where, &size, NULL, 0, p);
|
||||
error =
|
||||
vm_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
|
||||
break;
|
||||
|
||||
case KINFO_LOADAVG:
|
||||
name[0] = VM_LOADAVG;
|
||||
error = vm_sysctl(name, 1, uap->where, &size, NULL, 0, p);
|
||||
error =
|
||||
vm_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
|
||||
break;
|
||||
|
||||
case KINFO_CLOCKRATE:
|
||||
name[0] = KERN_CLOCKRATE;
|
||||
error = kern_sysctl(name, 1, uap->where, &size, NULL, 0, p);
|
||||
error =
|
||||
kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -785,8 +793,8 @@ ogetkerninfo(p, uap, retval)
|
|||
if (error)
|
||||
return (error);
|
||||
*retval = size;
|
||||
if (uap->size)
|
||||
error = copyout((caddr_t)&size, (caddr_t)uap->size,
|
||||
if (SCARG(uap, size))
|
||||
error = copyout((caddr_t)&size, (caddr_t)SCARG(uap, size),
|
||||
sizeof(size));
|
||||
return (error);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_time.c,v 1.10 1994/09/18 21:49:07 mycroft Exp $ */
|
||||
/* $NetBSD: kern_time.c,v 1.11 1994/10/20 04:22:59 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -42,6 +42,9 @@
|
|||
#include <sys/proc.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
/*
|
||||
|
@ -54,42 +57,40 @@
|
|||
* timers when they expire.
|
||||
*/
|
||||
|
||||
struct gettimeofday_args {
|
||||
struct timeval *tp;
|
||||
struct timezone *tzp;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
gettimeofday(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct gettimeofday_args *uap;
|
||||
int *retval;
|
||||
register struct gettimeofday_args /* {
|
||||
syscallarg(struct timeval *) tp;
|
||||
syscallarg(struct timezone *) tzp;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct timeval atv;
|
||||
int error = 0;
|
||||
|
||||
if (uap->tp) {
|
||||
if (SCARG(uap, tp)) {
|
||||
microtime(&atv);
|
||||
if (error = copyout((caddr_t)&atv, (caddr_t)uap->tp,
|
||||
if (error = copyout((caddr_t)&atv, (caddr_t)SCARG(uap, tp),
|
||||
sizeof (atv)))
|
||||
return (error);
|
||||
}
|
||||
if (uap->tzp)
|
||||
error = copyout((caddr_t)&tz, (caddr_t)uap->tzp,
|
||||
if (SCARG(uap, tzp))
|
||||
error = copyout((caddr_t)&tz, (caddr_t)SCARG(uap, tzp),
|
||||
sizeof (tz));
|
||||
return (error);
|
||||
}
|
||||
|
||||
struct settimeofday_args {
|
||||
struct timeval *tv;
|
||||
struct timezone *tzp;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
settimeofday(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct settimeofday_args *uap;
|
||||
int *retval;
|
||||
struct settimeofday_args /* {
|
||||
syscallarg(struct timeval *) tv;
|
||||
syscallarg(struct timezone *) tzp;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct timeval atv, delta;
|
||||
struct timezone atz;
|
||||
|
@ -98,13 +99,13 @@ settimeofday(p, uap, retval)
|
|||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
/* Verify all parameters before changing time. */
|
||||
if (uap->tv &&
|
||||
(error = copyin((caddr_t)uap->tv, (caddr_t)&atv, sizeof(atv))))
|
||||
if (SCARG(uap, tv) && (error = copyin((caddr_t)SCARG(uap, tv),
|
||||
(caddr_t)&atv, sizeof(atv))))
|
||||
return (error);
|
||||
if (uap->tzp &&
|
||||
(error = copyin((caddr_t)uap->tzp, (caddr_t)&atz, sizeof(atz))))
|
||||
if (SCARG(uap, tzp) && (error = copyin((caddr_t)SCARG(uap, tzp),
|
||||
(caddr_t)&atz, sizeof(atz))))
|
||||
return (error);
|
||||
if (uap->tv) {
|
||||
if (SCARG(uap, tv)) {
|
||||
/* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */
|
||||
s = splclock();
|
||||
/* nb. delta.tv_usec may be < 0, but this is OK here */
|
||||
|
@ -120,7 +121,7 @@ settimeofday(p, uap, retval)
|
|||
splx(s);
|
||||
resettodr();
|
||||
}
|
||||
if (uap->tzp)
|
||||
if (SCARG(uap, tzp))
|
||||
tz = atz;
|
||||
return (0);
|
||||
}
|
||||
|
@ -129,16 +130,15 @@ int tickdelta; /* current clock skew, us. per tick */
|
|||
long timedelta; /* unapplied time correction, us. */
|
||||
long bigadj = 1000000; /* use 10x skew above bigadj us. */
|
||||
|
||||
struct adjtime_args {
|
||||
struct timeval *delta;
|
||||
struct timeval *olddelta;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
adjtime(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct adjtime_args *uap;
|
||||
int *retval;
|
||||
register struct adjtime_args /* {
|
||||
syscallarg(struct timeval *) delta;
|
||||
syscallarg(struct timeval *) olddelta;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct timeval atv;
|
||||
register long ndelta, ntickdelta, odelta;
|
||||
|
@ -146,8 +146,8 @@ adjtime(p, uap, retval)
|
|||
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
if (error =
|
||||
copyin((caddr_t)uap->delta, (caddr_t)&atv, sizeof(struct timeval)))
|
||||
if (error = copyin((caddr_t)SCARG(uap, delta), (caddr_t)&atv,
|
||||
sizeof(struct timeval)))
|
||||
return (error);
|
||||
|
||||
/*
|
||||
|
@ -178,10 +178,10 @@ adjtime(p, uap, retval)
|
|||
tickdelta = ntickdelta;
|
||||
splx(s);
|
||||
|
||||
if (uap->olddelta) {
|
||||
if (SCARG(uap, olddelta)) {
|
||||
atv.tv_sec = odelta / 1000000;
|
||||
atv.tv_usec = odelta % 1000000;
|
||||
(void) copyout((caddr_t)&atv, (caddr_t)uap->olddelta,
|
||||
(void) copyout((caddr_t)&atv, (caddr_t)SCARG(uap, olddelta),
|
||||
sizeof(struct timeval));
|
||||
}
|
||||
return (0);
|
||||
|
@ -208,24 +208,23 @@ adjtime(p, uap, retval)
|
|||
* real time timers .it_interval. Rather, we compute the next time in
|
||||
* absolute time the timer should go off.
|
||||
*/
|
||||
struct getitimer_args {
|
||||
u_int which;
|
||||
struct itimerval *itv;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
getitimer(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct getitimer_args *uap;
|
||||
int *retval;
|
||||
register struct getitimer_args /* {
|
||||
syscallarg(u_int) which;
|
||||
syscallarg(struct itimerval *) itv;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct itimerval aitv;
|
||||
int s;
|
||||
|
||||
if (uap->which > ITIMER_PROF)
|
||||
if (SCARG(uap, which) > ITIMER_PROF)
|
||||
return (EINVAL);
|
||||
s = splclock();
|
||||
if (uap->which == ITIMER_REAL) {
|
||||
if (SCARG(uap, which) == ITIMER_REAL) {
|
||||
/*
|
||||
* Convert from absoulte to relative time in .it_value
|
||||
* part of real time timer. If time for real time timer
|
||||
|
@ -240,41 +239,42 @@ getitimer(p, uap, retval)
|
|||
timevalsub(&aitv.it_value,
|
||||
(struct timeval *)&time);
|
||||
} else
|
||||
aitv = p->p_stats->p_timer[uap->which];
|
||||
aitv = p->p_stats->p_timer[SCARG(uap, which)];
|
||||
splx(s);
|
||||
return (copyout((caddr_t)&aitv, (caddr_t)uap->itv,
|
||||
return (copyout((caddr_t)&aitv, (caddr_t)SCARG(uap, itv),
|
||||
sizeof (struct itimerval)));
|
||||
}
|
||||
|
||||
struct setitimer_args {
|
||||
u_int which;
|
||||
struct itimerval *itv, *oitv;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
setitimer(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct setitimer_args *uap;
|
||||
int *retval;
|
||||
register struct setitimer_args /* {
|
||||
syscallarg(u_int) which;
|
||||
syscallarg(struct itimerval *) itv;
|
||||
syscallarg(struct itimerval *) oitv;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct itimerval aitv;
|
||||
register struct itimerval *itvp;
|
||||
int s, error;
|
||||
|
||||
if (uap->which > ITIMER_PROF)
|
||||
if (SCARG(uap, which) > ITIMER_PROF)
|
||||
return (EINVAL);
|
||||
itvp = uap->itv;
|
||||
itvp = SCARG(uap, itv);
|
||||
if (itvp && (error = copyin((caddr_t)itvp, (caddr_t)&aitv,
|
||||
sizeof(struct itimerval))))
|
||||
return (error);
|
||||
if ((uap->itv = uap->oitv) && (error = getitimer(p, uap, retval)))
|
||||
if ((SCARG(uap, itv) = SCARG(uap, oitv)) &&
|
||||
(error = getitimer(p, uap, retval)))
|
||||
return (error);
|
||||
if (itvp == 0)
|
||||
return (0);
|
||||
if (itimerfix(&aitv.it_value) || itimerfix(&aitv.it_interval))
|
||||
return (EINVAL);
|
||||
s = splclock();
|
||||
if (uap->which == ITIMER_REAL) {
|
||||
if (SCARG(uap, which) == ITIMER_REAL) {
|
||||
untimeout(realitexpire, p);
|
||||
if (timerisset(&aitv.it_value)) {
|
||||
timevaladd(&aitv.it_value, (struct timeval *)&time);
|
||||
|
@ -282,7 +282,7 @@ setitimer(p, uap, retval)
|
|||
}
|
||||
p->p_realtimer = aitv;
|
||||
} else
|
||||
p->p_stats->p_timer[uap->which] = aitv;
|
||||
p->p_stats->p_timer[SCARG(uap, which)] = aitv;
|
||||
splx(s);
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_xxx.c,v 1.18 1994/06/29 06:32:50 cgd Exp $ */
|
||||
/* $NetBSD: kern_xxx.c,v 1.19 1994/10/20 04:23:01 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -43,53 +43,51 @@
|
|||
#include <vm/vm.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
struct reboot_args {
|
||||
int opt;
|
||||
};
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
reboot(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct reboot_args *uap;
|
||||
int *retval;
|
||||
struct reboot_args /* {
|
||||
syscallarg(int) opt;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int error;
|
||||
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
boot(uap->opt);
|
||||
boot(SCARG(uap, opt));
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
|
||||
|
||||
struct ogethostname_args {
|
||||
char *hostname;
|
||||
u_int len;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
ogethostname(p, uap, retval)
|
||||
compat_43_gethostname(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct ogethostname_args *uap;
|
||||
int *retval;
|
||||
struct compat_43_gethostname_args /* {
|
||||
syscallarg(char *) hostname;
|
||||
syscallarg(u_int) len;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int name;
|
||||
|
||||
name = KERN_HOSTNAME;
|
||||
return (kern_sysctl(&name, 1, uap->hostname, &uap->len, 0, 0));
|
||||
return (kern_sysctl(&name, 1, SCARG(uap, hostname), &SCARG(uap, len),
|
||||
0, 0));
|
||||
}
|
||||
|
||||
struct osethostname_args {
|
||||
char *hostname;
|
||||
u_int len;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
osethostname(p, uap, retval)
|
||||
compat_43_sethostname(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct osethostname_args *uap;
|
||||
int *retval;
|
||||
register struct compat_43_sethostname_args *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int name;
|
||||
int error;
|
||||
|
@ -97,43 +95,46 @@ osethostname(p, uap, retval)
|
|||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
name = KERN_HOSTNAME;
|
||||
return (kern_sysctl(&name, 1, 0, 0, uap->hostname, uap->len));
|
||||
return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, hostname),
|
||||
SCARG(uap, len)));
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
ogethostid(p, uap, retval)
|
||||
compat_43_gethostid(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*(long *)retval = hostid;
|
||||
*(int32_t *)retval = hostid;
|
||||
return (0);
|
||||
}
|
||||
#endif /* COMPAT_43 || COMPAT_SUNOS */
|
||||
|
||||
#ifdef COMPAT_43
|
||||
struct osethostid_args {
|
||||
long hostid;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
osethostid(p, uap, retval)
|
||||
compat_43_sethostid(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct osethostid_args *uap;
|
||||
int *retval;
|
||||
struct compat_43_sethostid_args /* {
|
||||
syscallarg(int32_t) hostid;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int error;
|
||||
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
hostid = uap->hostid;
|
||||
hostid = SCARG(uap, hostid);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
oquota()
|
||||
compat_43_quota(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
return (ENOSYS);
|
||||
|
@ -141,33 +142,32 @@ oquota()
|
|||
#endif /* COMPAT_43 */
|
||||
|
||||
#if defined(COMPAT_09) || defined(COMPAT_SUNOS) || defined(COMPAT_HPUX)
|
||||
struct ogetdomainname_args {
|
||||
char *domainname;
|
||||
u_int len;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
ogetdomainname(p, uap, retval)
|
||||
compat_09_getdomainname(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct ogetdomainname_args *uap;
|
||||
int *retval;
|
||||
struct compat_09_getdomainname_args /* {
|
||||
syscallarg(char *) domainname;
|
||||
syscallarg(int) len;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int name;
|
||||
|
||||
name = KERN_DOMAINNAME;
|
||||
return (kern_sysctl(&name, 1, uap->domainname, &uap->len, 0, 0));
|
||||
return (kern_sysctl(&name, 1, SCARG(uap, domainname),
|
||||
&SCARG(uap, len), 0, 0));
|
||||
}
|
||||
|
||||
struct osetdomainname_args {
|
||||
char *domainname;
|
||||
u_int len;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
osetdomainname(p, uap, retval)
|
||||
compat_09_setdomainname(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct osetdomainname_args *uap;
|
||||
int *retval;
|
||||
struct compat_09_setdomainname_args /* {
|
||||
syscallarg(char *) domainname;
|
||||
syscallarg(int) len;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int name;
|
||||
int error;
|
||||
|
@ -175,7 +175,8 @@ osetdomainname(p, uap, retval)
|
|||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
name = KERN_DOMAINNAME;
|
||||
return (kern_sysctl(&name, 1, 0, 0, uap->domainname, uap->len));
|
||||
return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, domainname),
|
||||
SCARG(uap, len)));
|
||||
}
|
||||
#endif /* COMPAT_09 || COMPAT_SUNOS || COMPAT_HPUX */
|
||||
|
||||
|
@ -188,15 +189,14 @@ struct outsname {
|
|||
char machine[32];
|
||||
};
|
||||
|
||||
struct ouname_args {
|
||||
struct outsname *name;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
ouname(p, uap, retval)
|
||||
compat_09_uname(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct ouname_args *uap;
|
||||
int *retval;
|
||||
struct compat_09_uname_args /* {
|
||||
syscallarg(struct outsname *) name;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct outsname outsname;
|
||||
char *cp, *dp, *ep;
|
||||
|
@ -217,50 +217,119 @@ ouname(p, uap, retval)
|
|||
*dp++ = *cp;
|
||||
*dp = '\0';
|
||||
strncpy(outsname.machine, MACHINE, sizeof(outsname.machine));
|
||||
return (copyout((caddr_t)&outsname, (caddr_t)uap->name,
|
||||
return (copyout((caddr_t)&outsname, (caddr_t)SCARG(uap, name),
|
||||
sizeof(struct outsname)));
|
||||
}
|
||||
#endif /* COMPAT_09 */
|
||||
|
||||
#ifdef SYSCALL_DEBUG
|
||||
int scdebug = 1; /* XXX */
|
||||
#define SCDEBUG_CALLS 0x0001 /* show calls */
|
||||
#define SCDEBUG_RETURNS 0x0002 /* show returns */
|
||||
#define SCDEBUG_ALL 0x0004 /* even syscalls that are implemented */
|
||||
#define SCDEBUG_SHOWARGS 0x0008 /* show arguments to calls */
|
||||
|
||||
int scdebug = SCDEBUG_CALLS|SCDEBUG_RETURNS|SCDEBUG_SHOWARGS;
|
||||
|
||||
extern int nsysent;
|
||||
extern char *syscallnames[];
|
||||
|
||||
#ifdef COMPAT_OSF1
|
||||
extern int nosf1_sysent;
|
||||
extern struct sysent osf1_sysent[];
|
||||
extern char *osf1_syscallnames[];
|
||||
#endif /* COMPAT_OSF1 */
|
||||
|
||||
static struct os_syscall {
|
||||
char *name;
|
||||
int *nsysent;
|
||||
struct sysent *sysent;
|
||||
char **syscallnames;
|
||||
} os_syscall[] = {
|
||||
{ "NetBSD", &nsysent, sysent, syscallnames },
|
||||
{ 0 },
|
||||
{ 0 },
|
||||
{ 0 },
|
||||
{ 0 },
|
||||
{ 0 },
|
||||
#ifdef COMPAT_OSF1
|
||||
{ "OSF/1", &nosf1_sysent, osf1_sysent, osf1_syscallnames },
|
||||
#else
|
||||
{ NULL, },
|
||||
#endif
|
||||
};
|
||||
|
||||
void
|
||||
scdebug_call(p, code, narg, args)
|
||||
scdebug_call(p, code, args)
|
||||
struct proc *p;
|
||||
int code, narg, *args;
|
||||
int code;
|
||||
register_t *args;
|
||||
{
|
||||
struct os_syscall *os;
|
||||
struct sysent *sy;
|
||||
int i;
|
||||
|
||||
if (!scdebug)
|
||||
if (!(scdebug & SCDEBUG_CALLS))
|
||||
return;
|
||||
|
||||
printf("proc %d: syscall ", p->p_pid);
|
||||
if (code < 0 || code >= nsysent) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (p->p_emul > sizeof os_syscall/sizeof os_syscall[0] ||
|
||||
os_syscall[p->p_emul].name == NULL)
|
||||
panic("bogus p_emul");
|
||||
#endif
|
||||
|
||||
os = &os_syscall[p->p_emul];
|
||||
sy = &os->sysent[code];
|
||||
if (!(scdebug & SCDEBUG_ALL || code < 0 || code >= *os->nsysent ||
|
||||
sy->sy_call == nosys))
|
||||
return;
|
||||
|
||||
printf("proc %d (%s): %s syscall ", p->p_pid, p->p_comm, os->name);
|
||||
if (code < 0 || code >= *os->nsysent) {
|
||||
printf("OUT OF RANGE (%d)", code);
|
||||
code = 0;
|
||||
} else
|
||||
printf("%d", code);
|
||||
printf(" called: %s(", syscallnames[code]);
|
||||
for (i = 0; i < narg; i++)
|
||||
printf("0x%x, ", args[i]);
|
||||
printf(")\n");
|
||||
printf(" called: %s", os->syscallnames[code]);
|
||||
if (scdebug & SCDEBUG_SHOWARGS) {
|
||||
printf("(");
|
||||
for (i = 0; i < sy->sy_argsize / sizeof(register_t); i++)
|
||||
printf("%s0x%lx", i == 0 ? "" : ", ", (long)args[i]);
|
||||
printf(")");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void
|
||||
scdebug_ret(p, code, error, retval)
|
||||
struct proc *p;
|
||||
int code, error, retval;
|
||||
int code, error;
|
||||
register_t *retval;
|
||||
{
|
||||
if (!scdebug)
|
||||
struct os_syscall *os;
|
||||
struct sysent *sy;
|
||||
|
||||
if (!(scdebug & SCDEBUG_RETURNS))
|
||||
return;
|
||||
|
||||
printf("proc %d: syscall ", p->p_pid);
|
||||
if (code < 0 || code >= nsysent) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (p->p_emul > sizeof os_syscall/sizeof os_syscall[0] ||
|
||||
os_syscall[p->p_emul].name == NULL)
|
||||
panic("bogus p_emul");
|
||||
#endif
|
||||
|
||||
os = &os_syscall[p->p_emul];
|
||||
sy = &os->sysent[code];
|
||||
if (!(scdebug & SCDEBUG_ALL || code < 0 || code >= *os->nsysent ||
|
||||
sy->sy_call == nosys))
|
||||
return;
|
||||
|
||||
printf("proc %d (%s): %s syscall ", p->p_pid, p->p_comm, os->name);
|
||||
if (code < 0 || code >= *os->nsysent) {
|
||||
printf("OUT OF RANGE (%d)", code);
|
||||
code = 0;
|
||||
} else
|
||||
printf("%d", code);
|
||||
printf(" return: error = %d, retval = %d\n", error, retval);
|
||||
printf(" return: error = %d, retval = 0x%lx,0x%lx\n", error,
|
||||
(long)retval[0], (long)retval[1]);
|
||||
}
|
||||
#endif /* SYSCALL_DEBUG */
|
||||
|
|
|
@ -1,196 +1,364 @@
|
|||
#! /bin/sh -
|
||||
# $NetBSD: makesyscalls.sh,v 1.10 1994/06/30 16:43:01 cgd Exp $
|
||||
# $NetBSD: makesyscalls.sh,v 1.11 1994/10/20 04:23:02 cgd Exp $
|
||||
#
|
||||
# @(#)makesyscalls.sh 8.1 (Berkeley) 6/10/93
|
||||
|
||||
set -e
|
||||
|
||||
# name of compat option:
|
||||
compat=COMPAT_43
|
||||
ncompat=COMPAT_09
|
||||
|
||||
# output files:
|
||||
sysnames="syscalls.c"
|
||||
syshdr="../sys/syscall.h"
|
||||
syssw="init_sysent.c"
|
||||
|
||||
# tmp files:
|
||||
sysdcl="sysent.dcl"
|
||||
syscompat="sysent.compat"
|
||||
sysncompat="sysent.ncompat"
|
||||
sysent="sysent.switch"
|
||||
|
||||
trap "rm $sysdcl $syscompat $sysncompat $sysent" 0
|
||||
|
||||
case $# in
|
||||
0) echo "Usage: $0 input-file" 1>&2
|
||||
2) ;;
|
||||
*) echo "Usage: $0 config-file input-file" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
awk < $1 "
|
||||
BEGIN {
|
||||
sysdcl = \"$sysdcl\"
|
||||
syscompat = \"$syscompat\"
|
||||
sysncompat = \"$sysncompat\"
|
||||
sysent = \"$sysent\"
|
||||
sysnames = \"$sysnames\"
|
||||
syshdr = \"$syshdr\"
|
||||
compat = \"$compat\"
|
||||
ncompat = \"$ncompat\"
|
||||
infile = \"$1\"
|
||||
"'
|
||||
# source the config file.
|
||||
. $1
|
||||
|
||||
printf "/*\n * System call switch table.\n *\n" > sysdcl
|
||||
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl
|
||||
# the config file sets the following variables:
|
||||
# sysnames the syscall names file
|
||||
# sysnumhdr the syscall numbers file
|
||||
# syssw the syscall switch file
|
||||
# sysarghdr the syscall argument struct definitions
|
||||
# compatopts those syscall types that are for 'compat' syscalls
|
||||
# switchname the name for the 'struct sysent' we define
|
||||
# namesname the name for the 'char *[]' we define
|
||||
# constprefix the prefix for the system call constants
|
||||
#
|
||||
# NOTE THAT THIS makesyscalls.sh DOES NOT SUPPORT 'LIBCOMPAT'.
|
||||
|
||||
printf "\n#ifdef %s\n", compat > syscompat
|
||||
printf "#define compat(n, name) n, __CONCAT(o,name)\n\n" > syscompat
|
||||
# tmp files:
|
||||
sysdcl="sysent.dcl"
|
||||
syscompat_pref="sysent."
|
||||
sysent="sysent.switch"
|
||||
|
||||
printf "\n#ifdef %s\n", ncompat > sysncompat
|
||||
printf "#define ncompat(n, name) n, __CONCAT(o,name)\n\n" > sysncompat
|
||||
syscompat_files=""
|
||||
for file in $compatopts; do
|
||||
syscompat_files="$syscompat_files $syscompat_pref$file"
|
||||
done
|
||||
|
||||
printf "/*\n * System call names.\n *\n" > sysnames
|
||||
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
|
||||
trap "rm $sysdcl $syscompat_files $sysent" 0
|
||||
|
||||
printf "/*\n * System call numbers.\n *\n" > syshdr
|
||||
printf " * DO NOT EDIT-- this file is automatically generated.\n" > syshdr
|
||||
}
|
||||
NR == 1 {
|
||||
printf " * created from: NetBSD %s %s %s %s\n */\n\n",$2,$3,$4,$5 > sysdcl
|
||||
printf "#include <sys/param.h>\n" > sysdcl
|
||||
printf "#include <sys/systm.h>\n\n" > sysdcl
|
||||
printf "int\tnosys();\n\n" > sysdcl
|
||||
# Awk program (must support nawk extensions)
|
||||
# Use "awk" at Berkeley, "nawk" or "gawk" elsewhere.
|
||||
awk=${AWK:-awk}
|
||||
|
||||
printf "struct sysent sysent[] = {\n" > sysent
|
||||
# Does this awk have a "toupper" function? (i.e. is it GNU awk)
|
||||
isgawk=`$awk 'BEGIN { print toupper("true"); exit; }' 2>/dev/null`
|
||||
|
||||
printf " * created from: NetBSD %s %s %s %s\n */\n\n",$2,$3,$4,$5 > sysnames
|
||||
printf "char *syscallnames[] = {\n" > sysnames
|
||||
# If this awk does not define "toupper" then define our own.
|
||||
if [ "$isgawk" = TRUE ] ; then
|
||||
# GNU awk provides it.
|
||||
toupper=
|
||||
else
|
||||
# Provide our own toupper()
|
||||
toupper='
|
||||
function toupper(str) {
|
||||
_toupper_cmd = "echo "str" |tr a-z A-Z"
|
||||
_toupper_cmd | getline _toupper_str;
|
||||
close(_toupper_cmd);
|
||||
return _toupper_str;
|
||||
}'
|
||||
fi
|
||||
|
||||
printf " * created from: NetBSD %s %s %s %s\n */\n\n",$2,$3,$4,$5 > syshdr
|
||||
next
|
||||
}
|
||||
NF == 0 || $1 ~ /^;/ {
|
||||
next
|
||||
}
|
||||
$1 ~ /^#[ ]*if/ {
|
||||
print > sysent
|
||||
print > sysdcl
|
||||
print > syscompat
|
||||
print > sysnames
|
||||
savesyscall = syscall
|
||||
next
|
||||
}
|
||||
$1 ~ /^#[ ]*else/ {
|
||||
print > sysent
|
||||
print > sysdcl
|
||||
print > syscompat
|
||||
print > sysnames
|
||||
syscall = savesyscall
|
||||
next
|
||||
}
|
||||
$1 ~ /^#/ {
|
||||
print > sysent
|
||||
print > sysdcl
|
||||
print > syscompat
|
||||
print > sysnames
|
||||
next
|
||||
}
|
||||
syscall != $1 {
|
||||
printf "%s: line %d: syscall number out of sync at %d\n", \
|
||||
infile, NR, syscall
|
||||
printf "line is:\n"
|
||||
print
|
||||
exit 1
|
||||
}
|
||||
{ comment = $4
|
||||
for (i = 5; i <= NF; i++)
|
||||
comment = comment " " $i
|
||||
if (NF < 5)
|
||||
$5 = $4
|
||||
}
|
||||
$2 == "STD" || $2 == "NODEF" {
|
||||
printf("int\t%s();\n", $4) > sysdcl
|
||||
printf("\t{ %d, %s },\t\t\t/* %d = %s */\n", \
|
||||
$3, $4, syscall, $5) > sysent
|
||||
printf("\t\"%s\",\t\t\t/* %d = %s */\n", \
|
||||
$5, syscall, $5) > sysnames
|
||||
if ($2 == "STD")
|
||||
printf("#define\tSYS_%s\t%d\n", \
|
||||
$5, syscall) > syshdr
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
$2 == "COMPAT" {
|
||||
printf("int\to%s();\n", $4) > syscompat
|
||||
printf("\t{ compat(%d,%s) },\t\t/* %d = old %s */\n", \
|
||||
$3, $4, syscall, $5) > sysent
|
||||
printf("\t\"old.%s\",\t\t/* %d = old %s */\n", \
|
||||
$5, syscall, $5) > sysnames
|
||||
printf("\t\t\t\t/* %d is old %s */\n", \
|
||||
syscall, comment) > syshdr
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
$2 == "NCOMPAT" {
|
||||
printf("int\to%s();\n", $4) > sysncompat
|
||||
printf("\t{ ncompat(%d,%s) },\t\t/* %d = old %s */\n", \
|
||||
$3, $4, syscall, $5) > sysent
|
||||
printf("\t\"old.%s\",\t\t/* %d = old %s */\n", \
|
||||
$5, syscall, $5) > sysnames
|
||||
printf("\t\t\t\t/* %d is old %s */\n", \
|
||||
syscall, comment) > syshdr
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
$2 == "LIBCOMPAT" {
|
||||
printf("int\to%s();\n", $4) > syscompat
|
||||
printf("\t{ compat(%d,%s) },\t\t/* %d = old %s */\n", \
|
||||
$3, $4, syscall, $5) > sysent
|
||||
printf("\t\"old.%s\",\t\t/* %d = old %s */\n", \
|
||||
$5, syscall, $5) > sysnames
|
||||
printf("#define\tSYS_%s\t%d\t/* compatibility; still used by libc */\n", \
|
||||
$5, syscall) > syshdr
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
$2 == "OBSOL" {
|
||||
printf("\t{ 0, nosys },\t\t\t/* %d = obsolete %s */\n", \
|
||||
syscall, comment) > sysent
|
||||
printf("\t\"obs_%s\",\t\t\t/* %d = obsolete %s */\n", \
|
||||
$4, syscall, comment) > sysnames
|
||||
printf("\t\t\t\t/* %d is obsolete %s */\n", \
|
||||
syscall, comment) > syshdr
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
$2 == "UNIMPL" {
|
||||
printf("\t{ 0, nosys },\t\t\t/* %d = %s */\n", \
|
||||
syscall, comment) > sysent
|
||||
printf("\t\"#%d\",\t\t\t/* %d = %s */\n", \
|
||||
syscall, syscall, comment) > sysnames
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
{
|
||||
printf "%s: line %d: unrecognized keyword %s\n", infile, NR, $2
|
||||
exit 1
|
||||
}
|
||||
END {
|
||||
printf("\n#else /* %s */\n", compat) > syscompat
|
||||
printf("#define compat(n, name) 0, nosys\n") > syscompat
|
||||
printf("#endif /* %s */\n\n", compat) > syscompat
|
||||
# before handing it off to awk, make a few adjustments:
|
||||
# (1) insert spaces around {, }, (, ), *, and commas.
|
||||
# (2) get rid of any and all dollar signs (so that rcs id use safe)
|
||||
#
|
||||
# The awk script will deal with blank lines and lines that
|
||||
# start with the comment character (';').
|
||||
|
||||
printf("\n#else /* %s */\n", compat) > sysncompat
|
||||
printf("#define ncompat(n, name) 0, nosys\n") > sysncompat
|
||||
printf("#endif /* %s */\n\n", compat) > sysncompat
|
||||
sed -e '
|
||||
s/\$//g
|
||||
:join
|
||||
/\\$/{a\
|
||||
|
||||
printf("};\n\n") > sysent
|
||||
printf("int\tnsysent = sizeof(sysent) / sizeof(sysent[0]);\n") > sysent
|
||||
N
|
||||
s/\\\n//
|
||||
b join
|
||||
}
|
||||
2,${
|
||||
/^#/!s/\([{}()*,]\)/ \1 /g
|
||||
}
|
||||
' < $2 | $awk "
|
||||
$toupper
|
||||
BEGIN {
|
||||
sysnames = \"$sysnames\"
|
||||
sysnumhdr = \"$sysnumhdr\"
|
||||
sysarghdr = \"$sysarghdr\"
|
||||
switchname = \"$switchname\"
|
||||
namesname = \"$namesname\"
|
||||
constprefix = \"$constprefix\"
|
||||
|
||||
printf("};\n") > sysnames
|
||||
} '
|
||||
sysdcl = \"$sysdcl\"
|
||||
syscompat_pref = \"$syscompat_pref\"
|
||||
sysent = \"$sysent\"
|
||||
infile = \"$2\"
|
||||
|
||||
cat $sysdcl $syscompat $sysncompat $sysent >$syssw
|
||||
compatopts = \"$compatopts\"
|
||||
"'
|
||||
|
||||
printf "/*\n * System call switch table.\n *\n" > sysdcl
|
||||
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl
|
||||
|
||||
ncompat = split(compatopts,compat)
|
||||
for (i = 1; i <= ncompat; i++) {
|
||||
compat_upper[i] = toupper(compat[i])
|
||||
compat_file[i] = sprintf("%s%s", syscompat_pref, compat[i])
|
||||
|
||||
printf "\n#ifdef %s\n", compat_upper[i] > compat_file[i]
|
||||
printf "#define %s(func) __CONCAT(%s_,func)\n\n", \
|
||||
compat[i], compat[i] > compat_file[i]
|
||||
}
|
||||
|
||||
printf "/*\n * System call names.\n *\n" > sysnames
|
||||
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
|
||||
|
||||
printf "/*\n * System call numbers.\n *\n" > sysnumhdr
|
||||
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnumhdr
|
||||
|
||||
printf "/*\n * System call numbers.\n *\n" > sysarghdr
|
||||
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysarghdr
|
||||
}
|
||||
NR == 1 {
|
||||
printf " * created from%s\n */\n\n", $0 > sysdcl
|
||||
|
||||
printf "#define\ts(type)\tsizeof(type)\n\n" > sysent
|
||||
printf "struct sysent %s[] = {\n",switchname > sysent
|
||||
|
||||
printf " * created from%s\n */\n\n", $0 > sysnames
|
||||
printf "char *%s[] = {\n",namesname > sysnames
|
||||
|
||||
printf " * created from%s\n */\n\n", $0 > sysnumhdr
|
||||
|
||||
printf " * created from%s\n */\n\n", $0 > sysarghdr
|
||||
printf "#define\tsyscallarg(x)\tunion { x datum; register_t pad; }\n" \
|
||||
> sysarghdr
|
||||
next
|
||||
}
|
||||
NF == 0 || $1 ~ /^;/ {
|
||||
next
|
||||
}
|
||||
$1 ~ /^#[ ]*include/ {
|
||||
print > sysdcl
|
||||
next
|
||||
}
|
||||
$1 ~ /^#[ ]*if/ {
|
||||
print > sysent
|
||||
print > sysdcl
|
||||
for (i = 1; i <= ncompat; i++)
|
||||
print > compat_file[i]
|
||||
print > sysnames
|
||||
savesyscall = syscall
|
||||
next
|
||||
}
|
||||
$1 ~ /^#[ ]*else/ {
|
||||
print > sysent
|
||||
print > sysdcl
|
||||
for (i = 1; i <= ncompat; i++)
|
||||
print > compat_file[i]
|
||||
print > sysnames
|
||||
syscall = savesyscall
|
||||
next
|
||||
}
|
||||
$1 ~ /^#/ {
|
||||
print > sysent
|
||||
print > sysdcl
|
||||
for (i = 1; i <= ncompat; i++)
|
||||
print > compat_file[i]
|
||||
print > sysnames
|
||||
next
|
||||
}
|
||||
syscall != $1 {
|
||||
printf "%s: line %d: syscall number out of sync at %d\n", \
|
||||
infile, NR, syscall
|
||||
printf "line is:\n"
|
||||
print
|
||||
exit 1
|
||||
}
|
||||
function parserr(was, wanted) {
|
||||
printf "%s: line %d: unexpected %s (expected %s)\n", \
|
||||
infile, NR, was, wanted
|
||||
exit 1
|
||||
}
|
||||
function parseline() {
|
||||
f=3 # toss number and type
|
||||
if ($NF != "}") {
|
||||
funcalias=$NF
|
||||
end=NF-1
|
||||
} else {
|
||||
funcalias=""
|
||||
end=NF
|
||||
}
|
||||
if ($f != "{")
|
||||
parserr($f, "{")
|
||||
f++
|
||||
if ($end != "}")
|
||||
parserr($end, "}")
|
||||
end--
|
||||
if ($end != ";")
|
||||
parserr($end, ";")
|
||||
end--
|
||||
if ($end != ")")
|
||||
parserr($end, ")")
|
||||
end--
|
||||
|
||||
f++ # toss return type
|
||||
|
||||
funcname=$f
|
||||
if (funcalias == "")
|
||||
funcalias=funcname
|
||||
f++
|
||||
|
||||
if ($f != "(")
|
||||
parserr($f, ")")
|
||||
f++
|
||||
|
||||
argc= 0;
|
||||
if (f == end) {
|
||||
if ($f != "void")
|
||||
parserr($f, "argument definition")
|
||||
return
|
||||
}
|
||||
|
||||
while (f <= end) {
|
||||
argc++
|
||||
argtype[argc]=""
|
||||
while (f < end && $(f+1) != ",") {
|
||||
if (argtype[argc] != "")
|
||||
argtype[argc] = argtype[argc]" ";
|
||||
argtype[argc] = argtype[argc]$f;
|
||||
f++
|
||||
}
|
||||
if (argtype[argc] == "")
|
||||
parserr($f, "argument definition")
|
||||
argname[argc]=$f;
|
||||
f += 2; # skip name, and any comma
|
||||
}
|
||||
}
|
||||
function putent(nodefs, declfile, compatwrap) {
|
||||
# output syscall declaration for switch table
|
||||
if (compatwrap == "")
|
||||
printf("int\t%s();\n", funcname) > declfile
|
||||
else
|
||||
printf("int\t%s(%s)();\n", compatwrap, funcname) > declfile
|
||||
|
||||
# output syscall switch entry
|
||||
# printf("\t{ { %d", argc) > sysent
|
||||
# for (i = 1; i <= argc; i++) {
|
||||
# if (i == 5) # wrap the line
|
||||
# printf(",\n\t ") > sysent
|
||||
# else
|
||||
# printf(", ") > sysent
|
||||
# printf("s(%s)", argtypenospc[i]) > sysent
|
||||
# }
|
||||
printf("\t{ %d, ", argc) > sysent
|
||||
if (argc == 0)
|
||||
printf("0") > sysent
|
||||
else if (compatwrap == "")
|
||||
printf("s(struct %s_args)", funcname) > sysent
|
||||
else
|
||||
printf("s(struct %s_%s_args)", compatwrap, funcname) > sysent
|
||||
if (compatwrap == "")
|
||||
wfn = sprintf("%s", funcname);
|
||||
else
|
||||
wfn = sprintf("%s(%s)", compatwrap, funcname);
|
||||
printf(",\n\t %s },", wfn) > sysent
|
||||
for (i = 0; i < (33 - length(wfn)) / 8; i++)
|
||||
printf("\t") > sysent
|
||||
if (compatwrap == "")
|
||||
printf("/* %d = %s */\n", syscall, funcalias) > sysent
|
||||
else
|
||||
printf("/* %d = %s %s */\n", syscall, compatwrap,
|
||||
funcalias) > sysent
|
||||
|
||||
# output syscall name for names table
|
||||
if (compatwrap == "")
|
||||
printf("\t\"%s\",\t\t\t/* %d = %s */\n", funcalias, syscall,
|
||||
funcalias) > sysnames
|
||||
else
|
||||
printf("\t\"%s_%s\",\t/* %d = %s %s */\n", compatwrap,
|
||||
funcalias, syscall, compatwrap, funcalias) > sysnames
|
||||
|
||||
# output syscall number of header, if appropriate
|
||||
if (nodefs == "" || nodefs == "NOARGS")
|
||||
printf("#define\t%s%s\t%d\n", constprefix, funcalias,
|
||||
syscall) > sysnumhdr
|
||||
else if (nodefs != "NODEF")
|
||||
printf("\t\t\t\t/* %d is %s %s */\n", syscall,
|
||||
compatwrap, funcalias) > sysnumhdr
|
||||
|
||||
# output syscall argument structure, if it has arguments
|
||||
if (argc != 0 && nodefs != "NOARGS") {
|
||||
if (compatwrap == "")
|
||||
printf("\nstruct %s_args {\n", funcname) > sysarghdr
|
||||
else
|
||||
printf("\nstruct %s_%s_args {\n", compatwrap,
|
||||
funcname) > sysarghdr
|
||||
for (i = 1; i <= argc; i++)
|
||||
printf("\tsyscallarg(%s) %s;\n", argtype[i],
|
||||
argname[i]) > sysarghdr
|
||||
printf("};\n") > sysarghdr
|
||||
}
|
||||
}
|
||||
$2 == "STD" {
|
||||
parseline()
|
||||
putent("", sysdcl, "")
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
$2 == "NODEF" || $2 == "NOARGS" {
|
||||
parseline()
|
||||
putent($2, sysdcl, "")
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
$2 == "OBSOL" || $2 == "UNIMPL" {
|
||||
if ($2 == "OBSOL")
|
||||
comment="obsolete"
|
||||
else
|
||||
comment="unimplemented"
|
||||
for (i = 3; i <= NF; i++)
|
||||
comment=comment " " $i
|
||||
|
||||
printf("\t{ 0, 0,\n\t nosys },\t\t\t\t/* %d = %s */\n", \
|
||||
syscall, comment) > sysent
|
||||
printf("\t\"#%d (%s)\",\t\t/* %d = %s */\n", \
|
||||
syscall, comment, syscall, comment) > sysnames
|
||||
if ($2 != "UNIMPL")
|
||||
printf("\t\t\t\t/* %d is %s */\n", syscall, comment) > sysnumhdr
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
{
|
||||
for (i = 1; i <= ncompat; i++) {
|
||||
if ($2 == compat_upper[i]) {
|
||||
parseline();
|
||||
putent("COMMENT", compat_file[i], compat[i])
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
}
|
||||
printf "%s: line %d: unrecognized keyword %s\n", infile, NR, $2
|
||||
exit 1
|
||||
}
|
||||
END {
|
||||
printf "\n#undef\tsyscallarg\n" > sysarghdr
|
||||
|
||||
for (i = 1; i <= ncompat; i++) {
|
||||
printf("\n#else /* %s */\n", compat_upper[i]) > compat_file[i]
|
||||
printf("#define %s(func) nosys\n", compat[i]) > \
|
||||
compat_file[i]
|
||||
printf("#endif /* %s */\n\n", compat_upper[i]) > compat_file[i]
|
||||
}
|
||||
|
||||
printf("};\n\n") > sysent
|
||||
printf("int\tn%s= sizeof(%s) / sizeof(%s[0]);\n", switchname,
|
||||
switchname, switchname) > sysent
|
||||
|
||||
printf("};\n") > sysnames
|
||||
} '
|
||||
|
||||
cat $sysdcl $syscompat_files $sysent > $syssw
|
||||
|
||||
#chmod 444 $sysnames $syshdr $syssw
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: subr_prof.c,v 1.3 1994/06/29 06:33:01 cgd Exp $ */
|
||||
/* $NetBSD: subr_prof.c,v 1.4 1994/10/20 04:23:04 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
|
@ -40,6 +40,10 @@
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#ifdef GPROF
|
||||
|
@ -141,24 +145,23 @@ sysctl_doprof(name, namelen, oldp, oldlenp, newp, newlen, p)
|
|||
* The scale factor is a fixed point number with 16 bits of fraction, so that
|
||||
* 1.0 is represented as 0x10000. A scale factor of 0 turns off profiling.
|
||||
*/
|
||||
struct profil_args {
|
||||
caddr_t samples;
|
||||
u_int size;
|
||||
u_int offset;
|
||||
u_int scale;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
profil(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct profil_args *uap;
|
||||
int *retval;
|
||||
register struct profil_args /* {
|
||||
syscallarg(caddr_t) samples;
|
||||
syscallarg(u_int) size;
|
||||
syscallarg(u_int) offset;
|
||||
syscallarg(u_int) scale;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct uprof *upp;
|
||||
int s;
|
||||
|
||||
if (uap->scale > (1 << 16))
|
||||
if (SCARG(uap, scale) > (1 << 16))
|
||||
return (EINVAL);
|
||||
if (uap->scale == 0) {
|
||||
if (SCARG(uap, scale) == 0) {
|
||||
stopprofclock(p);
|
||||
return (0);
|
||||
}
|
||||
|
@ -166,10 +169,10 @@ profil(p, uap, retval)
|
|||
|
||||
/* Block profile interrupts while changing state. */
|
||||
s = splstatclock();
|
||||
upp->pr_off = uap->offset;
|
||||
upp->pr_scale = uap->scale;
|
||||
upp->pr_base = uap->samples;
|
||||
upp->pr_size = uap->size;
|
||||
upp->pr_off = SCARG(uap, offset);
|
||||
upp->pr_scale = SCARG(uap, scale);
|
||||
upp->pr_base = SCARG(uap, samples);
|
||||
upp->pr_size = SCARG(uap, size);
|
||||
startprofclock(p);
|
||||
splx(s);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sys_generic.c,v 1.15 1994/06/29 06:33:05 cgd Exp $ */
|
||||
/* $NetBSD: sys_generic.c,v 1.16 1994/10/20 04:23:05 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -55,19 +55,21 @@
|
|||
#include <sys/ktrace.h>
|
||||
#endif
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
/*
|
||||
* Read system call.
|
||||
*/
|
||||
struct read_args {
|
||||
int fd;
|
||||
char *buf;
|
||||
u_int nbyte;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
read(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct read_args *uap;
|
||||
int *retval;
|
||||
register struct read_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(char *) buf;
|
||||
syscallarg(u_int) nbyte;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct file *fp;
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
|
@ -78,15 +80,15 @@ read(p, uap, retval)
|
|||
struct iovec ktriov;
|
||||
#endif
|
||||
|
||||
if (((u_int)uap->fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fd]) == NULL ||
|
||||
if (((u_int)SCARG(uap, fd)) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL ||
|
||||
(fp->f_flag & FREAD) == 0)
|
||||
return (EBADF);
|
||||
aiov.iov_base = (caddr_t)uap->buf;
|
||||
aiov.iov_len = uap->nbyte;
|
||||
aiov.iov_base = (caddr_t)SCARG(uap, buf);
|
||||
aiov.iov_len = SCARG(uap, nbyte);
|
||||
auio.uio_iov = &aiov;
|
||||
auio.uio_iovcnt = 1;
|
||||
auio.uio_resid = uap->nbyte;
|
||||
auio.uio_resid = SCARG(uap, nbyte);
|
||||
auio.uio_rw = UIO_READ;
|
||||
auio.uio_segflg = UIO_USERSPACE;
|
||||
auio.uio_procp = p;
|
||||
|
@ -99,7 +101,7 @@ read(p, uap, retval)
|
|||
if (KTRPOINT(p, KTR_GENIO))
|
||||
ktriov = aiov;
|
||||
#endif
|
||||
cnt = uap->nbyte;
|
||||
cnt = SCARG(uap, nbyte);
|
||||
if (error = (*fp->f_ops->fo_read)(fp, &auio, fp->f_cred))
|
||||
if (auio.uio_resid != cnt && (error == ERESTART ||
|
||||
error == EINTR || error == EWOULDBLOCK))
|
||||
|
@ -107,7 +109,8 @@ read(p, uap, retval)
|
|||
cnt -= auio.uio_resid;
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(p, KTR_GENIO) && error == 0)
|
||||
ktrgenio(p->p_tracep, uap->fd, UIO_READ, &ktriov, cnt, error);
|
||||
ktrgenio(p->p_tracep, SCARG(uap, fd), UIO_READ, &ktriov,
|
||||
cnt, error);
|
||||
#endif
|
||||
*retval = cnt;
|
||||
return (error);
|
||||
|
@ -116,15 +119,14 @@ read(p, uap, retval)
|
|||
/*
|
||||
* Scatter read system call.
|
||||
*/
|
||||
struct readv_args {
|
||||
int fdes;
|
||||
struct iovec *iovp;
|
||||
u_int iovcnt;
|
||||
};
|
||||
readv(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct readv_args *uap;
|
||||
int *retval;
|
||||
register struct readv_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(struct iovec *) iovp;
|
||||
syscallarg(u_int) iovcnt;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct file *fp;
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
|
@ -138,14 +140,14 @@ readv(p, uap, retval)
|
|||
struct iovec *ktriov = NULL;
|
||||
#endif
|
||||
|
||||
if (((u_int)uap->fdes) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fdes]) == NULL ||
|
||||
if (((u_int)SCARG(uap, fd)) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL ||
|
||||
(fp->f_flag & FREAD) == 0)
|
||||
return (EBADF);
|
||||
/* note: can't use iovlen until iovcnt is validated */
|
||||
iovlen = uap->iovcnt * sizeof (struct iovec);
|
||||
if (uap->iovcnt > UIO_SMALLIOV) {
|
||||
if (uap->iovcnt > UIO_MAXIOV)
|
||||
iovlen = SCARG(uap, iovcnt) * sizeof (struct iovec);
|
||||
if (SCARG(uap, iovcnt) > UIO_SMALLIOV) {
|
||||
if (SCARG(uap, iovcnt) > UIO_MAXIOV)
|
||||
return (EINVAL);
|
||||
MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK);
|
||||
needfree = iov;
|
||||
|
@ -154,14 +156,14 @@ readv(p, uap, retval)
|
|||
needfree = NULL;
|
||||
}
|
||||
auio.uio_iov = iov;
|
||||
auio.uio_iovcnt = uap->iovcnt;
|
||||
auio.uio_iovcnt = SCARG(uap, iovcnt);
|
||||
auio.uio_rw = UIO_READ;
|
||||
auio.uio_segflg = UIO_USERSPACE;
|
||||
auio.uio_procp = p;
|
||||
if (error = copyin((caddr_t)uap->iovp, (caddr_t)iov, iovlen))
|
||||
if (error = copyin((caddr_t)SCARG(uap, iovp), (caddr_t)iov, iovlen))
|
||||
goto done;
|
||||
auio.uio_resid = 0;
|
||||
for (i = 0; i < uap->iovcnt; i++) {
|
||||
for (i = 0; i < SCARG(uap, iovcnt); i++) {
|
||||
if (iov->iov_len < 0) {
|
||||
error = EINVAL;
|
||||
goto done;
|
||||
|
@ -191,7 +193,7 @@ readv(p, uap, retval)
|
|||
#ifdef KTRACE
|
||||
if (ktriov != NULL) {
|
||||
if (error == 0)
|
||||
ktrgenio(p->p_tracep, uap->fdes, UIO_READ, ktriov,
|
||||
ktrgenio(p->p_tracep, SCARG(uap, fd), UIO_READ, ktriov,
|
||||
cnt, error);
|
||||
FREE(ktriov, M_TEMP);
|
||||
}
|
||||
|
@ -206,15 +208,14 @@ done:
|
|||
/*
|
||||
* Write system call
|
||||
*/
|
||||
struct write_args {
|
||||
int fd;
|
||||
char *buf;
|
||||
u_int nbyte;
|
||||
};
|
||||
write(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct write_args *uap;
|
||||
int *retval;
|
||||
register struct write_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(char *) buf;
|
||||
syscallarg(u_int) nbyte;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct file *fp;
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
|
@ -225,15 +226,15 @@ write(p, uap, retval)
|
|||
struct iovec ktriov;
|
||||
#endif
|
||||
|
||||
if (((u_int)uap->fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fd]) == NULL ||
|
||||
if (((u_int)SCARG(uap, fd)) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL ||
|
||||
(fp->f_flag & FWRITE) == 0)
|
||||
return (EBADF);
|
||||
aiov.iov_base = (caddr_t)uap->buf;
|
||||
aiov.iov_len = uap->nbyte;
|
||||
aiov.iov_base = (caddr_t)SCARG(uap, buf);
|
||||
aiov.iov_len = SCARG(uap, nbyte);
|
||||
auio.uio_iov = &aiov;
|
||||
auio.uio_iovcnt = 1;
|
||||
auio.uio_resid = uap->nbyte;
|
||||
auio.uio_resid = SCARG(uap, nbyte);
|
||||
auio.uio_rw = UIO_WRITE;
|
||||
auio.uio_segflg = UIO_USERSPACE;
|
||||
auio.uio_procp = p;
|
||||
|
@ -246,7 +247,7 @@ write(p, uap, retval)
|
|||
if (KTRPOINT(p, KTR_GENIO))
|
||||
ktriov = aiov;
|
||||
#endif
|
||||
cnt = uap->nbyte;
|
||||
cnt = SCARG(uap, nbyte);
|
||||
if (error = (*fp->f_ops->fo_write)(fp, &auio, fp->f_cred)) {
|
||||
if (auio.uio_resid != cnt && (error == ERESTART ||
|
||||
error == EINTR || error == EWOULDBLOCK))
|
||||
|
@ -257,7 +258,7 @@ write(p, uap, retval)
|
|||
cnt -= auio.uio_resid;
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(p, KTR_GENIO) && error == 0)
|
||||
ktrgenio(p->p_tracep, uap->fd, UIO_WRITE,
|
||||
ktrgenio(p->p_tracep, SCARG(uap, fd), UIO_WRITE,
|
||||
&ktriov, cnt, error);
|
||||
#endif
|
||||
*retval = cnt;
|
||||
|
@ -267,15 +268,14 @@ write(p, uap, retval)
|
|||
/*
|
||||
* Gather write system call
|
||||
*/
|
||||
struct writev_args {
|
||||
int fd;
|
||||
struct iovec *iovp;
|
||||
u_int iovcnt;
|
||||
};
|
||||
writev(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct writev_args *uap;
|
||||
int *retval;
|
||||
register struct writev_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(struct iovec *) iovp;
|
||||
syscallarg(u_int) iovcnt;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct file *fp;
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
|
@ -289,14 +289,14 @@ writev(p, uap, retval)
|
|||
struct iovec *ktriov = NULL;
|
||||
#endif
|
||||
|
||||
if (((u_int)uap->fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fd]) == NULL ||
|
||||
if (((u_int)SCARG(uap, fd)) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL ||
|
||||
(fp->f_flag & FWRITE) == 0)
|
||||
return (EBADF);
|
||||
/* note: can't use iovlen until iovcnt is validated */
|
||||
iovlen = uap->iovcnt * sizeof (struct iovec);
|
||||
if (uap->iovcnt > UIO_SMALLIOV) {
|
||||
if (uap->iovcnt > UIO_MAXIOV)
|
||||
iovlen = SCARG(uap, iovcnt) * sizeof (struct iovec);
|
||||
if (SCARG(uap, iovcnt) > UIO_SMALLIOV) {
|
||||
if (SCARG(uap, iovcnt) > UIO_MAXIOV)
|
||||
return (EINVAL);
|
||||
MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK);
|
||||
needfree = iov;
|
||||
|
@ -305,14 +305,14 @@ writev(p, uap, retval)
|
|||
needfree = NULL;
|
||||
}
|
||||
auio.uio_iov = iov;
|
||||
auio.uio_iovcnt = uap->iovcnt;
|
||||
auio.uio_iovcnt = SCARG(uap, iovcnt);
|
||||
auio.uio_rw = UIO_WRITE;
|
||||
auio.uio_segflg = UIO_USERSPACE;
|
||||
auio.uio_procp = p;
|
||||
if (error = copyin((caddr_t)uap->iovp, (caddr_t)iov, iovlen))
|
||||
if (error = copyin((caddr_t)SCARG(uap, iovp), (caddr_t)iov, iovlen))
|
||||
goto done;
|
||||
auio.uio_resid = 0;
|
||||
for (i = 0; i < uap->iovcnt; i++) {
|
||||
for (i = 0; i < SCARG(uap, iovcnt); i++) {
|
||||
if (iov->iov_len < 0) {
|
||||
error = EINVAL;
|
||||
goto done;
|
||||
|
@ -345,7 +345,7 @@ writev(p, uap, retval)
|
|||
#ifdef KTRACE
|
||||
if (ktriov != NULL) {
|
||||
if (error == 0)
|
||||
ktrgenio(p->p_tracep, uap->fd, UIO_WRITE,
|
||||
ktrgenio(p->p_tracep, SCARG(uap, fd), UIO_WRITE,
|
||||
ktriov, cnt, error);
|
||||
FREE(ktriov, M_TEMP);
|
||||
}
|
||||
|
@ -360,16 +360,15 @@ done:
|
|||
/*
|
||||
* Ioctl system call
|
||||
*/
|
||||
struct ioctl_args {
|
||||
int fd;
|
||||
int com;
|
||||
caddr_t data;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
ioctl(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct ioctl_args *uap;
|
||||
int *retval;
|
||||
register struct ioctl_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(int) com;
|
||||
syscallarg(caddr_t) data;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct file *fp;
|
||||
register struct filedesc *fdp;
|
||||
|
@ -381,19 +380,19 @@ ioctl(p, uap, retval)
|
|||
char stkbuf[STK_PARAMS];
|
||||
|
||||
fdp = p->p_fd;
|
||||
if ((u_int)uap->fd >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fd]) == NULL)
|
||||
if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
||||
return (EBADF);
|
||||
|
||||
if ((fp->f_flag & (FREAD | FWRITE)) == 0)
|
||||
return (EBADF);
|
||||
|
||||
switch (com = uap->com) {
|
||||
switch (com = SCARG(uap, com)) {
|
||||
case FIONCLEX:
|
||||
fdp->fd_ofileflags[uap->fd] &= ~UF_EXCLOSE;
|
||||
fdp->fd_ofileflags[SCARG(uap, fd)] &= ~UF_EXCLOSE;
|
||||
return (0);
|
||||
case FIOCLEX:
|
||||
fdp->fd_ofileflags[uap->fd] |= UF_EXCLOSE;
|
||||
fdp->fd_ofileflags[SCARG(uap, fd)] |= UF_EXCLOSE;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -412,14 +411,14 @@ ioctl(p, uap, retval)
|
|||
data = stkbuf;
|
||||
if (com&IOC_IN) {
|
||||
if (size) {
|
||||
error = copyin(uap->data, data, (u_int)size);
|
||||
error = copyin(SCARG(uap, data), data, (u_int)size);
|
||||
if (error) {
|
||||
if (memp)
|
||||
free(memp, M_IOCTLOPS);
|
||||
return (error);
|
||||
}
|
||||
} else
|
||||
*(caddr_t *)data = uap->data;
|
||||
*(caddr_t *)data = SCARG(uap, data);
|
||||
} else if ((com&IOC_OUT) && size)
|
||||
/*
|
||||
* Zero the buffer so the user always
|
||||
|
@ -427,7 +426,7 @@ ioctl(p, uap, retval)
|
|||
*/
|
||||
bzero(data, size);
|
||||
else if (com&IOC_VOID)
|
||||
*(caddr_t *)data = uap->data;
|
||||
*(caddr_t *)data = SCARG(uap, data);
|
||||
|
||||
switch (com) {
|
||||
|
||||
|
@ -485,7 +484,7 @@ ioctl(p, uap, retval)
|
|||
* already set and checked above.
|
||||
*/
|
||||
if (error == 0 && (com&IOC_OUT) && size)
|
||||
error = copyout(data, uap->data, (u_int)size);
|
||||
error = copyout(data, SCARG(uap, data), (u_int)size);
|
||||
break;
|
||||
}
|
||||
if (memp)
|
||||
|
@ -498,15 +497,16 @@ int selwait, nselcoll;
|
|||
/*
|
||||
* Select system call.
|
||||
*/
|
||||
struct select_args {
|
||||
u_int nd;
|
||||
fd_set *in, *ou, *ex;
|
||||
struct timeval *tv;
|
||||
};
|
||||
select(p, uap, retval)
|
||||
register struct proc *p;
|
||||
register struct select_args *uap;
|
||||
int *retval;
|
||||
register struct select_args /* {
|
||||
syscallarg(u_int) nd;
|
||||
syscallarg(fd_set *) in;
|
||||
syscallarg(fd_set *) ou;
|
||||
syscallarg(fd_set *) ex;
|
||||
syscallarg(struct timeval *) tv;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
fd_set ibits[3], obits[3];
|
||||
struct timeval atv;
|
||||
|
@ -515,23 +515,25 @@ select(p, uap, retval)
|
|||
|
||||
bzero((caddr_t)ibits, sizeof(ibits));
|
||||
bzero((caddr_t)obits, sizeof(obits));
|
||||
if (uap->nd > FD_SETSIZE)
|
||||
if (SCARG(uap, nd) > FD_SETSIZE)
|
||||
return (EINVAL);
|
||||
if (uap->nd > p->p_fd->fd_nfiles)
|
||||
uap->nd = p->p_fd->fd_nfiles; /* forgiving; slightly wrong */
|
||||
ni = howmany(uap->nd, NFDBITS) * sizeof(fd_mask);
|
||||
if (SCARG(uap, nd) > p->p_fd->fd_nfiles) {
|
||||
/* forgiving; slightly wrong */
|
||||
SCARG(uap, nd) = p->p_fd->fd_nfiles;
|
||||
}
|
||||
ni = howmany(SCARG(uap, nd), NFDBITS) * sizeof(fd_mask);
|
||||
|
||||
#define getbits(name, x) \
|
||||
if (uap->name && \
|
||||
(error = copyin((caddr_t)uap->name, (caddr_t)&ibits[x], ni))) \
|
||||
if (SCARG(uap, name) && (error = copyin((caddr_t)SCARG(uap, name), \
|
||||
(caddr_t)&ibits[x], ni))) \
|
||||
goto done;
|
||||
getbits(in, 0);
|
||||
getbits(ou, 1);
|
||||
getbits(ex, 2);
|
||||
#undef getbits
|
||||
|
||||
if (uap->tv) {
|
||||
error = copyin((caddr_t)uap->tv, (caddr_t)&atv,
|
||||
if (SCARG(uap, tv)) {
|
||||
error = copyin((caddr_t)SCARG(uap, tv), (caddr_t)&atv,
|
||||
sizeof (atv));
|
||||
if (error)
|
||||
goto done;
|
||||
|
@ -553,12 +555,12 @@ select(p, uap, retval)
|
|||
retry:
|
||||
ncoll = nselcoll;
|
||||
p->p_flag |= P_SELECT;
|
||||
error = selscan(p, ibits, obits, uap->nd, retval);
|
||||
error = selscan(p, ibits, obits, SCARG(uap, nd), retval);
|
||||
if (error || *retval)
|
||||
goto done;
|
||||
s = splhigh();
|
||||
/* this should be timercmp(&time, &atv, >=) */
|
||||
if (uap->tv && (time.tv_sec > atv.tv_sec ||
|
||||
if (SCARG(uap, tv) && (time.tv_sec > atv.tv_sec ||
|
||||
time.tv_sec == atv.tv_sec && time.tv_usec >= atv.tv_usec)) {
|
||||
splx(s);
|
||||
goto done;
|
||||
|
@ -580,8 +582,8 @@ done:
|
|||
if (error == EWOULDBLOCK)
|
||||
error = 0;
|
||||
#define putbits(name, x) \
|
||||
if (uap->name && \
|
||||
(error2 = copyout((caddr_t)&obits[x], (caddr_t)uap->name, ni))) \
|
||||
if (SCARG(uap, name) && (error2 = copyout((caddr_t)&obits[x], \
|
||||
(caddr_t)SCARG(uap, name), ni))) \
|
||||
error = error2;
|
||||
if (error == 0) {
|
||||
int error2;
|
||||
|
@ -597,7 +599,8 @@ done:
|
|||
selscan(p, ibits, obits, nfd, retval)
|
||||
struct proc *p;
|
||||
fd_set *ibits, *obits;
|
||||
int nfd, *retval;
|
||||
int nfd;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
register int msk, i, j, fd;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sys_process.c,v 1.41 1994/09/24 07:17:18 mycroft Exp $ */
|
||||
/* $NetBSD: sys_process.c,v 1.42 1994/10/20 04:23:08 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -53,12 +53,16 @@
|
|||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <machine/reg.h>
|
||||
|
||||
/* Macros to clear/set/test flags. */
|
||||
|
@ -69,16 +73,16 @@
|
|||
/*
|
||||
* Process debugging system call.
|
||||
*/
|
||||
struct ptrace_args {
|
||||
int req;
|
||||
pid_t pid;
|
||||
caddr_t addr;
|
||||
int data;
|
||||
};
|
||||
int
|
||||
ptrace(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct ptrace_args *uap;
|
||||
int *retval;
|
||||
struct ptrace_args /* {
|
||||
syscallarg(int) req;
|
||||
syscallarg(pid_t) pid;
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(int) data;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct proc *t; /* target process */
|
||||
struct uio uio;
|
||||
|
@ -86,16 +90,16 @@ ptrace(p, uap, retval)
|
|||
int error, step, write;
|
||||
|
||||
/* "A foolish consistency..." XXX */
|
||||
if (uap->req == PT_TRACE_ME)
|
||||
if (SCARG(uap, req) == PT_TRACE_ME)
|
||||
t = p;
|
||||
else {
|
||||
/* Find the process we're supposed to be operating on. */
|
||||
if ((t = pfind(uap->pid)) == NULL)
|
||||
if ((t = pfind(SCARG(uap, pid))) == NULL)
|
||||
return (ESRCH);
|
||||
}
|
||||
|
||||
/* Make sure we can operate on it. */
|
||||
switch (uap->req) {
|
||||
switch (SCARG(uap, req)) {
|
||||
case PT_TRACE_ME:
|
||||
/* Saying that you're being traced is always legal. */
|
||||
break;
|
||||
|
@ -179,7 +183,7 @@ ptrace(p, uap, retval)
|
|||
step = write = 0;
|
||||
*retval = 0;
|
||||
|
||||
switch (uap->req) {
|
||||
switch (SCARG(uap, req)) {
|
||||
case PT_TRACE_ME:
|
||||
/* Just set the trace flag. */
|
||||
SET(t->p_flag, P_TRACED);
|
||||
|
@ -191,11 +195,12 @@ ptrace(p, uap, retval)
|
|||
case PT_READ_I: /* XXX no seperate I and D spaces */
|
||||
case PT_READ_D:
|
||||
/* write = 0 done above. */
|
||||
iov.iov_base = write ? (caddr_t)&uap->data : (caddr_t)retval;
|
||||
iov.iov_base =
|
||||
write ? (caddr_t)&SCARG(uap, data) : (caddr_t)retval;
|
||||
iov.iov_len = sizeof(int);
|
||||
uio.uio_iov = &iov;
|
||||
uio.uio_iovcnt = 1;
|
||||
uio.uio_offset = (off_t)uap->addr;
|
||||
uio.uio_offset = (off_t)SCARG(uap, addr);
|
||||
uio.uio_resid = sizeof(int);
|
||||
uio.uio_segflg = UIO_SYSSPACE;
|
||||
uio.uio_rw = write ? UIO_WRITE : UIO_READ;
|
||||
|
@ -210,11 +215,11 @@ ptrace(p, uap, retval)
|
|||
* almost worthless. Additionally, we _always_ require
|
||||
* that the address be int-aligned.
|
||||
*/
|
||||
if ((u_long)uap->addr > USPACE - sizeof(int) ||
|
||||
if ((u_long)SCARG(uap, addr) > USPACE - sizeof(int) ||
|
||||
#ifdef m68k /* XXX */
|
||||
((u_long)uap->addr & 1) != 0)
|
||||
((u_long)SCARG(uap, addr) & 1) != 0)
|
||||
#else /* !m68k XXX */
|
||||
((u_long)uap->addr & (sizeof(int) - 1)) != 0)
|
||||
((u_long)SCARG(uap, addr) & (sizeof(int) - 1)) != 0)
|
||||
#endif /* !m68k XXX */
|
||||
return (EINVAL);
|
||||
|
||||
|
@ -226,7 +231,8 @@ ptrace(p, uap, retval)
|
|||
fill_eproc(t, &t->p_addr->u_kproc.kp_eproc);
|
||||
|
||||
/* Finally, pull the appropriate int out of the user area. */
|
||||
*retval = *(int *)((caddr_t)t->p_addr + (u_long)uap->addr);
|
||||
*retval =
|
||||
*(int *)((caddr_t)t->p_addr + (u_long)SCARG(uap, addr));
|
||||
return (0);
|
||||
|
||||
case PT_WRITE_U:
|
||||
|
@ -235,16 +241,17 @@ ptrace(p, uap, retval)
|
|||
* reading it. Don't bother filling in the eproc, because
|
||||
* it won't be used for anything anyway.
|
||||
*/
|
||||
if ((u_long)uap->addr > USPACE - sizeof(int) ||
|
||||
if ((u_long)SCARG(uap, addr) > USPACE - sizeof(int) ||
|
||||
#ifdef m68k /* XXX */
|
||||
((u_long)uap->addr & 1) != 0)
|
||||
((u_long)SCARG(uap, addr) & 1) != 0)
|
||||
#else /* !m68k XXX */
|
||||
((u_long)uap->addr & (sizeof(int) - 1)) != 0)
|
||||
((u_long)SCARG(uap, addr) & (sizeof(int) - 1)) != 0)
|
||||
#endif /* !m68k XXX */
|
||||
return (EINVAL);
|
||||
|
||||
/* And write the data. */
|
||||
*(int *)((caddr_t)t->p_addr + (u_long)uap->addr) = uap->data;
|
||||
*(int *)((caddr_t)t->p_addr + (u_long)SCARG(uap, addr)) =
|
||||
SCARG(uap, data);
|
||||
return (0);
|
||||
|
||||
#ifdef PT_STEP
|
||||
|
@ -271,8 +278,8 @@ ptrace(p, uap, retval)
|
|||
*/
|
||||
/* step = 0 done above. */
|
||||
|
||||
/* Check that uap->data is a valid signal number or zero. */
|
||||
if (uap->data < 0 || uap->data >= NSIG)
|
||||
/* Check that the data is a valid signal number or zero. */
|
||||
if (SCARG(uap, data) < 0 || SCARG(uap, data) >= NSIG)
|
||||
return (EINVAL);
|
||||
|
||||
/*
|
||||
|
@ -282,19 +289,19 @@ ptrace(p, uap, retval)
|
|||
return (error);
|
||||
|
||||
/* If the address paramter is not (int *)1, set the pc. */
|
||||
if ((int *)uap->addr != (int *)1)
|
||||
if (error = process_set_pc(t, uap->addr))
|
||||
if ((int *)SCARG(uap, addr) != (int *)1)
|
||||
if (error = process_set_pc(t, SCARG(uap, addr)))
|
||||
return (error);
|
||||
|
||||
/* Finally, deliver the requested signal (or none). */
|
||||
sendsig:
|
||||
t->p_xstat = uap->data;
|
||||
t->p_xstat = SCARG(uap, data);
|
||||
setrunnable(t);
|
||||
return (0);
|
||||
|
||||
case PT_KILL:
|
||||
/* just send the process a KILL signal. */
|
||||
uap->data = SIGKILL;
|
||||
SCARG(uap, data) = SIGKILL;
|
||||
goto sendsig; /* in PT_CONTINUE, above. */
|
||||
|
||||
case PT_ATTACH:
|
||||
|
@ -342,10 +349,10 @@ sendsig:
|
|||
|
||||
/* and deliver any signal requested by tracer. */
|
||||
if (t->p_stat == SSTOP) {
|
||||
t->p_xstat = uap->data;
|
||||
setrunnable(t);
|
||||
} else if (uap->data)
|
||||
psignal(t, uap->data);
|
||||
t->p_xstat = SCARG(uap, data);
|
||||
setrunnable(t);
|
||||
} else if (SCARG(uap, data))
|
||||
psignal(t, SCARG(uap, data));
|
||||
|
||||
return (0);
|
||||
|
||||
|
@ -361,7 +368,7 @@ sendsig:
|
|||
if (!procfs_validregs(t))
|
||||
return (EINVAL);
|
||||
else {
|
||||
iov.iov_base = uap->addr;
|
||||
iov.iov_base = SCARG(uap, addr);
|
||||
iov.iov_len = sizeof(struct reg);
|
||||
uio.uio_iov = &iov;
|
||||
uio.uio_iovcnt = 1;
|
||||
|
@ -386,7 +393,7 @@ sendsig:
|
|||
if (!procfs_validfpregs(t))
|
||||
return (EINVAL);
|
||||
else {
|
||||
iov.iov_base = uap->addr;
|
||||
iov.iov_base = SCARG(uap, addr);
|
||||
iov.iov_len = sizeof(struct fpreg);
|
||||
uio.uio_iov = &iov;
|
||||
uio.uio_iovcnt = 1;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* System call names.
|
||||
*
|
||||
* DO NOT EDIT-- this file is automatically generated.
|
||||
* created from: NetBSD syscalls.master,v 1.22 1994/06/29 06:33:10
|
||||
* created from NetBSD: syscalls.master,v 1.22 1994/06/29 06:33:10 cgd Exp
|
||||
*/
|
||||
|
||||
char *syscallnames[] = {
|
||||
|
@ -14,10 +14,10 @@ char *syscallnames[] = {
|
|||
"open", /* 5 = open */
|
||||
"close", /* 6 = close */
|
||||
"wait4", /* 7 = wait4 */
|
||||
"old.creat", /* 8 = old creat */
|
||||
"compat_43_creat", /* 8 = compat_43 creat */
|
||||
"link", /* 9 = link */
|
||||
"unlink", /* 10 = unlink */
|
||||
"obs_execv", /* 11 = obsolete execv */
|
||||
"#11 (obsolete execv)", /* 11 = obsolete execv */
|
||||
"chdir", /* 12 = chdir */
|
||||
"fchdir", /* 13 = fchdir */
|
||||
"mknod", /* 14 = mknod */
|
||||
|
@ -25,7 +25,7 @@ char *syscallnames[] = {
|
|||
"chown", /* 16 = chown */
|
||||
"break", /* 17 = break */
|
||||
"getfsstat", /* 18 = getfsstat */
|
||||
"old.lseek", /* 19 = old lseek */
|
||||
"compat_43_lseek", /* 19 = compat_43 lseek */
|
||||
"getpid", /* 20 = getpid */
|
||||
"mount", /* 21 = mount */
|
||||
"unmount", /* 22 = unmount */
|
||||
|
@ -44,9 +44,9 @@ char *syscallnames[] = {
|
|||
"fchflags", /* 35 = fchflags */
|
||||
"sync", /* 36 = sync */
|
||||
"kill", /* 37 = kill */
|
||||
"old.stat", /* 38 = old stat */
|
||||
"compat_43_stat", /* 38 = compat_43 stat */
|
||||
"getppid", /* 39 = getppid */
|
||||
"old.lstat", /* 40 = old lstat */
|
||||
"compat_43_lstat", /* 40 = compat_43 lstat */
|
||||
"dup", /* 41 = dup */
|
||||
"pipe", /* 42 = pipe */
|
||||
"getegid", /* 43 = getegid */
|
||||
|
@ -54,7 +54,7 @@ char *syscallnames[] = {
|
|||
#ifdef KTRACE
|
||||
"ktrace", /* 45 = ktrace */
|
||||
#else
|
||||
"#45", /* 45 = ktrace */
|
||||
"#45 (unimplemented ktrace)", /* 45 = unimplemented ktrace */
|
||||
#endif
|
||||
"sigaction", /* 46 = sigaction */
|
||||
"getgid", /* 47 = getgid */
|
||||
|
@ -72,63 +72,63 @@ char *syscallnames[] = {
|
|||
"execve", /* 59 = execve */
|
||||
"umask", /* 60 = umask */
|
||||
"chroot", /* 61 = chroot */
|
||||
"old.fstat", /* 62 = old fstat */
|
||||
"old.getkerninfo", /* 63 = old getkerninfo */
|
||||
"old.getpagesize", /* 64 = old getpagesize */
|
||||
"compat_43_fstat", /* 62 = compat_43 fstat */
|
||||
"compat_43_getkerninfo", /* 63 = compat_43 getkerninfo */
|
||||
"compat_43_getpagesize", /* 64 = compat_43 getpagesize */
|
||||
"msync", /* 65 = msync */
|
||||
"vfork", /* 66 = vfork */
|
||||
"obs_vread", /* 67 = obsolete vread */
|
||||
"obs_vwrite", /* 68 = obsolete vwrite */
|
||||
"#67 (obsolete vread)", /* 67 = obsolete vread */
|
||||
"#68 (obsolete vwrite)", /* 68 = obsolete vwrite */
|
||||
"sbrk", /* 69 = sbrk */
|
||||
"sstk", /* 70 = sstk */
|
||||
"old.mmap", /* 71 = old mmap */
|
||||
"compat_43_mmap", /* 71 = compat_43 mmap */
|
||||
"vadvise", /* 72 = vadvise */
|
||||
"munmap", /* 73 = munmap */
|
||||
"mprotect", /* 74 = mprotect */
|
||||
"madvise", /* 75 = madvise */
|
||||
"obs_vhangup", /* 76 = obsolete vhangup */
|
||||
"obs_vlimit", /* 77 = obsolete vlimit */
|
||||
"#76 (obsolete vhangup)", /* 76 = obsolete vhangup */
|
||||
"#77 (obsolete vlimit)", /* 77 = obsolete vlimit */
|
||||
"mincore", /* 78 = mincore */
|
||||
"getgroups", /* 79 = getgroups */
|
||||
"setgroups", /* 80 = setgroups */
|
||||
"getpgrp", /* 81 = getpgrp */
|
||||
"setpgid", /* 82 = setpgid */
|
||||
"setitimer", /* 83 = setitimer */
|
||||
"old.wait", /* 84 = old wait */
|
||||
"compat_43_wait", /* 84 = compat_43 wait */
|
||||
"swapon", /* 85 = swapon */
|
||||
"getitimer", /* 86 = getitimer */
|
||||
"old.gethostname", /* 87 = old gethostname */
|
||||
"old.sethostname", /* 88 = old sethostname */
|
||||
"old.getdtablesize", /* 89 = old getdtablesize */
|
||||
"compat_43_gethostname", /* 87 = compat_43 gethostname */
|
||||
"compat_43_sethostname", /* 88 = compat_43 sethostname */
|
||||
"compat_43_getdtablesize", /* 89 = compat_43 getdtablesize */
|
||||
"dup2", /* 90 = dup2 */
|
||||
"#91", /* 91 = getdopt */
|
||||
"#91 (unimplemented getdopt)", /* 91 = unimplemented getdopt */
|
||||
"fcntl", /* 92 = fcntl */
|
||||
"select", /* 93 = select */
|
||||
"#94", /* 94 = setdopt */
|
||||
"#94 (unimplemented setdopt)", /* 94 = unimplemented setdopt */
|
||||
"fsync", /* 95 = fsync */
|
||||
"setpriority", /* 96 = setpriority */
|
||||
"socket", /* 97 = socket */
|
||||
"connect", /* 98 = connect */
|
||||
"old.accept", /* 99 = old accept */
|
||||
"compat_43_accept", /* 99 = compat_43 accept */
|
||||
"getpriority", /* 100 = getpriority */
|
||||
"old.send", /* 101 = old send */
|
||||
"old.recv", /* 102 = old recv */
|
||||
"compat_43_send", /* 101 = compat_43 send */
|
||||
"compat_43_recv", /* 102 = compat_43 recv */
|
||||
"sigreturn", /* 103 = sigreturn */
|
||||
"bind", /* 104 = bind */
|
||||
"setsockopt", /* 105 = setsockopt */
|
||||
"listen", /* 106 = listen */
|
||||
"obs_vtimes", /* 107 = obsolete vtimes */
|
||||
"old.sigvec", /* 108 = old sigvec */
|
||||
"old.sigblock", /* 109 = old sigblock */
|
||||
"old.sigsetmask", /* 110 = old sigsetmask */
|
||||
"#107 (obsolete vtimes)", /* 107 = obsolete vtimes */
|
||||
"compat_43_sigvec", /* 108 = compat_43 sigvec */
|
||||
"compat_43_sigblock", /* 109 = compat_43 sigblock */
|
||||
"compat_43_sigsetmask", /* 110 = compat_43 sigsetmask */
|
||||
"sigsuspend", /* 111 = sigsuspend */
|
||||
"old.sigstack", /* 112 = old sigstack */
|
||||
"old.recvmsg", /* 113 = old recvmsg */
|
||||
"old.sendmsg", /* 114 = old sendmsg */
|
||||
"compat_43_sigstack", /* 112 = compat_43 sigstack */
|
||||
"compat_43_recvmsg", /* 113 = compat_43 recvmsg */
|
||||
"compat_43_sendmsg", /* 114 = compat_43 sendmsg */
|
||||
#ifdef TRACE
|
||||
"vtrace", /* 115 = vtrace */
|
||||
#else
|
||||
"obs_vtrace", /* 115 = obsolete vtrace */
|
||||
"#115 (obsolete vtrace)", /* 115 = obsolete vtrace */
|
||||
#endif
|
||||
"gettimeofday", /* 116 = gettimeofday */
|
||||
"getrusage", /* 117 = getrusage */
|
||||
|
@ -136,19 +136,19 @@ char *syscallnames[] = {
|
|||
#ifdef vax
|
||||
"resuba", /* 119 = resuba */
|
||||
#else
|
||||
"#119", /* 119 = nosys */
|
||||
"#119 (unimplemented resuba)", /* 119 = unimplemented resuba */
|
||||
#endif
|
||||
"readv", /* 120 = readv */
|
||||
"writev", /* 121 = writev */
|
||||
"settimeofday", /* 122 = settimeofday */
|
||||
"fchown", /* 123 = fchown */
|
||||
"fchmod", /* 124 = fchmod */
|
||||
"old.recvfrom", /* 125 = old recvfrom */
|
||||
"old.setreuid", /* 126 = old setreuid */
|
||||
"old.setregid", /* 127 = old setregid */
|
||||
"compat_43_recvfrom", /* 125 = compat_43 recvfrom */
|
||||
"compat_43_setreuid", /* 126 = compat_43 setreuid */
|
||||
"compat_43_setregid", /* 127 = compat_43 setregid */
|
||||
"rename", /* 128 = rename */
|
||||
"old.truncate", /* 129 = old truncate */
|
||||
"old.ftruncate", /* 130 = old ftruncate */
|
||||
"compat_43_truncate", /* 129 = compat_43 truncate */
|
||||
"compat_43_ftruncate", /* 130 = compat_43 ftruncate */
|
||||
"flock", /* 131 = flock */
|
||||
"mkfifo", /* 132 = mkfifo */
|
||||
"sendto", /* 133 = sendto */
|
||||
|
@ -157,68 +157,68 @@ char *syscallnames[] = {
|
|||
"mkdir", /* 136 = mkdir */
|
||||
"rmdir", /* 137 = rmdir */
|
||||
"utimes", /* 138 = utimes */
|
||||
"obs_4.2", /* 139 = obsolete 4.2 sigreturn */
|
||||
"#139 (obsolete 4.2 sigreturn)", /* 139 = obsolete 4.2 sigreturn */
|
||||
"adjtime", /* 140 = adjtime */
|
||||
"old.getpeername", /* 141 = old getpeername */
|
||||
"old.gethostid", /* 142 = old gethostid */
|
||||
"old.sethostid", /* 143 = old sethostid */
|
||||
"old.getrlimit", /* 144 = old getrlimit */
|
||||
"old.setrlimit", /* 145 = old setrlimit */
|
||||
"old.killpg", /* 146 = old killpg */
|
||||
"compat_43_getpeername", /* 141 = compat_43 getpeername */
|
||||
"compat_43_gethostid", /* 142 = compat_43 gethostid */
|
||||
"compat_43_sethostid", /* 143 = compat_43 sethostid */
|
||||
"compat_43_getrlimit", /* 144 = compat_43 getrlimit */
|
||||
"compat_43_setrlimit", /* 145 = compat_43 setrlimit */
|
||||
"compat_43_killpg", /* 146 = compat_43 killpg */
|
||||
"setsid", /* 147 = setsid */
|
||||
"quotactl", /* 148 = quotactl */
|
||||
"old.quota", /* 149 = old quota */
|
||||
"old.getsockname", /* 150 = old getsockname */
|
||||
"#151", /* 151 = nosys */
|
||||
"#152", /* 152 = nosys */
|
||||
"#153", /* 153 = nosys */
|
||||
"#154", /* 154 = nosys */
|
||||
"compat_43_quota", /* 149 = compat_43 quota */
|
||||
"compat_43_getsockname", /* 150 = compat_43 getsockname */
|
||||
"#151 (unimplemented)", /* 151 = unimplemented */
|
||||
"#152 (unimplemented)", /* 152 = unimplemented */
|
||||
"#153 (unimplemented)", /* 153 = unimplemented */
|
||||
"#154 (unimplemented)", /* 154 = unimplemented */
|
||||
#if defined(NFSCLIENT) || defined(NFSSERVER)
|
||||
"nfssvc", /* 155 = nfssvc */
|
||||
#else
|
||||
"#155", /* 155 = nosys */
|
||||
"#155 (unimplemented)", /* 155 = unimplemented */
|
||||
#endif
|
||||
"old.getdirentries", /* 156 = old getdirentries */
|
||||
"compat_43_getdirentries", /* 156 = compat_43 getdirentries */
|
||||
"statfs", /* 157 = statfs */
|
||||
"fstatfs", /* 158 = fstatfs */
|
||||
"#159", /* 159 = nosys */
|
||||
"#160", /* 160 = nosys */
|
||||
"#159 (unimplemented)", /* 159 = unimplemented */
|
||||
"#160 (unimplemented)", /* 160 = unimplemented */
|
||||
#ifdef NFSCLIENT
|
||||
"getfh", /* 161 = getfh */
|
||||
#else
|
||||
"#161", /* 161 = nosys */
|
||||
"#161 (unimplemented getfh)", /* 161 = unimplemented getfh */
|
||||
#endif
|
||||
"old.getdomainname", /* 162 = old getdomainname */
|
||||
"old.setdomainname", /* 163 = old setdomainname */
|
||||
"old.uname", /* 164 = old uname */
|
||||
"compat_09_getdomainname", /* 162 = compat_09 getdomainname */
|
||||
"compat_09_setdomainname", /* 163 = compat_09 setdomainname */
|
||||
"compat_09_uname", /* 164 = compat_09 uname */
|
||||
"sysarch", /* 165 = sysarch */
|
||||
"#166", /* 166 = nosys */
|
||||
"#167", /* 167 = nosys */
|
||||
"#168", /* 168 = nosys */
|
||||
#ifdef SYSVSEM
|
||||
"semsys", /* 169 = semsys */
|
||||
"#166 (unimplemented)", /* 166 = unimplemented */
|
||||
"#167 (unimplemented)", /* 167 = unimplemented */
|
||||
"#168 (unimplemented)", /* 168 = unimplemented */
|
||||
#if defined(SYSVSEM) && !defined(alpha)
|
||||
"compat_10_semsys", /* 169 = compat_10 semsys */
|
||||
#else
|
||||
"#169", /* 169 = nosys */
|
||||
"#169 (unimplemented 1.0 semsys)", /* 169 = unimplemented 1.0 semsys */
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
"msgsys", /* 170 = msgsys */
|
||||
#if defined(SYSVMSG) && !defined(alpha)
|
||||
"compat_10_msgsys", /* 170 = compat_10 msgsys */
|
||||
#else
|
||||
"#170", /* 170 = nosys */
|
||||
"#170 (unimplemented 1.0 msgsys)", /* 170 = unimplemented 1.0 msgsys */
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
"shmsys", /* 171 = shmsys */
|
||||
#if defined(SYSVSHM) && !defined(alpha)
|
||||
"compat_10_shmsys", /* 171 = compat_10 shmsys */
|
||||
#else
|
||||
"#171", /* 171 = nosys */
|
||||
"#171 (unimplemented 1.0 shmsys)", /* 171 = unimplemented 1.0 shmsys */
|
||||
#endif
|
||||
"#172", /* 172 = nosys */
|
||||
"#173", /* 173 = nosys */
|
||||
"#174", /* 174 = nosys */
|
||||
"#175", /* 175 = nosys */
|
||||
"#176", /* 176 = nosys */
|
||||
"#177", /* 177 = nosys */
|
||||
"#178", /* 178 = nosys */
|
||||
"#179", /* 179 = nosys */
|
||||
"#180", /* 180 = nosys */
|
||||
"#172 (unimplemented)", /* 172 = unimplemented */
|
||||
"#173 (unimplemented)", /* 173 = unimplemented */
|
||||
"#174 (unimplemented)", /* 174 = unimplemented */
|
||||
"#175 (unimplemented)", /* 175 = unimplemented */
|
||||
"#176 (unimplemented)", /* 176 = unimplemented */
|
||||
"#177 (unimplemented)", /* 177 = unimplemented */
|
||||
"#178 (unimplemented)", /* 178 = unimplemented */
|
||||
"#179 (unimplemented)", /* 179 = unimplemented */
|
||||
"#180 (unimplemented)", /* 180 = unimplemented */
|
||||
"setgid", /* 181 = setgid */
|
||||
"setegid", /* 182 = setegid */
|
||||
"seteuid", /* 183 = seteuid */
|
||||
|
@ -228,17 +228,17 @@ char *syscallnames[] = {
|
|||
"lfs_segclean", /* 186 = lfs_segclean */
|
||||
"lfs_segwait", /* 187 = lfs_segwait */
|
||||
#else
|
||||
"#184", /* 184 = nosys */
|
||||
"#185", /* 185 = nosys */
|
||||
"#186", /* 186 = nosys */
|
||||
"#187", /* 187 = nosys */
|
||||
"#184 (unimplemented)", /* 184 = unimplemented */
|
||||
"#185 (unimplemented)", /* 185 = unimplemented */
|
||||
"#186 (unimplemented)", /* 186 = unimplemented */
|
||||
"#187 (unimplemented)", /* 187 = unimplemented */
|
||||
#endif
|
||||
"stat", /* 188 = stat */
|
||||
"fstat", /* 189 = fstat */
|
||||
"lstat", /* 190 = lstat */
|
||||
"pathconf", /* 191 = pathconf */
|
||||
"fpathconf", /* 192 = fpathconf */
|
||||
"#193", /* 193 = nosys */
|
||||
"#193 (unimplemented)", /* 193 = unimplemented */
|
||||
"getrlimit", /* 194 = getrlimit */
|
||||
"setrlimit", /* 195 = setrlimit */
|
||||
"getdirentries", /* 196 = getdirentries */
|
||||
|
@ -250,11 +250,11 @@ char *syscallnames[] = {
|
|||
"__sysctl", /* 202 = __sysctl */
|
||||
"mlock", /* 203 = mlock */
|
||||
"munlock", /* 204 = munlock */
|
||||
"#205", /* 205 = nosys */
|
||||
"#206", /* 206 = nosys */
|
||||
"#207", /* 207 = nosys */
|
||||
"#208", /* 208 = nosys */
|
||||
"#209", /* 209 = nosys */
|
||||
"#205 (unimplemented)", /* 205 = unimplemented */
|
||||
"#206 (unimplemented)", /* 206 = unimplemented */
|
||||
"#207 (unimplemented)", /* 207 = unimplemented */
|
||||
"#208 (unimplemented)", /* 208 = unimplemented */
|
||||
"#209 (unimplemented)", /* 209 = unimplemented */
|
||||
#ifdef LKM
|
||||
"lkmnosys", /* 210 = lkmnosys */
|
||||
"lkmnosys", /* 211 = lkmnosys */
|
||||
|
@ -267,15 +267,48 @@ char *syscallnames[] = {
|
|||
"lkmnosys", /* 218 = lkmnosys */
|
||||
"lkmnosys", /* 219 = lkmnosys */
|
||||
#else /* !LKM */
|
||||
"#210", /* 210 = nosys */
|
||||
"#211", /* 211 = nosys */
|
||||
"#212", /* 212 = nosys */
|
||||
"#213", /* 213 = nosys */
|
||||
"#214", /* 214 = nosys */
|
||||
"#215", /* 215 = nosys */
|
||||
"#216", /* 216 = nosys */
|
||||
"#217", /* 217 = nosys */
|
||||
"#218", /* 218 = nosys */
|
||||
"#219", /* 219 = nosys */
|
||||
"#210 (unimplemented)", /* 210 = unimplemented */
|
||||
"#211 (unimplemented)", /* 211 = unimplemented */
|
||||
"#212 (unimplemented)", /* 212 = unimplemented */
|
||||
"#213 (unimplemented)", /* 213 = unimplemented */
|
||||
"#214 (unimplemented)", /* 214 = unimplemented */
|
||||
"#215 (unimplemented)", /* 215 = unimplemented */
|
||||
"#216 (unimplemented)", /* 216 = unimplemented */
|
||||
"#217 (unimplemented)", /* 217 = unimplemented */
|
||||
"#218 (unimplemented)", /* 218 = unimplemented */
|
||||
"#219 (unimplemented)", /* 219 = unimplemented */
|
||||
#endif /* !LKM */
|
||||
#ifdef SYSVSEM
|
||||
"__semctl", /* 220 = __semctl */
|
||||
"semget", /* 221 = semget */
|
||||
"semop", /* 222 = semop */
|
||||
"semconfig", /* 223 = semconfig */
|
||||
#else
|
||||
"#220 (unimplemented semctl)", /* 220 = unimplemented semctl */
|
||||
"#221 (unimplemented semget)", /* 221 = unimplemented semget */
|
||||
"#222 (unimplemented semop)", /* 222 = unimplemented semop */
|
||||
"#223 (unimplemented semconfig)", /* 223 = unimplemented semconfig */
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
"msgctl", /* 224 = msgctl */
|
||||
"msgget", /* 225 = msgget */
|
||||
"msgsnd", /* 226 = msgsnd */
|
||||
"msgrcv", /* 227 = msgrcv */
|
||||
#else
|
||||
"#224 (unimplemented msgctl)", /* 224 = unimplemented msgctl */
|
||||
"#225 (unimplemented msgget)", /* 225 = unimplemented msgget */
|
||||
"#226 (unimplemented msgsnd)", /* 226 = unimplemented msgsnd */
|
||||
"#227 (unimplemented msgrcv)", /* 227 = unimplemented msgrcv */
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
"shmat", /* 228 = shmat */
|
||||
"shmctl", /* 229 = shmctl */
|
||||
"shmdt", /* 230 = shmdt */
|
||||
"shmget", /* 231 = shmget */
|
||||
#else
|
||||
"#228 (unimplemented shmat)", /* 228 = unimplemented shmat */
|
||||
"#229 (unimplemented shmctl)", /* 229 = unimplemented shmctl */
|
||||
"#230 (unimplemented shmdt)", /* 230 = unimplemented shmdt */
|
||||
"#231 (unimplemented shmget)", /* 231 = unimplemented shmget */
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
# $Id: syscalls.conf,v 1.1 1994/10/20 04:23:11 cgd Exp $
|
||||
|
||||
sysnames="syscalls.c"
|
||||
sysnumhdr="../sys/syscall.h"
|
||||
syssw="init_sysent.c"
|
||||
sysarghdr="../sys/syscallargs.h"
|
||||
compatopts="compat_43 compat_09 compat_10"
|
||||
libcompatopts=""
|
||||
|
||||
switchname="sysent"
|
||||
namesname="syscallnames"
|
||||
constprefix="SYS_"
|
|
@ -1,26 +1,40 @@
|
|||
$NetBSD: syscalls.master,v 1.22 1994/06/29 06:33:10 cgd Exp $
|
||||
$NetBSD: syscalls.master,v 1.23 1994/10/20 04:23:12 cgd Exp $
|
||||
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
|
||||
; System call name/number master file.
|
||||
; Processed to created init_sysent.c, syscalls.c and syscall.h.
|
||||
|
||||
; Columns: number type nargs name altname/comments
|
||||
; NetBSD system call name/number "master" file.
|
||||
; (See syscalls.conf to see what it is processed into.)
|
||||
;
|
||||
; Fields: number type [type-dependent ...]
|
||||
; number system call number, must be in order
|
||||
; type one of STD, OBSOL, UNIMPL, NODEF, COMPAT, NCOMPAT, LIBCOMPAT
|
||||
; nargs number of arguments
|
||||
; name name of syscall routine
|
||||
; altname name of system call if different
|
||||
; for UNIMPL/OBSOL, name continues with comments
|
||||
|
||||
; type one of STD, OBSOL, UNIMPL, NODEF, NOARGS, or one of
|
||||
; the copatibility options defined in syscalls.conf.
|
||||
;
|
||||
; types:
|
||||
; STD always included
|
||||
; COMPAT included on COMPAT #ifdef
|
||||
; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h
|
||||
; OBSOL obsolete, not included in system, only specifies name
|
||||
; NODEF do everything except include in syscall.h
|
||||
; NCOMPAT included on NetBSD COMPAT #ifdef
|
||||
; UNIMPL not implemented, placeholder only
|
||||
|
||||
; OBSOL obsolete, not included in system
|
||||
; UNIMP unimplemented, not included in system
|
||||
; NODEF included, but don't define the syscall number
|
||||
; NOARGS included, but don't define the syscall args structure
|
||||
;
|
||||
; The compat options are defined in the syscalls.conf file, and the
|
||||
; compat option name is prefixed to the syscall name. Other than
|
||||
; that, they're like NODEF (for 'compat' options), or STD (for
|
||||
; 'libcompat' options).
|
||||
;
|
||||
; The type-dependent arguments are as follows:
|
||||
; For STD, NODEF, NOARGS, and compat syscalls:
|
||||
; { pseudo-proto } [alias]
|
||||
; For other syscalls:
|
||||
; [comment]
|
||||
;
|
||||
; #ifdef's, etc. may be included, and are copied to the output files.
|
||||
; #include's are copied to the syscall switch definition file only.
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
; Reserved/unimplemented system calls in the range 0-150 inclusive
|
||||
; are reserved for use in future Berkeley releases.
|
||||
|
@ -28,285 +42,362 @@
|
|||
; redistributions should be placed in the reserved range at the end
|
||||
; of the current calls.
|
||||
|
||||
0 STD 0 nosys syscall
|
||||
1 STD 1 exit
|
||||
2 STD 0 fork
|
||||
3 STD 3 read
|
||||
4 STD 3 write
|
||||
5 STD 3 open
|
||||
6 STD 1 close
|
||||
7 STD 4 wait4
|
||||
8 COMPAT 2 creat
|
||||
9 STD 2 link
|
||||
10 STD 1 unlink
|
||||
11 OBSOL 2 execv
|
||||
12 STD 1 chdir
|
||||
13 STD 1 fchdir
|
||||
14 STD 3 mknod
|
||||
15 STD 2 chmod
|
||||
16 STD 3 chown
|
||||
17 STD 1 obreak break
|
||||
18 STD 3 getfsstat
|
||||
19 COMPAT 3 lseek
|
||||
20 STD 0 getpid
|
||||
21 STD 4 mount
|
||||
22 STD 2 unmount
|
||||
23 STD 1 setuid
|
||||
24 STD 0 getuid
|
||||
25 STD 0 geteuid
|
||||
26 STD 4 ptrace
|
||||
27 STD 3 recvmsg
|
||||
28 STD 3 sendmsg
|
||||
29 STD 6 recvfrom
|
||||
30 STD 3 accept
|
||||
31 STD 3 getpeername
|
||||
32 STD 3 getsockname
|
||||
33 STD 2 access
|
||||
34 STD 2 chflags
|
||||
35 STD 2 fchflags
|
||||
36 STD 0 sync
|
||||
37 STD 2 kill
|
||||
38 COMPAT 2 stat
|
||||
39 STD 0 getppid
|
||||
40 COMPAT 2 lstat
|
||||
41 STD 2 dup
|
||||
42 STD 0 pipe
|
||||
43 STD 0 getegid
|
||||
44 STD 4 profil
|
||||
0 STD { int nosys(void); } syscall
|
||||
1 STD { int exit(int rval); }
|
||||
2 STD { int fork(void); }
|
||||
3 STD { int read(int fd, char *buf, u_int nbyte); }
|
||||
4 STD { int write(int fd, char *buf, u_int nbyte); }
|
||||
5 STD { int open(char *path, int flags, int mode); }
|
||||
6 STD { int close(int fd); }
|
||||
7 STD { int wait4(int pid, int *status, int options, \
|
||||
struct rusage *rusage); }
|
||||
8 COMPAT_43 { int creat(char *path, int mode); }
|
||||
9 STD { int link(char *path, char *link); }
|
||||
10 STD { int unlink(char *path); }
|
||||
11 OBSOL execv
|
||||
12 STD { int chdir(char *path); }
|
||||
13 STD { int fchdir(int fd); }
|
||||
14 STD { int mknod(char *path, int mode, int dev); }
|
||||
15 STD { int chmod(char *path, int mode); }
|
||||
16 STD { int chown(char *path, int uid, int gid); }
|
||||
17 STD { int obreak(char *nsize); } break
|
||||
18 STD { int getfsstat(struct statfs *buf, long bufsize, \
|
||||
int flags); }
|
||||
19 COMPAT_43 { long lseek(int fd, long offset, int whence); }
|
||||
20 STD { pid_t getpid(void); }
|
||||
21 STD { int mount(char *type, char *path, int flags, \
|
||||
caddr_t data); }
|
||||
22 STD { int unmount(char *path, int flags); }
|
||||
23 STD { int setuid(uid_t uid); }
|
||||
24 STD { uid_t getuid(void); }
|
||||
25 STD { uid_t geteuid(void); }
|
||||
26 STD { int ptrace(int req, pid_t pid, caddr_t addr, \
|
||||
int data); }
|
||||
27 STD { int recvmsg(int s, struct msghdr *msg, int flags); }
|
||||
28 STD { int sendmsg(int s, caddr_t msg, int flags); }
|
||||
29 STD { int recvfrom(int s, caddr_t buf, size_t len, \
|
||||
int flags, caddr_t from, int *fromlenaddr); }
|
||||
30 STD { int accept(int s, caddr_t name, int *anamelen); }
|
||||
31 STD { int getpeername(int fdes, caddr_t asa, int *alen); }
|
||||
32 STD { int getsockname(int fdes, caddr_t asa, int *alen); }
|
||||
33 STD { int access(char *path, int flags); }
|
||||
34 STD { int chflags(char *path, int flags); }
|
||||
35 STD { int fchflags(int fd, int flags); }
|
||||
36 STD { int sync(void); }
|
||||
37 STD { int kill(int pid, int signum); }
|
||||
38 COMPAT_43 { int stat(char *path, struct ostat *ub); }
|
||||
39 STD { pid_t getppid(void); }
|
||||
40 COMPAT_43 { int lstat(char *path, struct ostat *ub); }
|
||||
41 STD { int dup(u_int fd); }
|
||||
42 STD { int pipe(void); }
|
||||
43 STD { gid_t getegid(void); }
|
||||
44 STD { int profil(caddr_t samples, u_int size, \
|
||||
u_int offset, u_int scale); }
|
||||
#ifdef KTRACE
|
||||
45 STD 4 ktrace
|
||||
45 STD { int ktrace(char *fname, int ops, int facs, \
|
||||
int pid); }
|
||||
#else
|
||||
45 UNIMPL 0 ktrace
|
||||
45 UNIMPL ktrace
|
||||
#endif
|
||||
46 STD 3 sigaction
|
||||
47 STD 0 getgid
|
||||
48 STD 2 sigprocmask
|
||||
49 STD 2 getlogin
|
||||
50 STD 1 setlogin
|
||||
51 STD 1 acct
|
||||
52 STD 0 sigpending
|
||||
53 STD 2 sigaltstack
|
||||
54 STD 3 ioctl
|
||||
55 STD 1 reboot
|
||||
56 STD 1 revoke
|
||||
57 STD 2 symlink
|
||||
58 STD 3 readlink
|
||||
59 STD 3 execve
|
||||
60 STD 1 umask
|
||||
61 STD 1 chroot
|
||||
62 COMPAT 2 fstat
|
||||
63 COMPAT 4 getkerninfo
|
||||
64 COMPAT 0 getpagesize
|
||||
65 STD 2 msync
|
||||
66 STD 0 vfork
|
||||
67 OBSOL 0 vread
|
||||
68 OBSOL 0 vwrite
|
||||
69 STD 1 sbrk
|
||||
70 STD 1 sstk
|
||||
71 COMPAT 7 mmap
|
||||
72 STD 1 ovadvise vadvise
|
||||
73 STD 2 munmap
|
||||
74 STD 3 mprotect
|
||||
75 STD 3 madvise
|
||||
76 OBSOL 0 vhangup
|
||||
77 OBSOL 0 vlimit
|
||||
78 STD 3 mincore
|
||||
79 STD 2 getgroups
|
||||
80 STD 2 setgroups
|
||||
81 STD 0 getpgrp
|
||||
82 STD 2 setpgid
|
||||
83 STD 3 setitimer
|
||||
84 COMPAT 0 wait
|
||||
85 STD 1 swapon
|
||||
86 STD 2 getitimer
|
||||
87 COMPAT 2 gethostname
|
||||
88 COMPAT 2 sethostname
|
||||
89 COMPAT 0 getdtablesize
|
||||
90 STD 2 dup2
|
||||
91 UNIMPL 2 getdopt
|
||||
92 STD 3 fcntl
|
||||
93 STD 5 select
|
||||
94 UNIMPL 2 setdopt
|
||||
95 STD 1 fsync
|
||||
96 STD 3 setpriority
|
||||
97 STD 3 socket
|
||||
98 STD 3 connect
|
||||
99 COMPAT 3 accept
|
||||
100 STD 2 getpriority
|
||||
101 COMPAT 4 send
|
||||
102 COMPAT 4 recv
|
||||
103 STD 1 sigreturn
|
||||
104 STD 3 bind
|
||||
105 STD 5 setsockopt
|
||||
106 STD 2 listen
|
||||
107 OBSOL 0 vtimes
|
||||
108 COMPAT 3 sigvec
|
||||
109 COMPAT 1 sigblock
|
||||
110 COMPAT 1 sigsetmask
|
||||
111 STD 1 sigsuspend
|
||||
112 COMPAT 2 sigstack
|
||||
113 COMPAT 3 recvmsg
|
||||
114 COMPAT 3 sendmsg
|
||||
46 STD { int sigaction(int signum, struct sigaction *nsa, \
|
||||
struct sigaction *osa); }
|
||||
47 STD { gid_t getgid(void); }
|
||||
48 STD { int sigprocmask(int how, sigset_t mask); }
|
||||
49 STD { int getlogin(char *namebuf, u_int namelen); }
|
||||
50 STD { int setlogin(char *namebuf); }
|
||||
51 STD { int acct(char *path); }
|
||||
52 STD { int sigpending(void); }
|
||||
53 STD { int sigaltstack(struct sigaltstack *nss, \
|
||||
struct sigaltstack *oss); }
|
||||
54 STD { int ioctl(int fd, u_long com, caddr_t data); }
|
||||
55 STD { int reboot(int opt); }
|
||||
56 STD { int revoke(char *path); }
|
||||
57 STD { int symlink(char *path, char *link); }
|
||||
58 STD { int readlink(char *path, char *buf, int count); }
|
||||
59 STD { int execve(char *path, char **argp, char **envp); }
|
||||
60 STD { int umask(int newmask); }
|
||||
61 STD { int chroot(char *path); }
|
||||
62 COMPAT_43 { int fstat(int fd, struct ostat *sb); }
|
||||
63 COMPAT_43 { int getkerninfo(int op, char *where, int *size, \
|
||||
int arg); }
|
||||
64 COMPAT_43 { int getpagesize(void); }
|
||||
65 STD { int msync(caddr_t addr, int len); }
|
||||
66 STD { int vfork(void); }
|
||||
67 OBSOL vread
|
||||
68 OBSOL vwrite
|
||||
69 STD { int sbrk(int incr); }
|
||||
70 STD { int sstk(int incr); }
|
||||
71 COMPAT_43 { int mmap(caddr_t addr, int len, int prot, \
|
||||
int flags, int fd, long pos); }
|
||||
72 STD { int ovadvise(int anom); } vadvise
|
||||
73 STD { int munmap(caddr_t addr, int len); }
|
||||
74 STD { int mprotect(caddr_t addr, int len, int prot); }
|
||||
75 STD { int madvise(caddr_t addr, int len, int behav); }
|
||||
76 OBSOL vhangup
|
||||
77 OBSOL vlimit
|
||||
78 STD { int mincore(caddr_t addr, int len, char *vec); }
|
||||
79 STD { int getgroups(u_int gidsetsize, gid_t *gidset); }
|
||||
80 STD { int setgroups(u_int gidsetsize, gid_t *gidset); }
|
||||
81 STD { int getpgrp(void); }
|
||||
82 STD { int setpgid(int pid, int pgid); }
|
||||
83 STD { int setitimer(u_int which, struct itimerval *itv, \
|
||||
struct itimerval *oitv); }
|
||||
84 COMPAT_43 { int wait(void); }
|
||||
85 STD { int swapon(char *name); }
|
||||
86 STD { int getitimer(u_int which, struct itimerval *itv); }
|
||||
87 COMPAT_43 { int gethostname(char *hostname, u_int len); }
|
||||
88 COMPAT_43 { int sethostname(char *hostname, u_int len); }
|
||||
89 COMPAT_43 { int getdtablesize(void); }
|
||||
90 STD { int dup2(u_int from, u_int to); }
|
||||
91 UNIMPL getdopt
|
||||
92 STD { int fcntl(int fd, int cmd, void *arg); }
|
||||
93 STD { int select(u_int nd, fd_set *in, fd_set *ou, \
|
||||
fd_set *ex, struct timeval *tv); }
|
||||
94 UNIMPL setdopt
|
||||
95 STD { int fsync(int fd); }
|
||||
96 STD { int setpriority(int which, int who, int prio); }
|
||||
97 STD { int socket(int domain, int type, int protocol); }
|
||||
98 STD { int connect(int s, caddr_t name, int namelen); }
|
||||
99 COMPAT_43 { int accept(int s, caddr_t name, int *anamelen); }
|
||||
100 STD { int getpriority(int which, int who); }
|
||||
101 COMPAT_43 { int send(int s, caddr_t buf, int len, int flags); }
|
||||
102 COMPAT_43 { int recv(int s, caddr_t buf, int len, int flags); }
|
||||
103 STD { int sigreturn(struct sigcontext *sigcntxp); }
|
||||
104 STD { int bind(int s, caddr_t name, int namelen); }
|
||||
105 STD { int setsockopt(int s, int level, int name, \
|
||||
caddr_t val, int valsize); }
|
||||
106 STD { int listen(int s, int backlog); }
|
||||
107 OBSOL vtimes
|
||||
108 COMPAT_43 { int sigvec(int signum, struct sigvec *nsv, \
|
||||
struct sigvec *osv); }
|
||||
109 COMPAT_43 { int sigblock(int mask); }
|
||||
110 COMPAT_43 { int sigsetmask(int mask); }
|
||||
111 STD { int sigsuspend(int mask); }
|
||||
112 COMPAT_43 { int sigstack(struct sigstack *nss, \
|
||||
struct sigstack *oss); }
|
||||
113 COMPAT_43 { int recvmsg(int s, struct omsghdr *msg, int flags); }
|
||||
114 COMPAT_43 { int sendmsg(int s, caddr_t msg, int flags); }
|
||||
#ifdef TRACE
|
||||
115 STD 2 vtrace
|
||||
115 STD { int vtrace(int request, int value); }
|
||||
#else
|
||||
115 OBSOL 2 vtrace
|
||||
115 OBSOL vtrace
|
||||
#endif
|
||||
116 STD 2 gettimeofday
|
||||
117 STD 2 getrusage
|
||||
118 STD 5 getsockopt
|
||||
116 STD { int gettimeofday(struct timeval *tp, \
|
||||
struct timezone *tzp); }
|
||||
117 STD { int getrusage(int who, struct rusage *rusage); }
|
||||
118 STD { int getsockopt(int s, int level, int name, \
|
||||
caddr_t val, int *avalsize); }
|
||||
#ifdef vax
|
||||
119 STD 1 resuba
|
||||
119 STD { int resuba(int value); }
|
||||
#else
|
||||
119 UNIMPL 0 nosys
|
||||
119 UNIMPL resuba
|
||||
#endif
|
||||
120 STD 3 readv
|
||||
121 STD 3 writev
|
||||
122 STD 2 settimeofday
|
||||
123 STD 3 fchown
|
||||
124 STD 2 fchmod
|
||||
125 COMPAT 6 recvfrom
|
||||
126 COMPAT 2 setreuid
|
||||
127 COMPAT 2 setregid
|
||||
128 STD 2 rename
|
||||
129 COMPAT 2 truncate
|
||||
130 COMPAT 2 ftruncate
|
||||
131 STD 2 flock
|
||||
132 STD 2 mkfifo
|
||||
133 STD 6 sendto
|
||||
134 STD 2 shutdown
|
||||
135 STD 5 socketpair
|
||||
136 STD 2 mkdir
|
||||
137 STD 1 rmdir
|
||||
138 STD 2 utimes
|
||||
139 OBSOL 0 4.2 sigreturn
|
||||
140 STD 2 adjtime
|
||||
141 COMPAT 3 getpeername
|
||||
142 COMPAT 0 gethostid
|
||||
143 COMPAT 1 sethostid
|
||||
144 COMPAT 2 getrlimit
|
||||
145 COMPAT 2 setrlimit
|
||||
146 COMPAT 2 killpg
|
||||
147 STD 0 setsid
|
||||
148 STD 4 quotactl
|
||||
149 COMPAT 4 quota
|
||||
150 COMPAT 3 getsockname
|
||||
120 STD { int readv(int fd, struct iovec *iovp, u_int iovcnt); }
|
||||
121 STD { int writev(int fd, struct iovec *iovp, \
|
||||
u_int iovcnt); }
|
||||
122 STD { int settimeofday(struct timeval *tv, \
|
||||
struct timezone *tzp); }
|
||||
123 STD { int fchown(int fd, int uid, int gid); }
|
||||
124 STD { int fchmod(int fd, int mode); }
|
||||
125 COMPAT_43 { int recvfrom(int s, caddr_t buf, size_t len, \
|
||||
int flags, caddr_t from, int *fromlenaddr); }
|
||||
126 COMPAT_43 { int setreuid(int ruid, int euid); }
|
||||
127 COMPAT_43 { int setregid(int rgid, int egid); }
|
||||
128 STD { int rename(char *from, char *to); }
|
||||
129 COMPAT_43 { int truncate(char *path, long length); }
|
||||
130 COMPAT_43 { int ftruncate(int fd, long length); }
|
||||
131 STD { int flock(int fd, int how); }
|
||||
132 STD { int mkfifo(char *path, int mode); }
|
||||
133 STD { int sendto(int s, caddr_t buf, size_t len, \
|
||||
int flags, caddr_t to, int tolen); }
|
||||
134 STD { int shutdown(int s, int how); }
|
||||
135 STD { int socketpair(int domain, int type, int protocol, \
|
||||
int *rsv); }
|
||||
136 STD { int mkdir(char *path, int mode); }
|
||||
137 STD { int rmdir(char *path); }
|
||||
138 STD { int utimes(char *path, struct timeval *tptr); }
|
||||
139 OBSOL 4.2 sigreturn
|
||||
140 STD { int adjtime(struct timeval *delta, \
|
||||
struct timeval *olddelta); }
|
||||
141 COMPAT_43 { int getpeername(int fdes, caddr_t asa, int *alen); }
|
||||
142 COMPAT_43 { int32_t gethostid(void); }
|
||||
143 COMPAT_43 { int sethostid(int32_t hostid); }
|
||||
144 COMPAT_43 { int getrlimit(u_int which, struct ogetrlimit *rlp); }
|
||||
145 COMPAT_43 { int setrlimit(u_int which, struct ogetrlimit *rlp); }
|
||||
146 COMPAT_43 { int killpg(int pgid, int signum); }
|
||||
147 STD { int setsid(void); }
|
||||
148 STD { int quotactl(char *path, int cmd, int uid, \
|
||||
caddr_t arg); }
|
||||
149 COMPAT_43 { int quota(void); }
|
||||
150 COMPAT_43 { int getsockname(int fdec, caddr_t asa, int *alen); }
|
||||
|
||||
; Syscalls 151-180 inclusive are reserved for vendor-specific
|
||||
; system calls. (This includes various calls added for compatibity
|
||||
; with other Unix variants.)
|
||||
; Some of these calls are now supported by BSD...
|
||||
151 UNIMPL 0 nosys
|
||||
152 UNIMPL 0 nosys
|
||||
153 UNIMPL 0 nosys
|
||||
154 UNIMPL 0 nosys
|
||||
151 UNIMPL
|
||||
152 UNIMPL
|
||||
153 UNIMPL
|
||||
154 UNIMPL
|
||||
#if defined(NFSCLIENT) || defined(NFSSERVER)
|
||||
155 STD 2 nfssvc
|
||||
155 STD { int nfssvc(int flag, caddr_t argp); }
|
||||
#else
|
||||
155 UNIMPL 0 nosys
|
||||
155 UNIMPL
|
||||
#endif
|
||||
156 COMPAT 4 getdirentries
|
||||
157 STD 2 statfs
|
||||
158 STD 2 fstatfs
|
||||
159 UNIMPL 0 nosys
|
||||
160 UNIMPL 0 nosys
|
||||
156 COMPAT_43 { int getdirentries(int fd, char *buf, u_int count, \
|
||||
long *basep); }
|
||||
157 STD { int statfs(char *path, struct statfs *buf); }
|
||||
158 STD { int fstatfs(int fd, struct statfs *buf); }
|
||||
159 UNIMPL
|
||||
160 UNIMPL
|
||||
#ifdef NFSCLIENT
|
||||
161 STD 2 getfh
|
||||
161 STD { int getfh(char *fname, fhandle_t *fhp); }
|
||||
#else
|
||||
161 UNIMPL 0 nosys
|
||||
161 UNIMPL getfh
|
||||
#endif
|
||||
162 NCOMPAT 2 getdomainname
|
||||
163 NCOMPAT 2 setdomainname
|
||||
164 NCOMPAT 1 uname
|
||||
165 STD 2 sysarch
|
||||
166 UNIMPL 0 nosys
|
||||
167 UNIMPL 0 nosys
|
||||
168 UNIMPL 0 nosys
|
||||
#ifdef SYSVSEM
|
||||
169 STD 5 semsys
|
||||
162 COMPAT_09 { int getdomainname(char *domainname, int len); }
|
||||
163 COMPAT_09 { int setdomainname(char *domainname, int len); }
|
||||
164 COMPAT_09 { int uname(struct outsname *name); }
|
||||
165 STD { int sysarch(int op, char *parms); }
|
||||
166 UNIMPL
|
||||
167 UNIMPL
|
||||
168 UNIMPL
|
||||
; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
|
||||
#if defined(SYSVSEM) && !defined(alpha)
|
||||
169 COMPAT_10 { int semsys(int which, int a2, int a3, int a4, \
|
||||
int a5); }
|
||||
#else
|
||||
169 UNIMPL 0 nosys
|
||||
169 UNIMPL 1.0 semsys
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
170 STD 6 msgsys
|
||||
; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
|
||||
#if defined(SYSVMSG) && !defined(alpha)
|
||||
170 COMPAT_10 { int msgsys(int which, int a2, int a3, int a4, \
|
||||
int a5, int a6); }
|
||||
#else
|
||||
170 UNIMPL 0 nosys
|
||||
170 UNIMPL 1.0 msgsys
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
171 STD 4 shmsys
|
||||
; XXX more generally, never on machines where sizeof(void *) != sizeof(int)
|
||||
#if defined(SYSVSHM) && !defined(alpha)
|
||||
171 COMPAT_10 { int shmsys(int which, int a2, int a3, int a4); }
|
||||
#else
|
||||
171 UNIMPL 0 nosys
|
||||
171 UNIMPL 1.0 shmsys
|
||||
#endif
|
||||
172 UNIMPL 0 nosys
|
||||
173 UNIMPL 0 nosys
|
||||
174 UNIMPL 0 nosys
|
||||
175 UNIMPL 0 nosys
|
||||
176 UNIMPL 0 nosys
|
||||
177 UNIMPL 0 nosys
|
||||
178 UNIMPL 0 nosys
|
||||
179 UNIMPL 0 nosys
|
||||
180 UNIMPL 0 nosys
|
||||
172 UNIMPL
|
||||
173 UNIMPL
|
||||
174 UNIMPL
|
||||
175 UNIMPL
|
||||
176 UNIMPL
|
||||
177 UNIMPL
|
||||
178 UNIMPL
|
||||
179 UNIMPL
|
||||
180 UNIMPL
|
||||
|
||||
; Syscalls 180-199 are used by/reserved for BSD
|
||||
181 STD 1 setgid
|
||||
182 STD 1 setegid
|
||||
183 STD 1 seteuid
|
||||
181 STD { int setgid(gid_t gid); }
|
||||
182 STD { int setegid(gid_t egid); }
|
||||
183 STD { int seteuid(uid_t euid); }
|
||||
#ifdef LFS
|
||||
184 STD 3 lfs_bmapv
|
||||
185 STD 3 lfs_markv
|
||||
186 STD 2 lfs_segclean
|
||||
187 STD 2 lfs_segwait
|
||||
184 STD { int lfs_bmapv(fsid_t *fsidp, \
|
||||
struct block_info *blkiov, int blkcnt); }
|
||||
185 STD { int lfs_markv(fsid_t *fsidp, \
|
||||
struct block_info *blkiov, int blkcnt); }
|
||||
186 STD { int lfs_segclean(fsid_t *fsidp, u_long segment); }
|
||||
187 STD { int lfs_segwait(fsid_t *fsidp, struct timeval *tv); }
|
||||
#else
|
||||
184 UNIMPL 0 nosys
|
||||
185 UNIMPL 0 nosys
|
||||
186 UNIMPL 0 nosys
|
||||
187 UNIMPL 0 nosys
|
||||
184 UNIMPL
|
||||
185 UNIMPL
|
||||
186 UNIMPL
|
||||
187 UNIMPL
|
||||
#endif
|
||||
188 STD 2 stat
|
||||
189 STD 2 fstat
|
||||
190 STD 2 lstat
|
||||
191 STD 2 pathconf
|
||||
192 STD 2 fpathconf
|
||||
193 UNIMPL 0 nosys
|
||||
194 STD 2 getrlimit
|
||||
195 STD 2 setrlimit
|
||||
196 STD 4 getdirentries
|
||||
197 STD 8 mmap
|
||||
198 STD 0 nosys __syscall
|
||||
199 STD 5 lseek
|
||||
200 STD 4 truncate
|
||||
201 STD 4 ftruncate
|
||||
202 STD 6 __sysctl
|
||||
203 STD 2 mlock
|
||||
204 STD 2 munlock
|
||||
205 UNIMPL 0 nosys
|
||||
206 UNIMPL 0 nosys
|
||||
207 UNIMPL 0 nosys
|
||||
208 UNIMPL 0 nosys
|
||||
209 UNIMPL 0 nosys
|
||||
188 STD { int stat(char *path, struct stat *ub); }
|
||||
189 STD { int fstat(int fd, struct stat *sb); }
|
||||
190 STD { int lstat(char *path, struct stat *ub); }
|
||||
191 STD { int pathconf(char *path, int name); }
|
||||
192 STD { int fpathconf(int fd, int name); }
|
||||
193 UNIMPL
|
||||
194 STD { int getrlimit(u_int which, struct rlimit *rlp); }
|
||||
195 STD { int setrlimit(u_int which, struct rlimit *rlp); }
|
||||
196 STD { int getdirentries(int fd, char *buf, u_int count, \
|
||||
long *basep); }
|
||||
197 STD { caddr_t mmap(caddr_t addr, size_t len, int prot, \
|
||||
int flags, int fd, long pad, off_t pos); }
|
||||
198 STD { int nosys(void); } __syscall
|
||||
199 STD { off_t lseek(int fd, int pad, off_t offset, \
|
||||
int whence); }
|
||||
200 STD { int truncate(char *path, int pad, off_t length); }
|
||||
201 STD { int ftruncate(int fd, int pad, off_t length); }
|
||||
202 STD { int __sysctl(int *name, u_int namelen, void *old, \
|
||||
size_t *oldlenp, void *new, size_t newlen); }
|
||||
203 STD { int mlock(caddr_t addr, size_t len); }
|
||||
204 STD { int munlock(caddr_t addr, size_t len); }
|
||||
205 UNIMPL
|
||||
206 UNIMPL
|
||||
207 UNIMPL
|
||||
208 UNIMPL
|
||||
209 UNIMPL
|
||||
;
|
||||
; Syscalls 210-219 are reserved for dynamically loaded syscalls
|
||||
;
|
||||
#ifdef LKM
|
||||
210 NODEF 0 lkmnosys
|
||||
211 NODEF 0 lkmnosys
|
||||
212 NODEF 0 lkmnosys
|
||||
213 NODEF 0 lkmnosys
|
||||
214 NODEF 0 lkmnosys
|
||||
215 NODEF 0 lkmnosys
|
||||
216 NODEF 0 lkmnosys
|
||||
217 NODEF 0 lkmnosys
|
||||
218 NODEF 0 lkmnosys
|
||||
219 NODEF 0 lkmnosys
|
||||
210 NODEF { int lkmnosys(void); }
|
||||
211 NODEF { int lkmnosys(void); }
|
||||
212 NODEF { int lkmnosys(void); }
|
||||
213 NODEF { int lkmnosys(void); }
|
||||
214 NODEF { int lkmnosys(void); }
|
||||
215 NODEF { int lkmnosys(void); }
|
||||
216 NODEF { int lkmnosys(void); }
|
||||
217 NODEF { int lkmnosys(void); }
|
||||
218 NODEF { int lkmnosys(void); }
|
||||
219 NODEF { int lkmnosys(void); }
|
||||
#else /* !LKM */
|
||||
210 UNIMPL 0 nosys
|
||||
211 UNIMPL 0 nosys
|
||||
212 UNIMPL 0 nosys
|
||||
213 UNIMPL 0 nosys
|
||||
214 UNIMPL 0 nosys
|
||||
215 UNIMPL 0 nosys
|
||||
216 UNIMPL 0 nosys
|
||||
217 UNIMPL 0 nosys
|
||||
218 UNIMPL 0 nosys
|
||||
219 UNIMPL 0 nosys
|
||||
210 UNIMPL
|
||||
211 UNIMPL
|
||||
212 UNIMPL
|
||||
213 UNIMPL
|
||||
214 UNIMPL
|
||||
215 UNIMPL
|
||||
216 UNIMPL
|
||||
217 UNIMPL
|
||||
218 UNIMPL
|
||||
219 UNIMPL
|
||||
#endif /* !LKM */
|
||||
; System calls 220-240 are reserved for use by NetBSD
|
||||
#ifdef SYSVSEM
|
||||
220 STD { int __semctl(int semid, int semnum, int cmd, \
|
||||
union semun *arg); }
|
||||
221 STD { int semget(key_t key, int nsems, int semflg); }
|
||||
222 STD { int semop(int semid, struct sembuf *sops, \
|
||||
u_int nsops); }
|
||||
223 STD { int semconfig(int flag); }
|
||||
#else
|
||||
220 UNIMPL semctl
|
||||
221 UNIMPL semget
|
||||
222 UNIMPL semop
|
||||
223 UNIMPL semconfig
|
||||
#endif
|
||||
#ifdef SYSVMSG
|
||||
224 STD { int msgctl(int msqid, int cmd, \
|
||||
struct msqid_ds *buf); }
|
||||
225 STD { int msgget(key_t key, int msgflg); }
|
||||
226 STD { int msgsnd(int msqid, void *msgp, size_t msgsz, \
|
||||
int msgflg); }
|
||||
227 STD { int msgrcv(int msqid, void *msgp, size_t msgsz, \
|
||||
long msgtyp, int msgflg); }
|
||||
#else
|
||||
224 UNIMPL msgctl
|
||||
225 UNIMPL msgget
|
||||
226 UNIMPL msgsnd
|
||||
227 UNIMPL msgrcv
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
228 STD { int shmat(int shmid, void *shmaddr, int shmflg); }
|
||||
229 STD { int shmctl(int shmid, int cmd, \
|
||||
struct shmid_ds *buf); }
|
||||
230 STD { int shmdt(void *shmaddr); }
|
||||
231 STD { int shmget(key_t key, int size, int shmflg); }
|
||||
#else
|
||||
228 UNIMPL shmat
|
||||
229 UNIMPL shmctl
|
||||
230 UNIMPL shmdt
|
||||
231 UNIMPL shmget
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sysv_msg.c,v 1.9 1994/06/29 06:33:13 cgd Exp $ */
|
||||
/* $NetBSD: sysv_msg.c,v 1.10 1994/10/20 04:23:15 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Implementation of SVID messages
|
||||
|
@ -26,13 +26,12 @@
|
|||
#include <sys/msg.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#define MSG_DEBUG
|
||||
#undef MSG_DEBUG_OK
|
||||
|
||||
static int msgctl(), msgget(), msgsnd(), msgrcv();
|
||||
|
||||
int (*msgcalls[])() = { msgctl, msgget, msgsnd, msgrcv };
|
||||
|
||||
int nfree_msgmaps; /* # of free map entries */
|
||||
short free_msgmaps; /* head of linked list of free map entries */
|
||||
struct msg *free_msghdrs; /* list of free msg headers */
|
||||
|
@ -94,26 +93,6 @@ msginit()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Entry point for all MSG calls
|
||||
*/
|
||||
|
||||
struct msgsys_args {
|
||||
u_int which;
|
||||
};
|
||||
|
||||
int
|
||||
msgsys(p, uap, retval)
|
||||
struct caller *p;
|
||||
struct msgsys_args *uap;
|
||||
int *retval;
|
||||
{
|
||||
|
||||
if (uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0]))
|
||||
return (EINVAL);
|
||||
return ((*msgcalls[uap->which])(p, &uap[1], retval));
|
||||
}
|
||||
|
||||
static void
|
||||
msg_freehdr(msghdr)
|
||||
struct msg *msghdr;
|
||||
|
@ -138,21 +117,19 @@ msg_freehdr(msghdr)
|
|||
free_msghdrs = msghdr;
|
||||
}
|
||||
|
||||
struct msgctl_args {
|
||||
int msqid;
|
||||
int cmd;
|
||||
struct msqid_ds *user_msqptr;
|
||||
};
|
||||
|
||||
int
|
||||
msgctl(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct msgctl_args *uap;
|
||||
int *retval;
|
||||
register struct msgctl_args /* {
|
||||
syscallarg(int) msqid;
|
||||
syscallarg(int) cmd;
|
||||
syscallarg(struct msqid_ds *) buf;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int msqid = uap->msqid;
|
||||
int cmd = uap->cmd;
|
||||
struct msqid_ds *user_msqptr = uap->user_msqptr;
|
||||
int msqid = SCARG(uap, msqid);
|
||||
int cmd = SCARG(uap, cmd);
|
||||
struct msqid_ds *user_msqptr = SCARG(uap, buf);
|
||||
struct ucred *cred = p->p_ucred;
|
||||
int i, rval, eval;
|
||||
struct msqid_ds msqbuf;
|
||||
|
@ -180,7 +157,7 @@ msgctl(p, uap, retval)
|
|||
#endif
|
||||
return(EINVAL);
|
||||
}
|
||||
if (msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) {
|
||||
if (msqptr->msg_perm.seq != IPCID_TO_SEQ(SCARG(uap, msqid))) {
|
||||
#ifdef MSG_DEBUG_OK
|
||||
printf("wrong sequence number\n");
|
||||
#endif
|
||||
|
@ -273,20 +250,18 @@ msgctl(p, uap, retval)
|
|||
return(eval);
|
||||
}
|
||||
|
||||
struct msgget_args {
|
||||
key_t key;
|
||||
int msgflg;
|
||||
};
|
||||
|
||||
int
|
||||
msgget(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct msgget_args *uap;
|
||||
int *retval;
|
||||
register struct msgget_args /* {
|
||||
syscallarg(key_t) key;
|
||||
syscallarg(int) msgflg;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int msqid, eval;
|
||||
int key = uap->key;
|
||||
int msgflg = uap->msgflg;
|
||||
int key = SCARG(uap, key);
|
||||
int msgflg = SCARG(uap, msgflg);
|
||||
struct ucred *cred = p->p_ucred;
|
||||
register struct msqid_ds *msqptr;
|
||||
|
||||
|
@ -378,23 +353,21 @@ found:
|
|||
return(0);
|
||||
}
|
||||
|
||||
struct msgsnd_args {
|
||||
int msqid;
|
||||
void *user_msgp;
|
||||
size_t msgsz;
|
||||
int msgflg;
|
||||
};
|
||||
|
||||
int
|
||||
msgsnd(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct msgsnd_args *uap;
|
||||
int *retval;
|
||||
register struct msgsnd_args /* {
|
||||
syscallarg(int) msqid;
|
||||
syscallarg(void *) msgp;
|
||||
syscallarg(size_t) msgsz;
|
||||
syscallarg(int) msgflg;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int msqid = uap->msqid;
|
||||
void *user_msgp = uap->user_msgp;
|
||||
size_t msgsz = uap->msgsz;
|
||||
int msgflg = uap->msgflg;
|
||||
int msqid = SCARG(uap, msqid);
|
||||
char *user_msgp = SCARG(uap, msgp);
|
||||
size_t msgsz = SCARG(uap, msgsz);
|
||||
int msgflg = SCARG(uap, msgflg);
|
||||
int segs_needed, eval;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
register struct msqid_ds *msqptr;
|
||||
|
@ -423,7 +396,7 @@ msgsnd(p, uap, retval)
|
|||
#endif
|
||||
return(EINVAL);
|
||||
}
|
||||
if (msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) {
|
||||
if (msqptr->msg_perm.seq != IPCID_TO_SEQ(SCARG(uap, msqid))) {
|
||||
#ifdef MSG_DEBUG_OK
|
||||
printf("wrong sequence number\n");
|
||||
#endif
|
||||
|
@ -712,25 +685,23 @@ msgsnd(p, uap, retval)
|
|||
return(0);
|
||||
}
|
||||
|
||||
struct msgrcv_args {
|
||||
int msqid;
|
||||
void *msgp;
|
||||
size_t msgsz;
|
||||
long msgtyp;
|
||||
int msgflg;
|
||||
};
|
||||
|
||||
int
|
||||
msgrcv(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct msgrcv_args *uap;
|
||||
int *retval;
|
||||
register struct msgrcv_args /* {
|
||||
syscallarg(int) msqid;
|
||||
syscallarg(void *) msgp;
|
||||
syscallarg(size_t) msgsz;
|
||||
syscallarg(long) msgtyp;
|
||||
syscallarg(int) msgflg;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int msqid = uap->msqid;
|
||||
void *user_msgp = uap->msgp;
|
||||
size_t msgsz = uap->msgsz;
|
||||
long msgtyp = uap->msgtyp;
|
||||
int msgflg = uap->msgflg;
|
||||
int msqid = SCARG(uap, msqid);
|
||||
char *user_msgp = SCARG(uap, msgp);
|
||||
size_t msgsz = SCARG(uap, msgsz);
|
||||
long msgtyp = SCARG(uap, msgtyp);
|
||||
int msgflg = SCARG(uap, msgflg);
|
||||
size_t len;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
register struct msqid_ds *msqptr;
|
||||
|
@ -760,7 +731,7 @@ msgrcv(p, uap, retval)
|
|||
#endif
|
||||
return(EINVAL);
|
||||
}
|
||||
if (msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) {
|
||||
if (msqptr->msg_perm.seq != IPCID_TO_SEQ(SCARG(uap, msqid))) {
|
||||
#ifdef MSG_DEBUG_OK
|
||||
printf("wrong sequence number\n");
|
||||
#endif
|
||||
|
@ -910,7 +881,7 @@ msgrcv(p, uap, retval)
|
|||
*/
|
||||
|
||||
if (msqptr->msg_qbytes == 0 ||
|
||||
msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) {
|
||||
msqptr->msg_perm.seq != IPCID_TO_SEQ(SCARG(uap, msqid))) {
|
||||
#ifdef MSG_DEBUG_OK
|
||||
printf("msqid deleted\n");
|
||||
#endif
|
||||
|
@ -1004,3 +975,74 @@ msgrcv(p, uap, retval)
|
|||
*retval = msgsz;
|
||||
return(0);
|
||||
}
|
||||
|
||||
#if defined(COMPAT_10) && !defined(alpha)
|
||||
int
|
||||
compat_10_msgsys(p, uap, retval)
|
||||
struct caller *p;
|
||||
struct compat_10_msgsys_args /* {
|
||||
syscallarg(int) which;
|
||||
syscallarg(int) a2;
|
||||
syscallarg(int) a3;
|
||||
syscallarg(int) a4;
|
||||
syscallarg(int) a5;
|
||||
syscallarg(int) a6;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct msgctl_args {
|
||||
syscallarg(int) msqid;
|
||||
syscallarg(int) cmd;
|
||||
syscallarg(struct msqid_ds *) buf;
|
||||
} msgctl_args;
|
||||
struct msgget_args {
|
||||
syscallarg(key_t) key;
|
||||
syscallarg(int) msgflg;
|
||||
} msgget_args;
|
||||
struct msgsnd_args {
|
||||
syscallarg(int) msqid;
|
||||
syscallarg(void *) msgp;
|
||||
syscallarg(size_t) msgsz;
|
||||
syscallarg(int) msgflg;
|
||||
} msgsnd_args;
|
||||
struct msgrcv_args {
|
||||
syscallarg(int) msqid;
|
||||
syscallarg(void *) msgp;
|
||||
syscallarg(size_t) msgsz;
|
||||
syscallarg(long) msgtyp;
|
||||
syscallarg(int) msgflg;
|
||||
} msgrcv_args;
|
||||
|
||||
switch (SCARG(uap, which)) {
|
||||
case 0: /* msgctl()*/
|
||||
SCARG(&msgctl_args, msqid) = SCARG(uap, a2);
|
||||
SCARG(&msgctl_args, cmd) = SCARG(uap, a3);
|
||||
SCARG(&msgctl_args, buf) =
|
||||
(struct msqid_ds *)SCARG(uap, a4);
|
||||
return (msgctl(p, &msgctl_args, retval));
|
||||
|
||||
case 1: /* msgget() */
|
||||
SCARG(&msgctl_args, key) = SCARG(uap, a2);
|
||||
SCARG(&msgctl_args, msgflg) = SCARG(uap, a3);
|
||||
return (msgget(p, &msgget_args, retval));
|
||||
|
||||
case 2: /* msgsnd() */
|
||||
SCARG(&msgsnd_args, msqid) = SCARG(uap, a2);
|
||||
SCARG(&msgsnd_args, msgp) = (void *)SCARG(uap, a3);
|
||||
SCARG(&msgsnd_args, msgsz) = SCARG(uap, a4);
|
||||
SCARG(&msgsnd_args, msgflg) = SCARG(uap, a5);
|
||||
return (msgget(p, &msgget_args, retval));
|
||||
|
||||
case 3: /* msgrcv() */
|
||||
SCARG(&msgsnd_args, msqid) = SCARG(uap, a2);
|
||||
SCARG(&msgsnd_args, msgp) = (void *)SCARG(uap, a3);
|
||||
SCARG(&msgsnd_args, msgsz) = SCARG(uap, a4);
|
||||
SCARG(&msgsnd_args, msgtyp) = SCARG(uap, a5);
|
||||
SCARG(&msgsnd_args, msgflg) = SCARG(uap, a6);
|
||||
return (msgget(p, &msgget_args, retval));
|
||||
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
}
|
||||
#endif /* defined(COMPAT_10) && !defined(alpha) */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sysv_sem.c,v 1.9 1994/06/29 06:33:15 cgd Exp $ */
|
||||
/* $NetBSD: sysv_sem.c,v 1.10 1994/10/20 04:23:17 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Implementation of SVID semaphores
|
||||
|
@ -15,8 +15,9 @@
|
|||
#include <sys/sem.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
static int semctl(), semget(), semop(), semconfig();
|
||||
int (*semcalls[])() = { semctl, semget, semop, semconfig };
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
int semtot = 0;
|
||||
|
||||
static struct proc *semlock_holder = NULL;
|
||||
|
@ -43,29 +44,6 @@ seminit()
|
|||
semu_list = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Entry point for all SEM calls
|
||||
*/
|
||||
|
||||
struct semsys_args {
|
||||
u_int which;
|
||||
};
|
||||
|
||||
int
|
||||
semsys(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct semsys_args *uap;
|
||||
int *retval;
|
||||
{
|
||||
|
||||
while (semlock_holder != NULL && semlock_holder != p)
|
||||
sleep((caddr_t)&semlock_holder, (PZERO - 4));
|
||||
|
||||
if (uap->which >= sizeof(semcalls)/sizeof(semcalls[0]))
|
||||
return (EINVAL);
|
||||
return ((*semcalls[uap->which])(p, &uap[1], retval));
|
||||
}
|
||||
|
||||
/*
|
||||
* Lock or unlock the entire semaphore facility.
|
||||
*
|
||||
|
@ -81,19 +59,17 @@ semsys(p, uap, retval)
|
|||
* in /dev/kmem.
|
||||
*/
|
||||
|
||||
struct semconfig_args {
|
||||
semconfig_ctl_t flag;
|
||||
};
|
||||
|
||||
int
|
||||
semconfig(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct semconfig_args *uap;
|
||||
int *retval;
|
||||
struct semconfig_args /* {
|
||||
syscallarg(int) flag;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int eval = 0;
|
||||
|
||||
switch (uap->flag) {
|
||||
switch (SCARG(uap, flag)) {
|
||||
case SEM_CONFIG_FREEZE:
|
||||
semlock_holder = p;
|
||||
break;
|
||||
|
@ -104,8 +80,9 @@ semconfig(p, uap, retval)
|
|||
break;
|
||||
|
||||
default:
|
||||
printf("semconfig: unknown flag parameter value (%d) - ignored\n",
|
||||
uap->flag);
|
||||
printf(
|
||||
"semconfig: unknown flag parameter value (%d) - ignored\n",
|
||||
SCARG(uap, flag));
|
||||
eval = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
@ -283,23 +260,21 @@ semundo_clear(semid, semnum)
|
|||
}
|
||||
}
|
||||
|
||||
struct semctl_args {
|
||||
int semid;
|
||||
int semnum;
|
||||
int cmd;
|
||||
union semun *arg;
|
||||
};
|
||||
|
||||
int
|
||||
semctl(p, uap, retval)
|
||||
__semctl(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct semctl_args *uap;
|
||||
int *retval;
|
||||
register struct __semctl_args /* {
|
||||
syscallarg(int) semid;
|
||||
syscallarg(int) semnum;
|
||||
syscallarg(int) cmd;
|
||||
syscallarg(union semun *) arg;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int semid = uap->semid;
|
||||
int semnum = uap->semnum;
|
||||
int cmd = uap->cmd;
|
||||
union semun *arg = uap->arg;
|
||||
int semid = SCARG(uap, semid);
|
||||
int semnum = SCARG(uap, semnum);
|
||||
int cmd = SCARG(uap, cmd);
|
||||
union semun *arg = SCARG(uap, arg);
|
||||
union semun real_arg;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
int i, rval, eval;
|
||||
|
@ -316,7 +291,7 @@ semctl(p, uap, retval)
|
|||
|
||||
semaptr = &sema[semid];
|
||||
if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0 ||
|
||||
semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid))
|
||||
semaptr->sem_perm.seq != IPCID_TO_SEQ(SCARG(uap, semid)))
|
||||
return(EINVAL);
|
||||
|
||||
eval = 0;
|
||||
|
@ -447,22 +422,20 @@ semctl(p, uap, retval)
|
|||
return(eval);
|
||||
}
|
||||
|
||||
struct semget_args {
|
||||
key_t key;
|
||||
int nsems;
|
||||
int semflg;
|
||||
};
|
||||
|
||||
int
|
||||
semget(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct semget_args *uap;
|
||||
int *retval;
|
||||
register struct semget_args /* {
|
||||
syscallarg(key_t) key;
|
||||
syscallarg(int) nsems;
|
||||
syscallarg(int) semflg;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int semid, eval;
|
||||
int key = uap->key;
|
||||
int nsems = uap->nsems;
|
||||
int semflg = uap->semflg;
|
||||
int key = SCARG(uap, key);
|
||||
int nsems = SCARG(uap, nsems);
|
||||
int semflg = SCARG(uap, semflg);
|
||||
struct ucred *cred = p->p_ucred;
|
||||
|
||||
#ifdef SEM_DEBUG
|
||||
|
@ -560,20 +533,18 @@ found:
|
|||
return(0);
|
||||
}
|
||||
|
||||
struct semop_args {
|
||||
int semid;
|
||||
struct sembuf *sops;
|
||||
int nsops;
|
||||
};
|
||||
|
||||
int
|
||||
semop(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct semop_args *uap;
|
||||
int *retval;
|
||||
register struct semop_args /* {
|
||||
syscallarg(int) semid;
|
||||
syscallarg(struct sembuf *) sops;
|
||||
syscallarg(u_int) nsops;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int semid = uap->semid;
|
||||
int nsops = uap->nsops;
|
||||
int semid = SCARG(uap, semid);
|
||||
int nsops = SCARG(uap, nsops);
|
||||
struct sembuf sops[MAX_SOPS];
|
||||
register struct semid_ds *semaptr;
|
||||
register struct sembuf *sopptr;
|
||||
|
@ -595,7 +566,7 @@ semop(p, uap, retval)
|
|||
semaptr = &sema[semid];
|
||||
if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0)
|
||||
return(EINVAL);
|
||||
if (semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid))
|
||||
if (semaptr->sem_perm.seq != IPCID_TO_SEQ(SCARG(uap, semid)))
|
||||
return(EINVAL);
|
||||
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_W))) {
|
||||
|
@ -612,10 +583,11 @@ semop(p, uap, retval)
|
|||
return(E2BIG);
|
||||
}
|
||||
|
||||
if ((eval = copyin(uap->sops, &sops, nsops * sizeof(sops[0]))) != 0) {
|
||||
if ((eval = copyin(SCARG(uap, sops), sops, nsops * sizeof(sops[0])))
|
||||
!= 0) {
|
||||
#ifdef SEM_DEBUG
|
||||
printf("eval = %d from copyin(%08x, %08x, %d)\n", eval,
|
||||
uap->sops, &sops, nsops * sizeof(sops[0]));
|
||||
SCARG(uap, sops), &sops, nsops * sizeof(sops[0]));
|
||||
#endif
|
||||
return(eval);
|
||||
}
|
||||
|
@ -728,7 +700,7 @@ semop(p, uap, retval)
|
|||
* Make sure that the semaphore still exists
|
||||
*/
|
||||
if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0 ||
|
||||
semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid)) {
|
||||
semaptr->sem_perm.seq != IPCID_TO_SEQ(SCARG(uap, semid))) {
|
||||
/* The man page says to return EIDRM. */
|
||||
/* Unfortunately, BSD doesn't define that code! */
|
||||
#ifdef EIDRM
|
||||
|
@ -937,3 +909,69 @@ unlock:
|
|||
wakeup((caddr_t)&semlock_holder);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(COMPAT_10) && !defined(alpha)
|
||||
int
|
||||
compat_10_semsys(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct compat_10_semsys_args /* {
|
||||
syscallarg(int) which;
|
||||
syscallarg(int) a2;
|
||||
syscallarg(int) a3;
|
||||
syscallarg(int) a4;
|
||||
syscallarg(int) a5;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct __semctl_args /* {
|
||||
syscallarg(int) semid;
|
||||
syscallarg(int) semnum;
|
||||
syscallarg(int) cmd;
|
||||
syscallarg(union semun *) arg;
|
||||
} */ __semctl_args;
|
||||
struct semget_args /* {
|
||||
syscallarg(key_t) key;
|
||||
syscallarg(int) nsems;
|
||||
syscallarg(int) semflg;
|
||||
} */ semget_args;
|
||||
struct semop_args /* {
|
||||
syscallarg(int) semid;
|
||||
syscallarg(struct sembuf *) sops;
|
||||
syscallarg(u_int) nsops;
|
||||
} */ semop_args;
|
||||
struct semconfig_args /* {
|
||||
syscallarg(int) flag;
|
||||
} */ semconfig_args;
|
||||
|
||||
while (semlock_holder != NULL && semlock_holder != p)
|
||||
sleep((caddr_t)&semlock_holder, (PZERO - 4));
|
||||
|
||||
switch (SCARG(uap, which)) {
|
||||
case 0: /* __semctl() */
|
||||
SCARG(&__semctl_args, semid) = SCARG(uap, a2);
|
||||
SCARG(&__semctl_args, semnum) = SCARG(uap, a3);
|
||||
SCARG(&__semctl_args, cmd) = SCARG(uap, a4);
|
||||
SCARG(&__semctl_args, arg) = (union semun *)SCARG(uap, a5);
|
||||
return (__semctl(p, &__semctl_args, retval));
|
||||
|
||||
case 1: /* semget() */
|
||||
SCARG(&semget_args, key) = SCARG(uap, a2);
|
||||
SCARG(&semget_args, nsems) = SCARG(uap, a3);
|
||||
SCARG(&semget_args, semflg) = SCARG(uap, a4);
|
||||
return (semget(p, &semget_args, retval));
|
||||
|
||||
case 2: /* semop() */
|
||||
SCARG(&semop_args, semid) = SCARG(uap, a2);
|
||||
SCARG(&semop_args, sops) = (struct sembuf *)SCARG(uap, a3);
|
||||
SCARG(&semop_args, nsops) = SCARG(uap, a4);
|
||||
return (semop(p, &semop_args, retval));
|
||||
|
||||
case 3: /* semconfig() */
|
||||
SCARG(&semconfig_args, flag) = SCARG(uap, a2);
|
||||
return (semconfig(p, &semconfig_args, retval));
|
||||
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
}
|
||||
#endif /* defined(COMPAT_10) && !defined(alpha) */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sysv_shm.c,v 1.25 1994/08/31 21:47:36 mycroft Exp $ */
|
||||
/* $NetBSD: sysv_shm.c,v 1.26 1994/10/20 04:23:19 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Adam Glass and Charles Hannum. All rights reserved.
|
||||
|
@ -42,6 +42,9 @@
|
|||
#include <sys/systm.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_map.h>
|
||||
#include <vm/vm_map.h>
|
||||
|
@ -60,9 +63,6 @@
|
|||
* per proc array of 'struct shmmap_state'
|
||||
*/
|
||||
|
||||
int shmat(), shmctl(), shmdt(), shmget();
|
||||
int (*shmcalls[])() = { shmat, shmctl, shmdt, shmget };
|
||||
|
||||
#define SHMSEG_FREE 0x0200
|
||||
#define SHMSEG_REMOVED 0x0400
|
||||
#define SHMSEG_ALLOCATED 0x0800
|
||||
|
@ -158,14 +158,13 @@ shm_delete_mapping(p, shmmap_s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct shmdt_args {
|
||||
void *shmaddr;
|
||||
};
|
||||
int
|
||||
shmdt(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct shmdt_args *uap;
|
||||
int *retval;
|
||||
struct shmdt_args /* {
|
||||
syscallarg(void *) shmaddr;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct shmmap_state *shmmap_s;
|
||||
int i;
|
||||
|
@ -173,23 +172,22 @@ shmdt(p, uap, retval)
|
|||
shmmap_s = (struct shmmap_state *)p->p_vmspace->vm_shm;
|
||||
for (i = 0; i < shminfo.shmseg; i++, shmmap_s++)
|
||||
if (shmmap_s->shmid != -1 &&
|
||||
shmmap_s->va == (vm_offset_t)uap->shmaddr)
|
||||
shmmap_s->va == (vm_offset_t)SCARG(uap, shmaddr))
|
||||
break;
|
||||
if (i == shminfo.shmseg)
|
||||
return EINVAL;
|
||||
return shm_delete_mapping(p, shmmap_s);
|
||||
}
|
||||
|
||||
struct shmat_args {
|
||||
int shmid;
|
||||
void *shmaddr;
|
||||
int shmflg;
|
||||
};
|
||||
int
|
||||
shmat(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct shmat_args *uap;
|
||||
int *retval;
|
||||
struct shmat_args /* {
|
||||
syscallarg(int) shmid;
|
||||
syscallarg(void *) shmaddr;
|
||||
syscallarg(int) shmflag;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int error, i, flags;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
|
@ -207,11 +205,11 @@ shmat(p, uap, retval)
|
|||
shmmap_s[i].shmid = -1;
|
||||
p->p_vmspace->vm_shm = (caddr_t)shmmap_s;
|
||||
}
|
||||
shmseg = shm_find_segment_by_shmid(uap->shmid);
|
||||
shmseg = shm_find_segment_by_shmid(SCARG(uap, shmid));
|
||||
if (shmseg == NULL)
|
||||
return EINVAL;
|
||||
if (error = ipcperm(cred, &shmseg->shm_perm,
|
||||
(uap->shmflg & SHM_RDONLY) ? IPC_R : IPC_R|IPC_W))
|
||||
(SCARG(uap, shmflg) & SHM_RDONLY) ? IPC_R : IPC_R|IPC_W))
|
||||
return error;
|
||||
for (i = 0; i < shminfo.shmseg; i++) {
|
||||
if (shmmap_s->shmid == -1)
|
||||
|
@ -222,15 +220,16 @@ shmat(p, uap, retval)
|
|||
return EMFILE;
|
||||
size = (shmseg->shm_segsz + CLOFSET) & ~CLOFSET;
|
||||
prot = VM_PROT_READ;
|
||||
if ((uap->shmflg & SHM_RDONLY) == 0)
|
||||
if ((SCARG(uap, shmflg) & SHM_RDONLY) == 0)
|
||||
prot |= VM_PROT_WRITE;
|
||||
flags = MAP_ANON | MAP_SHARED;
|
||||
if (uap->shmaddr) {
|
||||
if (SCARG(uap, shmaddr)) {
|
||||
flags |= MAP_FIXED;
|
||||
if (uap->shmflg & SHM_RND)
|
||||
attach_va = (vm_offset_t)uap->shmaddr & ~(SHMLBA-1);
|
||||
else if (((vm_offset_t)uap->shmaddr & (SHMLBA-1)) == 0)
|
||||
attach_va = (vm_offset_t)uap->shmaddr;
|
||||
if (SCARG(uap, shmflg) & SHM_RND)
|
||||
attach_va =
|
||||
(vm_offset_t)SCARG(uap, shmaddr) & ~(SHMLBA-1);
|
||||
else if (((vm_offset_t)SCARG(uap, shmaddr) & (SHMLBA-1)) == 0)
|
||||
attach_va = (vm_offset_t)SCARG(uap, shmaddr);
|
||||
else
|
||||
return EINVAL;
|
||||
} else {
|
||||
|
@ -238,11 +237,11 @@ shmat(p, uap, retval)
|
|||
attach_va = round_page(p->p_vmspace->vm_daddr + MAXDSIZ);
|
||||
}
|
||||
error = vm_mmap(&p->p_vmspace->vm_map, &attach_va, size, prot,
|
||||
VM_PROT_DEFAULT, flags, (caddr_t) uap->shmid, 0);
|
||||
VM_PROT_DEFAULT, flags, (caddr_t)(long)SCARG(uap, shmid), 0);
|
||||
if (error)
|
||||
return error;
|
||||
shmmap_s->va = attach_va;
|
||||
shmmap_s->shmid = uap->shmid;
|
||||
shmmap_s->shmid = SCARG(uap, shmid);
|
||||
shmseg->shm_lpid = p->p_pid;
|
||||
shmseg->shm_atime = time.tv_sec;
|
||||
shmseg->shm_nattch++;
|
||||
|
@ -250,36 +249,37 @@ shmat(p, uap, retval)
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct shmctl_args {
|
||||
int shmid;
|
||||
int cmd;
|
||||
struct shmat_ds *ubuf;
|
||||
};
|
||||
int
|
||||
shmctl(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct shmctl_args *uap;
|
||||
int *retval;
|
||||
struct shmctl_args /* {
|
||||
syscallarg(int) shmid;
|
||||
syscallarg(int) cmd;
|
||||
syscallarg(struct shmid_ds *) buf;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int error, segnum;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
struct shmid_ds inbuf;
|
||||
struct shmid_ds *shmseg;
|
||||
|
||||
shmseg = shm_find_segment_by_shmid(uap->shmid);
|
||||
shmseg = shm_find_segment_by_shmid(SCARG(uap, shmid));
|
||||
if (shmseg == NULL)
|
||||
return EINVAL;
|
||||
switch (uap->cmd) {
|
||||
switch (SCARG(uap, cmd)) {
|
||||
case IPC_STAT:
|
||||
if (error = ipcperm(cred, &shmseg->shm_perm, IPC_R))
|
||||
return error;
|
||||
if (error = copyout((caddr_t)shmseg, uap->ubuf, sizeof(inbuf)))
|
||||
if (error = copyout((caddr_t)shmseg, SCARG(uap, buf),
|
||||
sizeof(inbuf)))
|
||||
return error;
|
||||
break;
|
||||
case IPC_SET:
|
||||
if (error = ipcperm(cred, &shmseg->shm_perm, IPC_M))
|
||||
return error;
|
||||
if (error = copyin(uap->ubuf, (caddr_t)&inbuf, sizeof(inbuf)))
|
||||
if (error = copyin(SCARG(uap, buf), (caddr_t)&inbuf,
|
||||
sizeof(inbuf)))
|
||||
return error;
|
||||
shmseg->shm_perm.uid = inbuf.shm_perm.uid;
|
||||
shmseg->shm_perm.gid = inbuf.shm_perm.gid;
|
||||
|
@ -295,7 +295,7 @@ shmctl(p, uap, retval)
|
|||
shmseg->shm_perm.mode |= SHMSEG_REMOVED;
|
||||
if (shmseg->shm_nattch <= 0) {
|
||||
shm_deallocate_segment(shmseg);
|
||||
shm_last_free = IPCID_TO_IX(uap->shmid);
|
||||
shm_last_free = IPCID_TO_IX(SCARG(uap, shmid));
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
|
@ -308,18 +308,17 @@ shmctl(p, uap, retval)
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct shmget_args {
|
||||
key_t key;
|
||||
size_t size;
|
||||
int shmflg;
|
||||
};
|
||||
static int
|
||||
shmget_existing(p, uap, mode, segnum, retval)
|
||||
struct proc *p;
|
||||
struct shmget_args *uap;
|
||||
struct shmget_args /* {
|
||||
syscallarg(key_t) key;
|
||||
syscallarg(int) size;
|
||||
syscallarg(int) shmflag;
|
||||
} */ *uap;
|
||||
int mode;
|
||||
int segnum;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
struct shmid_ds *shmseg;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
|
@ -340,9 +339,10 @@ shmget_existing(p, uap, mode, segnum, retval)
|
|||
}
|
||||
if (error = ipcperm(cred, &shmseg->shm_perm, mode))
|
||||
return error;
|
||||
if (uap->size && uap->size > shmseg->shm_segsz)
|
||||
if (SCARG(uap, size) && SCARG(uap, size) > shmseg->shm_segsz)
|
||||
return EINVAL;
|
||||
if (uap->shmflg & (IPC_CREAT | IPC_EXCL) == (IPC_CREAT | IPC_EXCL))
|
||||
if (SCARG(uap, shmflg) & (IPC_CREAT | IPC_EXCL) ==
|
||||
(IPC_CREAT | IPC_EXCL))
|
||||
return EEXIST;
|
||||
*retval = IXSEQ_TO_IPCID(segnum, shmseg->shm_perm);
|
||||
return 0;
|
||||
|
@ -351,20 +351,25 @@ shmget_existing(p, uap, mode, segnum, retval)
|
|||
static int
|
||||
shmget_allocate_segment(p, uap, mode, retval)
|
||||
struct proc *p;
|
||||
struct shmget_args *uap;
|
||||
struct shmget_args /* {
|
||||
syscallarg(key_t) key;
|
||||
syscallarg(int) size;
|
||||
syscallarg(int) shmflag;
|
||||
} */ *uap;
|
||||
int mode;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
int i, segnum, result, shmid, size;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
struct shmid_ds *shmseg;
|
||||
struct shm_handle *shm_handle;
|
||||
|
||||
if (uap->size < shminfo.shmmin || uap->size > shminfo.shmmax)
|
||||
if (SCARG(uap, size) < shminfo.shmmin ||
|
||||
SCARG(uap, size) > shminfo.shmmax)
|
||||
return EINVAL;
|
||||
if (shm_nused >= shminfo.shmmni) /* any shmids left? */
|
||||
return ENOSPC;
|
||||
size = (uap->size + CLOFSET) & ~CLOFSET;
|
||||
size = (SCARG(uap, size) + CLOFSET) & ~CLOFSET;
|
||||
if (shm_committed + btoc(size) > shminfo.shmall)
|
||||
return ENOMEM;
|
||||
if (shm_last_free < 0) {
|
||||
|
@ -384,13 +389,13 @@ shmget_allocate_segment(p, uap, mode, retval)
|
|||
* so that noone else tries to create the same key.
|
||||
*/
|
||||
shmseg->shm_perm.mode = SHMSEG_ALLOCATED | SHMSEG_REMOVED;
|
||||
shmseg->shm_perm.key = uap->key;
|
||||
shmseg->shm_perm.key = SCARG(uap, key);
|
||||
shmseg->shm_perm.seq = (shmseg->shm_perm.seq + 1) & 0x7fff;
|
||||
shm_handle = (struct shm_handle *)
|
||||
malloc(sizeof(struct shm_handle), M_SHM, M_WAITOK);
|
||||
shmid = IXSEQ_TO_IPCID(segnum, shmseg->shm_perm);
|
||||
result = vm_mmap(sysvshm_map, &shm_handle->kva, size, VM_PROT_ALL,
|
||||
VM_PROT_DEFAULT, MAP_ANON, (caddr_t) shmid, 0);
|
||||
VM_PROT_DEFAULT, MAP_ANON, (caddr_t)(long)shmid, 0);
|
||||
if (result != KERN_SUCCESS) {
|
||||
shmseg->shm_perm.mode = SHMSEG_FREE;
|
||||
shm_last_free = segnum;
|
||||
|
@ -404,7 +409,7 @@ shmget_allocate_segment(p, uap, mode, retval)
|
|||
shmseg->shm_perm.cgid = shmseg->shm_perm.gid = cred->cr_gid;
|
||||
shmseg->shm_perm.mode = (shmseg->shm_perm.mode & SHMSEG_WANTED) |
|
||||
(mode & ACCESSPERMS) | SHMSEG_ALLOCATED;
|
||||
shmseg->shm_segsz = uap->size;
|
||||
shmseg->shm_segsz = SCARG(uap, size);
|
||||
shmseg->shm_cpid = p->p_pid;
|
||||
shmseg->shm_lpid = shmseg->shm_nattch = 0;
|
||||
shmseg->shm_atime = shmseg->shm_dtime = 0;
|
||||
|
@ -426,43 +431,32 @@ shmget_allocate_segment(p, uap, mode, retval)
|
|||
int
|
||||
shmget(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct shmget_args *uap;
|
||||
int *retval;
|
||||
struct shmget_args /* {
|
||||
syscallarg(key_t) key;
|
||||
syscallarg(int) size;
|
||||
syscallarg(int) shmflag;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int segnum, mode, error;
|
||||
struct shmid_ds *shmseg;
|
||||
|
||||
mode = uap->shmflg & ACCESSPERMS;
|
||||
if (uap->key != IPC_PRIVATE) {
|
||||
mode = SCARG(uap, shmflg) & ACCESSPERMS;
|
||||
if (SCARG(uap, key) != IPC_PRIVATE) {
|
||||
again:
|
||||
segnum = shm_find_segment_by_key(uap->key);
|
||||
segnum = shm_find_segment_by_key(SCARG(uap, key));
|
||||
if (segnum >= 0) {
|
||||
error = shmget_existing(p, uap, mode, segnum, retval);
|
||||
if (error == EAGAIN)
|
||||
goto again;
|
||||
return error;
|
||||
}
|
||||
if ((uap->shmflg & IPC_CREAT) == 0)
|
||||
if ((SCARG(uap, shmflg) & IPC_CREAT) == 0)
|
||||
return ENOENT;
|
||||
}
|
||||
return shmget_allocate_segment(p, uap, mode, retval);
|
||||
}
|
||||
|
||||
struct shmsys_args {
|
||||
u_int which;
|
||||
};
|
||||
int
|
||||
shmsys(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct shmsys_args *uap;
|
||||
int *retval;
|
||||
{
|
||||
|
||||
if (uap->which >= sizeof(shmcalls)/sizeof(shmcalls[0]))
|
||||
return EINVAL;
|
||||
return ((*shmcalls[uap->which])(p, &uap[1], retval));
|
||||
}
|
||||
|
||||
void
|
||||
shmfork(p1, p2, isvfork)
|
||||
struct proc *p1, *p2;
|
||||
|
@ -516,3 +510,63 @@ shminit()
|
|||
shm_nused = 0;
|
||||
shm_committed = 0;
|
||||
}
|
||||
|
||||
#if defined(COMPAT_10) && !defined(alpha)
|
||||
int
|
||||
compat_10_shmsys(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct compat_10_shmsys_args /* {
|
||||
syscallarg(int) which;
|
||||
syscallarg(int) a2;
|
||||
syscallarg(int) a3;
|
||||
syscallarg(int) a4;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct shmat_args /* {
|
||||
syscallarg(int) shmid;
|
||||
syscallarg(void *) shmaddr;
|
||||
syscallarg(int) shmflg;
|
||||
} */ shmat_args;
|
||||
struct shmctl_args /* {
|
||||
syscallarg(int) shmid;
|
||||
syscallarg(int) cmd;
|
||||
syscallarg(struct shmid_ds *) buf;
|
||||
} */ shmctl_args;
|
||||
struct shmdt_args /* {
|
||||
syscallarg(void *) shmaddr;
|
||||
} */ shmdt_args;
|
||||
struct shmget_args /* {
|
||||
syscallarg(key_t) key;
|
||||
syscallarg(int) size;
|
||||
syscallarg(int) shmflg;
|
||||
} */ shmget_args;
|
||||
|
||||
switch (SCARG(uap, which)) {
|
||||
case 0: /* shmat() */
|
||||
SCARG(&shmat_args, shmid) = SCARG(uap, a2);
|
||||
SCARG(&shmat_args, shmaddr) = (void *)SCARG(uap, a3);
|
||||
SCARG(&shmat_args, shmflg) = SCARG(uap, a4);
|
||||
return (shmat(p, &shmat_args, retval));
|
||||
|
||||
case 1: /* shmctl() */
|
||||
SCARG(&shmctl_args, shmid) = SCARG(uap, a2);
|
||||
SCARG(&shmctl_args, cmd) = SCARG(uap, a3);
|
||||
SCARG(&shmctl_args, buf) = (struct shmid_ds *)SCARG(uap, a4);
|
||||
return (shmctl(p, &shmctl_args, retval));
|
||||
|
||||
case 2: /* shmdt() */
|
||||
SCARG(&shmat_args, shmaddr) = (void *)SCARG(uap, a2);
|
||||
return (shmdt(p, &shmdt_args, retval));
|
||||
|
||||
case 3: /* shmget() */
|
||||
SCARG(&shmget_args, key) = SCARG(uap, a2);
|
||||
SCARG(&shmget_args, size) = SCARG(uap, a3);
|
||||
SCARG(&shmget_args, shmflg) = SCARG(uap, a4);
|
||||
return (shmget(p, &shmget_args, retval));
|
||||
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
}
|
||||
#endif /* defined(COMPAT_10) && !defined(alpha) */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: vnode_if.src,v 1.2 1994/06/29 06:34:07 cgd Exp $
|
||||
# $NetBSD: vnode_if.src,v 1.3 1994/10/20 04:23:26 cgd Exp $
|
||||
#
|
||||
# Copyright (c) 1992, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
|
@ -243,7 +243,7 @@ vop_islocked {
|
|||
vop_pathconf {
|
||||
IN struct vnode *vp;
|
||||
IN int name;
|
||||
OUT int *retval;
|
||||
OUT register_t *retval;
|
||||
};
|
||||
|
||||
vop_advlock {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fdesc_vnops.c,v 1.17 1994/08/19 11:25:31 mycroft Exp $ */
|
||||
/* $NetBSD: fdesc_vnops.c,v 1.18 1994/10/20 04:26:22 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -785,7 +785,7 @@ fdesc_pathconf(ap)
|
|||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
int *a_retval;
|
||||
register_t *a_retval;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fifo_vnops.c,v 1.9 1994/06/29 06:34:24 cgd Exp $ */
|
||||
/* $NetBSD: fifo_vnops.c,v 1.10 1994/10/20 04:26:25 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -439,7 +439,7 @@ fifo_pathconf(ap)
|
|||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
int *a_retval;
|
||||
register_t *a_retval;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kernfs_vnops.c,v 1.28 1994/07/21 10:22:20 mycroft Exp $ */
|
||||
/* $NetBSD: kernfs_vnops.c,v 1.29 1994/10/20 04:26:28 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -618,7 +618,7 @@ kernfs_pathconf(ap)
|
|||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
int *a_retval;
|
||||
register_t *a_retval;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: portal_vnops.c,v 1.6 1994/06/29 06:34:40 cgd Exp $ */
|
||||
/* $NetBSD: portal_vnops.c,v 1.7 1994/10/20 04:26:33 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -529,7 +529,7 @@ portal_pathconf(ap)
|
|||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
int *a_retval;
|
||||
register_t *a_retval;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: procfs_vnops.c,v 1.25 1994/08/30 03:06:42 mycroft Exp $ */
|
||||
/* $NetBSD: procfs_vnops.c,v 1.26 1994/10/20 04:26:36 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993 Jan-Simon Pendry
|
||||
|
@ -259,7 +259,7 @@ procfs_pathconf(ap)
|
|||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
int *a_retval;
|
||||
register_t *a_retval;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: spec_vnops.c,v 1.17 1994/07/16 11:40:56 paulus Exp $ */
|
||||
/* $NetBSD: spec_vnops.c,v 1.18 1994/10/20 04:26:38 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -633,7 +633,7 @@ spec_pathconf(ap)
|
|||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
int *a_retval;
|
||||
register_t *a_retval;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: union_vnops.c,v 1.5 1994/08/30 03:01:01 mycroft Exp $ */
|
||||
/* $NetBSD: union_vnops.c,v 1.6 1994/10/20 04:26:40 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994 The Regents of the University of California.
|
||||
|
@ -1391,7 +1391,7 @@ union_pathconf(ap)
|
|||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
int *a_retval;
|
||||
register_t *a_retval;
|
||||
} */ *ap;
|
||||
{
|
||||
int error;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: msdosfs_vnops.c,v 1.23 1994/09/28 15:00:31 mycroft Exp $ */
|
||||
/* $NetBSD: msdosfs_vnops.c,v 1.24 1994/10/20 04:26:43 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994 Wolfgang Solfrank.
|
||||
|
@ -1780,7 +1780,7 @@ msdosfs_pathconf(ap)
|
|||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
int *a_retval;
|
||||
register_t *a_retval;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vm_extern.h,v 1.8 1994/09/16 02:01:49 mycroft Exp $ */
|
||||
/* $NetBSD: vm_extern.h,v 1.9 1994/10/20 04:27:30 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -49,7 +49,7 @@ void chgkprot __P((caddr_t, int, int));
|
|||
|
||||
#ifdef KERNEL
|
||||
#ifdef TYPEDEF_FOR_UAP
|
||||
int ogetpagesize __P((struct proc *p, void *, int *));
|
||||
int compat_43_getpagesize __P((struct proc *p, void *, int *));
|
||||
int madvise __P((struct proc *, void *, int *));
|
||||
int mincore __P((struct proc *, void *, int *));
|
||||
int mprotect __P((struct proc *, void *, int *));
|
||||
|
|
269
sys/vm/vm_mmap.c
269
sys/vm/vm_mmap.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vm_mmap.c,v 1.32 1994/09/16 01:57:57 mycroft Exp $ */
|
||||
/* $NetBSD: vm_mmap.c,v 1.33 1994/10/20 04:27:31 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -56,6 +56,9 @@
|
|||
#include <sys/mman.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
@ -69,30 +72,28 @@ int mmapdebug = 0;
|
|||
#define MDB_MAPIT 0x04
|
||||
#endif
|
||||
|
||||
struct sbrk_args {
|
||||
int incr;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
sbrk(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct sbrk_args *uap;
|
||||
int *retval;
|
||||
struct sbrk_args /* {
|
||||
syscallarg(int) incr;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
/* Not yet implemented */
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
struct sstk_args {
|
||||
int incr;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
sstk(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct sstk_args *uap;
|
||||
int *retval;
|
||||
struct sstk_args /* {
|
||||
syscallarg(int) incr;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
/* Not yet implemented */
|
||||
|
@ -102,10 +103,10 @@ sstk(p, uap, retval)
|
|||
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
|
||||
/* ARGSUSED */
|
||||
int
|
||||
ogetpagesize(p, uap, retval)
|
||||
compat_43_getpagesize(p, uap, retval)
|
||||
struct proc *p;
|
||||
void *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
*retval = PAGE_SIZE;
|
||||
|
@ -113,32 +114,29 @@ ogetpagesize(p, uap, retval)
|
|||
}
|
||||
#endif /* COMPAT_43 || COMPAT_SUNOS */
|
||||
|
||||
struct mmap_args {
|
||||
caddr_t addr;
|
||||
size_t len;
|
||||
int prot;
|
||||
int flags;
|
||||
int fd;
|
||||
long pad;
|
||||
off_t pos;
|
||||
};
|
||||
|
||||
#ifdef COMPAT_43
|
||||
struct ommap_args {
|
||||
caddr_t addr;
|
||||
int len;
|
||||
int prot;
|
||||
int flags;
|
||||
int fd;
|
||||
long pos;
|
||||
};
|
||||
int
|
||||
ommap(p, uap, retval)
|
||||
compat_43_mmap(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct ommap_args *uap;
|
||||
int *retval;
|
||||
register struct compat_43_mmap_args /* {
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(int) len;
|
||||
syscallarg(int) prot;
|
||||
syscallarg(int) flags;
|
||||
syscallarg(int) fd;
|
||||
syscallarg(long) pos;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
struct mmap_args nargs;
|
||||
struct mmap_args /* {
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(size_t) len;
|
||||
syscallarg(int) prot;
|
||||
syscallarg(int) flags;
|
||||
syscallarg(int) fd;
|
||||
syscallarg(long) pad;
|
||||
syscallarg(off_t) pos;
|
||||
} */ nargs;
|
||||
static const char cvtbsdprot[8] = {
|
||||
0,
|
||||
PROT_EXEC,
|
||||
|
@ -155,24 +153,24 @@ ommap(p, uap, retval)
|
|||
#define OMAP_FIXED 0x0100
|
||||
#define OMAP_INHERIT 0x0800
|
||||
|
||||
nargs.addr = uap->addr;
|
||||
nargs.len = uap->len;
|
||||
nargs.prot = cvtbsdprot[uap->prot&0x7];
|
||||
nargs.flags = 0;
|
||||
if (uap->flags & OMAP_ANON)
|
||||
nargs.flags |= MAP_ANON;
|
||||
if (uap->flags & OMAP_COPY)
|
||||
nargs.flags |= MAP_COPY;
|
||||
if (uap->flags & OMAP_SHARED)
|
||||
nargs.flags |= MAP_SHARED;
|
||||
SCARG(&nargs, addr) = SCARG(uap, addr);
|
||||
SCARG(&nargs, len) = SCARG(uap, len);
|
||||
SCARG(&nargs, prot) = cvtbsdprot[SCARG(uap, prot)&0x7];
|
||||
SCARG(&nargs, flags) = 0;
|
||||
if (SCARG(uap, flags) & OMAP_ANON)
|
||||
SCARG(&nargs, flags) |= MAP_ANON;
|
||||
if (SCARG(uap, flags) & OMAP_COPY)
|
||||
SCARG(&nargs, flags) |= MAP_COPY;
|
||||
if (SCARG(uap, flags) & OMAP_SHARED)
|
||||
SCARG(&nargs, flags) |= MAP_SHARED;
|
||||
else
|
||||
nargs.flags |= MAP_PRIVATE;
|
||||
if (uap->flags & OMAP_FIXED)
|
||||
nargs.flags |= MAP_FIXED;
|
||||
if (uap->flags & OMAP_INHERIT)
|
||||
nargs.flags |= MAP_INHERIT;
|
||||
nargs.fd = uap->fd;
|
||||
nargs.pos = uap->pos;
|
||||
SCARG(&nargs, flags) |= MAP_PRIVATE;
|
||||
if (SCARG(uap, flags) & OMAP_FIXED)
|
||||
SCARG(&nargs, flags) |= MAP_FIXED;
|
||||
if (SCARG(uap, flags) & OMAP_INHERIT)
|
||||
SCARG(&nargs, flags) |= MAP_INHERIT;
|
||||
SCARG(&nargs, fd) = SCARG(uap, fd);
|
||||
SCARG(&nargs, pos) = SCARG(uap, pos);
|
||||
return (mmap(p, &nargs, retval));
|
||||
}
|
||||
#endif
|
||||
|
@ -180,8 +178,16 @@ ommap(p, uap, retval)
|
|||
int
|
||||
mmap(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct mmap_args *uap;
|
||||
int *retval;
|
||||
register struct mmap_args /* {
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(size_t) len;
|
||||
syscallarg(int) prot;
|
||||
syscallarg(int) flags;
|
||||
syscallarg(int) fd;
|
||||
syscallarg(long) pad;
|
||||
syscallarg(off_t) pos;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct filedesc *fdp = p->p_fd;
|
||||
register struct file *fp;
|
||||
|
@ -192,24 +198,25 @@ mmap(p, uap, retval)
|
|||
caddr_t handle;
|
||||
int flags, error;
|
||||
|
||||
prot = uap->prot & VM_PROT_ALL;
|
||||
flags = uap->flags;
|
||||
pos = uap->pos;
|
||||
prot = SCARG(uap, prot) & VM_PROT_ALL;
|
||||
flags = SCARG(uap, flags);
|
||||
pos = SCARG(uap, pos);
|
||||
#ifdef DEBUG
|
||||
if (mmapdebug & MDB_FOLLOW)
|
||||
printf("mmap(%d): addr %x len %x pro %x flg %x fd %d pos %x\n",
|
||||
p->p_pid, uap->addr, uap->len, prot,
|
||||
flags, uap->fd, pos);
|
||||
p->p_pid, SCARG(uap, addr), SCARG(uap, len), prot,
|
||||
flags, SCARG(uap, fd), pos);
|
||||
#endif
|
||||
/*
|
||||
* Address (if FIXED) must be page aligned.
|
||||
* Size is implicitly rounded to a page boundary.
|
||||
*/
|
||||
addr = (vm_offset_t) uap->addr;
|
||||
addr = (vm_offset_t) SCARG(uap, addr);
|
||||
if (((flags & MAP_FIXED) && (addr & PAGE_MASK)) ||
|
||||
(ssize_t)uap->len < 0 || ((flags & MAP_ANON) && uap->fd != -1))
|
||||
(ssize_t)SCARG(uap, len) < 0 ||
|
||||
((flags & MAP_ANON) && SCARG(uap, fd) != -1))
|
||||
return (EINVAL);
|
||||
size = (vm_size_t) round_page(uap->len);
|
||||
size = (vm_size_t) round_page(SCARG(uap, len));
|
||||
/*
|
||||
* Check for illegal addresses. Watch out for address wrap...
|
||||
* Note that VM_*_ADDRESS are not constants due to casts (argh).
|
||||
|
@ -244,8 +251,8 @@ mmap(p, uap, retval)
|
|||
* Mapping file, get fp for validation.
|
||||
* Obtain vnode and make sure it is of appropriate type.
|
||||
*/
|
||||
if (((unsigned)uap->fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[uap->fd]) == NULL)
|
||||
if (((unsigned)SCARG(uap, fd)) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
||||
return (EBADF);
|
||||
if (fp->f_type != DTYPE_VNODE)
|
||||
return (EINVAL);
|
||||
|
@ -286,21 +293,20 @@ mmap(p, uap, retval)
|
|||
}
|
||||
}
|
||||
error = vm_mmap(&p->p_vmspace->vm_map, &addr, size, prot, maxprot,
|
||||
flags, handle, (vm_offset_t)uap->pos);
|
||||
flags, handle, (vm_offset_t)SCARG(uap, pos));
|
||||
if (error == 0)
|
||||
*retval = (int)addr;
|
||||
*retval = (register_t)addr;
|
||||
return (error);
|
||||
}
|
||||
|
||||
struct msync_args {
|
||||
caddr_t addr;
|
||||
int len;
|
||||
};
|
||||
int
|
||||
msync(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct msync_args *uap;
|
||||
int *retval;
|
||||
struct msync_args /* {
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(int) len;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
vm_offset_t addr;
|
||||
vm_size_t size;
|
||||
|
@ -311,13 +317,14 @@ msync(p, uap, retval)
|
|||
#ifdef DEBUG
|
||||
if (mmapdebug & (MDB_FOLLOW|MDB_SYNC))
|
||||
printf("msync(%d): addr %x len %x\n",
|
||||
p->p_pid, uap->addr, uap->len);
|
||||
p->p_pid, SCARG(uap, addr), SCARG(uap, len));
|
||||
#endif
|
||||
if (((int)uap->addr & PAGE_MASK) || uap->addr + uap->len < uap->addr)
|
||||
if (((int)SCARG(uap, addr) & PAGE_MASK) ||
|
||||
SCARG(uap, addr) + SCARG(uap, len) < SCARG(uap, addr))
|
||||
return (EINVAL);
|
||||
map = &p->p_vmspace->vm_map;
|
||||
addr = (vm_offset_t)uap->addr;
|
||||
size = (vm_size_t)uap->len;
|
||||
addr = (vm_offset_t)SCARG(uap, addr);
|
||||
size = (vm_size_t)SCARG(uap, len);
|
||||
/*
|
||||
* XXX Gak! If size is zero we are supposed to sync "all modified
|
||||
* pages with the region containing addr". Unfortunately, we
|
||||
|
@ -370,15 +377,14 @@ msync(p, uap, retval)
|
|||
return (0);
|
||||
}
|
||||
|
||||
struct munmap_args {
|
||||
caddr_t addr;
|
||||
int len;
|
||||
};
|
||||
int
|
||||
munmap(p, uap, retval)
|
||||
register struct proc *p;
|
||||
register struct munmap_args *uap;
|
||||
int *retval;
|
||||
register struct munmap_args /* {
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(int) len;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
vm_offset_t addr;
|
||||
vm_size_t size;
|
||||
|
@ -387,13 +393,13 @@ munmap(p, uap, retval)
|
|||
#ifdef DEBUG
|
||||
if (mmapdebug & MDB_FOLLOW)
|
||||
printf("munmap(%d): addr %x len %x\n",
|
||||
p->p_pid, uap->addr, uap->len);
|
||||
p->p_pid, SCARG(uap, addr), SCARG(uap, len));
|
||||
#endif
|
||||
|
||||
addr = (vm_offset_t) uap->addr;
|
||||
if ((addr & PAGE_MASK) || uap->len < 0)
|
||||
addr = (vm_offset_t) SCARG(uap, addr);
|
||||
if ((addr & PAGE_MASK) || SCARG(uap, len) < 0)
|
||||
return(EINVAL);
|
||||
size = (vm_size_t) round_page(uap->len);
|
||||
size = (vm_size_t) round_page(SCARG(uap, len));
|
||||
if (size == 0)
|
||||
return(0);
|
||||
/*
|
||||
|
@ -433,16 +439,15 @@ munmapfd(p, fd)
|
|||
p->p_fd->fd_ofileflags[fd] &= ~UF_MAPPED;
|
||||
}
|
||||
|
||||
struct mprotect_args {
|
||||
caddr_t addr;
|
||||
int len;
|
||||
int prot;
|
||||
};
|
||||
int
|
||||
mprotect(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct mprotect_args *uap;
|
||||
int *retval;
|
||||
struct mprotect_args /* {
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(int) len;
|
||||
syscallarg(int) prot;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
vm_offset_t addr;
|
||||
vm_size_t size;
|
||||
|
@ -450,15 +455,15 @@ mprotect(p, uap, retval)
|
|||
|
||||
#ifdef DEBUG
|
||||
if (mmapdebug & MDB_FOLLOW)
|
||||
printf("mprotect(%d): addr %x len %x prot %d\n",
|
||||
p->p_pid, uap->addr, uap->len, uap->prot);
|
||||
printf("mprotect(%d): addr %x len %x prot %d\n", p->p_pid,
|
||||
SCARG(uap, addr), SCARG(uap, len), SCARG(uap, prot));
|
||||
#endif
|
||||
|
||||
addr = (vm_offset_t)uap->addr;
|
||||
if ((addr & PAGE_MASK) || uap->len < 0)
|
||||
addr = (vm_offset_t)SCARG(uap, addr);
|
||||
if ((addr & PAGE_MASK) || SCARG(uap, len) < 0)
|
||||
return(EINVAL);
|
||||
size = (vm_size_t)uap->len;
|
||||
prot = uap->prot & VM_PROT_ALL;
|
||||
size = (vm_size_t)SCARG(uap, len);
|
||||
prot = SCARG(uap, prot) & VM_PROT_ALL;
|
||||
|
||||
switch (vm_map_protect(&p->p_vmspace->vm_map, addr, addr+size, prot,
|
||||
FALSE)) {
|
||||
|
@ -470,49 +475,46 @@ mprotect(p, uap, retval)
|
|||
return (EINVAL);
|
||||
}
|
||||
|
||||
struct madvise_args {
|
||||
caddr_t addr;
|
||||
int len;
|
||||
int behav;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
madvise(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct madvise_args *uap;
|
||||
int *retval;
|
||||
struct madvise_args /* {
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(int) len;
|
||||
syscallarg(int) behav;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
/* Not yet implemented */
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
struct mincore_args {
|
||||
caddr_t addr;
|
||||
int len;
|
||||
char *vec;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
mincore(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct mincore_args *uap;
|
||||
int *retval;
|
||||
struct mincore_args /* {
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(int) len;
|
||||
syscallarg(char *) vec;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
/* Not yet implemented */
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
struct mlock_args {
|
||||
caddr_t addr;
|
||||
size_t len;
|
||||
};
|
||||
int
|
||||
mlock(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct mlock_args *uap;
|
||||
int *retval;
|
||||
struct mlock_args /* {
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(size_t) len;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
vm_offset_t addr;
|
||||
vm_size_t size;
|
||||
|
@ -522,12 +524,13 @@ mlock(p, uap, retval)
|
|||
#ifdef DEBUG
|
||||
if (mmapdebug & MDB_FOLLOW)
|
||||
printf("mlock(%d): addr %x len %x\n",
|
||||
p->p_pid, uap->addr, uap->len);
|
||||
p->p_pid, SCARG(uap, addr), SCARG(uap, len));
|
||||
#endif
|
||||
addr = (vm_offset_t)uap->addr;
|
||||
if ((addr & PAGE_MASK) || uap->addr + uap->len < uap->addr)
|
||||
addr = (vm_offset_t)SCARG(uap, addr);
|
||||
if ((addr & PAGE_MASK) ||
|
||||
SCARG(uap, addr) + SCARG(uap, len) < SCARG(uap, addr))
|
||||
return (EINVAL);
|
||||
size = round_page((vm_size_t)uap->len);
|
||||
size = round_page((vm_size_t)SCARG(uap, len));
|
||||
if (atop(size) + cnt.v_wire_count > vm_page_max_wired)
|
||||
return (EAGAIN);
|
||||
#ifdef pmap_wired_count
|
||||
|
@ -543,15 +546,14 @@ mlock(p, uap, retval)
|
|||
return (error == KERN_SUCCESS ? 0 : ENOMEM);
|
||||
}
|
||||
|
||||
struct munlock_args {
|
||||
caddr_t addr;
|
||||
size_t len;
|
||||
};
|
||||
int
|
||||
munlock(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct munlock_args *uap;
|
||||
int *retval;
|
||||
struct munlock_args /* {
|
||||
syscallarg(caddr_t) addr;
|
||||
syscallarg(size_t) len;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
vm_offset_t addr;
|
||||
vm_size_t size;
|
||||
|
@ -560,16 +562,17 @@ munlock(p, uap, retval)
|
|||
#ifdef DEBUG
|
||||
if (mmapdebug & MDB_FOLLOW)
|
||||
printf("munlock(%d): addr %x len %x\n",
|
||||
p->p_pid, uap->addr, uap->len);
|
||||
p->p_pid, SCARG(uap, addr), SCARG(uap, len));
|
||||
#endif
|
||||
addr = (vm_offset_t)uap->addr;
|
||||
if ((addr & PAGE_MASK) || uap->addr + uap->len < uap->addr)
|
||||
addr = (vm_offset_t)SCARG(uap, addr);
|
||||
if ((addr & PAGE_MASK) ||
|
||||
SCARG(uap, addr) + SCARG(uap, len) < SCARG(uap, addr))
|
||||
return (EINVAL);
|
||||
#ifndef pmap_wired_count
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
#endif
|
||||
size = round_page((vm_size_t)uap->len);
|
||||
size = round_page((vm_size_t)SCARG(uap, len));
|
||||
|
||||
error = vm_map_pageable(&p->p_vmspace->vm_map, addr, addr+size, TRUE);
|
||||
return (error == KERN_SUCCESS ? 0 : ENOMEM);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vm_swap.c,v 1.24 1994/07/21 07:12:13 mycroft Exp $ */
|
||||
/* $NetBSD: vm_swap.c,v 1.25 1994/10/20 04:27:32 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -46,6 +46,9 @@
|
|||
#include <sys/map.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
/*
|
||||
|
@ -267,15 +270,14 @@ swstrategy(bp)
|
|||
* which must be in the swdevsw. Return EBUSY
|
||||
* if already swapping on this device.
|
||||
*/
|
||||
struct swapon_args {
|
||||
char *name;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
swapon(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct swapon_args *uap;
|
||||
int *retval;
|
||||
struct swapon_args /* {
|
||||
syscallarg(char *) name;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct vnode *vp;
|
||||
register struct swdevt *sp;
|
||||
|
@ -285,7 +287,7 @@ swapon(p, uap, retval)
|
|||
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->name, p);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, name), p);
|
||||
if (error = namei(&nd))
|
||||
return (error);
|
||||
vp = nd.ni_vp;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vm_unix.c,v 1.13 1994/06/29 06:48:45 cgd Exp $ */
|
||||
/* $NetBSD: vm_unix.c,v 1.14 1994/10/20 04:27:33 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -52,17 +52,19 @@
|
|||
#include <sys/vnode.h>
|
||||
#include <sys/core.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
struct obreak_args {
|
||||
char *nsiz;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
obreak(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct obreak_args *uap;
|
||||
int *retval;
|
||||
struct obreak_args /* {
|
||||
syscallarg(char *) nsize;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct vmspace *vm = p->p_vmspace;
|
||||
vm_offset_t new, old;
|
||||
|
@ -70,7 +72,7 @@ obreak(p, uap, retval)
|
|||
register int diff;
|
||||
|
||||
old = (vm_offset_t)vm->vm_daddr;
|
||||
new = round_page(uap->nsiz);
|
||||
new = round_page(SCARG(uap, nsize));
|
||||
if ((int)(new - old) > p->p_rlimit[RLIMIT_DATA].rlim_cur)
|
||||
return(ENOMEM);
|
||||
old = round_page(old + ctob(vm->vm_dsize));
|
||||
|
@ -126,15 +128,14 @@ grow(p, sp)
|
|||
return (1);
|
||||
}
|
||||
|
||||
struct ovadvise_args {
|
||||
int anom;
|
||||
};
|
||||
/* ARGSUSED */
|
||||
int
|
||||
ovadvise(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct ovadvise_args *uap;
|
||||
int *retval;
|
||||
struct ovadvise_args /* {
|
||||
syscallarg(int) anom;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
return (EINVAL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vm_user.c,v 1.10 1994/06/29 06:48:46 cgd Exp $ */
|
||||
/* $NetBSD: vm_user.c,v 1.11 1994/10/20 04:27:34 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -92,19 +92,21 @@ int
|
|||
svm_allocate(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct svm_allocate_args *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
vm_offset_t addr;
|
||||
int rv;
|
||||
|
||||
uap->map = p->p_map; /* XXX */
|
||||
SCARG(uap, map) = p->p_map; /* XXX */
|
||||
|
||||
if (copyin((caddr_t)uap->addr, (caddr_t)&addr, sizeof (addr)))
|
||||
if (copyin((caddr_t)SCARG(uap, addr), (caddr_t)&addr, sizeof (addr)))
|
||||
rv = KERN_INVALID_ARGUMENT;
|
||||
else
|
||||
rv = vm_allocate(uap->map, &addr, uap->size, uap->anywhere);
|
||||
rv = vm_allocate(SCARG(uap, map), &addr, SCARG(uap, size),
|
||||
SCARG(uap, anywhere));
|
||||
if (rv == KERN_SUCCESS) {
|
||||
if (copyout((caddr_t)&addr, (caddr_t)uap->addr, sizeof(addr)))
|
||||
if (copyout((caddr_t)&addr, (caddr_t)SCARG(uap, addr),
|
||||
sizeof(addr)))
|
||||
rv = KERN_INVALID_ARGUMENT;
|
||||
}
|
||||
return((int)rv);
|
||||
|
@ -120,12 +122,12 @@ int
|
|||
svm_deallocate(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct svm_deallocate_args *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
int rv;
|
||||
|
||||
uap->map = p->p_map; /* XXX */
|
||||
rv = vm_deallocate(uap->map, uap->addr, uap->size);
|
||||
SCARG(uap, map) = p->p_map; /* XXX */
|
||||
rv = vm_deallocate(SCARG(uap, map), SCARG(uap, addr), SCARG(uap, size));
|
||||
return((int)rv);
|
||||
}
|
||||
|
||||
|
@ -140,12 +142,13 @@ int
|
|||
svm_inherit(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct svm_inherit_args *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
int rv;
|
||||
|
||||
uap->map = p->p_map; /* XXX */
|
||||
rv = vm_inherit(uap->map, uap->addr, uap->size, uap->inherit);
|
||||
SCARG(uap, map) = p->p_map; /* XXX */
|
||||
rv = vm_inherit(SCARG(uap, map), SCARG(uap, addr), SCARG(uap, size),
|
||||
SCARG(uap, inherit));
|
||||
return((int)rv);
|
||||
}
|
||||
|
||||
|
@ -161,12 +164,13 @@ int
|
|||
svm_protect(p, uap, retval)
|
||||
struct proc *p;
|
||||
struct svm_protect_args *uap;
|
||||
int *retval;
|
||||
register_t *retval;
|
||||
{
|
||||
int rv;
|
||||
|
||||
uap->map = p->p_map; /* XXX */
|
||||
rv = vm_protect(uap->map, uap->addr, uap->size, uap->setmax, uap->prot);
|
||||
SCARG(uap, map) = p->p_map; /* XXX */
|
||||
rv = vm_protect(SCARG(uap, map), SCARG(uap, addr), SCARG(uap, size),
|
||||
SCARG(uap, setmax), SCARG(uap, prot));
|
||||
return((int)rv);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue