Deleted Added
full compact
sys_generic.c (175140) sys_generic.c (177368)
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.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)sys_generic.c 8.5 (Berkeley) 1/21/94
35 */
36
37#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.

--- 21 unchanged lines hidden (view full) ---

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)sys_generic.c 8.5 (Berkeley) 1/21/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/sys_generic.c 175140 2008-01-07 20:05:19Z jhb $");
38__FBSDID("$FreeBSD: head/sys/kern/sys_generic.c 177368 2008-03-19 06:19:01Z jeff $");
39
40#include "opt_compat.h"
41#include "opt_ktrace.h"
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/sysproto.h>
46#include <sys/filedesc.h>

--- 961 unchanged lines hidden (view full) ---

1008
1009 /*
1010 * This is kinda bogus. We have fd limits, but that is not
1011 * really related to the size of the pollfd array. Make sure
1012 * we let the process use at least FD_SETSIZE entries and at
1013 * least enough for the current limits. We want to be reasonably
1014 * safe, but not overly restrictive.
1015 */
39
40#include "opt_compat.h"
41#include "opt_ktrace.h"
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/sysproto.h>
46#include <sys/filedesc.h>

--- 961 unchanged lines hidden (view full) ---

1008
1009 /*
1010 * This is kinda bogus. We have fd limits, but that is not
1011 * really related to the size of the pollfd array. Make sure
1012 * we let the process use at least FD_SETSIZE entries and at
1013 * least enough for the current limits. We want to be reasonably
1014 * safe, but not overly restrictive.
1015 */
1016 PROC_LOCK(td->td_proc);
1017 if ((nfds > lim_cur(td->td_proc, RLIMIT_NOFILE)) &&
1018 (nfds > FD_SETSIZE)) {
1019 PROC_UNLOCK(td->td_proc);
1016 if (nfds > maxfilesperproc && nfds > FD_SETSIZE)
1020 return (EINVAL);
1017 return (EINVAL);
1021 }
1022 PROC_UNLOCK(td->td_proc);
1023 ni = nfds * sizeof(struct pollfd);
1024 if (ni > sizeof(smallbits))
1025 bits = malloc(ni, M_TEMP, M_WAITOK);
1026 else
1027 bits = smallbits;
1028 error = copyin(uap->fds, bits, ni);
1029 if (error)
1030 goto done;

--- 434 unchanged lines hidden ---
1018 ni = nfds * sizeof(struct pollfd);
1019 if (ni > sizeof(smallbits))
1020 bits = malloc(ni, M_TEMP, M_WAITOK);
1021 else
1022 bits = smallbits;
1023 error = copyin(uap->fds, bits, ni);
1024 if (error)
1025 goto done;

--- 434 unchanged lines hidden ---