summaryrefslogtreecommitdiffstats
path: root/cpukit/libnetworking/net
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2007-03-27 04:24:41 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2007-03-27 04:24:41 +0000
commite6a59370c18c1ad1411233132dc6b7c5499aa827 (patch)
treed96c55ccdf62dd3ef4babd7443f5377a5fa08a85 /cpukit/libnetworking/net
parent2007-03-26 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-e6a59370c18c1ad1411233132dc6b7c5499aa827.tar.bz2
2007-03-26 Ralf Corsépius <ralf.corsepius@rtems.org>
* libnetworking/net/raw_cb.c: Sync with FreeBSD.
Diffstat (limited to 'cpukit/libnetworking/net')
-rw-r--r--cpukit/libnetworking/net/raw_cb.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/cpukit/libnetworking/net/raw_cb.c b/cpukit/libnetworking/net/raw_cb.c
index 0676931cdc..a598b6fad6 100644
--- a/cpukit/libnetworking/net/raw_cb.c
+++ b/cpukit/libnetworking/net/raw_cb.c
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -31,6 +27,10 @@
* SUCH DAMAGE.
*
* @(#)raw_cb.c 8.1 (Berkeley) 6/10/93
+ * $FreeBSD: src/sys/net/raw_cb.c,v 1.34 2006/06/02 08:27:15 rwatson Exp $
+ */
+
+/*
* $Id$
*/
@@ -49,6 +49,12 @@
#include <net/raw_cb.h>
#include <netinet/in.h>
+#ifdef __rtems__
+#define mtx_lock(x) /* UNUSED */
+#define mtx_unlock(x) /* UNUSED */
+#define KASSERT(x,y) /* UNUSED */
+#endif
+
/*
* Routines to manage the raw protocol control blocks.
*
@@ -58,7 +64,7 @@
* redo address binding to allow wildcards
*/
-struct rawcb rawcb;
+struct rawcb_list_head rawcb_list;
static u_long raw_sendspace = RAWSNDQ;
static u_long raw_recvspace = RAWRCVQ;
@@ -87,7 +93,9 @@ raw_attach(so, proto)
rp->rcb_socket = so;
rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family;
rp->rcb_proto.sp_protocol = proto;
- insque(rp, &rawcb);
+ mtx_lock(&rawcb_mtx);
+ LIST_INSERT_HEAD(&rawcb_list, rp, list);
+ mtx_unlock(&rawcb_mtx);
return (0);
}
@@ -101,9 +109,12 @@ raw_detach(rp)
{
struct socket *so = rp->rcb_socket;
- so->so_pcb = 0;
- sofree(so);
- remque(rp);
+ KASSERT(so->so_pcb == rp, ("raw_detach: so_pcb != rp"));
+
+ so->so_pcb = NULL;
+ mtx_lock(&rawcb_mtx);
+ LIST_REMOVE(rp, list);
+ mtx_unlock(&rawcb_mtx);
#ifdef notdef
if (rp->rcb_laddr)
m_freem(dtom(rp->rcb_laddr));
@@ -113,7 +124,7 @@ raw_detach(rp)
}
/*
- * Disconnect and possibly release resources.
+ * Disconnect raw socket.
*/
void
raw_disconnect(rp)
@@ -125,8 +136,6 @@ raw_disconnect(rp)
m_freem(dtom(rp->rcb_faddr));
rp->rcb_faddr = 0;
#endif
- if (rp->rcb_socket->so_state & SS_NOFDREF)
- raw_detach(rp);
}
#ifdef notdef
@@ -141,7 +150,7 @@ raw_bind(so, nam)
if (ifnet == 0)
return (EADDRNOTAVAIL);
rp = sotorawcb(so);
- nam = m_copym(nam, 0, M_COPYALL, M_WAITOK);
+ nam = m_copym(nam, 0, M_COPYALL, M_TRYWAIT);
rp->rcb_laddr = mtod(nam, struct sockaddr *);
return (0);
}