kern_descrip.c (77978ab8bc1968d7606144ddc20b2a8a9f9b3382) | kern_descrip.c (37b087a645354d60200c774d51b305b268e41c83) |
---|---|
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. --- 806 unchanged lines hidden (view full) --- 815{ 816 register struct filedesc0 *newfdp; 817 register struct filedesc *fdp = p->p_fd; 818 819 MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0), 820 M_FILEDESC, M_WAITOK); 821 bzero(newfdp, sizeof(struct filedesc0)); 822 newfdp->fd_fd.fd_cdir = fdp->fd_cdir; | 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. --- 806 unchanged lines hidden (view full) --- 815{ 816 register struct filedesc0 *newfdp; 817 register struct filedesc *fdp = p->p_fd; 818 819 MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0), 820 M_FILEDESC, M_WAITOK); 821 bzero(newfdp, sizeof(struct filedesc0)); 822 newfdp->fd_fd.fd_cdir = fdp->fd_cdir; |
823 VREF(newfdp->fd_fd.fd_cdir); | 823 if (newfdp->fd_fd.fd_cdir) 824 VREF(newfdp->fd_fd.fd_cdir); |
824 newfdp->fd_fd.fd_rdir = fdp->fd_rdir; | 825 newfdp->fd_fd.fd_rdir = fdp->fd_rdir; |
825 VREF(newfdp->fd_fd.fd_rdir); | 826 if (newfdp->fd_fd.fd_rdir) 827 VREF(newfdp->fd_fd.fd_rdir); |
826 newfdp->fd_fd.fd_jdir = fdp->fd_jdir; 827 if (newfdp->fd_fd.fd_jdir) 828 VREF(newfdp->fd_fd.fd_jdir); 829 830 /* Create the file descriptor table. */ 831 newfdp->fd_fd.fd_refcnt = 1; 832 newfdp->fd_fd.fd_cmask = cmask; 833 newfdp->fd_fd.fd_ofiles = newfdp->fd_dfiles; --- 28 unchanged lines hidden (view full) --- 862 863 /* Certain daemons might not have file descriptors. */ 864 if (fdp == NULL) 865 return (NULL); 866 867 MALLOC(newfdp, struct filedesc *, sizeof(struct filedesc0), 868 M_FILEDESC, M_WAITOK); 869 bcopy(fdp, newfdp, sizeof(struct filedesc)); | 828 newfdp->fd_fd.fd_jdir = fdp->fd_jdir; 829 if (newfdp->fd_fd.fd_jdir) 830 VREF(newfdp->fd_fd.fd_jdir); 831 832 /* Create the file descriptor table. */ 833 newfdp->fd_fd.fd_refcnt = 1; 834 newfdp->fd_fd.fd_cmask = cmask; 835 newfdp->fd_fd.fd_ofiles = newfdp->fd_dfiles; --- 28 unchanged lines hidden (view full) --- 864 865 /* Certain daemons might not have file descriptors. */ 866 if (fdp == NULL) 867 return (NULL); 868 869 MALLOC(newfdp, struct filedesc *, sizeof(struct filedesc0), 870 M_FILEDESC, M_WAITOK); 871 bcopy(fdp, newfdp, sizeof(struct filedesc)); |
870 VREF(newfdp->fd_cdir); 871 VREF(newfdp->fd_rdir); | 872 if (newfdp->fd_cdir) 873 VREF(newfdp->fd_cdir); 874 if (newfdp->fd_rdir) 875 VREF(newfdp->fd_rdir); |
872 if (newfdp->fd_jdir) 873 VREF(newfdp->fd_jdir); 874 newfdp->fd_refcnt = 1; 875 876 /* 877 * If the number of open files fits in the internal arrays 878 * of the open file structure, use them, otherwise allocate 879 * additional memory for the number of descriptors currently --- 60 unchanged lines hidden (view full) --- 940 if (--fdp->fd_refcnt > 0) 941 return; 942 fpp = fdp->fd_ofiles; 943 for (i = fdp->fd_lastfile; i-- >= 0; fpp++) 944 if (*fpp) 945 (void) closef(*fpp, p); 946 if (fdp->fd_nfiles > NDFILE) 947 FREE(fdp->fd_ofiles, M_FILEDESC); | 876 if (newfdp->fd_jdir) 877 VREF(newfdp->fd_jdir); 878 newfdp->fd_refcnt = 1; 879 880 /* 881 * If the number of open files fits in the internal arrays 882 * of the open file structure, use them, otherwise allocate 883 * additional memory for the number of descriptors currently --- 60 unchanged lines hidden (view full) --- 944 if (--fdp->fd_refcnt > 0) 945 return; 946 fpp = fdp->fd_ofiles; 947 for (i = fdp->fd_lastfile; i-- >= 0; fpp++) 948 if (*fpp) 949 (void) closef(*fpp, p); 950 if (fdp->fd_nfiles > NDFILE) 951 FREE(fdp->fd_ofiles, M_FILEDESC); |
948 vrele(fdp->fd_cdir); 949 vrele(fdp->fd_rdir); | 952 if (fdp->fd_cdir) 953 vrele(fdp->fd_cdir); 954 if (fdp->fd_rdir) 955 vrele(fdp->fd_rdir); |
950 if (fdp->fd_jdir) 951 vrele(fdp->fd_jdir); 952 if (fdp->fd_knlist) 953 FREE(fdp->fd_knlist, M_TEMP); 954 if (fdp->fd_knhash) 955 FREE(fdp->fd_knhash, M_TEMP); 956 FREE(fdp, M_FILEDESC); 957} --- 428 unchanged lines hidden --- | 956 if (fdp->fd_jdir) 957 vrele(fdp->fd_jdir); 958 if (fdp->fd_knlist) 959 FREE(fdp->fd_knlist, M_TEMP); 960 if (fdp->fd_knhash) 961 FREE(fdp->fd_knhash, M_TEMP); 962 FREE(fdp, M_FILEDESC); 963} --- 428 unchanged lines hidden --- |