summaryrefslogtreecommitdiff
path: root/pfinet
diff options
context:
space:
mode:
Diffstat (limited to 'pfinet')
-rw-r--r--pfinet/misc.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/pfinet/misc.c b/pfinet/misc.c
index e30f9493..45cf61ae 100644
--- a/pfinet/misc.c
+++ b/pfinet/misc.c
@@ -113,11 +113,22 @@ struct socket *
sock_alloc (void)
{
struct socket *sock;
+ struct wait_queue *wait, **waitp;
+
+ sock = malloc (sizeof (struct wait_queue)
+ + sizeof (struct wait_queue *)
+ + sizeof (struct socket));
+ wait = (void *)sock + sizeof (struct socket);
+ waitp = (void *)wait + sizeof (struct wait_queue);
- sock = malloc (sizeof (struct socket));
bzero (sock, sizeof (struct socket));
-
sock->state = SS_UNCONNECTED;
+ sock->wait = waitp;
+
+ condition_init (&wait->c);
+
+ *waitp = wait;
+
return sock;
}