summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-11-09 17:36:21 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-11-09 17:36:21 +0000
commit6610b95b1e967347c6157483a3123aa309280941 (patch)
tree1443e1c942f7f912261a94c2d101de16ddb104b7
parentac11c7f0064429f7baa34dff7dd554aeae36df7f (diff)
Formerly misc.c.~4~
-rw-r--r--pfinet/misc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/pfinet/misc.c b/pfinet/misc.c
index 7ad19c8e..e30f9493 100644
--- a/pfinet/misc.c
+++ b/pfinet/misc.c
@@ -62,6 +62,7 @@ make_sockaddr_port (struct socket *sock,
bcopy (buf, addrstruct->address, buflen);
*addr = ports_get_right (addr);
*addrtype = MACH_MSG_TYPE_MAKE_SEND;
+ ports_port_deref (addrstruct);
return 0;
}
@@ -89,6 +90,25 @@ end_using_sockaddr_port (struct sock_addr *addr)
ports_port_deref (addr);
}
+/* Nothing need be done here. */
+void
+clean_addrport (void *arg)
+{
+}
+
+/* Release the reference on the referenced socket. */
+void
+clean_socketport (void *arg)
+{
+ struct sock_user *user = arg;
+
+ mutex_lock (&global_lock);
+
+ user->sock->refcnt--;
+ if (user->sock->refcnt == 0)
+ sock_release (user->sock);
+}
+
struct socket *
sock_alloc (void)
{
@@ -137,6 +157,7 @@ sock_release (struct socket *sock)
(*sock->ops->release) (sock, peersock);
if (peersock)
sock_release_peer(peersock);
+ free (sock);
}