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
--- 20 unchanged lines hidden (view full) ---
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94
37 * $FreeBSD: head/sys/kern/uipc_syscalls.c 86487 2001-11-17 03:07:11Z dillon $
38 */
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/kernel.h>
--- 81 unchanged lines hidden (view full) ---
127 int fd, error;
128
129 mtx_lock(&Giant);
130 fdp = td->td_proc->p_fd;
131 error = falloc(td, &fp, &fd);
132 if (error)
133 goto done2;
134 fhold(fp);
135 error = socreate(uap->domain, &so, uap->type, uap->protocol, td);
136 if (error) {
137 if (fdp->fd_ofiles[fd] == fp) {
138 fdp->fd_ofiles[fd] = NULL;
139 fdrop(fp, td);
140 }
141 } else {
142 fp->f_data = (caddr_t)so; /* already has ref count */
143 fp->f_flag = FREAD|FWRITE;
--- 329 unchanged lines hidden (view full) ---
473 } */ *uap;
474{
475 register struct filedesc *fdp = td->td_proc->p_fd;
476 struct file *fp1, *fp2;
477 struct socket *so1, *so2;
478 int fd, error, sv[2];
479
480 mtx_lock(&Giant);
481 error = socreate(uap->domain, &so1, uap->type, uap->protocol, td);
482 if (error)
483 goto done2;
484 error = socreate(uap->domain, &so2, uap->type, uap->protocol, td);
485 if (error)
486 goto free1;
487 error = falloc(td, &fp1, &fd);
488 if (error)
489 goto free2;
490 fhold(fp1);
491 sv[0] = fd;
492 fp1->f_data = (caddr_t)so1; /* so1 already has ref count */
--- 1440 unchanged lines hidden ---
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
--- 20 unchanged lines hidden (view full) ---
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94
37 * $FreeBSD: head/sys/kern/uipc_syscalls.c 86487 2001-11-17 03:07:11Z dillon $
38 */
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/kernel.h>
--- 81 unchanged lines hidden (view full) ---
127 int fd, error;
128
129 mtx_lock(&Giant);
130 fdp = td->td_proc->p_fd;
131 error = falloc(td, &fp, &fd);
132 if (error)
133 goto done2;
134 fhold(fp);
135 error = socreate(uap->domain, &so, uap->type, uap->protocol, td);
136 if (error) {
137 if (fdp->fd_ofiles[fd] == fp) {
138 fdp->fd_ofiles[fd] = NULL;
139 fdrop(fp, td);
140 }
141 } else {
142 fp->f_data = (caddr_t)so; /* already has ref count */
143 fp->f_flag = FREAD|FWRITE;
--- 329 unchanged lines hidden (view full) ---
473 } */ *uap;
474{
475 register struct filedesc *fdp = td->td_proc->p_fd;
476 struct file *fp1, *fp2;
477 struct socket *so1, *so2;
478 int fd, error, sv[2];
479
480 mtx_lock(&Giant);
481 error = socreate(uap->domain, &so1, uap->type, uap->protocol, td);
482 if (error)
483 goto done2;
484 error = socreate(uap->domain, &so2, uap->type, uap->protocol, td);
485 if (error)
486 goto free1;
487 error = falloc(td, &fp1, &fd);
488 if (error)
489 goto free2;
490 fhold(fp1);
491 sv[0] = fd;
492 fp1->f_data = (caddr_t)so1; /* so1 already has ref count */
--- 1440 unchanged lines hidden ---