The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b79bd43f9ab3bf0dfd4744dee406782f0329134a

commit b79bd43f9ab3bf0dfd4744dee406782f0329134a
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2025-07-03 19:52:31 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2025-07-04 14:42:33 +0000

    libsysdecode: Add support for decoding inotify syscall flags
    
    MFC after:      3 months
    Sponsored by:   Klara, Inc.
---
 lib/libsysdecode/Makefile    | 1 +
 lib/libsysdecode/flags.c     | 9 ++++++++-
 lib/libsysdecode/mktables    | 1 +
 lib/libsysdecode/sysdecode.h | 1 +
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/libsysdecode/Makefile b/lib/libsysdecode/Makefile
index b01877bb8bb8..ca020552a6e9 100644
--- a/lib/libsysdecode/Makefile
+++ b/lib/libsysdecode/Makefile
@@ -84,6 +84,7 @@ MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \
        sysdecode_mask.3 sysdecode_fileflags.3 \
        sysdecode_mask.3 sysdecode_filemode.3 \
        sysdecode_mask.3 sysdecode_flock_operation.3 \
+       sysdecode_mask.3 sysdecode_inotifyflags.3 \
        sysdecode_mask.3 sysdecode_mlockall_flags.3 \
        sysdecode_mask.3 sysdecode_mmap_flags.3 \
        sysdecode_mask.3 sysdecode_mmap_prot.3 \
diff --git a/lib/libsysdecode/flags.c b/lib/libsysdecode/flags.c
index 32829d35dbe0..dc09c5747968 100644
--- a/lib/libsysdecode/flags.c
+++ b/lib/libsysdecode/flags.c
@@ -23,7 +23,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #define L2CAP_SOCKET_CHECKED
 
 #include <sys/types.h>
@@ -31,6 +30,7 @@
 #include <sys/capsicum.h>
 #include <sys/event.h>
 #include <sys/extattr.h>
+#include <sys/inotify.h>
 #include <sys/linker.h>
 #include <sys/mman.h>
 #include <sys/mount.h>
@@ -351,6 +351,13 @@ sysdecode_getrusage_who(int who)
        return (lookup_value(rusage, who));
 }
 
+bool
+sysdecode_inotifyflags(FILE *fp, int flag, int *rem)
+{
+
+       return (print_mask_int(fp, inotifyflags, flag, rem));
+}
+
 static struct name_table kevent_user_ffctrl[] = {
        X(NOTE_FFNOP) X(NOTE_FFAND) X(NOTE_FFOR) X(NOTE_FFCOPY)
        XEND
diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables
index 5d7be2aad3c8..6b4f79402660 100644
--- a/lib/libsysdecode/mktables
+++ b/lib/libsysdecode/mktables
@@ -98,6 +98,7 @@ gen_table "extattrns"       
"EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/
 gen_table "fadvisebehav"    "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+"          
"sys/fcntl.h"
 gen_table "openflags"       "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+"           
"sys/fcntl.h"       "O_RDONLY|O_RDWR|O_WRONLY"
 gen_table "flockops"        "LOCK_[A-Z]+[[:space:]]+0x[0-9]+"              
"sys/fcntl.h"
+gen_table "inotifyflags"    "IN_[A-Z_]+[[:space:]]+0x[0-9]+"               
"sys/inotify.h"      "IN_CLOEXEC|IN_NONBLOCK"
 gen_table "kldsymcmd"       "KLDSYM_[A-Z]+[[:space:]]+[0-9]+"              
"sys/linker.h"
 gen_table "kldunloadfflags" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+"       
"sys/linker.h"
 gen_table "lio_listiomodes" "LIO_(NO)?WAIT[[:space:]]+[0-9]+"              
"aio.h"
diff --git a/lib/libsysdecode/sysdecode.h b/lib/libsysdecode/sysdecode.h
index 8dc0bbea6f0d..c95d7f71379b 100644
--- a/lib/libsysdecode/sysdecode.h
+++ b/lib/libsysdecode/sysdecode.h
@@ -61,6 +61,7 @@ const char *sysdecode_getfsstat_mode(int _mode);
 const char *sysdecode_getrusage_who(int _who);
 const char *sysdecode_idtype(int _idtype);
 const char *sysdecode_ioctlname(unsigned long _val);
+bool   sysdecode_inotifyflags(FILE *_fp, int _flags, int *_rem);
 const char *sysdecode_ipproto(int _protocol);
 void   sysdecode_kevent_fflags(FILE *_fp, short _filter, int _fflags,
            int _base);

Reply via email to