1/* 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 |
39 * $Id: kern_descrip.c,v 1.22 1995/12/08 23:21:31 phk Exp $ |
40 */ 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/sysproto.h> 45#include <sys/conf.h> 46#include <sys/filedesc.h> 47#include <sys/kernel.h> --- 22 unchanged lines hidden (view full) --- 70#define NUMFDESC 64 71 72#define CDEV_MAJOR 22 73static struct cdevsw fildesc_cdevsw = 74 { fdopen, noclose, noread, nowrite, /*22*/ 75 noioc, nostop, nullreset, nodevtotty,/*fd(!=Fd)*/ 76 noselect, nommap, nostrat }; 77 |
78static int finishdup(struct filedesc *fdp, int old, int new, int *retval); |
79/* 80 * Descriptor management. 81 */ 82struct file *filehead; /* head of list of open files */ 83int nfiles; /* actual number of open files */ 84 85/* 86 * System calls on descriptors. --- 244 unchanged lines hidden (view full) --- 331 return (EINVAL); 332 } 333 /* NOTREACHED */ 334} 335 336/* 337 * Common code for dup, dup2, and fcntl(F_DUPFD). 338 */ |
339static int |
340finishdup(fdp, old, new, retval) 341 register struct filedesc *fdp; 342 register int old, new, *retval; 343{ 344 register struct file *fp; 345 346 fp = fdp->fd_ofiles[old]; 347 fdp->fd_ofiles[new] = fp; --- 169 unchanged lines hidden (view full) --- 517 panic("fpathconf"); 518 } 519 /*NOTREACHED*/ 520} 521 522/* 523 * Allocate a file descriptor for the process. 524 */ |
525static int fdexpand; 526SYSCTL_INT(_debug, OID_AUTO, fdexpand, CTLFLAG_RD, &fdexpand, 0, ""); |
527 528int 529fdalloc(p, want, result) 530 struct proc *p; 531 int want; 532 int *result; 533{ 534 register struct filedesc *fdp = p->p_fd; --- 546 unchanged lines hidden --- |