summaryrefslogtreecommitdiff
path: root/utils/rpctrace.c
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 /utils/rpctrace.c
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 'utils/rpctrace.c')
-rw-r--r--utils/rpctrace.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index ec8fa19e..ea06b1b7 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -32,6 +32,7 @@
#include <version.h>
#include <sys/wait.h>
#include <inttypes.h>
+#include <stddef.h>
const char *argp_program_version = STANDARD_HURD_VERSION (rpctrace);
@@ -63,7 +64,8 @@ msgid_ihash_cleanup (void *element, void *arg)
free (info);
}
-static struct ihash msgid_ihash = { cleanup: msgid_ihash_cleanup };
+static struct hurd_ihash msgid_ihash
+ = HURD_IHASH_INITIALIZER (HURD_IHASH_NO_LOCP);
/* Parse a file of RPC names and message IDs as output by mig's -list
option: "subsystem base-id routine n request-id reply-id". Put each
@@ -102,9 +104,9 @@ parse_msgid_list (const char *filename)
error (1, errno, "malloc");
info->name = name;
info->subsystem = subsystem;
- err = ihash_add (&msgid_ihash, msgid, info, NULL);
+ err = hurd_ihash_add (&msgid_ihash, msgid, info);
if (err)
- error (1, err, "ihash_add");
+ error (1, err, "hurd_ihash_add");
}
}
@@ -118,7 +120,7 @@ parse_msgid_list (const char *filename)
static const struct msgid_info *
msgid_info (mach_msg_id_t msgid)
{
- const struct msgid_info *info = ihash_find (&msgid_ihash, msgid);
+ const struct msgid_info *info = hurd_ihash_find (&msgid_ihash, msgid);
if (info == 0 && (msgid / 100) % 2 == 1)
{
/* This message ID is not in the table, and its number makes it
@@ -126,7 +128,7 @@ msgid_info (mach_msg_id_t msgid)
ID of the corresponding RPC request and synthesize a name from
that. Then stash that name in the table so the next time the
lookup will match directly. */
- info = ihash_find (&msgid_ihash, msgid - 100);
+ info = hurd_ihash_find (&msgid_ihash, msgid - 100);
if (info != 0)
{
struct msgid_info *reply_info = malloc (sizeof *info);
@@ -135,7 +137,7 @@ msgid_info (mach_msg_id_t msgid)
reply_info->subsystem = strdup (info->subsystem);
reply_info->name = 0;
asprintf (&reply_info->name, "%s-reply", info->name);
- ihash_add (&msgid_ihash, msgid, reply_info, NULL);
+ hurd_ihash_add (&msgid_ihash, msgid, reply_info);
info = reply_info;
}
else
@@ -186,7 +188,7 @@ struct traced_info
struct /* For a send right wrapper. */
{
- void **locp; /* position in the traced_names hash table */
+ hurd_ihash_locp_t locp; /* position in the traced_names hash table */
} send;
struct /* For a send-once right wrapper. */
@@ -205,7 +207,8 @@ struct traced_info
static struct traced_info *freelist;
-ihash_t traced_names;
+struct hurd_ihash traced_names
+ = HURD_IHASH_INITIALIZER (offsetof (struct traced_info, u.send.locp));
struct port_class *traced_class;
struct port_bucket *traced_bucket;
FILE *ostream;
@@ -261,7 +264,7 @@ new_send_wrapper (mach_port_t right, mach_port_t *wrapper_right)
/* Store it in the reverse-lookup hash table, so we can
look up this same right again to find the wrapper port.
The entry in the hash table holds a weak ref on INFO. */
- err = ihash_add (traced_names, info->forward, info, &info->u.send.locp);
+ err = hurd_ihash_add (&traced_names, info->forward, info);
assert_perror (err);
ports_port_ref_weak (info);
assert (info->u.send.locp != 0);
@@ -327,7 +330,7 @@ traced_dropweak (void *pi)
assert (info->u.send.locp);
/* Remove INFO from the hash table. */
- ihash_locp_remove (traced_names, info->u.send.locp);
+ hurd_ihash_locp_remove (&traced_names, info->u.send.locp);
ports_port_deref_weak (info);
/* Deallocate the forward port, so the real port also sees no-senders. */
@@ -360,7 +363,7 @@ rewrite_right (mach_port_t *right, mach_msg_type_name_t *type)
{
case MACH_MSG_TYPE_PORT_SEND:
/* See if we are already tracing this port. */
- info = ihash_find (traced_names, *right);
+ info = hurd_ihash_find (&traced_names, *right);
if (info)
{
/* We are already tracing this port. We will pass on a right
@@ -414,7 +417,7 @@ rewrite_right (mach_port_t *right, mach_msg_type_name_t *type)
mach_port_t rr; /* B */
char *name;
- info = ihash_find (traced_names, *right);
+ info = hurd_ihash_find (&traced_names, *right);
if (info)
{
/* This is a receive right that we have been tracing sends to. */
@@ -442,8 +445,7 @@ rewrite_right (mach_port_t *right, mach_msg_type_name_t *type)
assert_perror (err);
info->forward = rr;
- err = ihash_add (traced_names, info->forward, info,
- &info->u.send.locp);
+ err = hurd_ihash_add (&traced_names, info->forward, info);
assert_perror (err);
ports_port_ref_weak (info);
@@ -1104,8 +1106,7 @@ main (int argc, char **argv, char **envp)
traced_bucket = ports_create_bucket ();
traced_class = ports_create_class (0, &traced_dropweak);
- err = ihash_create (&traced_names);
- assert_perror (err);
+ hurd_ihash_set_cleanup (&msgid_ihash, msgid_ihash_cleanup, 0);
/* Spawn a single thread that will receive intercepted messages, print
them, and interpose on the ports they carry. The access to the