mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
kdump: Add support for decoding inotify events
These are emitted when reading from an inotify descriptor. MFC after: 3 months Sponsored by: Klara, Inc.
This commit is contained in:
parent
4d08e7815d
commit
e02d4fab54
1 changed files with 21 additions and 0 deletions
|
|
@ -46,6 +46,7 @@
|
|||
#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>
|
||||
|
|
@ -105,6 +106,7 @@ static void ktrcsw(struct ktr_csw *);
|
|||
static void ktrcsw_old(struct ktr_csw_old *);
|
||||
static void ktruser(int, void *);
|
||||
static void ktrcaprights(cap_rights_t *);
|
||||
static void ktrinotify(struct inotify_event *);
|
||||
static void ktritimerval(struct itimerval *it);
|
||||
static void ktrsockaddr(struct sockaddr *);
|
||||
static void ktrsplice(struct splice *);
|
||||
|
|
@ -1860,6 +1862,14 @@ ktrtimeval(struct timeval *tv)
|
|||
printf("{%ld, %ld}", (long)tv->tv_sec, tv->tv_usec);
|
||||
}
|
||||
|
||||
static 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);
|
||||
}
|
||||
|
||||
static void
|
||||
ktritimerval(struct itimerval *it)
|
||||
{
|
||||
|
|
@ -2128,6 +2138,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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue