X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/d7f27d019f5b3cbb8cd36431ca9d05f401400ad7..4d1070779d8657b19988204722255ae6b674f8ba:/sys/kern/kern_descrip.c diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index c62a46406d..8c731f9b53 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -30,9 +30,9 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)kern_descrip.c 7.28 (Berkeley) 6/25/91 + * from: @(#)kern_descrip.c 7.28 (Berkeley) 6/25/91 + * $Id: kern_descrip.c,v 1.6 1993/12/19 00:51:22 wollman Exp $ */ -static char rcsid[] = "$Header: /home/cvs/386BSD/src/sys.386bsd/kern/kern_descrip.c,v 1.1.1.1 1993/06/12 14:57:34 rgrimes Exp $"; #include "param.h" #include "systm.h" @@ -50,6 +50,8 @@ static char rcsid[] = "$Header: /home/cvs/386BSD/src/sys.386bsd/kern/kern_descri #include "syslog.h" #include "resourcevar.h" +#include "vm/vm_user.h" + /* * Descriptor management. */ @@ -61,6 +63,7 @@ extern int maxfdescs; /* maximum number of file descriptors to a process */ * System calls on descriptors. */ /* ARGSUSED */ +int getdtablesize(p, uap, retval) struct proc *p; struct args *uap; @@ -74,22 +77,28 @@ getdtablesize(p, uap, retval) /* * Duplicate a file descriptor. */ + +struct dup_args { + int i; +}; + /* ARGSUSED */ +int dup(p, uap, retval) struct proc *p; - struct args { - int i; - } *uap; + struct dup_args *uap; int *retval; { register struct filedesc *fdp = p->p_fd; struct file *fp; int fd, error; +#if 0 /* * XXX Compatibility */ if (uap->i &~ 077) { uap->i &= 077; return (dup2(p, uap, retval)); } +#endif if ((unsigned)uap->i >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[uap->i]) == NULL) @@ -108,13 +117,17 @@ dup(p, uap, retval) /* * Duplicate a file descriptor to a particular value. */ + +struct dup2_args { + u_int from; + u_int to; +}; + /* ARGSUSED */ +int dup2(p, uap, retval) struct proc *p; - struct args { - u_int from; - u_int to; - } *uap; + struct dup2_args *uap; int *retval; { register struct filedesc *fdp = p->p_fd; @@ -154,14 +167,18 @@ dup2(p, uap, retval) /* * The file control system call. */ + +struct fcntl_args { + int fd; + int cmd; + int arg; +}; + /* ARGSUSED */ +int fcntl(p, uap, retval) struct proc *p; - register struct args { - int fd; - int cmd; - int arg; - } *uap; + register struct fcntl_args *uap; int *retval; { register struct filedesc *fdp = p->p_fd; @@ -304,11 +321,14 @@ fcntl(p, uap, retval) * Close a file descriptor. */ /* ARGSUSED */ +struct close_args { + int fd; +}; + +int close(p, uap, retval) struct proc *p; - struct args { - int fd; - } *uap; + struct close_args *uap; int *retval; { register struct filedesc *fdp = p->p_fd; @@ -334,13 +354,17 @@ close(p, uap, retval) /* * Return status information about a file descriptor. */ + +struct fstat_args { + int fd; + struct stat *sb; +}; + /* ARGSUSED */ +int fstat(p, uap, retval) struct proc *p; - register struct args { - int fd; - struct stat *sb; - } *uap; + register struct fstat_args *uap; int *retval; { register struct filedesc *fdp = p->p_fd; @@ -375,6 +399,7 @@ fstat(p, uap, retval) */ int fdexpand; +int fdalloc(p, want, result) struct proc *p; int want; @@ -443,6 +468,7 @@ fdalloc(p, want, result) * Check to see whether n user file descriptors * are available to the process p. */ +int fdavail(p, n) struct proc *p; register int n; @@ -465,6 +491,7 @@ fdavail(p, n) * Create a new open file structure and allocate * a file decriptor for the process that refers to it. */ +int falloc(p, resultfp, resultfd) register struct proc *p; struct file **resultfp; @@ -512,6 +539,7 @@ falloc(p, resultfp, resultfd) /* * Free a file descriptor. */ +void ffree(fp) register struct file *fp; { @@ -645,6 +673,7 @@ fdcloseexec(p) * Internal form of close. * Decrement reference count on file structure. */ +int closef(fp, p) register struct file *fp; register struct proc *p; @@ -693,13 +722,16 @@ closef(fp, p) * the entire file (l_whence = SEEK_SET, l_start = 0, l_len = 0). */ +struct flock_args { + int fd; + int how; +}; + /* ARGSUSED */ +int flock(p, uap, retval) struct proc *p; - register struct args { - int fd; - int how; - } *uap; + register struct flock_args *uap; int *retval; { register struct filedesc *fdp = p->p_fd; @@ -743,6 +775,7 @@ flock(p, uap, retval) * references to this file will be direct to the other driver. */ /* ARGSUSED */ +int fdopen(dev, mode, type) dev_t dev; int mode, type; @@ -763,6 +796,7 @@ fdopen(dev, mode, type) /* * Duplicate the specified descriptor to a free descriptor. */ +int dupfdopen(fdp, indx, dfd, mode) register struct filedesc *fdp; register int indx, dfd;