filedesc.h (31558) | filedesc.h (41086) |
---|---|
1/* 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)filedesc.h 8.1 (Berkeley) 6/2/93 | 1/* 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)filedesc.h 8.1 (Berkeley) 6/2/93 |
34 * $Id: filedesc.h,v 1.12 1997/10/12 20:25:57 phk Exp $ | 34 * $Id: filedesc.h,v 1.13 1997/12/05 18:58:10 bde Exp $ |
35 */ 36 37#ifndef _SYS_FILEDESC_H_ 38#define _SYS_FILEDESC_H_ 39 | 35 */ 36 37#ifndef _SYS_FILEDESC_H_ 38#define _SYS_FILEDESC_H_ 39 |
40#include <sys/queue.h> 41 |
|
40/* 41 * This structure is used for the management of descriptors. It may be 42 * shared by multiple processes. 43 * 44 * A process is initially started out with NDFILE descriptors stored within 45 * this structure, selected to be enough for typical applications based on 46 * the historical limit of 20 open files (and the usage of descriptors by 47 * shells). If these descriptors are exhausted, a larger descriptor table --- 38 unchanged lines hidden (view full) --- 86#define UF_EXCLOSE 0x01 /* auto-close on exec */ 87#define UF_MAPPED 0x02 /* mapped from device */ 88 89/* 90 * Storage required per open file descriptor. 91 */ 92#define OFILESIZE (sizeof(struct file *) + sizeof(char)) 93 | 42/* 43 * This structure is used for the management of descriptors. It may be 44 * shared by multiple processes. 45 * 46 * A process is initially started out with NDFILE descriptors stored within 47 * this structure, selected to be enough for typical applications based on 48 * the historical limit of 20 open files (and the usage of descriptors by 49 * shells). If these descriptors are exhausted, a larger descriptor table --- 38 unchanged lines hidden (view full) --- 88#define UF_EXCLOSE 0x01 /* auto-close on exec */ 89#define UF_MAPPED 0x02 /* mapped from device */ 90 91/* 92 * Storage required per open file descriptor. 93 */ 94#define OFILESIZE (sizeof(struct file *) + sizeof(char)) 95 |
96/* 97 * This structure that holds the information needed to send a SIGIO or 98 * a SIGURG signal to a process or process group when new data arrives 99 * on a device or socket. The structure is placed on an SLIST belonging 100 * to the proc or pgrp so that the entire list may be revoked when the 101 * process exits or the process group disappears. 102 */ 103struct sigio { 104 union { 105 struct proc *siu_proc; /* Process to receive SIGIO/SIGURG */ 106 struct pgrp *siu_pgrp; /* Process group to receive ... */ 107 } sio_u; 108 SLIST_ENTRY(sigio) sio_pgsigio; /* sigio's for process or group */ 109 struct sigio **sio_myref; /* location of the pointer that holds 110 * the reference to this structure */ 111 struct ucred *sio_ucred; /* Current credentials */ 112 uid_t sio_ruid; /* Real user id */ 113 pid_t sio_pgid; /* pgid for signals */ 114}; 115#define sio_proc sio_u.siu_proc 116#define sio_pgrp sio_u.siu_pgrp 117 118SLIST_HEAD(sigiolst, sigio); 119 |
|
94#ifdef KERNEL 95/* 96 * Kernel global variables and routines. 97 */ 98int dupfdopen __P((struct filedesc *, int, int, int, int)); 99int fdalloc __P((struct proc *p, int want, int *result)); 100int fdavail __P((struct proc *p, int n)); 101int falloc __P((struct proc *p, struct file **resultfp, int *resultfd)); 102void ffree __P((struct file *)); 103struct filedesc *fdinit __P((struct proc *p)); 104struct filedesc *fdshare __P((struct proc *p)); 105struct filedesc *fdcopy __P((struct proc *p)); 106void fdfree __P((struct proc *p)); 107int closef __P((struct file *fp,struct proc *p)); 108void fdcloseexec __P((struct proc *p)); 109int getvnode __P((struct filedesc *fdp, int fd, struct file **fpp)); 110int fdissequential __P((struct file *)); 111void fdsequential __P((struct file *, int)); | 120#ifdef KERNEL 121/* 122 * Kernel global variables and routines. 123 */ 124int dupfdopen __P((struct filedesc *, int, int, int, int)); 125int fdalloc __P((struct proc *p, int want, int *result)); 126int fdavail __P((struct proc *p, int n)); 127int falloc __P((struct proc *p, struct file **resultfp, int *resultfd)); 128void ffree __P((struct file *)); 129struct filedesc *fdinit __P((struct proc *p)); 130struct filedesc *fdshare __P((struct proc *p)); 131struct filedesc *fdcopy __P((struct proc *p)); 132void fdfree __P((struct proc *p)); 133int closef __P((struct file *fp,struct proc *p)); 134void fdcloseexec __P((struct proc *p)); 135int getvnode __P((struct filedesc *fdp, int fd, struct file **fpp)); 136int fdissequential __P((struct file *)); 137void fdsequential __P((struct file *, int)); |
138pid_t fgetown __P((struct sigio *)); 139int fsetown __P((pid_t, struct sigio **)); 140void funsetown __P((struct sigio *)); 141void funsetownlst __P((struct sigiolst *)); |
|
112#endif 113 114#endif | 142#endif 143 144#endif |