uipc_socket.c (165889) | uipc_socket.c (166171) |
---|---|
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> | 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 165889 2007-01-08 17:49:59Z rwatson $"); | 98__FBSDID("$FreeBSD: head/sys/kern/uipc_socket.c 166171 2007-01-22 14:50:28Z andre $"); |
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> --- 943 unchanged lines hidden (view full) --- 1050 if (flags & MSG_EOR) 1051 top->m_flags |= M_EOR; 1052 } else { 1053#ifdef ZERO_COPY_SOCKETS 1054 error = sosend_copyin(uio, &top, atomic, &space, flags); 1055 if (error) 1056 goto out; 1057#else | 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> --- 943 unchanged lines hidden (view full) --- 1050 if (flags & MSG_EOR) 1051 top->m_flags |= M_EOR; 1052 } else { 1053#ifdef ZERO_COPY_SOCKETS 1054 error = sosend_copyin(uio, &top, atomic, &space, flags); 1055 if (error) 1056 goto out; 1057#else |
1058 /* 1059 * Copy the data from userland into a mbuf chain. 1060 * If no data is to be copied in, a single empty mbuf 1061 * is returned. 1062 */ |
|
1058 top = m_uiotombuf(uio, M_WAITOK, space, max_hdr, 1059 (M_PKTHDR | ((flags & MSG_EOR) ? M_EOR : 0))); 1060 if (top == NULL) { 1061 error = EFAULT; /* only possible error */ 1062 goto out; 1063 } 1064 space -= resid - uio->uio_resid; 1065#endif --- 159 unchanged lines hidden (view full) --- 1225#ifdef ZERO_COPY_SOCKETS 1226 error = sosend_copyin(uio, &top, atomic, 1227 &space, flags); 1228 if (error != 0) { 1229 SOCKBUF_LOCK(&so->so_snd); 1230 goto release; 1231 } 1232#else | 1063 top = m_uiotombuf(uio, M_WAITOK, space, max_hdr, 1064 (M_PKTHDR | ((flags & MSG_EOR) ? M_EOR : 0))); 1065 if (top == NULL) { 1066 error = EFAULT; /* only possible error */ 1067 goto out; 1068 } 1069 space -= resid - uio->uio_resid; 1070#endif --- 159 unchanged lines hidden (view full) --- 1230#ifdef ZERO_COPY_SOCKETS 1231 error = sosend_copyin(uio, &top, atomic, 1232 &space, flags); 1233 if (error != 0) { 1234 SOCKBUF_LOCK(&so->so_snd); 1235 goto release; 1236 } 1237#else |
1238 /* 1239 * Copy the data from userland into a mbuf 1240 * chain. If no data is to be copied in, 1241 * a single empty mbuf is returned. 1242 */ |
|
1233 top = m_uiotombuf(uio, M_WAITOK, space, 1234 (atomic ? max_hdr : 0), 1235 (atomic ? M_PKTHDR : 0) | 1236 ((flags & MSG_EOR) ? M_EOR : 0)); 1237 if (top == NULL) { 1238 SOCKBUF_LOCK(&so->so_snd); 1239 error = EFAULT; /* only possible error */ 1240 goto release; --- 1460 unchanged lines hidden --- | 1243 top = m_uiotombuf(uio, M_WAITOK, space, 1244 (atomic ? max_hdr : 0), 1245 (atomic ? M_PKTHDR : 0) | 1246 ((flags & MSG_EOR) ? M_EOR : 0)); 1247 if (top == NULL) { 1248 SOCKBUF_LOCK(&so->so_snd); 1249 error = EFAULT; /* only possible error */ 1250 goto release; --- 1460 unchanged lines hidden --- |