summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2017-11-25 04:49:12 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-08-08 08:15:17 +0200
commit57c03363c8a6354055fc20ed605a45a4196da81b (patch)
tree35dcb3e71feec89faaf6ae74fe31f627acb33b9b
parentAdd abstime kqueue(2) timers and expand struct kevent members. (diff)
downloadrtems-57c03363c8a6354055fc20ed605a45a4196da81b.tar.bz2
Decode kevent structures logged via ktrace(2) in kdump.
- Add a new KTR_STRUCT_ARRAY ktrace record type which dumps an array of structures. The structure name in the record payload is preceded by a size_t containing the size of the individual structures. Use this to replace the previous code that dumped the kevent arrays dumped for kevent(). kdump is now able to decode the kevent structures rather than dumping their contents via a hexdump. One change from before is that the 'changes' and 'events' arrays are not marked with separate 'read' and 'write' annotations in kdump output. Instead, the first array is the 'changes' array, and the second array (only present if kevent doesn't fail with an error) is the 'events' array. For kevent(), empty arrays are denoted by an entry with an array containing zero entries rather than no record. - Move kevent decoding tables from truss to libsysdecode. This adds three new functions to decode members of struct kevent: sysdecode_kevent_filter, sysdecode_kevent_flags, and sysdecode_kevent_fflags. kdump uses these helper functions to pretty-print kevent fields. - Move structure definitions for freebsd11 and freebsd32 kevent structures to <sys/event.h> so that they can be shared with userland. The 32-bit structures are only exposed if _WANT_KEVENT32 is defined. The freebsd11 structures are only exposed if _WANT_FREEBSD11_KEVENT is defined. The 32-bit freebsd11 structure requires both. - Decode freebsd11 kevent structures in truss for the compat11.kevent() system call. - Log 32-bit kevent structures via ktrace for 32-bit compat kevent() system calls. - While here, constify the 'void *data' argument to ktrstruct(). Reviewed by: kib (earlier version) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12470
-rw-r--r--cpukit/include/sys/event.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/cpukit/include/sys/event.h b/cpukit/include/sys/event.h
index d1cfb58e9c..2274caeee1 100644
--- a/cpukit/include/sys/event.h
+++ b/cpukit/include/sys/event.h
@@ -71,6 +71,47 @@ struct kevent {
__uint64_t ext[4];
};
+#if defined(_WANT_FREEBSD11_KEVENT)
+/* Older structure used in FreeBSD 11.x and older. */
+struct kevent_freebsd11 {
+ __uintptr_t ident; /* identifier for this event */
+ short filter; /* filter for event */
+ unsigned short flags;
+ unsigned int fflags;
+ __intptr_t data;
+ void *udata; /* opaque user data identifier */
+};
+#endif
+
+#if defined(_WANT_KEVENT32) || (defined(_KERNEL) && defined(__LP64__))
+struct kevent32 {
+ uint32_t ident; /* identifier for this event */
+ short filter; /* filter for event */
+ u_short flags;
+ u_int fflags;
+#ifndef __amd64__
+ uint32_t pad0;
+#endif
+ int32_t data1, data2;
+ uint32_t udata; /* opaque user data identifier */
+#ifndef __amd64__
+ uint32_t pad1;
+#endif
+ uint32_t ext64[8];
+};
+
+#ifdef _WANT_FREEBSD11_KEVENT
+struct kevent32_freebsd11 {
+ u_int32_t ident; /* identifier for this event */
+ short filter; /* filter for event */
+ u_short flags;
+ u_int fflags;
+ int32_t data;
+ u_int32_t udata; /* opaque user data identifier */
+};
+#endif
+#endif
+
/* actions */
#define EV_ADD 0x0001 /* add event to kq (implies enable) */
#define EV_DELETE 0x0002 /* delete event from kq */