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 88739 2001-12-31 17:45:16Z rwatson $ |
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, 136 td->td_proc->p_ucred, td); |
137 if (error) { 138 if (fdp->fd_ofiles[fd] == fp) { 139 fdp->fd_ofiles[fd] = NULL; 140 fdrop(fp, td); 141 } 142 } else { 143 fp->f_data = (caddr_t)so; /* already has ref count */ 144 fp->f_flag = FREAD|FWRITE; --- 329 unchanged lines hidden (view full) --- 474 } */ *uap; 475{ 476 register struct filedesc *fdp = td->td_proc->p_fd; 477 struct file *fp1, *fp2; 478 struct socket *so1, *so2; 479 int fd, error, sv[2]; 480 481 mtx_lock(&Giant); |
482 error = socreate(uap->domain, &so1, uap->type, uap->protocol, 483 td->td_proc->p_ucred, td); |
484 if (error) 485 goto done2; |
486 error = socreate(uap->domain, &so2, uap->type, uap->protocol, 487 td->td_proc->p_ucred, td); |
488 if (error) 489 goto free1; 490 error = falloc(td, &fp1, &fd); 491 if (error) 492 goto free2; 493 fhold(fp1); 494 sv[0] = fd; 495 fp1->f_data = (caddr_t)so1; /* so1 already has ref count */ --- 1440 unchanged lines hidden --- |