Deleted Added
full compact
uipc_usrreq.c (142174) uipc_usrreq.c (142190)
1/*-
2 * Copyright 2004-2005 Robert N. M. Watson
3 * Copyright (c) 1982, 1986, 1989, 1991, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright 2004-2005 Robert N. M. Watson
3 * Copyright (c) 1982, 1986, 1989, 1991, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/kern/uipc_usrreq.c 142174 2005-02-21 14:21:50Z rwatson $");
34__FBSDID("$FreeBSD: head/sys/kern/uipc_usrreq.c 142190 2005-02-21 21:58:17Z rwatson $");
35
36#include "opt_mac.h"
37
38#include <sys/param.h>
39#include <sys/domain.h>
40#include <sys/fcntl.h>
41#include <sys/malloc.h> /* XXX must be before <sys/file.h> */
42#include <sys/file.h>

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

119static void unp_shutdown(struct unpcb *);
120static void unp_drop(struct unpcb *, int);
121static void unp_gc(void);
122static void unp_scan(struct mbuf *, void (*)(struct file *));
123static void unp_mark(struct file *);
124static void unp_discard(struct file *);
125static void unp_freerights(struct file **, int);
126static int unp_internalize(struct mbuf **, struct thread *);
35
36#include "opt_mac.h"
37
38#include <sys/param.h>
39#include <sys/domain.h>
40#include <sys/fcntl.h>
41#include <sys/malloc.h> /* XXX must be before <sys/file.h> */
42#include <sys/file.h>

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

119static void unp_shutdown(struct unpcb *);
120static void unp_drop(struct unpcb *, int);
121static void unp_gc(void);
122static void unp_scan(struct mbuf *, void (*)(struct file *));
123static void unp_mark(struct file *);
124static void unp_discard(struct file *);
125static void unp_freerights(struct file **, int);
126static int unp_internalize(struct mbuf **, struct thread *);
127static int unp_listen(struct unpcb *, struct thread *);
127static int unp_listen(struct socket *, struct unpcb *, struct thread *);
128
129static int
130uipc_abort(struct socket *so)
131{
132 struct unpcb *unp;
133
134 UNP_LOCK();
135 unp = sotounpcb(so);

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

279 int error;
280
281 UNP_LOCK();
282 unp = sotounpcb(so);
283 if (unp == NULL || unp->unp_vnode == NULL) {
284 UNP_UNLOCK();
285 return (EINVAL);
286 }
128
129static int
130uipc_abort(struct socket *so)
131{
132 struct unpcb *unp;
133
134 UNP_LOCK();
135 unp = sotounpcb(so);

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

279 int error;
280
281 UNP_LOCK();
282 unp = sotounpcb(so);
283 if (unp == NULL || unp->unp_vnode == NULL) {
284 UNP_UNLOCK();
285 return (EINVAL);
286 }
287 error = unp_listen(unp, td);
287 error = unp_listen(so, unp, td);
288 UNP_UNLOCK();
289 return (error);
290}
291
292static int
293uipc_peeraddr(struct socket *so, struct sockaddr **nam)
294{
295 struct unpcb *unp;

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

1703unp_dispose(struct mbuf *m)
1704{
1705
1706 if (m)
1707 unp_scan(m, unp_discard);
1708}
1709
1710static int
288 UNP_UNLOCK();
289 return (error);
290}
291
292static int
293uipc_peeraddr(struct socket *so, struct sockaddr **nam)
294{
295 struct unpcb *unp;

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

1703unp_dispose(struct mbuf *m)
1704{
1705
1706 if (m)
1707 unp_scan(m, unp_discard);
1708}
1709
1710static int
1711unp_listen(struct unpcb *unp, struct thread *td)
1711unp_listen(struct socket *so, struct unpcb *unp, struct thread *td)
1712{
1712{
1713 int error;
1714
1713 UNP_LOCK_ASSERT();
1714
1715 UNP_LOCK_ASSERT();
1716
1715 /*
1716 * XXXRW: Why populate the local peer cred with our own credential?
1717 */
1718 cru2x(td->td_ucred, &unp->unp_peercred);
1719 unp->unp_flags |= UNP_HAVEPCCACHED;
1720 return (0);
1717 SOCK_LOCK(so);
1718 error = solisten_proto_check(so);
1719 if (error == 0) {
1720 cru2x(td->td_ucred, &unp->unp_peercred);
1721 unp->unp_flags |= UNP_HAVEPCCACHED;
1722 solisten_proto(so);
1723 }
1724 SOCK_UNLOCK(so);
1725 return (error);
1721}
1722
1723static void
1724unp_scan(struct mbuf *m0, void (*op)(struct file *))
1725{
1726 struct mbuf *m;
1727 struct file **rp;
1728 struct cmsghdr *cm;

--- 61 unchanged lines hidden ---
1726}
1727
1728static void
1729unp_scan(struct mbuf *m0, void (*op)(struct file *))
1730{
1731 struct mbuf *m;
1732 struct file **rp;
1733 struct cmsghdr *cm;

--- 61 unchanged lines hidden ---