sys_generic.c (124736) | sys_generic.c (125454) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 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. --- 25 unchanged lines hidden (view full) --- 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 * @(#)sys_generic.c 8.5 (Berkeley) 1/21/94 39 */ 40 41#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1982, 1986, 1989, 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. --- 25 unchanged lines hidden (view full) --- 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 * @(#)sys_generic.c 8.5 (Berkeley) 1/21/94 39 */ 40 41#include <sys/cdefs.h> |
42__FBSDID("$FreeBSD: head/sys/kern/sys_generic.c 124736 2004-01-20 01:27:42Z ache $"); | 42__FBSDID("$FreeBSD: head/sys/kern/sys_generic.c 125454 2004-02-04 21:52:57Z jhb $"); |
43 44#include "opt_ktrace.h" 45 46#include <sys/param.h> 47#include <sys/systm.h> 48#include <sys/sysproto.h> 49#include <sys/filedesc.h> 50#include <sys/filio.h> --- 905 unchanged lines hidden (view full) --- 956 mtx_lock(&Giant); 957 /* 958 * This is kinda bogus. We have fd limits, but that is not 959 * really related to the size of the pollfd array. Make sure 960 * we let the process use at least FD_SETSIZE entries and at 961 * least enough for the current limits. We want to be reasonably 962 * safe, but not overly restrictive. 963 */ | 43 44#include "opt_ktrace.h" 45 46#include <sys/param.h> 47#include <sys/systm.h> 48#include <sys/sysproto.h> 49#include <sys/filedesc.h> 50#include <sys/filio.h> --- 905 unchanged lines hidden (view full) --- 956 mtx_lock(&Giant); 957 /* 958 * This is kinda bogus. We have fd limits, but that is not 959 * really related to the size of the pollfd array. Make sure 960 * we let the process use at least FD_SETSIZE entries and at 961 * least enough for the current limits. We want to be reasonably 962 * safe, but not overly restrictive. 963 */ |
964 if ((nfds > td->td_proc->p_rlimit[RLIMIT_NOFILE].rlim_cur) && | 964 PROC_LOCK(td->td_proc); 965 if ((nfds > lim_cur(td->td_proc, RLIMIT_NOFILE)) && |
965 (nfds > FD_SETSIZE)) { | 966 (nfds > FD_SETSIZE)) { |
967 PROC_UNLOCK(td->td_proc); |
|
966 error = EINVAL; 967 goto done2; 968 } | 968 error = EINVAL; 969 goto done2; 970 } |
971 PROC_UNLOCK(td->td_proc); |
|
969 ni = nfds * sizeof(struct pollfd); 970 if (ni > sizeof(smallbits)) 971 bits = malloc(ni, M_TEMP, M_WAITOK); 972 else 973 bits = smallbits; 974 error = copyin(uap->fds, bits, ni); 975 if (error) 976 goto done_nosellock; --- 258 unchanged lines hidden --- | 972 ni = nfds * sizeof(struct pollfd); 973 if (ni > sizeof(smallbits)) 974 bits = malloc(ni, M_TEMP, M_WAITOK); 975 else 976 bits = smallbits; 977 error = copyin(uap->fds, bits, ni); 978 if (error) 979 goto done_nosellock; --- 258 unchanged lines hidden --- |