sctp_syscalls.c (207535) | sctp_syscalls.c (207548) |
---|---|
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 207535 2010-05-02 19:25:22Z kib $"); | 36__FBSDID("$FreeBSD: head/sys/kern/uipc_syscalls.c 207548 2010-05-03 05:41:50Z alc $"); |
37 38#include "opt_inet.h" 39#include "opt_inet6.h" 40#include "opt_sctp.h" 41#include "opt_compat.h" 42#include "opt_ktrace.h" 43 44#include <sys/param.h> --- 1665 unchanged lines hidden (view full) --- 1710void 1711sf_buf_mext(void *addr, void *args) 1712{ 1713 vm_page_t m; 1714 struct sendfile_sync *sfs; 1715 1716 m = sf_buf_page(args); 1717 sf_buf_free(args); | 37 38#include "opt_inet.h" 39#include "opt_inet6.h" 40#include "opt_sctp.h" 41#include "opt_compat.h" 42#include "opt_ktrace.h" 43 44#include <sys/param.h> --- 1665 unchanged lines hidden (view full) --- 1710void 1711sf_buf_mext(void *addr, void *args) 1712{ 1713 vm_page_t m; 1714 struct sendfile_sync *sfs; 1715 1716 m = sf_buf_page(args); 1717 sf_buf_free(args); |
1718 vm_page_lock(m); |
|
1718 vm_page_lock_queues(); 1719 vm_page_unwire(m, 0); 1720 /* 1721 * Check for the object going away on us. This can 1722 * happen since we don't hold a reference to it. 1723 * If so, we're responsible for freeing the page. 1724 */ 1725 if (m->wire_count == 0 && m->object == NULL) 1726 vm_page_free(m); 1727 vm_page_unlock_queues(); | 1719 vm_page_lock_queues(); 1720 vm_page_unwire(m, 0); 1721 /* 1722 * Check for the object going away on us. This can 1723 * happen since we don't hold a reference to it. 1724 * If so, we're responsible for freeing the page. 1725 */ 1726 if (m->wire_count == 0 && m->object == NULL) 1727 vm_page_free(m); 1728 vm_page_unlock_queues(); |
1729 vm_page_unlock(m); |
|
1728 if (addr == NULL) 1729 return; 1730 sfs = addr; 1731 mtx_lock(&sfs->mtx); 1732 KASSERT(sfs->count> 0, ("Sendfile sync botchup count == 0")); 1733 if (--sfs->count == 0) 1734 cv_signal(&sfs->cv); 1735 mtx_unlock(&sfs->mtx); --- 395 unchanged lines hidden (view full) --- 2131 2132 /* 2133 * Get a sendfile buf. We usually wait as long 2134 * as necessary, but this wait can be interrupted. 2135 */ 2136 if ((sf = sf_buf_alloc(pg, 2137 (mnw ? SFB_NOWAIT : SFB_CATCH))) == NULL) { 2138 mbstat.sf_allocfail++; | 1730 if (addr == NULL) 1731 return; 1732 sfs = addr; 1733 mtx_lock(&sfs->mtx); 1734 KASSERT(sfs->count> 0, ("Sendfile sync botchup count == 0")); 1735 if (--sfs->count == 0) 1736 cv_signal(&sfs->cv); 1737 mtx_unlock(&sfs->mtx); --- 395 unchanged lines hidden (view full) --- 2133 2134 /* 2135 * Get a sendfile buf. We usually wait as long 2136 * as necessary, but this wait can be interrupted. 2137 */ 2138 if ((sf = sf_buf_alloc(pg, 2139 (mnw ? SFB_NOWAIT : SFB_CATCH))) == NULL) { 2140 mbstat.sf_allocfail++; |
2141 vm_page_lock(pg); |
|
2139 vm_page_lock_queues(); 2140 vm_page_unwire(pg, 0); 2141 /* 2142 * XXX: Not same check as above!? 2143 */ 2144 if (pg->wire_count == 0 && pg->object == NULL) 2145 vm_page_free(pg); 2146 vm_page_unlock_queues(); | 2142 vm_page_lock_queues(); 2143 vm_page_unwire(pg, 0); 2144 /* 2145 * XXX: Not same check as above!? 2146 */ 2147 if (pg->wire_count == 0 && pg->object == NULL) 2148 vm_page_free(pg); 2149 vm_page_unlock_queues(); |
2150 vm_page_unlock(pg); |
|
2147 error = (mnw ? EAGAIN : EINTR); 2148 break; 2149 } 2150 2151 /* 2152 * Get an mbuf and set it up as having 2153 * external storage. 2154 */ --- 590 unchanged lines hidden --- | 2151 error = (mnw ? EAGAIN : EINTR); 2152 break; 2153 } 2154 2155 /* 2156 * Get an mbuf and set it up as having 2157 * external storage. 2158 */ --- 590 unchanged lines hidden --- |