Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Aug 2026 15:16:28 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 04e69f7cc26e - stable/14 - kdump: Add support for decoding inotify events
Message-ID:  <6a7353cc.4526d.5f0cfe35@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by markj:

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

commit 04e69f7cc26e71b1e91b44a116a4257a1b679dcf
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-07-03 19:53:30 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-08-05 15:15:15 +0000

    kdump: Add support for decoding inotify events
    
    These are emitted when reading from an inotify descriptor.
    
    MFC after:      3 months
    Sponsored by:   Klara, Inc.
    
    (cherry picked from commit e02d4fab54539a5d127c12e9e9f8b0ddd2a1cafa)
---
 usr.bin/kdump/kdump.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 47002a065dd6..576b8c07787c 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -58,6 +58,7 @@ static char sccsid[] = "@(#)kdump.c	8.1 (Berkeley) 6/6/93";
 #include <sys/ktrace.h>
 #include <sys/mman.h>
 #include <sys/ioctl.h>
+#include <sys/inotify.h>
 #include <sys/poll.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
@@ -115,6 +116,7 @@ void ktrpsig(struct ktr_psig *);
 void ktrcsw(struct ktr_csw *);
 void ktrcsw_old(struct ktr_csw_old *);
 void ktruser(int, void *);
+void ktrinotify(struct inotify_event *);
 void ktrcaprights(cap_rights_t *);
 void ktritimerval(struct itimerval *it);
 void ktrsockaddr(struct sockaddr *);
@@ -1861,6 +1863,14 @@ ktrtimeval(struct timeval *tv)
 	printf("{%ld, %ld}", (long)tv->tv_sec, tv->tv_usec);
 }
 
+void
+ktrinotify(struct inotify_event *ev)
+{
+	printf(
+    "inotify { .wd = %d, .mask = %#x, .cookie = %u, .len = %u, .name = %s }\n",
+	    ev->wd, ev->mask, ev->cookie, ev->len, ev->name);
+}
+
 void
 ktritimerval(struct itimerval *it)
 {
@@ -2120,6 +2130,17 @@ ktrstruct(char *buf, size_t buflen)
 			goto invalid;
 		memcpy(&rights, data, datalen);
 		ktrcaprights(&rights);
+	} else if (strcmp(name, "inotify") == 0) {
+		struct inotify_event *ev;
+
+		if (datalen < sizeof(struct inotify_event) ||
+		    datalen > sizeof(struct inotify_event) + NAME_MAX + 1)
+			goto invalid;
+		ev = malloc(datalen);
+		if (ev == NULL)
+			err(1, "malloc");
+		memcpy(ev, data, datalen);
+		ktrinotify(ev);
 	} else if (strcmp(name, "itimerval") == 0) {
 		if (datalen != sizeof(struct itimerval))
 			goto invalid;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a7353cc.4526d.5f0cfe35>