diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index d7e42026b83e..fc58173a6c2f 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,545 +1,551 @@ /*- * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)kern_exit.c 8.7 (Berkeley) 2/12/94 - * $Id: kern_exit.c,v 1.35 1996/07/30 03:08:37 dyson Exp $ + * $Id: kern_exit.c,v 1.36 1996/08/19 02:28:23 julian Exp $ */ #include "opt_ktrace.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* for acct_process() function prototype */ #include #include #include #ifdef COMPAT_43 #include #include #endif #include #include #include #include #include #include #include static int wait1 __P((struct proc *, struct wait_args *, int [], int)); /* * callout list for things to do at exit time */ typedef struct exit_list_element { struct exit_list_element *next; exitlist_fn function; } *ele_p; static ele_p exit_list; /* * exit -- * Death of process. */ __dead void exit(p, uap, retval) struct proc *p; struct rexit_args /* { int rval; } */ *uap; int *retval; { exit1(p, W_EXITCODE(uap->rval, 0)); /* NOTREACHED */ } /* * Exit: deallocate address space and other resources, change proc state * to zombie, and unlink proc from allproc and parent's lists. Save exit * status and rusage for wait(). Check for child processes and orphan them. */ __dead void exit1(p, rv) register struct proc *p; int rv; { register struct proc *q, *nq; register struct vmspace *vm; ele_p ep = exit_list; if (p->p_pid == 1) { printf("init died (signal %d, exit %d)\n", WTERMSIG(rv), WEXITSTATUS(rv)); panic("Going nowhere without my init!"); } #ifdef PGINPROF vmsizmon(); #endif /* * Check if any LKMs need anything done at process exit * e.g. SYSV IPC stuff * XXX what if one of these generates an error? */ while(ep) { (*ep->function)(p); ep = ep->next; } if (p->p_flag & P_PROFIL) stopprofclock(p); MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage), M_ZOMBIE, M_WAITOK); /* * If parent is waiting for us to exit or exec, * P_PPWAIT is set; we will wakeup the parent below. */ p->p_flag &= ~(P_TRACED | P_PPWAIT); p->p_flag |= P_WEXIT; p->p_sigignore = ~0; p->p_siglist = 0; untimeout(realitexpire, (caddr_t)p); /* * Close open files and release open-file table. * This may block! */ fdfree(p); + /* + * Delete select() buffers + */ + if (p->p_selbits) + free (p->p_selbits, M_SELECT); + /* * XXX Shutdown SYSV semaphores */ semexit(p); /* The next two chunks should probably be moved to vmspace_exit. */ vm = p->p_vmspace; if (vm->vm_shm) shmexit(p); /* * Release user portion of address space. * This releases references to vnodes, * which could cause I/O if the file has been unlinked. * Need to do this early enough that we can still sleep. * Can't free the entire vmspace as the kernel stack * may be mapped within that space also. */ if (vm->vm_refcnt == 1) (void) vm_map_remove(&vm->vm_map, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS); if (SESS_LEADER(p)) { register struct session *sp = p->p_session; if (sp->s_ttyvp) { /* * Controlling process. * Signal foreground pgrp, * drain controlling terminal * and revoke access to controlling terminal. */ if (sp->s_ttyp->t_session == sp) { if (sp->s_ttyp->t_pgrp) pgsignal(sp->s_ttyp->t_pgrp, SIGHUP, 1); (void) ttywait(sp->s_ttyp); /* * The tty could have been revoked * if we blocked. */ if (sp->s_ttyvp) vgoneall(sp->s_ttyvp); } if (sp->s_ttyvp) vrele(sp->s_ttyvp); sp->s_ttyvp = NULL; /* * s_ttyp is not zero'd; we use this to indicate * that the session once had a controlling terminal. * (for logging and informational purposes) */ } sp->s_leader = NULL; } fixjobc(p, p->p_pgrp, 0); p->p_rlimit[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; (void)acct_process(p); #ifdef KTRACE /* * release trace file */ p->p_traceflag = 0; /* don't trace the vrele() */ if (p->p_tracep) vrele(p->p_tracep); #endif /* * Remove proc from allproc queue and pidhash chain. * Place onto zombproc. Unlink from parent's child list. */ LIST_REMOVE(p, p_list); LIST_INSERT_HEAD(&zombproc, p, p_list); p->p_stat = SZOMB; LIST_REMOVE(p, p_hash); q = p->p_children.lh_first; if (q) /* only need this if any child is S_ZOMB */ wakeup((caddr_t) initproc); for (; q != 0; q = nq) { nq = q->p_sibling.le_next; LIST_REMOVE(q, p_sibling); LIST_INSERT_HEAD(&initproc->p_children, q, p_sibling); q->p_pptr = initproc; /* * Traced processes are killed * since their existence means someone is screwing up. */ if (q->p_flag & P_TRACED) { q->p_flag &= ~P_TRACED; psignal(q, SIGKILL); } } /* * Save exit status and final rusage info, adding in child rusage * info and self times. */ p->p_xstat = rv; *p->p_ru = p->p_stats->p_ru; calcru(p, &p->p_ru->ru_utime, &p->p_ru->ru_stime, NULL); ruadd(p->p_ru, &p->p_stats->p_cru); /* * Notify parent that we're gone. */ psignal(p->p_pptr, SIGCHLD); wakeup((caddr_t)p->p_pptr); #if defined(tahoe) /* move this to cpu_exit */ p->p_addr->u_pcb.pcb_savacc.faddr = (float *)NULL; #endif /* * Clear curproc after we've done all operations * that could block, and before tearing down the rest * of the process state that might be used from clock, etc. * Also, can't clear curproc while we're still runnable, * as we're not on a run queue (we are current, just not * a proper proc any longer!). * * Other substructures are freed from wait(). */ curproc = NULL; if (--p->p_limit->p_refcnt == 0) { FREE(p->p_limit, M_SUBPROC); p->p_limit = NULL; } /* * Finally, call machine-dependent code to release the remaining * resources including address space, the kernel stack and pcb. * The address space is released by "vmspace_free(p->p_vmspace)"; * This is machine-dependent, as we may have to change stacks * or ensure that the current one isn't reallocated before we * finish. cpu_exit will end with a call to cpu_switch(), finishing * our execution (pun intended). */ cpu_exit(p); } #ifdef COMPAT_43 #if defined(hp300) || defined(luna68k) #include #define GETPS(rp) ((struct frame *)(rp))->f_sr #else #define GETPS(rp) (rp)[PS] #endif int owait(p, uap, retval) struct proc *p; register struct owait_args /* { int dummy; } */ *uap; int *retval; { struct wait_args w; #ifdef PSL_ALLCC if ((GETPS(p->p_md.md_regs) & PSL_ALLCC) != PSL_ALLCC) { w.options = 0; w.rusage = NULL; } else { w.options = p->p_md.md_regs[R0]; w.rusage = (struct rusage *)p->p_md.md_regs[R1]; } #else w.options = 0; w.rusage = NULL; #endif w.pid = WAIT_ANY; w.status = NULL; return (wait1(p, &w, retval, 1)); } #endif /* COMPAT_43 */ int wait4(p, uap, retval) struct proc *p; struct wait_args *uap; int *retval; { return (wait1(p, uap, retval, 0)); } static int wait1(q, uap, retval, compat) register struct proc *q; register struct wait_args /* { int pid; int *status; int options; struct rusage *rusage; } */ *uap; int retval[]; int compat; { register int nfound; register struct proc *p, *t; int status, error; if (uap->pid == 0) uap->pid = -q->p_pgid; #ifdef notyet if (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) continue; nfound++; if (p->p_stat == SZOMB) { /* charge childs scheduling cpu usage to parent */ if (curproc->p_pid != 1) { curproc->p_estcpu = min(curproc->p_estcpu + p->p_estcpu, UCHAR_MAX); } retval[0] = p->p_pid; #ifdef COMPAT_43 if (compat) retval[1] = p->p_xstat; else #endif if (uap->status) { status = p->p_xstat; /* convert to int */ if ((error = copyout((caddr_t)&status, (caddr_t)uap->status, sizeof(status)))) return (error); } if (uap->rusage && (error = copyout((caddr_t)p->p_ru, (caddr_t)uap->rusage, sizeof (struct rusage)))) return (error); /* * If we got the child via a ptrace 'attach', * we need to give it back to the old parent. */ if (p->p_oppid && (t = pfind(p->p_oppid))) { p->p_oppid = 0; proc_reparent(p, t); psignal(t, SIGCHLD); wakeup((caddr_t)t); return (0); } p->p_xstat = 0; ruadd(&q->p_stats->p_cru, p->p_ru); FREE(p->p_ru, M_ZOMBIE); p->p_ru = NULL; /* * Decrement the count of procs running with this uid. */ (void)chgproccnt(p->p_cred->p_ruid, -1); /* * Release reference to text vnode */ if (p->p_textvp) vrele(p->p_textvp); /* * Free up credentials. */ if (--p->p_cred->p_refcnt == 0) { crfree(p->p_cred->pc_ucred); FREE(p->p_cred, M_SUBPROC); p->p_cred = NULL; } /* * Finally finished with old proc entry. * Unlink it from its process group and free it. */ leavepgrp(p); LIST_REMOVE(p, p_list); /* off zombproc */ LIST_REMOVE(p, p_sibling); /* * Give machine-dependent layer a chance * to free anything that cpu_exit couldn't * release while still running in process context. */ cpu_wait(p); FREE(p, M_PROC); nprocs--; 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_WAITED; retval[0] = p->p_pid; #ifdef COMPAT_43 if (compat) { retval[1] = W_STOPCODE(p->p_xstat); error = 0; } else #endif if (uap->status) { status = W_STOPCODE(p->p_xstat); error = copyout((caddr_t)&status, (caddr_t)uap->status, sizeof(status)); } else error = 0; return (error); } } if (nfound == 0) return (ECHILD); if (uap->options & WNOHANG) { retval[0] = 0; return (0); } if ((error = tsleep((caddr_t)q, PWAIT | PCATCH, "wait", 0))) return (error); goto loop; } /* * make process 'parent' the new parent of process 'child'. */ void proc_reparent(child, parent) register struct proc *child; register struct proc *parent; { if (child->p_pptr == parent) return; LIST_REMOVE(child, p_sibling); LIST_INSERT_HEAD(&parent->p_children, child, p_sibling); child->p_pptr = parent; } /********************************************************* * general routines to handle adding/deleting items on the * exit callout list ***** * Take the arguments given and put them onto the exit callout list. * However first make sure that it's not already there. * returns 0 on success. */ int at_exit(exitlist_fn function) { ele_p ep; if(rm_at_exit(function)) { printf("exit callout entry already present\n"); } ep = malloc(sizeof(*ep),M_TEMP,M_NOWAIT); if(!ep) return ENOMEM; ep->next = exit_list; ep->function = function; exit_list = ep; return 0; } /* * Scan the exit callout list for the given items and remove them. * Returns the number of items removed. */ int rm_at_exit(exitlist_fn function) { ele_p *epp,ep; int count = 0; epp = &exit_list; ep = *epp; while(ep) { if(ep->function == function) { *epp = ep->next; free(ep,M_TEMP); count++; } else { epp = &ep->next; } ep = *epp; } return count; } diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index acf407bd1e3b..27b9910dd575 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,710 +1,738 @@ /* * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)sys_generic.c 8.5 (Berkeley) 1/21/94 - * $Id: sys_generic.c,v 1.17 1995/12/14 08:31:48 phk Exp $ + * $Id: sys_generic.c,v 1.18 1996/01/03 21:42:17 wollman Exp $ */ #include "opt_ktrace.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef KTRACE #include #endif #include -static int selscan __P((struct proc *, fd_set *, fd_set *, int, int *)); +static int selscan __P((struct proc *, fd_mask **, fd_mask **, int, int *)); /* * Read system call. */ #ifndef _SYS_SYSPROTO_H_ struct read_args { int fd; char *buf; u_int nbyte; }; #endif /* ARGSUSED */ int read(p, uap, retval) struct proc *p; register struct read_args *uap; int *retval; { register struct file *fp; register struct filedesc *fdp = p->p_fd; struct uio auio; struct iovec aiov; long cnt, error = 0; #ifdef KTRACE struct iovec ktriov; #endif if (((u_int)uap->fd) >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[uap->fd]) == NULL || (fp->f_flag & FREAD) == 0) return (EBADF); aiov.iov_base = (caddr_t)uap->buf; aiov.iov_len = uap->nbyte; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_resid = uap->nbyte; if (auio.uio_resid < 0) return (EINVAL); auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_procp = p; #ifdef KTRACE /* * if tracing, save a copy of iovec */ if (KTRPOINT(p, KTR_GENIO)) ktriov = aiov; #endif cnt = 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)) error = 0; cnt -= auio.uio_resid; #ifdef KTRACE if (KTRPOINT(p, KTR_GENIO) && error == 0) ktrgenio(p->p_tracep, uap->fd, UIO_READ, &ktriov, cnt, error); #endif *retval = cnt; return (error); } /* * Scatter read system call. */ #ifndef _SYS_SYSPROTO_H_ struct readv_args { int fd; struct iovec *iovp; u_int iovcnt; }; #endif int readv(p, uap, retval) struct proc *p; register struct readv_args *uap; int *retval; { register struct file *fp; register struct filedesc *fdp = p->p_fd; struct uio auio; register struct iovec *iov; struct iovec *needfree; struct iovec aiov[UIO_SMALLIOV]; long i, cnt, error = 0; u_int iovlen; #ifdef KTRACE struct iovec *ktriov = NULL; #endif if (((u_int)uap->fd) >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[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) return (EINVAL); MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK); needfree = iov; } else { iov = aiov; needfree = NULL; } auio.uio_iov = iov; auio.uio_iovcnt = 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))) goto done; auio.uio_resid = 0; for (i = 0; i < uap->iovcnt; i++) { auio.uio_resid += iov->iov_len; if (auio.uio_resid < 0) { error = EINVAL; goto done; } iov++; } #ifdef KTRACE /* * if tracing, save a copy of iovec */ if (KTRPOINT(p, KTR_GENIO)) { MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); } #endif cnt = auio.uio_resid; if ((error = (*fp->f_ops->fo_read)(fp, &auio, fp->f_cred))) if (auio.uio_resid != cnt && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; cnt -= auio.uio_resid; #ifdef KTRACE if (ktriov != NULL) { if (error == 0) ktrgenio(p->p_tracep, uap->fd, UIO_READ, ktriov, cnt, error); FREE(ktriov, M_TEMP); } #endif *retval = cnt; done: if (needfree) FREE(needfree, M_IOV); return (error); } /* * Write system call */ #ifndef _SYS_SYSPROTO_H_ struct write_args { int fd; char *buf; u_int nbyte; }; #endif int write(p, uap, retval) struct proc *p; register struct write_args *uap; int *retval; { register struct file *fp; register struct filedesc *fdp = p->p_fd; struct uio auio; struct iovec aiov; long cnt, error = 0; #ifdef KTRACE struct iovec ktriov; #endif if (((u_int)uap->fd) >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[uap->fd]) == NULL || (fp->f_flag & FWRITE) == 0) return (EBADF); aiov.iov_base = (caddr_t)uap->buf; aiov.iov_len = uap->nbyte; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_resid = uap->nbyte; auio.uio_rw = UIO_WRITE; auio.uio_segflg = UIO_USERSPACE; auio.uio_procp = p; #ifdef KTRACE /* * if tracing, save a copy of iovec */ if (KTRPOINT(p, KTR_GENIO)) ktriov = aiov; #endif cnt = 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)) error = 0; if (error == EPIPE) psignal(p, SIGPIPE); } cnt -= auio.uio_resid; #ifdef KTRACE if (KTRPOINT(p, KTR_GENIO) && error == 0) ktrgenio(p->p_tracep, uap->fd, UIO_WRITE, &ktriov, cnt, error); #endif *retval = cnt; return (error); } /* * Gather write system call */ #ifndef _SYS_SYSPROTO_H_ struct writev_args { int fd; struct iovec *iovp; u_int iovcnt; }; #endif int writev(p, uap, retval) struct proc *p; register struct writev_args *uap; int *retval; { register struct file *fp; register struct filedesc *fdp = p->p_fd; struct uio auio; register struct iovec *iov; struct iovec *needfree; struct iovec aiov[UIO_SMALLIOV]; long i, cnt, error = 0; u_int iovlen; #ifdef KTRACE struct iovec *ktriov = NULL; #endif if (((u_int)uap->fd) >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[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) return (EINVAL); MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK); needfree = iov; } else { iov = aiov; needfree = NULL; } auio.uio_iov = iov; auio.uio_iovcnt = 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))) goto done; auio.uio_resid = 0; for (i = 0; i < uap->iovcnt; i++) { auio.uio_resid += iov->iov_len; if (auio.uio_resid < 0) { error = EINVAL; goto done; } iov++; } #ifdef KTRACE /* * if tracing, save a copy of iovec */ if (KTRPOINT(p, KTR_GENIO)) { MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); } #endif cnt = auio.uio_resid; if ((error = (*fp->f_ops->fo_write)(fp, &auio, fp->f_cred))) { if (auio.uio_resid != cnt && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; if (error == EPIPE) psignal(p, SIGPIPE); } cnt -= auio.uio_resid; #ifdef KTRACE if (ktriov != NULL) { if (error == 0) ktrgenio(p->p_tracep, uap->fd, UIO_WRITE, ktriov, cnt, error); FREE(ktriov, M_TEMP); } #endif *retval = cnt; done: if (needfree) FREE(needfree, M_IOV); return (error); } /* * Ioctl system call */ #ifndef _SYS_SYSPROTO_H_ struct ioctl_args { int fd; int com; caddr_t data; }; #endif /* ARGSUSED */ int ioctl(p, uap, retval) struct proc *p; register struct ioctl_args *uap; int *retval; { register struct file *fp; register struct filedesc *fdp; register int com, error; register u_int size; caddr_t data, memp; int tmp; #define STK_PARAMS 128 char stkbuf[STK_PARAMS]; fdp = p->p_fd; if ((u_int)uap->fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[uap->fd]) == NULL) return (EBADF); if ((fp->f_flag & (FREAD | FWRITE)) == 0) return (EBADF); switch (com = uap->com) { case FIONCLEX: fdp->fd_ofileflags[uap->fd] &= ~UF_EXCLOSE; return (0); case FIOCLEX: fdp->fd_ofileflags[uap->fd] |= UF_EXCLOSE; return (0); } /* * Interpret high order word to find amount of data to be * copied to/from the user's address space. */ size = IOCPARM_LEN(com); if (size > IOCPARM_MAX) return (ENOTTY); memp = NULL; if (size > sizeof (stkbuf)) { memp = (caddr_t)malloc((u_long)size, M_IOCTLOPS, M_WAITOK); data = memp; } else data = stkbuf; if (com&IOC_IN) { if (size) { error = copyin(uap->data, data, (u_int)size); if (error) { if (memp) free(memp, M_IOCTLOPS); return (error); } } else *(caddr_t *)data = uap->data; } else if ((com&IOC_OUT) && size) /* * Zero the buffer so the user always * gets back something deterministic. */ bzero(data, size); else if (com&IOC_VOID) *(caddr_t *)data = uap->data; switch (com) { case FIONBIO: if ((tmp = *(int *)data)) fp->f_flag |= FNONBLOCK; else fp->f_flag &= ~FNONBLOCK; error = (*fp->f_ops->fo_ioctl)(fp, FIONBIO, (caddr_t)&tmp, p); break; case FIOASYNC: if ((tmp = *(int *)data)) fp->f_flag |= FASYNC; else fp->f_flag &= ~FASYNC; error = (*fp->f_ops->fo_ioctl)(fp, FIOASYNC, (caddr_t)&tmp, p); break; case FIOSETOWN: tmp = *(int *)data; if (fp->f_type == DTYPE_SOCKET) { ((struct socket *)fp->f_data)->so_pgid = tmp; error = 0; break; } if (tmp <= 0) { tmp = -tmp; } else { struct proc *p1 = pfind(tmp); if (p1 == 0) { error = ESRCH; break; } tmp = p1->p_pgrp->pg_id; } error = (*fp->f_ops->fo_ioctl) (fp, (int)TIOCSPGRP, (caddr_t)&tmp, p); break; case FIOGETOWN: if (fp->f_type == DTYPE_SOCKET) { error = 0; *(int *)data = ((struct socket *)fp->f_data)->so_pgid; break; } error = (*fp->f_ops->fo_ioctl)(fp, (int)TIOCGPGRP, data, p); *(int *)data = -*(int *)data; break; default: error = (*fp->f_ops->fo_ioctl)(fp, com, data, p); /* * Copy any data to user, size was * already set and checked above. */ if (error == 0 && (com&IOC_OUT) && size) error = copyout(data, uap->data, (u_int)size); break; } if (memp) free(memp, M_IOCTLOPS); return (error); } static int nselcoll; int selwait; /* * Select system call. */ #ifndef _SYS_SYSPROTO_H_ struct select_args { - u_int nd; + int nd; fd_set *in, *ou, *ex; struct timeval *tv; }; #endif int select(p, uap, retval) register struct proc *p; register struct select_args *uap; int *retval; { - fd_set ibits[3], obits[3]; + fd_mask *ibits[3], *obits[3]; struct timeval atv; - int s, ncoll, error = 0, timo; + int s, ncoll, error = 0, timo, i; u_int ni; - bzero((caddr_t)ibits, sizeof(ibits)); - bzero((caddr_t)obits, sizeof(obits)); - if (uap->nd > FD_SETSIZE) - return (EINVAL); + if (uap->nd < 0) + return EINVAL; + if (uap->nd > p->p_fd->fd_nfiles) - uap->nd = p->p_fd->fd_nfiles; /* forgiving; slightly wrong */ + uap->nd = p->p_fd->fd_nfiles; /* forgiving; slightly wrong */ + + /* The amount of space we need to allocate */ + ni = howmany(roundup2 (uap->nd, FD_SETSIZE), NFDBITS) * + sizeof(fd_mask); + + if (ni > p->p_selbits_size) { + if (p->p_selbits_size) + free (p->p_selbits, M_SELECT); + + while (p->p_selbits_size < ni) + p->p_selbits_size += 32; /* Increase by 256 bits */ + + p->p_selbits = malloc(p->p_selbits_size * 6, M_SELECT, + M_WAITOK); + } + for (i = 0; i < 3; i++) { + ibits[i] = (fd_mask *)(p->p_selbits + i * p->p_selbits_size); + obits[i] = (fd_mask *)(p->p_selbits + (i + 3) * + p->p_selbits_size); + } + + /* + * This buffer is usually very small therefore it's probably faster + * to just zero it, rather than calculate what needs to be zeroed. + */ + bzero (p->p_selbits, p->p_selbits_size * 6); + + /* The amount of space we need to copyin/copyout */ ni = howmany(uap->nd, NFDBITS) * sizeof(fd_mask); #define getbits(name, x) \ if (uap->name && \ - (error = copyin((caddr_t)uap->name, (caddr_t)&ibits[x], ni))) \ + (error = copyin((caddr_t)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, sizeof (atv)); if (error) goto done; if (itimerfix(&atv)) { error = EINVAL; goto done; } s = splclock(); timevaladd(&atv, (struct timeval *)&time); timo = hzto(&atv); /* * Avoid inadvertently sleeping forever. */ if (timo == 0) timo = 1; splx(s); } else timo = 0; retry: ncoll = nselcoll; p->p_flag |= P_SELECT; error = selscan(p, ibits, obits, 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 || (time.tv_sec == atv.tv_sec && time.tv_usec >= atv.tv_usec))) { splx(s); goto done; } if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) { splx(s); goto retry; } p->p_flag &= ~P_SELECT; error = tsleep((caddr_t)&selwait, PSOCK | PCATCH, "select", timo); splx(s); if (error == 0) goto retry; done: p->p_flag &= ~P_SELECT; /* select is not restarted after signals... */ if (error == ERESTART) error = EINTR; if (error == EWOULDBLOCK) error = 0; #define putbits(name, x) \ if (uap->name && \ - (error2 = copyout((caddr_t)&obits[x], (caddr_t)uap->name, ni))) \ + (error2 = copyout((caddr_t)obits[x], (caddr_t)uap->name, ni))) \ error = error2; if (error == 0) { int error2; putbits(in, 0); putbits(ou, 1); putbits(ex, 2); #undef putbits } return (error); } static int selscan(p, ibits, obits, nfd, retval) struct proc *p; - fd_set *ibits, *obits; + fd_mask **ibits, **obits; int nfd, *retval; { register struct filedesc *fdp = p->p_fd; register int msk, i, j, fd; register fd_mask bits; struct file *fp; int n = 0; static int flag[3] = { FREAD, FWRITE, 0 }; for (msk = 0; msk < 3; msk++) { for (i = 0; i < nfd; i += NFDBITS) { - bits = ibits[msk].fds_bits[i/NFDBITS]; + bits = ibits[msk][i/NFDBITS]; while ((j = ffs(bits)) && (fd = i + --j) < nfd) { bits &= ~(1 << j); fp = fdp->fd_ofiles[fd]; if (fp == NULL) return (EBADF); if ((*fp->f_ops->fo_select)(fp, flag[msk], p)) { - FD_SET(fd, &obits[msk]); + obits[msk][(fd)/NFDBITS] |= + (1 << ((fd) % NFDBITS)); n++; } } } } *retval = n; return (0); } /*ARGSUSED*/ int seltrue(dev, flag, p) dev_t dev; int flag; struct proc *p; { return (1); } /* * Record a select request. */ void selrecord(selector, sip) struct proc *selector; struct selinfo *sip; { struct proc *p; pid_t mypid; mypid = selector->p_pid; if (sip->si_pid == mypid) return; if (sip->si_pid && (p = pfind(sip->si_pid)) && p->p_wchan == (caddr_t)&selwait) sip->si_flags |= SI_COLL; else sip->si_pid = mypid; } /* * Do a wakeup when a selectable event occurs. */ void selwakeup(sip) register struct selinfo *sip; { register struct proc *p; int s; if (sip->si_pid == 0) return; if (sip->si_flags & SI_COLL) { nselcoll++; sip->si_flags &= ~SI_COLL; wakeup((caddr_t)&selwait); } p = pfind(sip->si_pid); sip->si_pid = 0; if (p != NULL) { s = splhigh(); if (p->p_wchan == (caddr_t)&selwait) { if (p->p_stat == SSLEEP) setrunnable(p); else unsleep(p); } else if (p->p_flag & P_SELECT) p->p_flag &= ~P_SELECT; splx(s); } } diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index ba6ef552b4c3..ad5ba53e1c48 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,387 +1,387 @@ - $Id: syscalls.master,v 1.26 1996/02/23 18:20:44 peter Exp $ + $Id: syscalls.master,v 1.27 1996/03/02 16:51:25 peter Exp $ ; from: @(#)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 namespc name alt{name,tag,rtyp}/comments ; number system call number, must be in order ; type one of STD, OBSOL, UNIMPL, COMPAT ; namespc one of POSIX, BSD, NOHIDE ; name psuedo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" ; altrtyp return type if not int (bogus - syscalls always return int) ; for UNIMPL/OBSOL, name continues with comments ; 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 ; UNIMPL not implemented, placeholder only ; #ifdef's, etc. may be included, and are copied to the output files. #include #include #include #include #include ; Reserved/unimplemented system calls in the range 0-150 inclusive ; are reserved for use in future Berkeley releases. ; Additional system calls implemented in vendor and other ; redistributions should be placed in the reserved range at the end ; of the current calls. 0 STD NOHIDE { int nosys(void); } syscall nosys_args int 1 STD NOHIDE { void exit(int rval); } exit rexit_args void 2 STD POSIX { int fork(void); } 3 STD POSIX { int read(int fd, char *buf, u_int nbyte); } 4 STD POSIX { int write(int fd, char *buf, u_int nbyte); } 5 STD POSIX { int open(char *path, int flags, int mode); } ; XXX should be { int open(const char *path, int flags, ...); } ; but we're not ready for `const' or varargs. ; XXX man page says `mode_t mode'. 6 STD POSIX { int close(int fd); } 7 STD BSD { int wait4(int pid, int *status, int options, \ struct rusage *rusage); } wait4 wait_args int 8 COMPAT BSD { int creat(char *path, int mode); } 9 STD POSIX { int link(char *path, char *link); } 10 STD POSIX { int unlink(char *path); } 11 OBSOL NOHIDE execv 12 STD POSIX { int chdir(char *path); } 13 STD BSD { int fchdir(int fd); } 14 STD POSIX { int mknod(char *path, int mode, int dev); } 15 STD POSIX { int chmod(char *path, int mode); } 16 STD POSIX { int chown(char *path, int uid, int gid); } 17 STD BSD { int obreak(char *nsize); } break obreak_args int 18 STD BSD { int getfsstat(struct statfs *buf, long bufsize, \ int flags); } 19 COMPAT POSIX { long lseek(int fd, long offset, int whence); } 20 STD POSIX { pid_t getpid(void); } 21 STD BSD { int mount(int type, char *path, int flags, \ caddr_t data); } ; XXX 4.4lite2 uses `char *type' but we're not ready for that. ; XXX `path' should have type `const char *' but we're not ready for that. 22 STD BSD { int unmount(char *path, int flags); } 23 STD POSIX { int setuid(uid_t uid); } 24 STD POSIX { uid_t getuid(void); } 25 STD POSIX { uid_t geteuid(void); } 26 STD BSD { int ptrace(int req, pid_t pid, caddr_t addr, \ int data); } 27 STD BSD { int recvmsg(int s, struct msghdr *msg, int flags); } 28 STD BSD { int sendmsg(int s, caddr_t msg, int flags); } 29 STD BSD { int recvfrom(int s, caddr_t buf, size_t len, \ int flags, caddr_t from, int *fromlenaddr); } 30 STD BSD { int accept(int s, caddr_t name, int *anamelen); } 31 STD BSD { int getpeername(int fdes, caddr_t asa, int *alen); } 32 STD BSD { int getsockname(int fdes, caddr_t asa, int *alen); } 33 STD POSIX { int access(char *path, int flags); } 34 STD BSD { int chflags(char *path, int flags); } 35 STD BSD { int fchflags(int fd, int flags); } 36 STD BSD { int sync(void); } 37 STD POSIX { int kill(int pid, int signum); } 38 COMPAT POSIX { int stat(char *path, struct ostat *ub); } 39 STD POSIX { pid_t getppid(void); } 40 COMPAT POSIX { int lstat(char *path, struct ostat *ub); } 41 STD POSIX { int dup(u_int fd); } 42 STD POSIX { int pipe(void); } 43 STD POSIX { gid_t getegid(void); } 44 STD BSD { int profil(caddr_t samples, u_int size, \ u_int offset, u_int scale); } 45 STD BSD { int ktrace(char *fname, int ops, int facs, \ int pid); } 46 STD POSIX { int sigaction(int signum, struct sigaction *nsa, \ struct sigaction *osa); } 47 STD POSIX { gid_t getgid(void); } 48 STD POSIX { int sigprocmask(int how, sigset_t mask); } 49 STD BSD { int getlogin(char *namebuf, u_int namelen); } 50 STD BSD { int setlogin(char *namebuf); } 51 STD BSD { int acct(char *path); } 52 STD POSIX { int sigpending(void); } 53 STD BSD { int sigaltstack(struct sigaltstack *nss, \ struct sigaltstack *oss); } 54 STD POSIX { int ioctl(int fd, u_long com, caddr_t data); } 55 STD BSD { int reboot(int opt); } 56 STD POSIX { int revoke(char *path); } 57 STD POSIX { int symlink(char *path, char *link); } 58 STD POSIX { int readlink(char *path, char *buf, int count); } 59 STD POSIX { int execve(char *fname, char **argv, char **envv); } 60 STD POSIX { int umask(int newmask); } umask umask_args mode_t 61 STD BSD { int chroot(char *path); } 62 COMPAT POSIX { int fstat(int fd, struct ostat *sb); } 63 COMPAT BSD { int getkerninfo(int op, char *where, int *size, \ int arg); } getkerninfo getkerninfo_args int 64 COMPAT BSD { int getpagesize(void); } \ getpagesize getpagesize_args int 65 STD BSD { int msync(caddr_t addr, size_t len, int flags); } 66 STD BSD { int vfork(void); } 67 OBSOL NOHIDE vread 68 OBSOL NOHIDE vwrite 69 STD BSD { int sbrk(int incr); } 70 STD BSD { int sstk(int incr); } 71 COMPAT BSD { int mmap(caddr_t addr, int len, int prot, \ int flags, int fd, long pos); } 72 STD BSD { int ovadvise(int anom); } vadvise ovadvise_args int 73 STD BSD { int munmap(caddr_t addr, size_t len); } 74 STD BSD { int mprotect(caddr_t addr, size_t len, int prot); } 75 STD BSD { int madvise(caddr_t addr, size_t len, int behav); } 76 OBSOL NOHIDE vhangup 77 OBSOL NOHIDE vlimit 78 STD BSD { int mincore(caddr_t addr, size_t len, char *vec); } 79 STD POSIX { int getgroups(u_int gidsetsize, gid_t *gidset); } 80 STD POSIX { int setgroups(u_int gidsetsize, gid_t *gidset); } 81 STD POSIX { int getpgrp(void); } 82 STD POSIX { int setpgid(int pid, int pgid); } 83 STD BSD { int setitimer(u_int which, struct itimerval *itv, \ struct itimerval *oitv); } 84 COMPAT BSD { int wait(void); } 85 STD BSD { int swapon(char *name); } 86 STD BSD { int getitimer(u_int which, struct itimerval *itv); } 87 COMPAT BSD { int gethostname(char *hostname, u_int len); } \ gethostname gethostname_args int 88 COMPAT BSD { int sethostname(char *hostname, u_int len); } \ sethostname sethostname_args int 89 STD BSD { int getdtablesize(void); } 90 STD POSIX { int dup2(u_int from, u_int to); } 91 UNIMPL BSD getdopt 92 STD POSIX { int fcntl(int fd, int cmd, int arg); } ; XXX should be { int fcntl(int fd, int cmd, ...); } ; but we're not ready for varargs. ; XXX man page says `int arg' too. -93 STD BSD { int select(u_int nd, fd_set *in, fd_set *ou, \ +93 STD BSD { int select(int nd, fd_set *in, fd_set *ou, \ fd_set *ex, struct timeval *tv); } 94 UNIMPL BSD setdopt 95 STD POSIX { int fsync(int fd); } 96 STD BSD { int setpriority(int which, int who, int prio); } 97 STD BSD { int socket(int domain, int type, int protocol); } 98 STD BSD { int connect(int s, caddr_t name, int namelen); } 99 CPT_NOA BSD { int accept(int s, caddr_t name, int *anamelen); } \ accept accept_args int 100 STD BSD { int getpriority(int which, int who); } 101 COMPAT BSD { int send(int s, caddr_t buf, int len, int flags); } 102 COMPAT BSD { int recv(int s, caddr_t buf, int len, int flags); } 103 STD BSD { int sigreturn(struct sigcontext *sigcntxp); } 104 STD BSD { int bind(int s, caddr_t name, int namelen); } 105 STD BSD { int setsockopt(int s, int level, int name, \ caddr_t val, int valsize); } 106 STD BSD { int listen(int s, int backlog); } 107 OBSOL NOHIDE vtimes 108 COMPAT BSD { int sigvec(int signum, struct sigvec *nsv, \ struct sigvec *osv); } 109 COMPAT BSD { int sigblock(int mask); } 110 COMPAT BSD { int sigsetmask(int mask); } 111 STD POSIX { int sigsuspend(int mask); } 112 COMPAT BSD { int sigstack(struct sigstack *nss, \ struct sigstack *oss); } 113 COMPAT BSD { int recvmsg(int s, struct omsghdr *msg, int flags); } 114 COMPAT BSD { int sendmsg(int s, caddr_t msg, int flags); } 115 OBSOL NOHIDE vtrace 116 STD BSD { int gettimeofday(struct timeval *tp, \ struct timezone *tzp); } 117 STD BSD { int getrusage(int who, struct rusage *rusage); } 118 STD BSD { int getsockopt(int s, int level, int name, \ caddr_t val, int *avalsize); } 119 UNIMPL NOHIDE resuba (BSD/OS 2.x) 120 STD BSD { int readv(int fd, struct iovec *iovp, u_int iovcnt); } 121 STD BSD { int writev(int fd, struct iovec *iovp, \ u_int iovcnt); } 122 STD BSD { int settimeofday(struct timeval *tv, \ struct timezone *tzp); } 123 STD BSD { int fchown(int fd, int uid, int gid); } 124 STD BSD { int fchmod(int fd, int mode); } 125 CPT_NOA BSD { int recvfrom(int s, caddr_t buf, size_t len, \ int flags, caddr_t from, int *fromlenaddr); } \ recvfrom recvfrom_args int 126 STD BSD { int setreuid(int ruid, int euid); } 127 STD BSD { int setregid(int rgid, int egid); } 128 STD POSIX { int rename(char *from, char *to); } 129 COMPAT BSD { int truncate(char *path, long length); } 130 COMPAT BSD { int ftruncate(int fd, long length); } 131 STD BSD { int flock(int fd, int how); } 132 STD POSIX { int mkfifo(char *path, int mode); } 133 STD BSD { int sendto(int s, caddr_t buf, size_t len, \ int flags, caddr_t to, int tolen); } 134 STD BSD { int shutdown(int s, int how); } 135 STD BSD { int socketpair(int domain, int type, int protocol, \ int *rsv); } 136 STD POSIX { int mkdir(char *path, int mode); } 137 STD POSIX { int rmdir(char *path); } 138 STD BSD { int utimes(char *path, struct timeval *tptr); } 139 OBSOL NOHIDE 4.2 sigreturn 140 STD BSD { int adjtime(struct timeval *delta, \ struct timeval *olddelta); } 141 COMPAT BSD { int getpeername(int fdes, caddr_t asa, int *alen); } 142 COMPAT BSD { long gethostid(void); } 143 COMPAT BSD { int sethostid(long hostid); } 144 COMPAT BSD { int getrlimit(u_int which, struct ogetrlimit *rlp); } 145 COMPAT BSD { int setrlimit(u_int which, struct ogetrlimit *rlp); } 146 COMPAT BSD { int killpg(int pgid, int signum); } 147 STD POSIX { int setsid(void); } 148 STD BSD { int quotactl(char *path, int cmd, int uid, \ caddr_t arg); } 149 COMPAT BSD { int quota(void); } 150 CPT_NOA BSD { int getsockname(int fdec, caddr_t asa, int *alen); }\ getsockname getsockname_args int ; 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 NOHIDE sem_lock (BSD/OS 2.x) 152 UNIMPL NOHIDE sem_wakeup (BSD/OS 2.x) 153 UNIMPL NOHIDE asyncdaemon (BSD/OS 2.x) 154 UNIMPL NOHIDE nosys #ifdef NFS 155 STD BSD { int nfssvc(int flag, caddr_t argp); } #else 155 UNIMPL BSD nosys #endif 156 COMPAT BSD { int getdirentries(int fd, char *buf, u_int count, \ long *basep); } 157 STD BSD { int statfs(char *path, struct statfs *buf); } 158 STD BSD { int fstatfs(int fd, struct statfs *buf); } 159 UNIMPL NOHIDE nosys 160 UNIMPL NOHIDE nosys #if defined(NFS) && !defined (NFS_NOSERVER) 161 STD BSD { int getfh(char *fname, fhandle_t *fhp); } #else 161 UNIMPL BSD nosys #endif 162 STD BSD { int getdomainname(char *domainname, int len); } 163 STD BSD { int setdomainname(char *domainname, int len); } 164 STD BSD { int uname(struct utsname *name); } 165 STD BSD { int sysarch(int op, char *parms); } 166 STD BSD { int rtprio(int function, pid_t pid, \ struct rtprio *rtp); } 167 UNIMPL NOHIDE nosys 168 UNIMPL NOHIDE nosys 169 STD BSD { int semsys(int which, int a2, int a3, int a4, \ int a5); } ; XXX should be { int semsys(int which, ...); } 170 STD BSD { int msgsys(int which, int a2, int a3, int a4, \ int a5, int a6); } ; XXX should be { int msgsys(int which, ...); } 171 STD BSD { int shmsys(int which, int a2, int a3, int a4); } ; XXX should be { int shmsys(int which, ...); } 172 UNIMPL NOHIDE nosys 173 UNIMPL NOHIDE nosys 174 UNIMPL NOHIDE nosys 175 UNIMPL NOHIDE nosys 176 STD BSD { int ntp_adjtime(struct timex *tp); } 177 UNIMPL NOHIDE sfork (BSD/OS 2.x) 178 UNIMPL NOHIDE getdescriptor (BSD/OS 2.x) 179 UNIMPL NOHIDE setdescriptor (BSD/OS 2.x) 180 UNIMPL NOHIDE nosys ; Syscalls 180-199 are used by/reserved for BSD 181 STD POSIX { int setgid(gid_t gid); } 182 STD BSD { int setegid(gid_t egid); } 183 STD BSD { int seteuid(uid_t euid); } #ifdef LFS 184 STD BSD { int lfs_bmapv(fsid_t *fsidp, \ struct block_info *blkiov, int blkcnt); } 185 STD BSD { int lfs_markv(fsid_t *fsidp, \ struct block_info *blkiov, int blkcnt); } 186 STD BSD { int lfs_segclean(fsid_t *fsidp, u_long segment); } 187 STD BSD { int lfs_segwait(fsid_t *fsidp, struct timeval *tv); } #else 184 UNIMPL BSD nosys 185 UNIMPL BSD nosys 186 UNIMPL BSD nosys 187 UNIMPL BSD nosys #endif 188 STD POSIX { int stat(char *path, struct stat *ub); } 189 STD POSIX { int fstat(int fd, struct stat *sb); } 190 STD POSIX { int lstat(char *path, struct stat *ub); } 191 STD POSIX { int pathconf(char *path, int name); } 192 STD POSIX { int fpathconf(int fd, int name); } 193 UNIMPL NOHIDE nosys 194 STD BSD { int getrlimit(u_int which, \ struct orlimit *rlp); } \ getrlimit __getrlimit_args int 195 STD BSD { int setrlimit(u_int which, \ struct orlimit *rlp); } \ setrlimit __setrlimit_args int 196 STD BSD { int getdirentries(int fd, char *buf, u_int count, \ long *basep); } 197 STD BSD { caddr_t mmap(caddr_t addr, size_t len, int prot, \ int flags, int fd, long pad, off_t pos); } 198 STD NOHIDE { int nosys(void); } __syscall __syscall_args int 199 STD POSIX { off_t lseek(int fd, int pad, off_t offset, \ int whence); } 200 STD BSD { int truncate(char *path, int pad, off_t length); } 201 STD BSD { int ftruncate(int fd, int pad, off_t length); } 202 STD BSD { int __sysctl(int *name, u_int namelen, void *old, \ size_t *oldlenp, void *new, size_t newlen); } \ __sysctl sysctl_args int ; properly, __sysctl should be a NOHIDE, but making an exception ; here allows to avoid one in libc/sys/Makefile.inc. 203 STD BSD { int mlock(caddr_t addr, size_t len); } 204 STD BSD { int munlock(caddr_t addr, size_t len); } 205 UNIMPL NOHIDE nosys 206 UNIMPL NOHIDE nosys 207 UNIMPL NOHIDE nosys 208 UNIMPL NOHIDE nosys 209 UNIMPL NOHIDE nosys ; ; The following are reserved for loadable syscalls ; 210 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 211 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 212 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 213 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 214 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 215 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 216 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 217 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 218 NODEF NOHIDE lkmnosys lkmnosys nosys_args int 219 NODEF NOHIDE lkmnosys lkmnosys nosys_args int ; ; The following were introduced with NetBSD/4.4Lite-2 ; 220 STD BSD { int __semctl(int semid, int semnum, int cmd, \ union semun *arg); } 221 STD BSD { int semget(key_t key, int nsems, int semflg); } 222 STD BSD { int semop(int semid, struct sembuf *sops, \ u_int nsops); } 223 STD BSD { int semconfig(int flag); } 224 STD BSD { int msgctl(int msqid, int cmd, \ struct msqid_ds *buf); } 225 STD BSD { int msgget(key_t key, int msgflg); } 226 STD BSD { int msgsnd(int msqid, void *msgp, size_t msgsz, \ int msgflg); } 227 STD BSD { int msgrcv(int msqid, void *msgp, size_t msgsz, \ long msgtyp, int msgflg); } 228 STD BSD { int shmat(int shmid, void *shmaddr, int shmflg); } 229 STD BSD { int shmctl(int shmid, int cmd, \ struct shmid_ds *buf); } 230 STD BSD { int shmdt(void *shmaddr); } 231 STD BSD { int shmget(key_t key, int size, int shmflg); } ; 232 UNIMPL NOHIDE nosys 233 UNIMPL NOHIDE nosys 234 UNIMPL NOHIDE nosys 235 UNIMPL NOHIDE nosys 236 UNIMPL NOHIDE nosys 237 UNIMPL NOHIDE nosys 238 UNIMPL NOHIDE nosys 239 UNIMPL NOHIDE nosys 240 UNIMPL NOHIDE nosys 241 UNIMPL NOHIDE nosys 242 UNIMPL NOHIDE nosys 243 UNIMPL NOHIDE nosys 244 UNIMPL NOHIDE nosys 245 UNIMPL NOHIDE nosys 246 UNIMPL NOHIDE nosys 247 UNIMPL NOHIDE nosys 248 UNIMPL NOHIDE nosys 249 UNIMPL NOHIDE nosys ; syscall numbers initially used in OpenBSD 250 STD BSD { int minherit(caddr_t addr, size_t len, int inherit); } 251 STD BSD { int rfork(int flags); } diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 75860e4abd28..70f85e0966ad 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -1,350 +1,352 @@ /* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)malloc.h 8.5 (Berkeley) 5/3/95 - * $Id: malloc.h,v 1.14 1996/06/14 17:22:18 wollman Exp $ + * $Id: malloc.h,v 1.15 1996/08/04 20:12:57 phk Exp $ */ #ifndef _SYS_MALLOC_H_ #define _SYS_MALLOC_H_ #define KMEMSTATS /* * flags to malloc */ #define M_WAITOK 0x0000 #define M_NOWAIT 0x0001 #define M_KERNEL 0x0002 /* * Types of memory to be allocated */ #define M_FREE 0 /* should be on free list */ #define M_MBUF 1 /* mbuf */ #define M_DEVBUF 2 /* device driver memory */ #define M_SOCKET 3 /* socket structure */ #define M_PCB 4 /* protocol control block */ #define M_RTABLE 5 /* routing tables */ #define M_HTABLE 6 /* IMP host tables */ #define M_FTABLE 7 /* fragment reassembly header */ #define M_ZOMBIE 8 /* zombie proc status */ #define M_IFADDR 9 /* interface address */ #define M_SOOPTS 10 /* socket options */ #define M_SONAME 11 /* socket name */ #define M_NAMEI 12 /* namei path name buffer */ #define M_GPROF 13 /* kernel profiling buffer */ #define M_IOCTLOPS 14 /* ioctl data buffer */ #define M_MAPMEM 15 /* mapped memory descriptors */ #define M_CRED 16 /* credentials */ #define M_PGRP 17 /* process group header */ #define M_SESSION 18 /* session header */ #define M_IOV 19 /* large iov's */ #define M_MOUNT 20 /* vfs mount struct */ #define M_FHANDLE 21 /* network file handle */ #define M_NFSREQ 22 /* NFS request header */ #define M_NFSMNT 23 /* NFS mount structure */ #define M_NFSNODE 24 /* NFS vnode private part */ #define M_VNODE 25 /* Dynamically allocated vnodes */ #define M_CACHE 26 /* Dynamically allocated cache entries */ #define M_DQUOT 27 /* UFS quota entries */ #define M_UFSMNT 28 /* UFS mount structure */ #define M_SHM 29 /* SVID compatible shared memory segments */ #define M_VMMAP 30 /* VM map structures */ #define M_VMMAPENT 31 /* VM map entry structures */ #define M_VMOBJ 32 /* VM object structure */ #define M_VMOBJHASH 33 /* VM object hash structure */ #define M_VMPMAP 34 /* VM pmap */ #define M_VMPVENT 35 /* VM phys-virt mapping entry */ #define M_VMPAGER 36 /* XXX: VM pager struct */ #define M_VMPGDATA 37 /* XXX: VM pager private data */ #define M_FILE 38 /* Open file structure */ #define M_FILEDESC 39 /* Open file descriptor table */ #define M_LOCKF 40 /* Byte-range locking structures */ #define M_PROC 41 /* Proc structures */ #define M_SUBPROC 42 /* Proc sub-structures */ #define M_SEGMENT 43 /* Segment for LFS */ #define M_LFSNODE 44 /* LFS vnode private part */ #define M_FFSNODE 45 /* FFS vnode private part */ #define M_MFSNODE 46 /* MFS vnode private part */ #define M_NQLEASE 47 /* Nqnfs lease */ #define M_NQMHOST 48 /* Nqnfs host address table */ #define M_NETADDR 49 /* Export host address structure */ #define M_NFSSVC 50 /* Nfs server structure */ #define M_NFSUID 51 /* Nfs uid mapping structure */ #define M_NFSD 52 /* Nfs server daemon structure */ #define M_IPMOPTS 53 /* internet multicast options */ #define M_IPMADDR 54 /* internet multicast address */ #define M_IFMADDR 55 /* link-level multicast address */ #define M_MRTABLE 56 /* multicast routing tables */ #define M_ISOFSMNT 57 /* ISOFS mount structure */ #define M_ISOFSNODE 58 /* ISOFS vnode private part */ #define M_NFSRVDESC 59 /* NFS server socket descriptor */ #define M_NFSDIROFF 60 /* NFS directory offset data */ #define M_NFSBIGFH 61 /* NFS version 3 file handle */ #define M_MSDOSFSMNT 67 /* MSDOSFS mount structure */ #define M_MSDOSFSNODE 68 /* MSDOSFS vnode private part */ #define M_MSDOSFSFAT 69 /* MSDOSFS file allocation table */ #define M_DEVFSMNT 70 /* DEVFS mount structure */ #define M_DEVFSBACK 71 /* DEVFS Back node */ #define M_DEVFSFRONT 72 /* DEVFS Front node */ #define M_DEVFSNODE 73 /* DEVFS node */ #define M_TEMP 74 /* misc temporary data buffers */ #define M_TTYS 75 /* tty data structures */ #define M_GZIP 76 /* Gzip trees */ #define M_IPFW 77 /* IpFw/IpAcct chain's */ #define M_DEVL 78 /* isa_device lists in userconfig() */ #define M_PKTCLASS 79 /* structures used in packet classifier */ #define M_SYSCTL 80 /* sysctl internal magic */ #define M_SECA 81 /* security associations, key management */ #define M_BIOBUF 82 /* BIO buffer */ #define M_KTRACE 83 /* KTRACE */ -#define M_LAST 84 /* Must be last type + 1 */ +#define M_SELECT 84 /* select() buffer */ +#define M_LAST 85 /* Must be last type + 1 */ #define INITKMEMNAMES { \ "free", /* 0 M_FREE */ \ "mbuf", /* 1 M_MBUF */ \ "devbuf", /* 2 M_DEVBUF */ \ "socket", /* 3 M_SOCKET */ \ "pcb", /* 4 M_PCB */ \ "routetbl", /* 5 M_RTABLE */ \ "hosttbl", /* 6 M_HTABLE */ \ "fragtbl", /* 7 M_FTABLE */ \ "zombie", /* 8 M_ZOMBIE */ \ "ifaddr", /* 9 M_IFADDR */ \ "soopts", /* 10 M_SOOPTS */ \ "soname", /* 11 M_SONAME */ \ "namei", /* 12 M_NAMEI */ \ "gprof", /* 13 M_GPROF */ \ "ioctlops", /* 14 M_IOCTLOPS */ \ "mapmem", /* 15 M_MAPMEM */ \ "cred", /* 16 M_CRED */ \ "pgrp", /* 17 M_PGRP */ \ "session", /* 18 M_SESSION */ \ "iov", /* 19 M_IOV */ \ "mount", /* 20 M_MOUNT */ \ "fhandle", /* 21 M_FHANDLE */ \ "NFS req", /* 22 M_NFSREQ */ \ "NFS mount", /* 23 M_NFSMNT */ \ "NFS node", /* 24 M_NFSNODE */ \ "vnodes", /* 25 M_VNODE */ \ "namecache", /* 26 M_CACHE */ \ "UFS quota", /* 27 M_DQUOT */ \ "UFS mount", /* 28 M_UFSMNT */ \ "shm", /* 29 M_SHM */ \ "VM map", /* 30 M_VMMAP */ \ "VM mapent", /* 31 M_VMMAPENT */ \ "VM object", /* 32 M_VMOBJ */ \ "VM objhash", /* 33 M_VMOBJHASH */ \ "VM pmap", /* 34 M_VMPMAP */ \ "VM pvmap", /* 35 M_VMPVENT */ \ "VM pager", /* 36 M_VMPAGER */ \ "VM pgdata", /* 37 M_VMPGDATA */ \ "file", /* 38 M_FILE */ \ "file desc", /* 39 M_FILEDESC */ \ "lockf", /* 40 M_LOCKF */ \ "proc", /* 41 M_PROC */ \ "subproc", /* 42 M_SUBPROC */ \ "LFS segment", /* 43 M_SEGMENT */ \ "LFS node", /* 44 M_LFSNODE */ \ "FFS node", /* 45 M_FFSNODE */ \ "MFS node", /* 46 M_MFSNODE */ \ "NQNFS Lease", /* 47 M_NQLEASE */ \ "NQNFS Host", /* 48 M_NQMHOST */ \ "Export Host", /* 49 M_NETADDR */ \ "NFS srvsock", /* 50 M_NFSSVC */ \ "NFS uid", /* 51 M_NFSUID */ \ "NFS daemon", /* 52 M_NFSD */ \ "ip_moptions", /* 53 M_IPMOPTS */ \ "in_multi", /* 54 M_IPMADDR */ \ "ether_multi", /* 55 M_IFMADDR */ \ "mrt", /* 56 M_MRTABLE */ \ "ISOFS mount", /* 57 M_ISOFSMNT */ \ "ISOFS node", /* 58 M_ISOFSNODE */ \ "NFSV3 srvdesc",/* 59 M_NFSRVDESC */ \ "NFSV3 diroff", /* 60 M_NFSDIROFF */ \ "NFSV3 bigfh", /* 61 M_NFSBIGFH */ \ NULL, \ NULL, NULL, NULL, NULL, \ "MSDOSFS mount",/* 67 M_MSDOSFSMNT */ \ "MSDOSFS node", /* 68 M_MSDOSFSNODE */ \ "MSDOSFS FAT", /* 69 M_MSDOSFSFAR */ \ "DEVFS mount", /* 70 M_DEVFSMNT */ \ "DEVFS back", /* 71 M_DEVFSBACK */ \ "DEVFS front", /* 72 M_DEVFSFRONT */ \ "DEVFS node", /* 73 M_DEVFSNODE */ \ "temp", /* 74 M_TEMP */ \ "ttys", /* 75 M_TTYS */ \ "Gzip trees", /* 76 M_GZIP */ \ "IpFw/IpAcct", /* 77 M_IPFW */ \ "isa_devlist", /* 78 M_DEVL */ \ "PktClass", /* 79 M_PKTCLASS */ \ "sysctl", /* 80 M_SYSCTL */ \ "key mgmt", /* 81 M_SECA */ \ "BIO buffer", /* 82 M_BIOBUF */ \ "KTRACE", /* 83 M_KTRACE */ \ + "select", /* 84 M_SELECT */ \ } struct kmemstats { long ks_inuse; /* # of packets of this type currently in use */ long ks_calls; /* total packets of this type ever allocated */ long ks_memuse; /* total memory held in bytes */ u_short ks_limblocks; /* number of times blocked for hitting limit */ u_short ks_mapblocks; /* number of times blocked for kernel map */ long ks_maxused; /* maximum number ever used */ long ks_limit; /* most that are allowed to exist */ long ks_size; /* sizes of this thing that are allocated */ long ks_spare; }; /* * Array of descriptors that describe the contents of each page */ struct kmemusage { short ku_indx; /* bucket index */ union { u_short freecnt;/* for small allocations, free pieces in page */ u_short pagecnt;/* for large allocations, pages alloced */ } ku_un; }; #define ku_freecnt ku_un.freecnt #define ku_pagecnt ku_un.pagecnt /* * Set of buckets for each size of memory block that is retained */ struct kmembuckets { caddr_t kb_next; /* list of free blocks */ caddr_t kb_last; /* last free block */ long kb_calls; /* total calls to allocate this size */ long kb_total; /* total number of blocks allocated */ long kb_totalfree; /* # of free elements in this bucket */ long kb_elmpercl; /* # of elements in this sized allocation */ long kb_highwat; /* high water mark */ long kb_couldfree; /* over high water mark and could free */ }; #ifdef KERNEL #define MINALLOCSIZE (1 << MINBUCKET) #define BUCKETINDX(size) \ ((size) <= (MINALLOCSIZE * 128) \ ? (size) <= (MINALLOCSIZE * 8) \ ? (size) <= (MINALLOCSIZE * 2) \ ? (size) <= (MINALLOCSIZE * 1) \ ? (MINBUCKET + 0) \ : (MINBUCKET + 1) \ : (size) <= (MINALLOCSIZE * 4) \ ? (MINBUCKET + 2) \ : (MINBUCKET + 3) \ : (size) <= (MINALLOCSIZE* 32) \ ? (size) <= (MINALLOCSIZE * 16) \ ? (MINBUCKET + 4) \ : (MINBUCKET + 5) \ : (size) <= (MINALLOCSIZE * 64) \ ? (MINBUCKET + 6) \ : (MINBUCKET + 7) \ : (size) <= (MINALLOCSIZE * 2048) \ ? (size) <= (MINALLOCSIZE * 512) \ ? (size) <= (MINALLOCSIZE * 256) \ ? (MINBUCKET + 8) \ : (MINBUCKET + 9) \ : (size) <= (MINALLOCSIZE * 1024) \ ? (MINBUCKET + 10) \ : (MINBUCKET + 11) \ : (size) <= (MINALLOCSIZE * 8192) \ ? (size) <= (MINALLOCSIZE * 4096) \ ? (MINBUCKET + 12) \ : (MINBUCKET + 13) \ : (size) <= (MINALLOCSIZE * 16384) \ ? (MINBUCKET + 14) \ : (MINBUCKET + 15)) /* * Turn virtual addresses into kmem map indices */ #define kmemxtob(alloc) (kmembase + (alloc) * PAGE_SIZE) #define btokmemx(addr) (((caddr_t)(addr) - kmembase) / PAGE_SIZE) #define btokup(addr) (&kmemusage[(caddr_t)(addr) - kmembase >> PAGE_SHIFT]) /* * Macro versions for the usual cases of malloc/free */ #if defined(KMEMSTATS) || defined(DIAGNOSTIC) #define MALLOC(space, cast, size, type, flags) \ (space) = (cast)malloc((u_long)(size), type, flags) #define FREE(addr, type) free((addr), type) #else /* do not collect statistics */ #define MALLOC(space, cast, size, type, flags) { \ register struct kmembuckets *kbp = &bucket[BUCKETINDX(size)]; \ long s = splimp(); \ if (kbp->kb_next == NULL) { \ (space) = (cast)malloc((u_long)(size), type, flags); \ } else { \ (space) = (cast)kbp->kb_next; \ kbp->kb_next = *(caddr_t *)(space); \ } \ splx(s); \ } #define FREE(addr, type) { \ register struct kmembuckets *kbp; \ register struct kmemusage *kup = btokup(addr); \ long s = splimp(); \ if (1 << kup->ku_indx > MAXALLOCSAVE) { \ free((addr), type); \ } else { \ kbp = &bucket[kup->ku_indx]; \ if (kbp->kb_next == NULL) \ kbp->kb_next = (caddr_t)(addr); \ else \ *(caddr_t *)(kbp->kb_last) = (caddr_t)(addr); \ *(caddr_t *)(addr) = NULL; \ kbp->kb_last = (caddr_t)(addr); \ } \ splx(s); \ } #endif /* do not collect statistics */ extern struct kmemstats kmemstats[]; extern struct kmemusage *kmemusage; extern char *kmembase; extern struct kmembuckets bucket[]; void *contigmalloc __P((unsigned long size, int type, int flags, unsigned long low, unsigned long high, unsigned long alignment, unsigned long boundary)); void free __P((void *addr, int type)); void *malloc __P((unsigned long size, int type, int flags)); #endif /* KERNEL */ #endif /* !_SYS_MALLOC_H_ */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 669567eaedfa..43c56afeb6d2 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,313 +1,316 @@ /*- * Copyright (c) 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)proc.h 8.15 (Berkeley) 5/19/95 - * $Id: proc.h,v 1.25 1996/06/09 15:00:11 alex Exp $ + * $Id: proc.h,v 1.26 1996/07/31 09:26:54 davidg Exp $ */ #ifndef _SYS_PROC_H_ #define _SYS_PROC_H_ #include /* Machine-dependent proc substruct. */ #include /* For struct rtprio. */ #include /* For struct selinfo. */ #include /* For structs itimerval, timeval. */ #include #include /* * One structure allocated per session. */ struct session { int s_count; /* Ref cnt; pgrps in session. */ struct proc *s_leader; /* Session leader. */ struct vnode *s_ttyvp; /* Vnode of controlling terminal. */ struct tty *s_ttyp; /* Controlling terminal. */ char s_login[MAXLOGNAME]; /* Setlogin() name. */ }; /* * One structure allocated per process group. */ struct pgrp { LIST_ENTRY(pgrp) pg_hash; /* Hash chain. */ LIST_HEAD(, proc) pg_members; /* Pointer to pgrp members. */ struct session *pg_session; /* Pointer to session. */ pid_t pg_id; /* Pgrp id. */ int pg_jobc; /* # procs qualifying pgrp for job control */ }; /* * Description of a process. * * This structure contains the information needed to manage a thread of * control, known in UN*X as a process; it has references to substructures * containing descriptions of things that the process uses, but may share * with related processes. The process structure and the substructures * are always addressable except for those marked "(PROC ONLY)" below, * which might be addressable only on a processor on which the process * is running. */ struct proc { TAILQ_ENTRY(proc) p_procq; /* run/sleep queue. */ LIST_ENTRY(proc) p_list; /* List of all processes. */ /* substructures: */ struct pcred *p_cred; /* Process owner's identity. */ struct filedesc *p_fd; /* Ptr to open files structure. */ struct pstats *p_stats; /* Accounting/statistics (PROC ONLY). */ struct plimit *p_limit; /* Process limits. */ struct vmspace *p_vmspace; /* Address space. */ struct sigacts *p_sigacts; /* Signal actions, state (PROC ONLY). */ #define p_ucred p_cred->pc_ucred #define p_rlimit p_limit->pl_rlimit int p_flag; /* P_* flags. */ char p_stat; /* S* process status. */ char p_pad1[3]; pid_t p_pid; /* Process identifier. */ LIST_ENTRY(proc) p_pglist; /* List of processes in pgrp. */ struct proc *p_pptr; /* Pointer to parent process. */ LIST_ENTRY(proc) p_sibling; /* List of sibling processes. */ LIST_HEAD(, proc) p_children; /* Pointer to list of children. */ /* The following fields are all zeroed upon creation in fork. */ #define p_startzero p_oppid pid_t p_oppid; /* Save parent pid during ptrace. XXX */ int p_dupfd; /* Sideways return value from fdopen. XXX */ /* scheduling */ u_int p_estcpu; /* Time averaged value of p_cpticks. */ int p_cpticks; /* Ticks of cpu time. */ fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */ void *p_wchan; /* Sleep address. */ char *p_wmesg; /* Reason for sleep. */ u_int p_swtime; /* Time swapped in or out. */ u_int p_slptime; /* Time since last blocked. */ struct itimerval p_realtimer; /* Alarm timer. */ struct timeval p_rtime; /* Real time. */ u_quad_t p_uticks; /* Statclock hits in user mode. */ u_quad_t p_sticks; /* Statclock hits in system mode. */ u_quad_t p_iticks; /* Statclock hits processing intr. */ int p_traceflag; /* Kernel trace points. */ struct vnode *p_tracep; /* Trace to vnode. */ int p_siglist; /* Signals arrived but not delivered. */ struct vnode *p_textvp; /* Vnode of executable. */ char p_lock; /* Process lock (prevent swap) count. */ char p_pad2[3]; /* alignment */ + char *p_selbits; /* For select(), bits */ + u_int p_selbits_size; /* For select(), fd_set size (bytes) */ + short p_locks; /* DEBUG: lockmgr count of held locks */ short p_simple_locks; /* DEBUG: count of held simple locks */ /* End area that is zeroed on creation. */ #define p_endzero p_hash.le_next /* * Not copied, not zero'ed. * Belongs after p_pid, but here to avoid shifting proc elements. */ LIST_ENTRY(proc) p_hash; /* Hash chain. */ /* The following fields are all copied upon creation in fork. */ #define p_startcopy p_sigmask sigset_t p_sigmask; /* Current signal mask. */ sigset_t p_sigignore; /* Signals being ignored. */ sigset_t p_sigcatch; /* Signals being caught by user. */ u_char p_priority; /* Process priority. */ u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */ char p_nice; /* Process "nice" value. */ char p_comm[MAXCOMLEN+1]; struct pgrp *p_pgrp; /* Pointer to process group. */ struct sysentvec *p_sysent; /* System call dispatch information. */ struct rtprio p_rtprio; /* Realtime priority. */ /* End area that is copied on creation. */ #define p_endcopy p_addr struct user *p_addr; /* Kernel virtual addr of u-area (PROC ONLY). */ struct mdproc p_md; /* Any machine-dependent fields. */ u_short p_xstat; /* Exit status for wait; also stop signal. */ u_short p_acflag; /* Accounting flags. */ struct rusage *p_ru; /* Exit information. XXX */ }; #define p_session p_pgrp->pg_session #define p_pgid p_pgrp->pg_id /* Status values. */ #define SIDL 1 /* Process being created by fork. */ #define SRUN 2 /* Currently runnable. */ #define SSLEEP 3 /* Sleeping on an address. */ #define SSTOP 4 /* Process debugging or suspension. */ #define SZOMB 5 /* Awaiting collection by parent. */ /* These flags are kept in p_flags. */ #define P_ADVLOCK 0x00001 /* Process may hold a POSIX advisory lock. */ #define P_CONTROLT 0x00002 /* Has a controlling terminal. */ #define P_INMEM 0x00004 /* Loaded into memory. */ #define P_NOCLDSTOP 0x00008 /* No SIGCHLD when children stop. */ #define P_PPWAIT 0x00010 /* Parent is waiting for child to exec/exit. */ #define P_PROFIL 0x00020 /* Has started profiling. */ #define P_SELECT 0x00040 /* Selecting; wakeup/waiting danger. */ #define P_SINTR 0x00080 /* Sleep is interruptible. */ #define P_SUGID 0x00100 /* Had set id privileges since last exec. */ #define P_SYSTEM 0x00200 /* System proc: no sigs, stats or swapping. */ #define P_TIMEOUT 0x00400 /* Timing out during sleep. */ #define P_TRACED 0x00800 /* Debugged process being traced. */ #define P_WAITED 0x01000 /* Debugging process has waited for child. */ #define P_WEXIT 0x02000 /* Working on exiting. */ #define P_EXEC 0x04000 /* Process called exec. */ /* Should probably be changed into a hold count. */ #define P_NOSWAP 0x08000 /* Another flag to prevent swap out. */ #define P_PHYSIO 0x10000 /* Doing physical I/O. */ /* Should be moved to machine-dependent areas. */ #define P_OWEUPC 0x20000 /* Owe process an addupc() call at next ast. */ #define P_SWAPPING 0x40000 /* Process is being swapped. */ /* * MOVE TO ucred.h? * * Shareable process credentials (always resident). This includes a reference * to the current user credentials as well as real and saved ids that may be * used to change ids. */ struct pcred { struct ucred *pc_ucred; /* Current credentials. */ uid_t p_ruid; /* Real user id. */ uid_t p_svuid; /* Saved effective user id. */ gid_t p_rgid; /* Real group id. */ gid_t p_svgid; /* Saved effective group id. */ int p_refcnt; /* Number of references. */ }; #ifdef KERNEL /* * We use process IDs <= PID_MAX; PID_MAX + 1 must also fit in a pid_t, * as it is used to represent "no process group". */ #define PID_MAX 30000 #define NO_PID 30001 #define SESS_LEADER(p) ((p)->p_session->s_leader == (p)) #define SESSHOLD(s) ((s)->s_count++) #define SESSRELE(s) { \ if (--(s)->s_count == 0) \ FREE(s, M_SESSION); \ } /* hold process U-area in memory, normally for ptrace/procfs work */ #define PHOLD(p) { \ if ((p)->p_lock++ == 0 && ((p)->p_flag & P_INMEM) == 0) \ faultin(p); \ } #define PRELE(p) (--(p)->p_lock) #define PIDHASH(pid) (&pidhashtbl[(pid) & pidhash]) extern LIST_HEAD(pidhashhead, proc) *pidhashtbl; extern u_long pidhash; #define PGRPHASH(pgid) (&pgrphashtbl[(pgid) & pgrphash]) extern LIST_HEAD(pgrphashhead, pgrp) *pgrphashtbl; extern u_long pgrphash; extern struct proc *curproc; /* Current running proc. */ extern struct proc proc0; /* Process slot for swapper. */ extern int nprocs, maxproc; /* Current and max number of procs. */ extern int maxprocperuid; /* Max procs per uid. */ LIST_HEAD(proclist, proc); extern struct proclist allproc; /* List of all processes. */ extern struct proclist zombproc; /* List of zombie processes. */ extern struct proc *initproc, *pageproc; /* Process slots for init, pager. */ #define NQS 32 /* 32 run queues. */ extern struct prochd qs[]; extern struct prochd rtqs[]; extern struct prochd idqs[]; extern int whichqs; /* Bit mask summary of non-empty Q's. */ struct prochd { struct proc *ph_link; /* Linked list of running processes. */ struct proc *ph_rlink; }; struct proc *pfind __P((pid_t)); /* Find process by id. */ struct pgrp *pgfind __P((pid_t)); /* Find process group by id. */ int chgproccnt __P((uid_t uid, int diff)); int enterpgrp __P((struct proc *p, pid_t pgid, int mksess)); void fixjobc __P((struct proc *p, struct pgrp *pgrp, int entering)); int inferior __P((struct proc *p)); int leavepgrp __P((struct proc *p)); void mi_switch __P((void)); void procinit __P((void)); void resetpriority __P((struct proc *)); void roundrobin __P((void *)); void schedcpu __P((void *)); void setrunnable __P((struct proc *)); void setrunqueue __P((struct proc *)); void sleepinit __P((void)); void remrq __P((struct proc *)); void cpu_switch __P((struct proc *)); int tsleep __P((void *chan, int pri, char *wmesg, int timo)); void unsleep __P((struct proc *)); void wakeup __P((void *chan)); void wakeup_one __P((void *chan)); __dead void cpu_exit __P((struct proc *)) __dead2; __dead void exit1 __P((struct proc *, int)) __dead2; int cpu_fork __P((struct proc *, struct proc *)); int trace_req __P((struct proc *)); void cpu_wait __P((struct proc *)); int cpu_coredump __P((struct proc *, struct vnode *, struct ucred *)); #endif /* KERNEL */ #endif /* !_SYS_PROC_H_ */ diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index b9769c9d5471..d62781911813 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -1,1052 +1,1052 @@ /* * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. * created from Id: syscalls.master,v 1.27 1996/03/02 16:51:25 peter Exp */ #ifndef _SYS_SYSPROTO_H_ #define _SYS_SYSPROTO_H_ #include #include #include struct nosys_args { int dummy; }; struct rexit_args { int rval; }; struct fork_args { int dummy; }; struct read_args { int fd; char * buf; u_int nbyte; }; struct write_args { int fd; char * buf; u_int nbyte; }; struct open_args { char * path; int flags; int mode; }; struct close_args { int fd; }; struct wait_args { int pid; int * status; int options; struct rusage * rusage; }; struct link_args { char * path; char * link; }; struct unlink_args { char * path; }; struct chdir_args { char * path; }; struct fchdir_args { int fd; }; struct mknod_args { char * path; int mode; int dev; }; struct chmod_args { char * path; int mode; }; struct chown_args { char * path; int uid; int gid; }; struct obreak_args { char * nsize; }; struct getfsstat_args { struct statfs * buf; long bufsize; int flags; }; struct getpid_args { int dummy; }; struct mount_args { int type; char * path; int flags; caddr_t data; }; struct unmount_args { char * path; int flags; }; struct setuid_args { uid_t uid; }; struct getuid_args { int dummy; }; struct geteuid_args { int dummy; }; struct ptrace_args { int req; pid_t pid; caddr_t addr; int data; }; struct recvmsg_args { int s; struct msghdr * msg; int flags; }; struct sendmsg_args { int s; caddr_t msg; int flags; }; struct recvfrom_args { int s; caddr_t buf; size_t len; int flags; caddr_t from; int * fromlenaddr; }; struct accept_args { int s; caddr_t name; int * anamelen; }; struct getpeername_args { int fdes; caddr_t asa; int * alen; }; struct getsockname_args { int fdes; caddr_t asa; int * alen; }; struct access_args { char * path; int flags; }; struct chflags_args { char * path; int flags; }; struct fchflags_args { int fd; int flags; }; struct sync_args { int dummy; }; struct kill_args { int pid; int signum; }; struct getppid_args { int dummy; }; struct dup_args { u_int fd; }; struct pipe_args { int dummy; }; struct getegid_args { int dummy; }; struct profil_args { caddr_t samples; u_int size; u_int offset; u_int scale; }; struct ktrace_args { char * fname; int ops; int facs; int pid; }; struct sigaction_args { int signum; struct sigaction * nsa; struct sigaction * osa; }; struct getgid_args { int dummy; }; struct sigprocmask_args { int how; sigset_t mask; }; struct getlogin_args { char * namebuf; u_int namelen; }; struct setlogin_args { char * namebuf; }; struct acct_args { char * path; }; struct sigpending_args { int dummy; }; struct sigaltstack_args { struct sigaltstack * nss; struct sigaltstack * oss; }; struct ioctl_args { int fd; u_long com; caddr_t data; }; struct reboot_args { int opt; }; struct revoke_args { char * path; }; struct symlink_args { char * path; char * link; }; struct readlink_args { char * path; char * buf; int count; }; struct execve_args { char * fname; char ** argv; char ** envv; }; struct umask_args { int newmask; }; struct chroot_args { char * path; }; struct getpagesize_args { int dummy; }; struct msync_args { caddr_t addr; size_t len; int flags; }; struct vfork_args { int dummy; }; struct sbrk_args { int incr; }; struct sstk_args { int incr; }; struct ovadvise_args { int anom; }; struct munmap_args { caddr_t addr; size_t len; }; struct mprotect_args { caddr_t addr; size_t len; int prot; }; struct madvise_args { caddr_t addr; size_t len; int behav; }; struct mincore_args { caddr_t addr; size_t len; char * vec; }; struct getgroups_args { u_int gidsetsize; gid_t * gidset; }; struct setgroups_args { u_int gidsetsize; gid_t * gidset; }; struct getpgrp_args { int dummy; }; struct setpgid_args { int pid; int pgid; }; struct setitimer_args { u_int which; struct itimerval * itv; struct itimerval * oitv; }; struct owait_args { int dummy; }; struct swapon_args { char * name; }; struct getitimer_args { u_int which; struct itimerval * itv; }; struct getdtablesize_args { int dummy; }; struct dup2_args { u_int from; u_int to; }; struct fcntl_args { int fd; int cmd; int arg; }; struct select_args { - u_int nd; + int nd; fd_set * in; fd_set * ou; fd_set * ex; struct timeval * tv; }; struct fsync_args { int fd; }; struct setpriority_args { int which; int who; int prio; }; struct socket_args { int domain; int type; int protocol; }; struct connect_args { int s; caddr_t name; int namelen; }; struct getpriority_args { int which; int who; }; struct sigreturn_args { struct sigcontext * sigcntxp; }; struct bind_args { int s; caddr_t name; int namelen; }; struct setsockopt_args { int s; int level; int name; caddr_t val; int valsize; }; struct listen_args { int s; int backlog; }; struct sigsuspend_args { int mask; }; struct gettimeofday_args { struct timeval * tp; struct timezone * tzp; }; struct getrusage_args { int who; struct rusage * rusage; }; struct getsockopt_args { int s; int level; int name; caddr_t val; int * avalsize; }; struct readv_args { int fd; struct iovec * iovp; u_int iovcnt; }; struct writev_args { int fd; struct iovec * iovp; u_int iovcnt; }; struct settimeofday_args { struct timeval * tv; struct timezone * tzp; }; struct fchown_args { int fd; int uid; int gid; }; struct fchmod_args { int fd; int mode; }; struct setreuid_args { int ruid; int euid; }; struct setregid_args { int rgid; int egid; }; struct rename_args { char * from; char * to; }; struct flock_args { int fd; int how; }; struct mkfifo_args { char * path; int mode; }; struct sendto_args { int s; caddr_t buf; size_t len; int flags; caddr_t to; int tolen; }; struct shutdown_args { int s; int how; }; struct socketpair_args { int domain; int type; int protocol; int * rsv; }; struct mkdir_args { char * path; int mode; }; struct rmdir_args { char * path; }; struct utimes_args { char * path; struct timeval * tptr; }; struct adjtime_args { struct timeval * delta; struct timeval * olddelta; }; struct ogethostid_args { int dummy; }; struct setsid_args { int dummy; }; struct quotactl_args { char * path; int cmd; int uid; caddr_t arg; }; struct oquota_args { int dummy; }; #ifdef NFS struct nfssvc_args { int flag; caddr_t argp; }; #else #endif struct statfs_args { char * path; struct statfs * buf; }; struct fstatfs_args { int fd; struct statfs * buf; }; #if defined(NFS) && !defined (NFS_NOSERVER) struct getfh_args { char * fname; fhandle_t * fhp; }; #else #endif struct getdomainname_args { char * domainname; int len; }; struct setdomainname_args { char * domainname; int len; }; struct uname_args { struct utsname * name; }; struct sysarch_args { int op; char * parms; }; struct rtprio_args { int function; pid_t pid; struct rtprio * rtp; }; struct semsys_args { int which; int a2; int a3; int a4; int a5; }; struct msgsys_args { int which; int a2; int a3; int a4; int a5; int a6; }; struct shmsys_args { int which; int a2; int a3; int a4; }; struct ntp_adjtime_args { struct timex * tp; }; struct setgid_args { gid_t gid; }; struct setegid_args { gid_t egid; }; struct seteuid_args { uid_t euid; }; #ifdef LFS struct lfs_bmapv_args { fsid_t * fsidp; struct block_info * blkiov; int blkcnt; }; struct lfs_markv_args { fsid_t * fsidp; struct block_info * blkiov; int blkcnt; }; struct lfs_segclean_args { fsid_t * fsidp; u_long segment; }; struct lfs_segwait_args { fsid_t * fsidp; struct timeval * tv; }; #else #endif struct stat_args { char * path; struct stat * ub; }; struct fstat_args { int fd; struct stat * sb; }; struct lstat_args { char * path; struct stat * ub; }; struct pathconf_args { char * path; int name; }; struct fpathconf_args { int fd; int name; }; struct __getrlimit_args { u_int which; struct orlimit * rlp; }; struct __setrlimit_args { u_int which; struct orlimit * rlp; }; struct getdirentries_args { int fd; char * buf; u_int count; long * basep; }; struct mmap_args { caddr_t addr; size_t len; int prot; int flags; int fd; long pad; off_t pos; }; struct lseek_args { int fd; int pad; off_t offset; int whence; }; struct truncate_args { char * path; int pad; off_t length; }; struct ftruncate_args { int fd; int pad; off_t length; }; struct sysctl_args { int * name; u_int namelen; void * old; size_t * oldlenp; void * new; size_t newlen; }; struct mlock_args { caddr_t addr; size_t len; }; struct munlock_args { caddr_t addr; size_t len; }; struct __semctl_args { int semid; int semnum; int cmd; union semun * arg; }; struct semget_args { key_t key; int nsems; int semflg; }; struct semop_args { int semid; struct sembuf * sops; u_int nsops; }; struct semconfig_args { int flag; }; struct msgctl_args { int msqid; int cmd; struct msqid_ds * buf; }; struct msgget_args { key_t key; int msgflg; }; struct msgsnd_args { int msqid; void * msgp; size_t msgsz; int msgflg; }; struct msgrcv_args { int msqid; void * msgp; size_t msgsz; long msgtyp; int msgflg; }; struct shmat_args { int shmid; void * shmaddr; int shmflg; }; struct shmctl_args { int shmid; int cmd; struct shmid_ds * buf; }; struct shmdt_args { void * shmaddr; }; struct shmget_args { key_t key; int size; int shmflg; }; struct minherit_args { caddr_t addr; size_t len; int inherit; }; struct rfork_args { int flags; }; int nosys __P((struct proc *, struct nosys_args *, int [])); __dead void exit __P((struct proc *, struct rexit_args *, int [])); int fork __P((struct proc *, struct fork_args *, int [])); int read __P((struct proc *, struct read_args *, int [])); int write __P((struct proc *, struct write_args *, int [])); int open __P((struct proc *, struct open_args *, int [])); int close __P((struct proc *, struct close_args *, int [])); int wait4 __P((struct proc *, struct wait_args *, int [])); int link __P((struct proc *, struct link_args *, int [])); int unlink __P((struct proc *, struct unlink_args *, int [])); int chdir __P((struct proc *, struct chdir_args *, int [])); int fchdir __P((struct proc *, struct fchdir_args *, int [])); int mknod __P((struct proc *, struct mknod_args *, int [])); int chmod __P((struct proc *, struct chmod_args *, int [])); int chown __P((struct proc *, struct chown_args *, int [])); int obreak __P((struct proc *, struct obreak_args *, int [])); int getfsstat __P((struct proc *, struct getfsstat_args *, int [])); int getpid __P((struct proc *, struct getpid_args *, int [])); int mount __P((struct proc *, struct mount_args *, int [])); int unmount __P((struct proc *, struct unmount_args *, int [])); int setuid __P((struct proc *, struct setuid_args *, int [])); int getuid __P((struct proc *, struct getuid_args *, int [])); int geteuid __P((struct proc *, struct geteuid_args *, int [])); int ptrace __P((struct proc *, struct ptrace_args *, int [])); int recvmsg __P((struct proc *, struct recvmsg_args *, int [])); int sendmsg __P((struct proc *, struct sendmsg_args *, int [])); int recvfrom __P((struct proc *, struct recvfrom_args *, int [])); int accept __P((struct proc *, struct accept_args *, int [])); int getpeername __P((struct proc *, struct getpeername_args *, int [])); int getsockname __P((struct proc *, struct getsockname_args *, int [])); int access __P((struct proc *, struct access_args *, int [])); int chflags __P((struct proc *, struct chflags_args *, int [])); int fchflags __P((struct proc *, struct fchflags_args *, int [])); int sync __P((struct proc *, struct sync_args *, int [])); int kill __P((struct proc *, struct kill_args *, int [])); int getppid __P((struct proc *, struct getppid_args *, int [])); int dup __P((struct proc *, struct dup_args *, int [])); int pipe __P((struct proc *, struct pipe_args *, int [])); int getegid __P((struct proc *, struct getegid_args *, int [])); int profil __P((struct proc *, struct profil_args *, int [])); int ktrace __P((struct proc *, struct ktrace_args *, int [])); int sigaction __P((struct proc *, struct sigaction_args *, int [])); int getgid __P((struct proc *, struct getgid_args *, int [])); int sigprocmask __P((struct proc *, struct sigprocmask_args *, int [])); int getlogin __P((struct proc *, struct getlogin_args *, int [])); int setlogin __P((struct proc *, struct setlogin_args *, int [])); int acct __P((struct proc *, struct acct_args *, int [])); int sigpending __P((struct proc *, struct sigpending_args *, int [])); int sigaltstack __P((struct proc *, struct sigaltstack_args *, int [])); int ioctl __P((struct proc *, struct ioctl_args *, int [])); int reboot __P((struct proc *, struct reboot_args *, int [])); int revoke __P((struct proc *, struct revoke_args *, int [])); int symlink __P((struct proc *, struct symlink_args *, int [])); int readlink __P((struct proc *, struct readlink_args *, int [])); int execve __P((struct proc *, struct execve_args *, int [])); mode_t umask __P((struct proc *, struct umask_args *, int [])); int chroot __P((struct proc *, struct chroot_args *, int [])); int msync __P((struct proc *, struct msync_args *, int [])); int vfork __P((struct proc *, struct vfork_args *, int [])); int sbrk __P((struct proc *, struct sbrk_args *, int [])); int sstk __P((struct proc *, struct sstk_args *, int [])); int ovadvise __P((struct proc *, struct ovadvise_args *, int [])); int munmap __P((struct proc *, struct munmap_args *, int [])); int mprotect __P((struct proc *, struct mprotect_args *, int [])); int madvise __P((struct proc *, struct madvise_args *, int [])); int mincore __P((struct proc *, struct mincore_args *, int [])); int getgroups __P((struct proc *, struct getgroups_args *, int [])); int setgroups __P((struct proc *, struct setgroups_args *, int [])); int getpgrp __P((struct proc *, struct getpgrp_args *, int [])); int setpgid __P((struct proc *, struct setpgid_args *, int [])); int setitimer __P((struct proc *, struct setitimer_args *, int [])); int swapon __P((struct proc *, struct swapon_args *, int [])); int getitimer __P((struct proc *, struct getitimer_args *, int [])); int getdtablesize __P((struct proc *, struct getdtablesize_args *, int [])); int dup2 __P((struct proc *, struct dup2_args *, int [])); int fcntl __P((struct proc *, struct fcntl_args *, int [])); int select __P((struct proc *, struct select_args *, int [])); int fsync __P((struct proc *, struct fsync_args *, int [])); int setpriority __P((struct proc *, struct setpriority_args *, int [])); int socket __P((struct proc *, struct socket_args *, int [])); int connect __P((struct proc *, struct connect_args *, int [])); int getpriority __P((struct proc *, struct getpriority_args *, int [])); int sigreturn __P((struct proc *, struct sigreturn_args *, int [])); int bind __P((struct proc *, struct bind_args *, int [])); int setsockopt __P((struct proc *, struct setsockopt_args *, int [])); int listen __P((struct proc *, struct listen_args *, int [])); int sigsuspend __P((struct proc *, struct sigsuspend_args *, int [])); int gettimeofday __P((struct proc *, struct gettimeofday_args *, int [])); int getrusage __P((struct proc *, struct getrusage_args *, int [])); int getsockopt __P((struct proc *, struct getsockopt_args *, int [])); int readv __P((struct proc *, struct readv_args *, int [])); int writev __P((struct proc *, struct writev_args *, int [])); int settimeofday __P((struct proc *, struct settimeofday_args *, int [])); int fchown __P((struct proc *, struct fchown_args *, int [])); int fchmod __P((struct proc *, struct fchmod_args *, int [])); int setreuid __P((struct proc *, struct setreuid_args *, int [])); int setregid __P((struct proc *, struct setregid_args *, int [])); int rename __P((struct proc *, struct rename_args *, int [])); int flock __P((struct proc *, struct flock_args *, int [])); int mkfifo __P((struct proc *, struct mkfifo_args *, int [])); int sendto __P((struct proc *, struct sendto_args *, int [])); int shutdown __P((struct proc *, struct shutdown_args *, int [])); int socketpair __P((struct proc *, struct socketpair_args *, int [])); int mkdir __P((struct proc *, struct mkdir_args *, int [])); int rmdir __P((struct proc *, struct rmdir_args *, int [])); int utimes __P((struct proc *, struct utimes_args *, int [])); int adjtime __P((struct proc *, struct adjtime_args *, int [])); int setsid __P((struct proc *, struct setsid_args *, int [])); int quotactl __P((struct proc *, struct quotactl_args *, int [])); #ifdef NFS int nfssvc __P((struct proc *, struct nfssvc_args *, int [])); #else #endif int statfs __P((struct proc *, struct statfs_args *, int [])); int fstatfs __P((struct proc *, struct fstatfs_args *, int [])); #if defined(NFS) && !defined (NFS_NOSERVER) int getfh __P((struct proc *, struct getfh_args *, int [])); #else #endif int getdomainname __P((struct proc *, struct getdomainname_args *, int [])); int setdomainname __P((struct proc *, struct setdomainname_args *, int [])); int uname __P((struct proc *, struct uname_args *, int [])); int sysarch __P((struct proc *, struct sysarch_args *, int [])); int rtprio __P((struct proc *, struct rtprio_args *, int [])); int semsys __P((struct proc *, struct semsys_args *, int [])); int msgsys __P((struct proc *, struct msgsys_args *, int [])); int shmsys __P((struct proc *, struct shmsys_args *, int [])); int ntp_adjtime __P((struct proc *, struct ntp_adjtime_args *, int [])); int setgid __P((struct proc *, struct setgid_args *, int [])); int setegid __P((struct proc *, struct setegid_args *, int [])); int seteuid __P((struct proc *, struct seteuid_args *, int [])); #ifdef LFS int lfs_bmapv __P((struct proc *, struct lfs_bmapv_args *, int [])); int lfs_markv __P((struct proc *, struct lfs_markv_args *, int [])); int lfs_segclean __P((struct proc *, struct lfs_segclean_args *, int [])); int lfs_segwait __P((struct proc *, struct lfs_segwait_args *, int [])); #else #endif int stat __P((struct proc *, struct stat_args *, int [])); int fstat __P((struct proc *, struct fstat_args *, int [])); int lstat __P((struct proc *, struct lstat_args *, int [])); int pathconf __P((struct proc *, struct pathconf_args *, int [])); int fpathconf __P((struct proc *, struct fpathconf_args *, int [])); int getrlimit __P((struct proc *, struct __getrlimit_args *, int [])); int setrlimit __P((struct proc *, struct __setrlimit_args *, int [])); int getdirentries __P((struct proc *, struct getdirentries_args *, int [])); int mmap __P((struct proc *, struct mmap_args *, int [])); int lseek __P((struct proc *, struct lseek_args *, int [])); int truncate __P((struct proc *, struct truncate_args *, int [])); int ftruncate __P((struct proc *, struct ftruncate_args *, int [])); int __sysctl __P((struct proc *, struct sysctl_args *, int [])); int mlock __P((struct proc *, struct mlock_args *, int [])); int munlock __P((struct proc *, struct munlock_args *, int [])); int lkmnosys __P((struct proc *, struct nosys_args *, int [])); int __semctl __P((struct proc *, struct __semctl_args *, int [])); int semget __P((struct proc *, struct semget_args *, int [])); int semop __P((struct proc *, struct semop_args *, int [])); int semconfig __P((struct proc *, struct semconfig_args *, int [])); int msgctl __P((struct proc *, struct msgctl_args *, int [])); int msgget __P((struct proc *, struct msgget_args *, int [])); int msgsnd __P((struct proc *, struct msgsnd_args *, int [])); int msgrcv __P((struct proc *, struct msgrcv_args *, int [])); int shmat __P((struct proc *, struct shmat_args *, int [])); int shmctl __P((struct proc *, struct shmctl_args *, int [])); int shmdt __P((struct proc *, struct shmdt_args *, int [])); int shmget __P((struct proc *, struct shmget_args *, int [])); int minherit __P((struct proc *, struct minherit_args *, int [])); int rfork __P((struct proc *, struct rfork_args *, int [])); #ifdef COMPAT_43 struct ocreat_args { char * path; int mode; }; struct olseek_args { int fd; long offset; int whence; }; struct ostat_args { char * path; struct ostat * ub; }; struct olstat_args { char * path; struct ostat * ub; }; struct ofstat_args { int fd; struct ostat * sb; }; struct getkerninfo_args { int op; char * where; int * size; int arg; }; struct ommap_args { caddr_t addr; int len; int prot; int flags; int fd; long pos; }; struct gethostname_args { char * hostname; u_int len; }; struct sethostname_args { char * hostname; u_int len; }; struct osend_args { int s; caddr_t buf; int len; int flags; }; struct orecv_args { int s; caddr_t buf; int len; int flags; }; struct osigvec_args { int signum; struct sigvec * nsv; struct sigvec * osv; }; struct osigblock_args { int mask; }; struct osigsetmask_args { int mask; }; struct osigstack_args { struct sigstack * nss; struct sigstack * oss; }; struct orecvmsg_args { int s; struct omsghdr * msg; int flags; }; struct osendmsg_args { int s; caddr_t msg; int flags; }; struct otruncate_args { char * path; long length; }; struct oftruncate_args { int fd; long length; }; struct ogetpeername_args { int fdes; caddr_t asa; int * alen; }; struct osethostid_args { long hostid; }; struct ogetrlimit_args { u_int which; struct ogetrlimit * rlp; }; struct osetrlimit_args { u_int which; struct ogetrlimit * rlp; }; struct okillpg_args { int pgid; int signum; }; #ifdef NFS #else #endif struct ogetdirentries_args { int fd; char * buf; u_int count; long * basep; }; #if defined(NFS) && !defined (NFS_NOSERVER) #else #endif #ifdef LFS #else #endif int ocreat __P((struct proc *, struct ocreat_args *, int [])); int olseek __P((struct proc *, struct olseek_args *, int [])); int ostat __P((struct proc *, struct ostat_args *, int [])); int olstat __P((struct proc *, struct olstat_args *, int [])); int ofstat __P((struct proc *, struct ofstat_args *, int [])); int ogetkerninfo __P((struct proc *, struct getkerninfo_args *, int [])); int ogetpagesize __P((struct proc *, struct getpagesize_args *, int [])); int ommap __P((struct proc *, struct ommap_args *, int [])); int owait __P((struct proc *, struct owait_args *, int [])); int ogethostname __P((struct proc *, struct gethostname_args *, int [])); int osethostname __P((struct proc *, struct sethostname_args *, int [])); int oaccept __P((struct proc *, struct accept_args *, int [])); int osend __P((struct proc *, struct osend_args *, int [])); int orecv __P((struct proc *, struct orecv_args *, int [])); int osigvec __P((struct proc *, struct osigvec_args *, int [])); int osigblock __P((struct proc *, struct osigblock_args *, int [])); int osigsetmask __P((struct proc *, struct osigsetmask_args *, int [])); int osigstack __P((struct proc *, struct osigstack_args *, int [])); int orecvmsg __P((struct proc *, struct orecvmsg_args *, int [])); int osendmsg __P((struct proc *, struct osendmsg_args *, int [])); int orecvfrom __P((struct proc *, struct recvfrom_args *, int [])); int otruncate __P((struct proc *, struct otruncate_args *, int [])); int oftruncate __P((struct proc *, struct oftruncate_args *, int [])); int ogetpeername __P((struct proc *, struct ogetpeername_args *, int [])); int ogethostid __P((struct proc *, struct ogethostid_args *, int [])); int osethostid __P((struct proc *, struct osethostid_args *, int [])); int ogetrlimit __P((struct proc *, struct ogetrlimit_args *, int [])); int osetrlimit __P((struct proc *, struct osetrlimit_args *, int [])); int okillpg __P((struct proc *, struct okillpg_args *, int [])); int oquota __P((struct proc *, struct oquota_args *, int [])); int ogetsockname __P((struct proc *, struct getsockname_args *, int [])); int ogetdirentries __P((struct proc *, struct ogetdirentries_args *, int [])); #endif /* COMPAT_43 */ #endif /* !_SYS_SYSPROTO_H_ */