kern_descrip.c (130344) | kern_descrip.c (130387) |
---|---|
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. --- 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 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 35 */ 36 37#include <sys/cdefs.h> | 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. --- 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 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/kern/kern_descrip.c 130344 2004-06-11 11:16:26Z phk $"); | 38__FBSDID("$FreeBSD: head/sys/kern/kern_descrip.c 130387 2004-06-12 20:47:32Z rwatson $"); |
39 40#include "opt_compat.h" 41 42#include <sys/param.h> 43#include <sys/limits.h> 44#include <sys/systm.h> 45#include <sys/syscallsubr.h> 46#include <sys/sysproto.h> --- 1972 unchanged lines hidden (view full) --- 2019 if ((error = _fget(td, fd, &fp, 0, 0)) != 0) 2020 return (error); 2021 if (fp->f_type != DTYPE_SOCKET) { 2022 error = ENOTSOCK; 2023 } else { 2024 *spp = fp->f_data; 2025 if (fflagp) 2026 *fflagp = fp->f_flag; | 39 40#include "opt_compat.h" 41 42#include <sys/param.h> 43#include <sys/limits.h> 44#include <sys/systm.h> 45#include <sys/syscallsubr.h> 46#include <sys/sysproto.h> --- 1972 unchanged lines hidden (view full) --- 2019 if ((error = _fget(td, fd, &fp, 0, 0)) != 0) 2020 return (error); 2021 if (fp->f_type != DTYPE_SOCKET) { 2022 error = ENOTSOCK; 2023 } else { 2024 *spp = fp->f_data; 2025 if (fflagp) 2026 *fflagp = fp->f_flag; |
2027 SOCK_LOCK(*spp); |
|
2027 soref(*spp); | 2028 soref(*spp); |
2029 SOCK_UNLOCK(*spp); |
|
2028 } 2029 FILEDESC_UNLOCK(td->td_proc->p_fd); 2030 return (error); 2031} 2032 2033/* 2034 * Drop the reference count on the the socket and XXX release the SX lock in 2035 * the future. The last reference closes the socket. 2036 */ 2037void 2038fputsock(struct socket *so) 2039{ 2040 2041 NET_ASSERT_GIANT(); | 2030 } 2031 FILEDESC_UNLOCK(td->td_proc->p_fd); 2032 return (error); 2033} 2034 2035/* 2036 * Drop the reference count on the the socket and XXX release the SX lock in 2037 * the future. The last reference closes the socket. 2038 */ 2039void 2040fputsock(struct socket *so) 2041{ 2042 2043 NET_ASSERT_GIANT(); |
2044 SOCK_LOCK(so); |
|
2042 sorele(so); 2043} 2044 2045/* 2046 * Drop reference on struct file passed in, may call closef if the 2047 * reference hits zero. 2048 * Expects struct file locked, and will unlock it. 2049 */ --- 451 unchanged lines hidden --- | 2045 sorele(so); 2046} 2047 2048/* 2049 * Drop reference on struct file passed in, may call closef if the 2050 * reference hits zero. 2051 * Expects struct file locked, and will unlock it. 2052 */ --- 451 unchanged lines hidden --- |