From cbe5af61970052429388737de19dbc7ad03ffa96 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Thu, 5 Aug 2021 16:47:08 +0300 Subject: libports: Create a notify_port in each bucket This notify port will be used to request & receive Mach notifications. While it is present in the bucket much like any other port, it is not counted in ports_count_bucket () and is not exposed to the user callback in ports_bucket_iterate (). --- libports/count-bucket.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libports/count-bucket.c') diff --git a/libports/count-bucket.c b/libports/count-bucket.c index 63feb6be..45fc7bfa 100644 --- a/libports/count-bucket.c +++ b/libports/count-bucket.c @@ -1,5 +1,5 @@ -/* - Copyright (C) 1995 Free Software Foundation, Inc. +/* + Copyright (C) 1995, 2021 Free Software Foundation, Inc. Written by Michael I. Bushnell. This file is part of the GNU Hurd. @@ -24,11 +24,12 @@ int ports_count_bucket (struct port_bucket *bucket) { int ret; - + pthread_mutex_lock (&_ports_lock); - ret = bucket->count; + /* Account for the notify port. */ + ret = bucket->count - 1; bucket->flags |= PORT_BUCKET_NO_ALLOC; pthread_mutex_unlock (&_ports_lock); - + return ret; } -- cgit v1.2.3