From 66a791667c93978f89cd93b2e2f0dcb31d489c92 Mon Sep 17 00:00:00 2001 From: kevans Date: Wed, 19 Feb 2020 14:52:32 +0000 Subject: [PATCH] libsysdecode: grab shmflags from sys/mman.h, add decode method Any SHM_* flag here is (and likely will continue to be) a shmflag that may be passed to shm_open2(), with exception to SHM_ANON. This is a prereq to adding appropriate support to truss/kdump. Reviewed by: kaktus (slightly earlier version) Differential Revision: https://reviews.freebsd.org/D23733 --- lib/libsysdecode/flags.c | 7 +++++++ lib/libsysdecode/mktables | 1 + lib/libsysdecode/sysdecode.h | 1 + 3 files changed, 9 insertions(+) diff --git a/lib/libsysdecode/flags.c b/lib/libsysdecode/flags.c index 957b4a95e66..5ba19743845 100644 --- a/lib/libsysdecode/flags.c +++ b/lib/libsysdecode/flags.c @@ -1277,3 +1277,10 @@ sysdecode_sctp_sinfo_flags(FILE *fp, int sinfo_flags) } } } + +bool +sysdecode_shmflags(FILE *fp, int flags, int *rem) +{ + + return (print_mask_0(fp, shmflags, flags, rem)); +} diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index 4765ca5d8be..c85cd865723 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -165,6 +165,7 @@ if [ -e "${include_dir}/x86/sysarch.h" ]; then else gen_table "sysarchnum" "[A-Z_]+[[:space:]]+[0-9]+" "machine/sysarch.h" fi +gen_table "shmflags" "SHM_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/mman.h" "SHM_ANON" # Generate a .depend file for our output file if [ -n "$output_file" ]; then diff --git a/lib/libsysdecode/sysdecode.h b/lib/libsysdecode/sysdecode.h index 218943245b6..a01ac1243aa 100644 --- a/lib/libsysdecode/sysdecode.h +++ b/lib/libsysdecode/sysdecode.h @@ -128,5 +128,6 @@ const char *sysdecode_vmresult(int _result); bool sysdecode_wait4_options(FILE *_fp, int _options, int *_rem); bool sysdecode_wait6_options(FILE *_fp, int _options, int *_rem); const char *sysdecode_whence(int _whence); +bool sysdecode_shmflags(FILE *_fp, int _flags, int *_rem); #endif /* !__SYSDECODE_H__ */ -- 2.45.0