kdump: Decode Linux l_sigset_t.
Reviewed by: markj Differential revision: https://reviews.freebsd.org/D35153 MFC after: 2 weeks
This commit is contained in:
parent
9310737333
commit
3606a213bf
@ -2056,7 +2056,10 @@ ktrstruct(char *buf, size_t buflen)
|
||||
ktrbitset(name, set, datalen);
|
||||
free(set);
|
||||
} else {
|
||||
printf("unknown structure\n");
|
||||
#ifdef SYSDECODE_HAVE_LINUX
|
||||
if (ktrstruct_linux(name, data, datalen) == false)
|
||||
#endif
|
||||
printf("unknown structure\n");
|
||||
}
|
||||
return;
|
||||
invalid:
|
||||
|
@ -77,6 +77,7 @@ bool print_mask_arg_part(bool (*decoder)(FILE *, int, int *),
|
||||
int value, int *rem);
|
||||
|
||||
#ifdef SYSDECODE_HAVE_LINUX
|
||||
bool ktrstruct_linux(const char *name, const char *data, size_t datalen);
|
||||
void ktrsyscall_linux(struct ktr_syscall *ktr, register_t **resip,
|
||||
int *resnarg, char *resc);
|
||||
#ifdef __amd64__
|
||||
|
@ -31,7 +31,11 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/param.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/ktrace.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysdecode.h>
|
||||
|
||||
#include "kdump.h"
|
||||
@ -45,6 +49,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <i386/linux/linux_syscall.h>
|
||||
#endif
|
||||
|
||||
#include <compat/linux/linux.h>
|
||||
|
||||
static void
|
||||
print_linux_signal(int signo)
|
||||
{
|
||||
@ -183,3 +189,41 @@ ktrsyscall_linux32(struct ktr_syscall *ktr, register_t **resip,
|
||||
*resnarg = narg;
|
||||
}
|
||||
#endif /* __amd64__ */
|
||||
|
||||
static void
|
||||
ktrsigset(const char *name, const l_sigset_t *mask, size_t sz)
|
||||
{
|
||||
unsigned long i, c;
|
||||
|
||||
printf("%s [ ", name);
|
||||
c = 0;
|
||||
for (i = 1; i <= sz * CHAR_BIT; i++) {
|
||||
if (!LINUX_SIGISMEMBER(*mask, i))
|
||||
continue;
|
||||
if (c != 0)
|
||||
printf(", ");
|
||||
printf("%s", sysdecode_linux_signal(i));
|
||||
c++;
|
||||
}
|
||||
if (c == 0)
|
||||
printf("empty ]\n");
|
||||
else
|
||||
printf(" ]\n");
|
||||
}
|
||||
|
||||
bool
|
||||
ktrstruct_linux(const char *name, const char *data, size_t datalen)
|
||||
{
|
||||
l_sigset_t mask;
|
||||
|
||||
if (strcmp(name, "l_sigset_t") == 0) {
|
||||
/* Old Linux sigset_t is one word size. */
|
||||
if (datalen < sizeof(int) || datalen > sizeof(l_sigset_t))
|
||||
return (false);
|
||||
memcpy(&mask, data, datalen);
|
||||
ktrsigset(name, &mask, datalen);
|
||||
} else
|
||||
return (false);
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user