From 462b70075061366e9095f8d267f642dceba12879 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 29 Sep 2014 17:05:59 +0200 Subject: fix libports patches --- ...s-use-a-global-hash-table-for-the-lookups.patch | 22 ++++++++--------- ...ck-less-reference-counting-for-port_info-.patch | 28 ++++++++++++++++------ 2 files changed, 32 insertions(+), 18 deletions(-) (limited to 'debian') diff --git a/debian/patches/0001-libports-use-a-global-hash-table-for-the-lookups.patch b/debian/patches/0001-libports-use-a-global-hash-table-for-the-lookups.patch index ca25ebd3..e01e8424 100644 --- a/debian/patches/0001-libports-use-a-global-hash-table-for-the-lookups.patch +++ b/debian/patches/0001-libports-use-a-global-hash-table-for-the-lookups.patch @@ -1,4 +1,4 @@ -From 9c12cb8e9474692b35f658643d278816bd524355 Mon Sep 17 00:00:00 2001 +From b2ae574d39adfe283c61a3ec0c766e8780f345af Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sat, 3 May 2014 03:53:41 +0200 Subject: [PATCH 1/2] libports: use a global hash table for the lookups @@ -53,7 +53,7 @@ argument. * libports/init.c (_ports_htable): Initialize. (_ports_htable_lock): Likewise. --- - libports/bucket-iterate.c | 16 +++++++++------- + libports/bucket-iterate.c | 14 +++++++++----- libports/claim-right.c | 5 ++++- libports/class-iterate.c | 10 +--------- libports/complete-deallocate.c | 7 +++---- @@ -71,10 +71,10 @@ argument. libports/reallocate-from-external.c | 15 +++++++++++---- libports/reallocate-port.c | 9 ++++++++- libports/transfer-right.c | 18 ++++++++++++++---- - 18 files changed, 144 insertions(+), 95 deletions(-) + 18 files changed, 144 insertions(+), 93 deletions(-) diff --git a/libports/bucket-iterate.c b/libports/bucket-iterate.c -index 2d1b00d..79b6d72 100644 +index 2d1b00d..b9ef0eb 100644 --- a/libports/bucket-iterate.c +++ b/libports/bucket-iterate.c @@ -25,7 +25,7 @@ @@ -86,7 +86,7 @@ index 2d1b00d..79b6d72 100644 struct port_class *class, error_t (*fun)(void *)) { -@@ -36,23 +36,24 @@ _ports_bucket_class_iterate (struct port_bucket *bucket, +@@ -36,23 +36,26 @@ _ports_bucket_class_iterate (struct port_bucket *bucket, error_t err; pthread_mutex_lock (&_ports_lock); @@ -95,8 +95,8 @@ index 2d1b00d..79b6d72 100644 - if (bucket->htable.nr_items == 0) + if (ht->nr_items == 0) { -- pthread_mutex_unlock (&_ports_lock); + pthread_rwlock_unlock (&_ports_htable_lock); + pthread_mutex_unlock (&_ports_lock); return 0; } @@ -105,8 +105,8 @@ index 2d1b00d..79b6d72 100644 p = malloc (nr_items * sizeof *p); if (p == NULL) { -- pthread_mutex_unlock (&_ports_lock); + pthread_rwlock_unlock (&_ports_htable_lock); + pthread_mutex_unlock (&_ports_lock); return ENOMEM; } @@ -116,7 +116,7 @@ index 2d1b00d..79b6d72 100644 { struct port_info *const pi = arg; -@@ -63,6 +64,7 @@ _ports_bucket_class_iterate (struct port_bucket *bucket, +@@ -63,6 +66,7 @@ _ports_bucket_class_iterate (struct port_bucket *bucket, n++; } } @@ -124,7 +124,7 @@ index 2d1b00d..79b6d72 100644 pthread_mutex_unlock (&_ports_lock); if (n != 0 && n != nr_items) -@@ -89,5 +91,5 @@ error_t +@@ -89,5 +93,5 @@ error_t ports_bucket_iterate (struct port_bucket *bucket, error_t (*fun)(void *)) { @@ -470,7 +470,7 @@ index f79f6f0..858ee11 100644 return pi; } diff --git a/libports/ports.h b/libports/ports.h -index 7f13124..6922162 100644 +index 7f13124..8118de9 100644 --- a/libports/ports.h +++ b/libports/ports.h @@ -48,7 +48,7 @@ struct port_info @@ -528,7 +528,7 @@ index 7f13124..6922162 100644 + momentarily to check whether someone else reacquired a reference + through the hash table. */ +extern struct hurd_ihash _ports_htable; -+/* Access to the hash table is protected by this lock. */ ++/* Access to all hash tables is protected by this lock. */ +extern pthread_rwlock_t _ports_htable_lock; + extern int _ports_total_rpcs; diff --git a/debian/patches/0002-libports-lock-less-reference-counting-for-port_info-.patch b/debian/patches/0002-libports-lock-less-reference-counting-for-port_info-.patch index 151815b3..387ebdf5 100644 --- a/debian/patches/0002-libports-lock-less-reference-counting-for-port_info-.patch +++ b/debian/patches/0002-libports-lock-less-reference-counting-for-port_info-.patch @@ -1,4 +1,4 @@ -From f496af4ca56392434655668035f912350f37261b Mon Sep 17 00:00:00 2001 +From 711934158a35f8b54bec33d4ab55cdd81fb5680e Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sat, 3 May 2014 01:02:35 +0200 Subject: [PATCH 2/2] libports: lock-less reference counting for port_info @@ -20,7 +20,7 @@ reference through a hash table lookup. * libports/transfer-right.c: Likewise. * utils/rpctrace.c: Likewise. --- - libports/bucket-iterate.c | 4 +--- + libports/bucket-iterate.c | 6 +----- libports/complete-deallocate.c | 14 ++++++++++++++ libports/create-internal.c | 3 +-- libports/get-right.c | 2 +- @@ -34,13 +34,13 @@ reference through a hash table lookup. libports/reallocate-from-external.c | 2 +- libports/transfer-right.c | 2 +- utils/rpctrace.c | 10 ++++++++-- - 14 files changed, 52 insertions(+), 52 deletions(-) + 14 files changed, 52 insertions(+), 54 deletions(-) diff --git a/libports/bucket-iterate.c b/libports/bucket-iterate.c -index 79b6d72..b021b99 100644 +index b9ef0eb..b021b99 100644 --- a/libports/bucket-iterate.c +++ b/libports/bucket-iterate.c -@@ -35,7 +35,6 @@ _ports_bucket_class_iterate (struct hurd_ihash *ht, +@@ -35,13 +35,11 @@ _ports_bucket_class_iterate (struct hurd_ihash *ht, size_t i, n, nr_items; error_t err; @@ -48,7 +48,21 @@ index 79b6d72..b021b99 100644 pthread_rwlock_rdlock (&_ports_htable_lock); if (ht->nr_items == 0) -@@ -59,13 +58,12 @@ _ports_bucket_class_iterate (struct hurd_ihash *ht, + { + pthread_rwlock_unlock (&_ports_htable_lock); +- pthread_mutex_unlock (&_ports_lock); + return 0; + } + +@@ -50,7 +48,6 @@ _ports_bucket_class_iterate (struct hurd_ihash *ht, + if (p == NULL) + { + pthread_rwlock_unlock (&_ports_htable_lock); +- pthread_mutex_unlock (&_ports_lock); + return ENOMEM; + } + +@@ -61,13 +58,12 @@ _ports_bucket_class_iterate (struct hurd_ihash *ht, if (class == 0 || pi->class == class) { @@ -260,7 +274,7 @@ index 92b7118..9a1c71e 100644 + refcounts_ref (&pi->refcounts, NULL); } diff --git a/libports/ports.h b/libports/ports.h -index 6922162..40d3b43 100644 +index 8118de9..652edb8 100644 --- a/libports/ports.h +++ b/libports/ports.h @@ -27,6 +27,7 @@ -- cgit v1.2.3