Changeset 57c03363 in rtems


Ignore:
Timestamp:
Nov 25, 2017, 4:49:12 AM (2 years ago)
Author:
jhb <jhb@…>
Branches:
master
Children:
bf026dd4
Parents:
e9b708a
git-author:
jhb <jhb@…> (11/25/17 04:49:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/08/18 06:15:17)
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/sys/event.h

    re9b708a r57c03363  
    7171        __uint64_t      ext[4];
    7272};
     73
     74#if defined(_WANT_FREEBSD11_KEVENT)
     75/* Older structure used in FreeBSD 11.x and older. */
     76struct kevent_freebsd11 {
     77        __uintptr_t     ident;          /* identifier for this event */
     78        short           filter;         /* filter for event */
     79        unsigned short  flags;
     80        unsigned int    fflags;
     81        __intptr_t      data;
     82        void            *udata;         /* opaque user data identifier */
     83};
     84#endif
     85
     86#if defined(_WANT_KEVENT32) || (defined(_KERNEL) && defined(__LP64__))
     87struct kevent32 {
     88        uint32_t        ident;          /* identifier for this event */
     89        short           filter;         /* filter for event */
     90        u_short         flags;
     91        u_int           fflags;
     92#ifndef __amd64__
     93        uint32_t        pad0;
     94#endif
     95        int32_t         data1, data2;
     96        uint32_t        udata;          /* opaque user data identifier */
     97#ifndef __amd64__
     98        uint32_t        pad1;
     99#endif
     100        uint32_t        ext64[8];
     101};
     102
     103#ifdef _WANT_FREEBSD11_KEVENT
     104struct kevent32_freebsd11 {
     105        u_int32_t       ident;          /* identifier for this event */
     106        short           filter;         /* filter for event */
     107        u_short         flags;
     108        u_int           fflags;
     109        int32_t         data;
     110        u_int32_t       udata;          /* opaque user data identifier */
     111};
     112#endif
     113#endif
    73114
    74115/* actions */
Note: See TracChangeset for help on using the changeset viewer.