From 3b27074b252cae3c7aee8f05f0c968dd26fa055b Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Wed, 9 Dec 2020 03:22:44 +0000 Subject: [PATCH] libsysdecode: decode _UMTX_OP flags Assume that UMTX_OP with a double underbar following is a flag, while any underbar+alphanumeric combination immeiately following is an op. This was a part of D27325. Reviewed by: kib --- lib/libsysdecode/flags.c | 14 ++++++++++++++ lib/libsysdecode/mktables | 3 ++- lib/libsysdecode/sysdecode.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/libsysdecode/flags.c b/lib/libsysdecode/flags.c index 1eb48858fd88..df461cf0dca1 100644 --- a/lib/libsysdecode/flags.c +++ b/lib/libsysdecode/flags.c @@ -941,6 +941,20 @@ sysdecode_umtx_op(int op) return (lookup_value(umtxop, op)); } +bool +sysdecode_umtx_op_flags(FILE *fp, int op, int *rem) +{ + uintmax_t val; + bool printed; + + printed = false; + val = (unsigned)op; + print_mask_part(fp, umtxopflags, &val, &printed); + if (rem != NULL) + *rem = val; + return (printed); +} + const char * sysdecode_vmresult(int result) { diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index b42978d57c4d..3a0284a2deb4 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -145,7 +145,8 @@ gen_table "sockoptudp" "UDP_[[:alnum:]]+[[:space:]]+[0-9]+" "neti gen_table "sockoptudplite" "UDPLITE_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/udplite.h" gen_table "socktype" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" gen_table "thrcreateflags" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h" -gen_table "umtxop" "UMTX_OP_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" +gen_table "umtxop" "UMTX_OP_[[:alnum:]][[:alnum:]_]*[[:space:]]+[0-9]+" "sys/umtx.h" +gen_table "umtxopflags" "UMTX_OP__[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" gen_table "vmprot" "VM_PROT_[A-Z]+[[:space:]]+\(\(vm_prot_t\)[[:space:]]+0x[0-9]+\)" "vm/vm.h" gen_table "vmresult" "KERN_[A-Z_]+[[:space:]]+[0-9]+" "vm/vm_param.h" gen_table "wait6opt" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h" diff --git a/lib/libsysdecode/sysdecode.h b/lib/libsysdecode/sysdecode.h index a01ac1243aa2..cdb9205f3da1 100644 --- a/lib/libsysdecode/sysdecode.h +++ b/lib/libsysdecode/sysdecode.h @@ -121,6 +121,7 @@ const char *sysdecode_sysarch_number(int _number); bool sysdecode_thr_create_flags(FILE *_fp, int _flags, int *_rem); bool sysdecode_umtx_cvwait_flags(FILE *_fp, u_long _flags, u_long *_rem); const char *sysdecode_umtx_op(int _op); +bool sysdecode_umtx_op_flags(FILE *_fp, int op, int *_rem); bool sysdecode_umtx_rwlock_flags(FILE *_fp, u_long _flags, u_long *_rem); int sysdecode_utrace(FILE *_fp, void *_buf, size_t _len); bool sysdecode_vmprot(FILE *_fp, int _type, int *_rem);