From f580a5ba5bcf9592335aac4d3aa8ce86cd6a9906 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Fri, 21 Nov 2014 04:48:41 +0100 Subject: [PATCH hurd 28/30] xxx hopefully fix proc crash --- libports/destroy-right.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/libports/destroy-right.c b/libports/destroy-right.c index 9eb29eb..3a78e0b 100644 --- a/libports/destroy-right.c +++ b/libports/destroy-right.c @@ -27,7 +27,7 @@ #include /* To prevent protected payloads from becoming stale, we defer the - derefercing of port_info objects. */ + derefercing of port_info objects. Consumes PI. */ static error_t defer_dereferencing (struct port_info *pi); error_t @@ -116,19 +116,6 @@ gc_loop (void *arg) while (d != NULL) { struct deferred_dereference *next = d->next; - struct references refs; - - refcounts_references (&d->pi->refcounts, &refs); - - // XXX: Need to think more about this. - assert (refs.hard <= 2 || !"reference to destroyed right leaked"); - - if (refs.hard == 2) - { - /* XXX: does this actually happen? if so, why?? */ - /* Get rid of the hash table reference. */ - ports_port_deref (d->pi); - } /* Get rid of our reference. */ ports_port_deref (d->pi); @@ -161,19 +148,18 @@ start_gc (void) assert_perror (err); } -/* Defer the derefercing of port_info objects. */ +/* Defer the derefercing of port_info objects. Consumes PI. */ static error_t defer_dereferencing (struct port_info *pi) { static pthread_once_t once = PTHREAD_ONCE_INIT; int g; - struct deferred_dereference *d = malloc (sizeof *d); - if (d == NULL) - return ENOMEM; - + struct deferred_dereference *d; pthread_once (&once, start_gc); - ports_port_ref (pi); + d = malloc (sizeof *d); + if (d == NULL) + return ENOMEM; d->pi = pi; retry: -- 2.1.3