Deleted Added
full compact
uipc_syscalls.c (191917) uipc_syscalls.c (192080)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * sendfile(2) and related extensions:
6 * Copyright (c) 1998, David Greenman. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94
33 */
34
35#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * sendfile(2) and related extensions:
6 * Copyright (c) 1998, David Greenman. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/sys/kern/uipc_syscalls.c 191917 2009-05-08 14:34:25Z zec $");
36__FBSDID("$FreeBSD: head/sys/kern/uipc_syscalls.c 192080 2009-05-14 03:24:22Z jeff $");
37
38#include "opt_sctp.h"
39#include "opt_compat.h"
40#include "opt_ktrace.h"
41#include "opt_mac.h"
42
43#include <sys/param.h>
44#include <sys/systm.h>

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

117 */
118static int
119getsock(struct filedesc *fdp, int fd, struct file **fpp, u_int *fflagp)
120{
121 struct file *fp;
122 int error;
123
124 fp = NULL;
37
38#include "opt_sctp.h"
39#include "opt_compat.h"
40#include "opt_ktrace.h"
41#include "opt_mac.h"
42
43#include <sys/param.h>
44#include <sys/systm.h>

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

117 */
118static int
119getsock(struct filedesc *fdp, int fd, struct file **fpp, u_int *fflagp)
120{
121 struct file *fp;
122 int error;
123
124 fp = NULL;
125 if (fdp == NULL)
125 if (fdp == NULL || (fp = fget_unlocked(fdp, fd)) == NULL) {
126 error = EBADF;
126 error = EBADF;
127 else {
128 FILEDESC_SLOCK(fdp);
129 fp = fget_locked(fdp, fd);
130 if (fp == NULL)
131 error = EBADF;
132 else if (fp->f_type != DTYPE_SOCKET) {
133 fp = NULL;
134 error = ENOTSOCK;
135 } else {
136 fhold(fp);
137 if (fflagp != NULL)
138 *fflagp = fp->f_flag;
139 error = 0;
140 }
141 FILEDESC_SUNLOCK(fdp);
127 } else if (fp->f_type != DTYPE_SOCKET) {
128 fdrop(fp, curthread);
129 fp = NULL;
130 error = ENOTSOCK;
131 } else {
132 if (fflagp != NULL)
133 *fflagp = fp->f_flag;
134 error = 0;
142 }
143 *fpp = fp;
144 return (error);
145}
146
147/*
148 * System call interface to the socket abstraction.
149 */

--- 2577 unchanged lines hidden ---
135 }
136 *fpp = fp;
137 return (error);
138}
139
140/*
141 * System call interface to the socket abstraction.
142 */

--- 2577 unchanged lines hidden ---