aboutsummaryrefslogtreecommitdiff
path: root/libports/count-bucket.c
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2021-08-05 16:47:08 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-08-10 22:12:09 +0200
commitcbe5af61970052429388737de19dbc7ad03ffa96 (patch)
tree6593266852426d9aa6306414044d902e16b8a230 /libports/count-bucket.c
parent8db6b70ab6a64ea9b0ac313f2816131a046fbd76 (diff)
downloadhurd-cbe5af61970052429388737de19dbc7ad03ffa96.tar.gz
hurd-cbe5af61970052429388737de19dbc7ad03ffa96.tar.bz2
hurd-cbe5af61970052429388737de19dbc7ad03ffa96.zip
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 ().
Diffstat (limited to 'libports/count-bucket.c')
-rw-r--r--libports/count-bucket.c11
1 files changed, 6 insertions, 5 deletions
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;
}