summaryrefslogtreecommitdiff
path: root/libps
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2004-03-01 09:58:44 +0000
committerMarcus Brinkmann <marcus@gnu.org>2004-03-01 09:58:44 +0000
commitac1cab88f6e43ece947ef2e212f0a732f9c39d81 (patch)
tree38cac8a5bf4151ccb51d733b4fb408f8cc56e56e /libps
parenta2a436b8a8c2d41030ab98e02cad653c254c025a (diff)
auth/
2003-08-17 Marcus Brinkmann <marcus@gnu.org> * auth.c: Include <stddef.h>. (pending_users, pending_server): Change type to struct hurd_ihash, initialize with HURD_IHASH_INITIALIZER. (struct pending): Change type of member LOCP to hurd_ihash_locp_t. (S_auth_user_authenticate): Use hurd_ihash_* functions instead ihash_*. (S_auth_server_authenticate): Likewise. (main): Do not allocate the hash tables. console-client/ 2003-08-17 Marcus Brinkmann <marcus@gnu.org> * vga-dynafont.c: Include <stddef.h>. (struct mapped_character): Change type of LOCP to hurd_ihash_locp_t. (struct dynafont): Change type of CHARMAP to struct hurd_ihash. (dynafont_new): Use hurd_ihash_init instead of ihash_create. Remove variable ERR. Call hurd_ihash_add instead of ihash_add. (dynafont_free): Call hurd_ihash_destroy, no ihash_free. (dynafont_lookup_internal): Use hurd_ihash_find, not ihash_find. (dynafont_lookup_internal): Call hurd_ihash_locp_remove instead ihash_locp_remove, and hurd_ihash_add instead ihash_add. (dynafont_change_font): Likewise. Clean out LOCP if character is unmapped. ftpfs/ 2003-08-17 Marcus Brinkmann <marcus@gnu.org> * ftpfs.h: Include <hurd/ihash.h>. (struct ftpfs): Change type of INODE_MAPPINGS to struct hurd_ihash. (struct ftpfs_dir_entry): Change type of INODE_LOCP to hurd_ihash_locp_t. * node.c (ftpfs_create_node): Call hurd_ihash_add, not ihash_add. (netfs_node_norefs): Call hurd_ihash_locp_remove, not ihash_locp_remove. * fs.c: Include <stddef.h>. (ftpfs_create): Call hurd_ihash_init, not hurd_ihash_create. Call hurd_ihash_destroy on error. libihash/ 2003-08-17 Marcus Brinkmann <marcus@gnu.org> * ihash.c: Rewritten. * ihash.h: Rewritten. * Makefile (SRCS): Remove sizes.c. (LCLHDRS): Remove priv.h. * primes.c, sizes.c, priv.h: Files removed. 2003-08-17 Marcus Brinkmann <marcus@gnu.org> * ports.h (struct port_bucket): Change type of HTABLE to struct hurd_ihash. (struct port_info): Change type of HENTRY to hurd_ihash_locp_t. * lookup-port.c (ports_lookup_port): Use hurd_ihash_find instead ihash_find. * bucket-iterate.c (_ports_bucket_class_iterate): Use HURD_IHASH_ITERATE instead ihash_iterate. * inhibit-all-rpcs.c (ports_inhibit_all_rpcs): Likewise. * inhibit-bucket-rpcs.c (ports_inhibit_bucket_rpcs): Likewise. * create-internal.c (_ports_create_port_internal): Use hurd_ihash_add instead ihash_add. * import-port.c (ports_import_port): Likewise. * reallocate-from-external.c (ports_reallocate_from_external): Likewise. * reallocate-port.c (ports_reallocate_port): Likewise. * transfer-right.c (ports_transfer_right): Likewise. * create-bucket.c: Include <stddef.h>. (ports_create_bucket): Use hurd_ihash_init instead hurd_ihash_create. * class-iterate.c: Do not include <hurd/ihash.h>. * claim-right.c (ports_claim_right): Call hurd_ihash_locp_remove instead ihash_locp_remove. * complete-deallocate.c (_ports_complete_deallocate): Likewise. * destroy-right.c (ports_destroy_right): Likewise. * reallocate-from-external.c (ports_reallocate_from_external): Likewise. * reallocate-port.c (ports_reallocate_port): Likewise. * transfer-right.c (ports_transfer_right): Likewise. libps/ 2003-08-17 Marcus Brinkmann <marcus@gnu.org> * ps.h (struct ps_context): Change type of members procs, ttys, ttys_by_cttyid and users to struct hurd_ihash. * context.c (ps_context_create): Remove variables err_procs, err_ttys, err_ttys_by_cttyid and err_users. Use hurd_ihash_init instead of ihash_create. Call hurd_ihash_set_cleanup and the hurd_ihash_cleanup_t type instead of ihash_set_cleanup. (ps_context_free): Call hurd_ihash_destroy instead of ihash_free. (lookup): Call hurd_ihash_find instead ihash_find, hurd_ihash_add instead ihash_add. (ps_context_find_proc_stat): Take pointer of hash object. (ps_context_find_tty): Likewise. (ps_context_find_tty_by_cttyid): Likewise. (ps_context_find_user): Likewise. libpthread/ 2003-08-17 Marcus Brinkmann <marcus@gnu.org> * sysdeps/hurd/pt-key.h (PTHREAD_KEY_MEMBERS): Change type of THREAD_SPECIFICS to hurd_ihash_t. * sysdeps/hurd/pt-setspecific.c (pthread_setspecific): Call hurd_ihash_create instead ihash_create, and hurd_ihash_add instead ihash_add. * sysdeps/hurd/pt-getspecific.c (pthread_getspecific): Call hurd_ihash_find instead of ihash_find. * sysdeps/hurd/pt-destroy-specific.c (__pthread_destroy_specific): Call hurd_ihash_find instead of ihash_find, hurd_ihash_remove instead of ihash_remove, and hurd_ihash_free instead of ihash_free. proc/ 2003-08-17 Marcus Brinkmann <marcus@gnu.org> * proc.h: Include <hurd/ihash.h>. (struct proc): Change type of members p_pidhashloc and p_taskhashloc to hurd_ihash_locp_t. (struct pgrp): Likewise for pg_hashloc. (struct session): Likewise for s_hashloc. * hash.c: Change type of pghash, pidhash, taskhash and sidhash to struct hurd_ihash and initialize them with HURD_IHASH_INITIALIZER. Include stddef.h. (pid_find): Call hurd_ihash_find instead ihash_find. (pid_find_allow_zombie): Likewise. (task_find): Likewise. (task_find_nocreate): Likewise. (pgrp_find): Likewise. (session_find): Likewise. (add_proc_to_hash): Call hurd_ihash_add instead ihash_add. (add_pgrp_to_hash): Likewise. (add_session_to_hash): Likewise. (remove_pgrp_from_hash): Call hurd_ihash_locp_remove instead ihash_locp_remove, and provide hash table pointer. (remove_proc_from_hash): Likewise. (remove_session_from_hash): Likewise. (prociterate): Use HURD_IHASH_ITERATE instead ihash_iterate. trans/ 2003-08-17 Marcus Brinkmann <marcus@gnu.org> * fakeroot.c: Include <stddef.h>. (struct netnode): Change type of member idport_locp to hurd_ihash_locp_t. (idport_ihash): Change type to struct hurd_ihash and initialize with HURD_IHASH_INITIALIZER. (new_node): Call hurd_ihash_add instead of ihash_add. (netfs_node_norefs): Call hrd_ihash_locp_remove instead ihash_locp_remove. (netfs_S_dir_lookup): Call hurd_ihash_find instead ihash_find. utils/ 2003-08-17 Marcus Brinkmann <marcus@gnu.org> * rpctrace.c: Include <stddef.h>. (struct traced_info): Change type of LOCP to hurd_ihash_locp_t. (msgid_ihash): Change type to struct hurd_ihash, and initialize with HURD_IHASH_INITIALIZER, don't set cleanup here. (traced_names): Likewise. (main): Call hurd_ihash_set_cleanup for msgid_ihash. Don't create traced_names. (parse_msgid_list): Call hurd_ihash_add instead ihash_add. (new_send_wrapper): Likewise. (msgid_info): Likewise. Call hurd_ihash_find instead ihash_find. (rewrite_right): Likewise. (traced_dropweak): Call hurd_ihash_locp_remove instead ihash_locp_remove.
Diffstat (limited to 'libps')
-rw-r--r--libps/ChangeLog16
-rw-r--r--libps/context.c70
-rw-r--r--libps/ps.h8
3 files changed, 48 insertions, 46 deletions
diff --git a/libps/ChangeLog b/libps/ChangeLog
index a2e48c955..79885024a 100644
--- a/libps/ChangeLog
+++ b/libps/ChangeLog
@@ -1,3 +1,19 @@
+2003-08-17 Marcus Brinkmann <marcus@gnu.org>
+
+ * ps.h (struct ps_context): Change type of members procs, ttys,
+ ttys_by_cttyid and users to struct hurd_ihash.
+ * context.c (ps_context_create): Remove variables err_procs,
+ err_ttys, err_ttys_by_cttyid and err_users. Use hurd_ihash_init
+ instead of ihash_create. Call hurd_ihash_set_cleanup and the
+ hurd_ihash_cleanup_t type instead of ihash_set_cleanup.
+ (ps_context_free): Call hurd_ihash_destroy instead of ihash_free.
+ (lookup): Call hurd_ihash_find instead ihash_find, hurd_ihash_add
+ instead ihash_add.
+ (ps_context_find_proc_stat): Take pointer of hash object.
+ (ps_context_find_tty): Likewise.
+ (ps_context_find_tty_by_cttyid): Likewise.
+ (ps_context_find_user): Likewise.
+
2002-06-09 Roland McGrath <roland@frob.com>
* Makefile (installhdrs): List just ps.h, not common.h as well.
diff --git a/libps/context.c b/libps/context.c
index b8ca102a7..3082d83b1 100644
--- a/libps/context.c
+++ b/libps/context.c
@@ -34,39 +34,23 @@
error_t
ps_context_create (process_t server, struct ps_context **pc)
{
- error_t err_procs, err_ttys, err_ttys_by_cttyid, err_users;
-
*pc = NEW (struct ps_context);
if (*pc == NULL)
return ENOMEM;
(*pc)->server = server;
(*pc)->user_hooks = 0;
- err_procs = ihash_create (&(*pc)->procs);
- err_ttys = ihash_create (&(*pc)->ttys);
- err_ttys_by_cttyid = ihash_create (&(*pc)->ttys_by_cttyid);
- err_users = ihash_create (&(*pc)->users);
-
- if (err_procs || err_ttys || err_ttys_by_cttyid)
- /* Some allocation error occurred, backout any successful ones and fail. */
- {
- if (!err_procs) ihash_free ((*pc)->procs);
- if (!err_users) ihash_free ((*pc)->users);
- if (!err_ttys) ihash_free ((*pc)->ttys);
- if (!err_ttys_by_cttyid) ihash_free ((*pc)->ttys_by_cttyid);
- free (*pc);
- return ENOMEM;
- }
-
- ihash_set_cleanup ((*pc)->procs,
- (void (*)(void *, void *arg))_proc_stat_free,
- NULL);
- ihash_set_cleanup ((*pc)->ttys,
- (void (*)(void *, void *arg))ps_tty_free,
- NULL);
- ihash_set_cleanup ((*pc)->users,
- (void (*)(void *, void *arg))ps_user_free,
- NULL);
+ hurd_ihash_init (&(*pc)->procs, HURD_IHASH_NO_LOCP);
+ hurd_ihash_init (&(*pc)->ttys, HURD_IHASH_NO_LOCP);
+ hurd_ihash_init (&(*pc)->ttys_by_cttyid, HURD_IHASH_NO_LOCP);
+ hurd_ihash_init (&(*pc)->users, HURD_IHASH_NO_LOCP);
+
+ hurd_ihash_set_cleanup (&(*pc)->procs,
+ (hurd_ihash_cleanup_t) _proc_stat_free, NULL);
+ hurd_ihash_set_cleanup (&(*pc)->ttys,
+ (hurd_ihash_cleanup_t) ps_tty_free, NULL);
+ hurd_ihash_set_cleanup (&(*pc)->users,
+ (hurd_ihash_cleanup_t) ps_user_free, NULL);
return 0;
}
@@ -75,12 +59,13 @@ ps_context_create (process_t server, struct ps_context **pc)
void
ps_context_free (struct ps_context *pc)
{
- ihash_free (pc->procs);
- ihash_free (pc->ttys);
- ihash_free (pc->ttys_by_cttyid);
- ihash_free (pc->users);
+ hurd_ihash_destroy (&pc->procs);
+ hurd_ihash_destroy (&pc->ttys);
+ hurd_ihash_destroy (&pc->ttys_by_cttyid);
+ hurd_ihash_destroy (&pc->users);
free (pc);
}
+
/* ---------------------------------------------------------------- */
@@ -89,15 +74,16 @@ ps_context_free (struct ps_context *pc)
(CREATE should return either an error-code or 0 if no error occurs), and
cache it in HT. */
static error_t
-lookup (int id, ihash_t ht, error_t (*create)(int id, void **), void **value)
+lookup (int id, hurd_ihash_t ht, error_t (*create)(int id, void **),
+ void **value)
{
- *value = ihash_find (ht, id);
+ *value = hurd_ihash_find (ht, id);
if (*value == NULL)
{
error_t err = create (id, value);
if (err)
return err;
- ihash_add (ht, id, *value, NULL);
+ hurd_ihash_add (ht, id, *value);
}
return 0;
}
@@ -111,7 +97,7 @@ ps_context_find_proc_stat (struct ps_context *pc, pid_t pid, struct proc_stat **
{
return _proc_stat_create (pid, pc, (struct proc_stat **)value);
}
- return lookup (pid, pc->procs, create, (void **)ps);
+ return lookup (pid, &pc->procs, create, (void **)ps);
}
/* Find a ps_tty for the terminal referred to by the port TTY_PORT, and
@@ -121,9 +107,9 @@ ps_context_find_tty (struct ps_context *pc, mach_port_t tty_port,
struct ps_tty **tty)
{
return lookup (tty_port,
- pc->ttys,
- (error_t (*)(int id, void **result))ps_tty_create,
- (void **)tty);
+ &pc->ttys,
+ (error_t (*)(int id, void **result))ps_tty_create,
+ (void **)tty);
}
/* Find a ps_tty for the terminal referred to by the ctty id port
@@ -151,7 +137,7 @@ ps_context_find_tty_by_cttyid (struct ps_context *pc, mach_port_t cttyid_port,
}
}
- return lookup (cttyid_port, pc->ttys_by_cttyid, create, (void **)tty);
+ return lookup (cttyid_port, &pc->ttys_by_cttyid, create, (void **)tty);
}
/* Find a ps_user for the user referred to by UID, and return it in U. */
@@ -159,7 +145,7 @@ error_t
ps_context_find_user (struct ps_context *pc, uid_t uid, struct ps_user **u)
{
return lookup (uid,
- pc->users,
- (error_t (*)(int id, void **result))ps_user_create,
- (void **)u);
+ &pc->users,
+ (error_t (*)(int id, void **result))ps_user_create,
+ (void **) u);
}
diff --git a/libps/ps.h b/libps/ps.h
index eb9a4cd89..27f2e787d 100644
--- a/libps/ps.h
+++ b/libps/ps.h
@@ -125,17 +125,17 @@ struct ps_context
process_t server;
/* proc_stats for every process we know about, indexed by process id. */
- ihash_t procs;
+ struct hurd_ihash procs;
/* ps_ttys for every tty we know about, indexed by the terminal port. */
- ihash_t ttys;
+ struct hurd_ihash ttys;
/* ps_ttys for every tty we know about, indexed by their ctty id port
(from libc). */
- ihash_t ttys_by_cttyid;
+ struct hurd_ihash ttys_by_cttyid;
/* A ps_user for every user we know about, indexed by user-id. */
- ihash_t users;
+ struct hurd_ihash users;
/* Functions that can be set to extend the behavior of proc_stats. */
struct ps_user_hooks *user_hooks;