kern_descrip.c (51418) | kern_descrip.c (51649) |
---|---|
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 | 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 * $FreeBSD: head/sys/kern/kern_descrip.c 51418 1999-09-19 17:00:25Z green $ | 39 * $FreeBSD: head/sys/kern/kern_descrip.c 51649 1999-09-25 14:14:21Z phk $ |
40 */ 41 42#include "opt_compat.h" 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/sysproto.h> 46#include <sys/conf.h> 47#include <sys/filedesc.h> --- 832 unchanged lines hidden (view full) --- 880 881 MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0), 882 M_FILEDESC, M_WAITOK); 883 bzero(newfdp, sizeof(struct filedesc0)); 884 newfdp->fd_fd.fd_cdir = fdp->fd_cdir; 885 VREF(newfdp->fd_fd.fd_cdir); 886 newfdp->fd_fd.fd_rdir = fdp->fd_rdir; 887 VREF(newfdp->fd_fd.fd_rdir); | 40 */ 41 42#include "opt_compat.h" 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/sysproto.h> 46#include <sys/conf.h> 47#include <sys/filedesc.h> --- 832 unchanged lines hidden (view full) --- 880 881 MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0), 882 M_FILEDESC, M_WAITOK); 883 bzero(newfdp, sizeof(struct filedesc0)); 884 newfdp->fd_fd.fd_cdir = fdp->fd_cdir; 885 VREF(newfdp->fd_fd.fd_cdir); 886 newfdp->fd_fd.fd_rdir = fdp->fd_rdir; 887 VREF(newfdp->fd_fd.fd_rdir); |
888 newfdp->fd_fd.fd_jdir = fdp->fd_jdir; 889 if (newfdp->fd_fd.fd_jdir) 890 VREF(newfdp->fd_fd.fd_jdir); |
|
888 889 /* Create the file descriptor table. */ 890 newfdp->fd_fd.fd_refcnt = 1; 891 newfdp->fd_fd.fd_cmask = cmask; 892 newfdp->fd_fd.fd_ofiles = newfdp->fd_dfiles; 893 newfdp->fd_fd.fd_ofileflags = newfdp->fd_dfileflags; 894 newfdp->fd_fd.fd_nfiles = NDFILE; 895 --- 31 unchanged lines hidden (view full) --- 927 if (fdp == NULL) 928 return NULL; 929 930 MALLOC(newfdp, struct filedesc *, sizeof(struct filedesc0), 931 M_FILEDESC, M_WAITOK); 932 bcopy(fdp, newfdp, sizeof(struct filedesc)); 933 VREF(newfdp->fd_cdir); 934 VREF(newfdp->fd_rdir); | 891 892 /* Create the file descriptor table. */ 893 newfdp->fd_fd.fd_refcnt = 1; 894 newfdp->fd_fd.fd_cmask = cmask; 895 newfdp->fd_fd.fd_ofiles = newfdp->fd_dfiles; 896 newfdp->fd_fd.fd_ofileflags = newfdp->fd_dfileflags; 897 newfdp->fd_fd.fd_nfiles = NDFILE; 898 --- 31 unchanged lines hidden (view full) --- 930 if (fdp == NULL) 931 return NULL; 932 933 MALLOC(newfdp, struct filedesc *, sizeof(struct filedesc0), 934 M_FILEDESC, M_WAITOK); 935 bcopy(fdp, newfdp, sizeof(struct filedesc)); 936 VREF(newfdp->fd_cdir); 937 VREF(newfdp->fd_rdir); |
938 if (newfdp->fd_jdir) 939 VREF(newfdp->fd_jdir); |
|
935 newfdp->fd_refcnt = 1; 936 937 /* 938 * If the number of open files fits in the internal arrays 939 * of the open file structure, use them, otherwise allocate 940 * additional memory for the number of descriptors currently 941 * in use. 942 */ --- 47 unchanged lines hidden (view full) --- 990 fpp = fdp->fd_ofiles; 991 for (i = fdp->fd_lastfile; i-- >= 0; fpp++) 992 if (*fpp) 993 (void) closef(*fpp, p); 994 if (fdp->fd_nfiles > NDFILE) 995 FREE(fdp->fd_ofiles, M_FILEDESC); 996 vrele(fdp->fd_cdir); 997 vrele(fdp->fd_rdir); | 940 newfdp->fd_refcnt = 1; 941 942 /* 943 * If the number of open files fits in the internal arrays 944 * of the open file structure, use them, otherwise allocate 945 * additional memory for the number of descriptors currently 946 * in use. 947 */ --- 47 unchanged lines hidden (view full) --- 995 fpp = fdp->fd_ofiles; 996 for (i = fdp->fd_lastfile; i-- >= 0; fpp++) 997 if (*fpp) 998 (void) closef(*fpp, p); 999 if (fdp->fd_nfiles > NDFILE) 1000 FREE(fdp->fd_ofiles, M_FILEDESC); 1001 vrele(fdp->fd_cdir); 1002 vrele(fdp->fd_rdir); |
1003 if(fdp->fd_jdir) 1004 vrele(fdp->fd_jdir); |
|
998 FREE(fdp, M_FILEDESC); 999} 1000 1001/* 1002 * Close any files on exec? 1003 */ 1004void 1005fdcloseexec(p) --- 358 unchanged lines hidden --- | 1005 FREE(fdp, M_FILEDESC); 1006} 1007 1008/* 1009 * Close any files on exec? 1010 */ 1011void 1012fdcloseexec(p) --- 358 unchanged lines hidden --- |