diff options
author | bde <bde@FreeBSD.org> | 1999-12-26 14:07:43 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1999-12-26 14:07:43 +0000 |
commit | 81b3aed1d181b6e482aedd1c33dee744ef152e24 (patch) | |
tree | d059a464c30145082133d79924f5b9a2b1b7bc7d /sys | |
parent | 4397ebaec086a0c76e3381ab0fa8e4bfca692ff0 (diff) | |
download | FreeBSD-src-81b3aed1d181b6e482aedd1c33dee744ef152e24.zip FreeBSD-src-81b3aed1d181b6e482aedd1c33dee744ef152e24.tar.gz |
Removed unused includes.
Rumoved unused compatibility cruft for dup(). Using it today would just
break dup() on fd's >= 64.
Fixed some style bugs.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_descrip.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index a659aee8..26e0cfc 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -50,14 +50,12 @@ #include <sys/vnode.h> #include <sys/proc.h> #include <sys/file.h> -#include <sys/socketvar.h> #include <sys/stat.h> #include <sys/filio.h> #include <sys/fcntl.h> #include <sys/malloc.h> #include <sys/unistd.h> #include <sys/resourcevar.h> -#include <sys/pipe.h> #include <vm/vm.h> #include <vm/vm_extern.h> @@ -66,7 +64,6 @@ static MALLOC_DEFINE(M_FILEDESC, "file desc", "Open file descriptor table"); MALLOC_DEFINE(M_FILE, "file", "Open file structure"); static MALLOC_DEFINE(M_SIGIO, "sigio", "sigio structures"); - static d_open_t fdopen; #define NUMFDESC 64 @@ -188,14 +185,6 @@ dup(p, uap) int new, error; old = uap->fd; - -#if 0 - /* - * XXX Compatibility - */ - if (old &~ 077) { uap->fd &= 077; return (dup2(p, uap, p->p_retval)); } -#endif - fdp = p->p_fd; if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL) return (EBADF); @@ -422,6 +411,7 @@ fsetown(pgid, sigiop) proc = pfind(pgid); if (proc == NULL) return (ESRCH); + /* * Policy - Don't allow a process to FSETOWN a process * in another session. @@ -430,13 +420,15 @@ fsetown(pgid, sigiop) * restrict FSETOWN to the current process or process * group for maximum safety. */ - else if (proc->p_session != curproc->p_session) + if (proc->p_session != curproc->p_session) return (EPERM); + pgrp = NULL; } else /* if (pgid < 0) */ { pgrp = pgfind(-pgid); if (pgrp == NULL) return (ESRCH); + /* * Policy - Don't allow a process to FSETOWN a process * in another session. @@ -445,13 +437,13 @@ fsetown(pgid, sigiop) * restrict FSETOWN to the current process or process * group for maximum safety. */ - else if (pgrp->pg_session != curproc->p_session) + if (pgrp->pg_session != curproc->p_session) return (EPERM); + proc = NULL; } funsetown(*sigiop); - MALLOC(sigio, struct sigio *, sizeof(struct sigio), M_SIGIO, - M_WAITOK); + MALLOC(sigio, struct sigio *, sizeof(struct sigio), M_SIGIO, M_WAITOK); if (pgid > 0) { SLIST_INSERT_HEAD(&proc->p_sigiolst, sigio, sio_pgsigio); sigio->sio_proc = proc; @@ -867,11 +859,9 @@ fdcopy(p) register struct file **fpp; register int i; -/* - * Certain daemons might not have file descriptors - */ + /* Certain daemons might not have file descriptors. */ if (fdp == NULL) - return NULL; + return (NULL); MALLOC(newfdp, struct filedesc *, sizeof(struct filedesc0), M_FILEDESC, M_WAITOK); @@ -927,9 +917,7 @@ fdfree(p) struct file **fpp; register int i; -/* - * Certain daemons might not have file descriptors - */ + /* Certain daemons might not have file descriptors. */ if (fdp == NULL) return; @@ -943,7 +931,7 @@ fdfree(p) FREE(fdp->fd_ofiles, M_FILEDESC); vrele(fdp->fd_cdir); vrele(fdp->fd_rdir); - if(fdp->fd_jdir) + if (fdp->fd_jdir) vrele(fdp->fd_jdir); FREE(fdp, M_FILEDESC); } @@ -960,9 +948,7 @@ fdcloseexec(p) char *fdfp; register int i; -/* - * Certain daemons might not have file descriptors - */ + /* Certain daemons might not have file descriptors. */ if (fdp == NULL) return; |