diff options
author | Miles Bader <miles@gnu.org> | 1996-01-27 17:07:24 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-01-27 17:07:24 +0000 |
commit | 79e3fec7afb19f7a6556a9079b8452400af3b7c7 (patch) | |
tree | c84bc6dd4ee6a0a74899485c562eb96346998148 /libports/allocate-port.c | |
parent | 39d940666837cad76d4650a7bdf23f2c9999235d (diff) |
(ports_allocate_port): Call ports_create_port.
Diffstat (limited to 'libports/allocate-port.c')
-rw-r--r-- | libports/allocate-port.c | 62 |
1 files changed, 6 insertions, 56 deletions
diff --git a/libports/allocate-port.c b/libports/allocate-port.c index 8b52590c..950ffc8e 100644 --- a/libports/allocate-port.c +++ b/libports/allocate-port.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 1995, 1996 Free Software Foundation, Inc. Written by Michael I. Bushnell. This file is part of the GNU Hurd. @@ -19,64 +19,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ports.h" -#include <assert.h> -#include <cthreads.h> -#include <hurd/ihash.h> +/* Backward compatibility. */ void *ports_allocate_port (struct port_bucket *bucket, size_t size, struct port_class *class) { - mach_port_t port; - error_t err; - struct port_info *pi; - - err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, - &port); - assert_perror (err); - if (size < sizeof (struct port_info)) - size = sizeof (struct port_info); - - pi = malloc (size); - assert (pi); - pi->class = class; - pi->refcnt = 1; - pi->weakrefcnt = 0; - pi->cancel_threshhold = 0; - pi->mscount = 0; - pi->flags = 0; - pi->port_right = port; - pi->current_rpcs = 0; - pi->bucket = bucket; - - mutex_lock (&_ports_lock); - - loop: - if (class->flags & PORT_CLASS_NO_ALLOC) - { - class->flags |= PORT_CLASS_ALLOC_WAIT; - condition_wait (&_ports_block, &_ports_lock); - goto loop; - } - if (bucket->flags & PORT_BUCKET_NO_ALLOC) - { - bucket->flags |= PORT_BUCKET_ALLOC_WAIT; - condition_wait (&_ports_block, &_ports_lock); - goto loop; - } - - err = ihash_add (bucket->htable, port, pi, &pi->hentry); - assert_perror (err); - pi->next = class->ports; - pi->prevp = &class->ports; - if (class->ports) - class->ports->prevp = &pi->next; - class->ports = pi; - bucket->count++; - class->count++; - mutex_unlock (&_ports_lock); - - mach_port_move_member (mach_task_self (), pi->port_right, bucket->portset); - return pi; + void *result; + if (ports_create_port (class, bucket, size, &result)) + result = 0; + return result; } - |