fdesc_vfsops.c (84873) | fdesc_vfsops.c (89306) |
---|---|
1/* 2 * Copyright (c) 1992, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software donated to Berkeley by 6 * Jan-Simon Pendry. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 21 unchanged lines hidden (view full) --- 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)fdesc_vfsops.c 8.4 (Berkeley) 1/21/94 37 * | 1/* 2 * Copyright (c) 1992, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software donated to Berkeley by 6 * Jan-Simon Pendry. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 21 unchanged lines hidden (view full) --- 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)fdesc_vfsops.c 8.4 (Berkeley) 1/21/94 37 * |
38 * $FreeBSD: head/sys/fs/fdescfs/fdesc_vfsops.c 84873 2001-10-13 06:41:41Z bde $ | 38 * $FreeBSD: head/sys/fs/fdescfs/fdesc_vfsops.c 89306 2002-01-13 11:58:06Z alfred $ |
39 */ 40 41/* 42 * /dev/fd Filesystem 43 */ 44 45#include <sys/param.h> 46#include <sys/systm.h> --- 123 unchanged lines hidden (view full) --- 170 /* 171 * Compute number of free file descriptors. 172 * [ Strange results will ensue if the open file 173 * limit is ever reduced below the current number 174 * of open files... ] 175 */ 176 lim = td->td_proc->p_rlimit[RLIMIT_NOFILE].rlim_cur; 177 fdp = td->td_proc->p_fd; | 39 */ 40 41/* 42 * /dev/fd Filesystem 43 */ 44 45#include <sys/param.h> 46#include <sys/systm.h> --- 123 unchanged lines hidden (view full) --- 170 /* 171 * Compute number of free file descriptors. 172 * [ Strange results will ensue if the open file 173 * limit is ever reduced below the current number 174 * of open files... ] 175 */ 176 lim = td->td_proc->p_rlimit[RLIMIT_NOFILE].rlim_cur; 177 fdp = td->td_proc->p_fd; |
178 FILEDESC_LOCK(fdp); |
|
178 last = min(fdp->fd_nfiles, lim); 179 freefd = 0; 180 for (i = fdp->fd_freefile; i < last; i++) 181 if (fdp->fd_ofiles[i] == NULL) 182 freefd++; 183 184 /* 185 * Adjust for the fact that the fdesc array may not 186 * have been fully allocated yet. 187 */ 188 if (fdp->fd_nfiles < lim) 189 freefd += (lim - fdp->fd_nfiles); | 179 last = min(fdp->fd_nfiles, lim); 180 freefd = 0; 181 for (i = fdp->fd_freefile; i < last; i++) 182 if (fdp->fd_ofiles[i] == NULL) 183 freefd++; 184 185 /* 186 * Adjust for the fact that the fdesc array may not 187 * have been fully allocated yet. 188 */ 189 if (fdp->fd_nfiles < lim) 190 freefd += (lim - fdp->fd_nfiles); |
191 FILEDESC_UNLOCK(fdp); |
|
190 191 sbp->f_flags = 0; 192 sbp->f_bsize = DEV_BSIZE; 193 sbp->f_iosize = DEV_BSIZE; 194 sbp->f_blocks = 2; /* 1K to keep df happy */ 195 sbp->f_bfree = 0; 196 sbp->f_bavail = 0; 197 sbp->f_files = lim + 1; /* Allow for "." */ --- 28 unchanged lines hidden --- | 192 193 sbp->f_flags = 0; 194 sbp->f_bsize = DEV_BSIZE; 195 sbp->f_iosize = DEV_BSIZE; 196 sbp->f_blocks = 2; /* 1K to keep df happy */ 197 sbp->f_bfree = 0; 198 sbp->f_bavail = 0; 199 sbp->f_files = lim + 1; /* Allow for "." */ --- 28 unchanged lines hidden --- |