Deleted Added
full compact
uipc_syscalls.c (98499) uipc_syscalls.c (98849)
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
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 98499 2002-06-20 18:52:54Z alfred $
37 * $FreeBSD: head/sys/kern/uipc_syscalls.c 98849 2002-06-26 03:37:47Z ken $
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>

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

69#include <vm/vm_object.h>
70#include <vm/vm_page.h>
71#include <vm/vm_pageout.h>
72#include <vm/vm_kern.h>
73#include <vm/vm_extern.h>
74
75static void sf_buf_init(void *arg);
76SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL)
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>

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

69#include <vm/vm_object.h>
70#include <vm/vm_page.h>
71#include <vm/vm_pageout.h>
72#include <vm/vm_kern.h>
73#include <vm/vm_extern.h>
74
75static void sf_buf_init(void *arg);
76SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL)
77static struct sf_buf *sf_buf_alloc(void);
78static void sf_buf_free(caddr_t addr, void *args);
77struct sf_buf *sf_buf_alloc(void);
78void sf_buf_free(caddr_t addr, void *args);
79
80static int sendit(struct thread *td, int s, struct msghdr *mp, int flags);
81static int recvit(struct thread *td, int s, struct msghdr *mp,
82 caddr_t namelenp);
83
84static int accept1(struct thread *td, struct accept_args *uap, int compat);
85static int getsockname1(struct thread *td, struct getsockname_args *uap,
86 int compat);

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

91 * Expanded sf_freelist head. Really an SLIST_HEAD() in disguise, with the
92 * sf_freelist head with the sf_lock mutex.
93 */
94static struct {
95 SLIST_HEAD(, sf_buf) sf_head;
96 struct mtx sf_lock;
97} sf_freelist;
98
79
80static int sendit(struct thread *td, int s, struct msghdr *mp, int flags);
81static int recvit(struct thread *td, int s, struct msghdr *mp,
82 caddr_t namelenp);
83
84static int accept1(struct thread *td, struct accept_args *uap, int compat);
85static int getsockname1(struct thread *td, struct getsockname_args *uap,
86 int compat);

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

91 * Expanded sf_freelist head. Really an SLIST_HEAD() in disguise, with the
92 * sf_freelist head with the sf_lock mutex.
93 */
94static struct {
95 SLIST_HEAD(, sf_buf) sf_head;
96 struct mtx sf_lock;
97} sf_freelist;
98
99static vm_offset_t sf_base;
100static struct sf_buf *sf_bufs;
101static u_int sf_buf_alloc_want;
99vm_offset_t sf_base;
100struct sf_buf *sf_bufs;
101u_int sf_buf_alloc_want;
102
103/*
104 * System call interface to the socket abstraction.
105 */
106#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
107#define COMPAT_OLDSOCK
108#endif
109

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

1565 }
1566 sf_buf_alloc_want = 0;
1567 mtx_unlock(&sf_freelist.sf_lock);
1568}
1569
1570/*
1571 * Get an sf_buf from the freelist. Will block if none are available.
1572 */
102
103/*
104 * System call interface to the socket abstraction.
105 */
106#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
107#define COMPAT_OLDSOCK
108#endif
109

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

1565 }
1566 sf_buf_alloc_want = 0;
1567 mtx_unlock(&sf_freelist.sf_lock);
1568}
1569
1570/*
1571 * Get an sf_buf from the freelist. Will block if none are available.
1572 */
1573static struct sf_buf *
1573struct sf_buf *
1574sf_buf_alloc()
1575{
1576 struct sf_buf *sf;
1577 int error;
1578
1579 mtx_lock(&sf_freelist.sf_lock);
1580 while ((sf = SLIST_FIRST(&sf_freelist.sf_head)) == NULL) {
1581 sf_buf_alloc_want++;

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

1595 return (sf);
1596}
1597
1598#define dtosf(x) (&sf_bufs[((uintptr_t)(x) - (uintptr_t)sf_base) >> PAGE_SHIFT])
1599
1600/*
1601 * Detatch mapped page and release resources back to the system.
1602 */
1574sf_buf_alloc()
1575{
1576 struct sf_buf *sf;
1577 int error;
1578
1579 mtx_lock(&sf_freelist.sf_lock);
1580 while ((sf = SLIST_FIRST(&sf_freelist.sf_head)) == NULL) {
1581 sf_buf_alloc_want++;

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

1595 return (sf);
1596}
1597
1598#define dtosf(x) (&sf_bufs[((uintptr_t)(x) - (uintptr_t)sf_base) >> PAGE_SHIFT])
1599
1600/*
1601 * Detatch mapped page and release resources back to the system.
1602 */
1603static void
1603void
1604sf_buf_free(caddr_t addr, void *args)
1605{
1606 struct sf_buf *sf;
1607 struct vm_page *m;
1608
1609 GIANT_REQUIRED;
1610
1611 sf = dtosf(addr);

--- 341 unchanged lines hidden ---
1604sf_buf_free(caddr_t addr, void *args)
1605{
1606 struct sf_buf *sf;
1607 struct vm_page *m;
1608
1609 GIANT_REQUIRED;
1610
1611 sf = dtosf(addr);

--- 341 unchanged lines hidden ---