summaryrefslogtreecommitdiff
path: root/libps
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-23 02:00:58 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-23 02:00:58 +0100
commit02bec9a7652b981ee00c5656e9235ee0cc897f99 (patch)
treeb571ca34e266506b4be83fefab6662af593ce106 /libps
parent9e237b93a53bae03c31e0332b6a98f304157f20c (diff)
libps: support getting RPC names for WAIT output
* libps/Makefile (SRCS): Add ../utils/msgids.c. (../utils/msgids-CPPFLAGS): Add DATADIR macro. * libps/spec.c: Include "../utils/msgids.h". (get_rpc_name): Implement with msgid_info. * utils/msgids.c (parse_opt): Move end code to ... (msgids_scan_std): ... new function. * utils/msgids.h (msgids_scan_std): New prototype. * utils/ps.c (main): Call msgids_scan_std.
Diffstat (limited to 'libps')
-rw-r--r--libps/Makefile3
-rw-r--r--libps/spec.c8
2 files changed, 9 insertions, 2 deletions
diff --git a/libps/Makefile b/libps/Makefile
index d3c0b187..07d27eeb 100644
--- a/libps/Makefile
+++ b/libps/Makefile
@@ -24,7 +24,7 @@ makemode := library
libname = libps
SRCS = context.c filters.c fmt.c host.c proclist.c procstat.c spec.c \
- tty.c user.c write.c
+ tty.c user.c write.c ../utils/msgids.c
installhdrs = ps.h
installhdrsubdir = .
@@ -33,6 +33,7 @@ OBJS = $(SRCS:.c=.o) msgUser.o termUser.o
msg-MIGUFLAGS = -D'MSG_IMPORTS=waittime 1000;' -DUSERPREFIX=ps_
term-MIGUFLAGS = -D'TERM_IMPORTS=waittime 1000;' -DUSERPREFIX=ps_
+../utils/msgids-CPPFLAGS = -DDATADIR=\"${datadir}\"
ps_%.h: %_U.h
sed 's/_$*_user_/_ps_$*_user_/g' $< > $@
diff --git a/libps/spec.c b/libps/spec.c
index 4760c431..c9164f9d 100644
--- a/libps/spec.c
+++ b/libps/spec.c
@@ -32,10 +32,16 @@
#include "ps.h"
#include "common.h"
+#include "../utils/msgids.h"
/* XXX */
static char *get_syscall_name (int num) { return 0; }
-static char *get_rpc_name (mach_msg_id_t it) { return 0; }
+
+static char *get_rpc_name (mach_msg_id_t it)
+{
+ const struct msgid_info *info = msgid_info (it);
+ return info ? info->name : 0;
+}
/* ---------------------------------------------------------------- */
/* Getter definitions */