1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California.
4 * Copyright (c) 2004 The FreeBSD Foundation
5 * Copyright (c) 2004-2006 Robert N. M. Watson
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 81 unchanged lines hidden (view full) ---
90 * calls to explicitly manage socket references, soref(), and sorele().
91 * Currently, these are generally required only when transitioning a socket
92 * from a listen queue to a file descriptor, in order to prevent garbage
93 * collection of the socket at an untimely moment. For a number of reasons,
94 * these interfaces are not preferred, and should be avoided.
95 */
96
97#include <sys/cdefs.h>
98__FBSDID("$FreeBSD: head/sys/kern/uipc_socket.c 167799 2007-03-22 13:21:24Z glebius $");
99
100#include "opt_inet.h"
101#include "opt_mac.h"
102#include "opt_zero.h"
103#include "opt_compat.h"
104
105#include <sys/param.h>
106#include <sys/systm.h>
--- 11 unchanged lines hidden (view full) ---
118#include <sys/eventhandler.h>
119#include <sys/poll.h>
120#include <sys/proc.h>
121#include <sys/protosw.h>
122#include <sys/socket.h>
123#include <sys/socketvar.h>
124#include <sys/resourcevar.h>
125#include <sys/signalvar.h>
126#include <sys/sysctl.h>
127#include <sys/uio.h>
128#include <sys/jail.h>
129
130#include <security/mac/mac_framework.h>
131
132#include <vm/uma.h>
133
--- 2454 unchanged lines hidden (view full) ---
2588
2589 SOCKBUF_LOCK(sb);
2590 knlist_add(&sb->sb_sel.si_note, kn, 1);
2591 sb->sb_flags |= SB_KNOTE;
2592 SOCKBUF_UNLOCK(sb);
2593 return (0);
2594}
2595
2596static void
2597filt_sordetach(struct knote *kn)
2598{
2599 struct socket *so = kn->kn_fp->f_data;
2600
2601 SOCKBUF_LOCK(&so->so_rcv);
2602 knlist_remove(&so->so_rcv.sb_sel.si_note, kn, 1);
2603 if (knlist_empty(&so->so_rcv.sb_sel.si_note))
--- 92 unchanged lines hidden (view full) ---
2696 return (error);
2697
2698 if (val < 1 || val > USHRT_MAX)
2699 return (EINVAL);
2700
2701 somaxconn = val;
2702 return (0);
2703}
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California.
4 * Copyright (c) 2004 The FreeBSD Foundation
5 * Copyright (c) 2004-2006 Robert N. M. Watson
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 81 unchanged lines hidden (view full) ---
90 * calls to explicitly manage socket references, soref(), and sorele().
91 * Currently, these are generally required only when transitioning a socket
92 * from a listen queue to a file descriptor, in order to prevent garbage
93 * collection of the socket at an untimely moment. For a number of reasons,
94 * these interfaces are not preferred, and should be avoided.
95 */
96
97#include <sys/cdefs.h>
98__FBSDID("$FreeBSD: head/sys/kern/uipc_socket.c 167799 2007-03-22 13:21:24Z glebius $");
99
100#include "opt_inet.h"
101#include "opt_mac.h"
102#include "opt_zero.h"
103#include "opt_compat.h"
104
105#include <sys/param.h>
106#include <sys/systm.h>
--- 11 unchanged lines hidden (view full) ---
118#include <sys/eventhandler.h>
119#include <sys/poll.h>
120#include <sys/proc.h>
121#include <sys/protosw.h>
122#include <sys/socket.h>
123#include <sys/socketvar.h>
124#include <sys/resourcevar.h>
125#include <sys/signalvar.h>
126#include <sys/sysctl.h>
127#include <sys/uio.h>
128#include <sys/jail.h>
129
130#include <security/mac/mac_framework.h>
131
132#include <vm/uma.h>
133
--- 2454 unchanged lines hidden (view full) ---
2588
2589 SOCKBUF_LOCK(sb);
2590 knlist_add(&sb->sb_sel.si_note, kn, 1);
2591 sb->sb_flags |= SB_KNOTE;
2592 SOCKBUF_UNLOCK(sb);
2593 return (0);
2594}
2595
2596static void
2597filt_sordetach(struct knote *kn)
2598{
2599 struct socket *so = kn->kn_fp->f_data;
2600
2601 SOCKBUF_LOCK(&so->so_rcv);
2602 knlist_remove(&so->so_rcv.sb_sel.si_note, kn, 1);
2603 if (knlist_empty(&so->so_rcv.sb_sel.si_note))
--- 92 unchanged lines hidden (view full) ---
2696 return (error);
2697
2698 if (val < 1 || val > USHRT_MAX)
2699 return (EINVAL);
2700
2701 somaxconn = val;
2702 return (0);
2703}