Index: sys/kern/kern_cpuset.c =================================================================== --- sys/kern/kern_cpuset.c +++ sys/kern/kern_cpuset.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" +#include "opt_ktrace.h" #include #include @@ -61,6 +62,7 @@ #include #include #include +#include #include #include @@ -1974,6 +1976,11 @@ PROC_UNLOCK(p); if (error == 0) error = copyout(mask, maskp, size); +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + ktrcpuset_t(mask, size); +#endif + out: free(mask, M_TEMP); return (error); @@ -2016,6 +2023,10 @@ error = copyin(maskp, mask, size); if (error) goto out; +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + ktrcpuset_t(mask, size); +#endif if (CPU_EMPTY(mask)) { error = EDEADLK; goto out; Index: sys/sys/ktrace.h =================================================================== --- sys/sys/ktrace.h +++ sys/sys/ktrace.h @@ -307,6 +307,8 @@ ktrstruct("stat", (s), sizeof(struct stat)) #define ktrstat_error(s, error) \ ktrstruct_error("stat", (s), sizeof(struct stat), error) +#define ktrcpuset_t(s, l) \ + ktrstruct("cpuset_t", (s), l) extern u_int ktr_geniosize; #ifdef KTRACE extern int ktr_filesize_limit_signal; Index: usr.bin/kdump/kdump.c =================================================================== --- usr.bin/kdump/kdump.c +++ usr.bin/kdump/kdump.c @@ -48,8 +48,11 @@ #define _WANT_KEVENT32 #endif #define _WANT_FREEBSD11_KEVENT +#define _WANT_FREEBSD_BITSET #include #include +#include +#include #include #include #include @@ -119,6 +122,7 @@ void ktrfaultend(struct ktr_faultend *); void ktrkevent(struct kevent *); void ktrstructarray(struct ktr_struct_array *, size_t); +void ktrbitset(char *, struct bitset *, size_t); void usage(void); #define TIMESTAMP_NONE 0x0 @@ -1967,6 +1971,23 @@ printf(" }\n"); } +void +ktrbitset(char *name, struct bitset *set, size_t setlen) +{ + unsigned long i; + int bit; + + printf("%s [ ", name); + for (i = 0; i < setlen * CHAR_BIT; i++) { + bit = BIT_ISSET(setlen, i, set); + if (i == 0) + printf("%c", '0' + bit); + else + printf(", %c", '0' + bit); + } + printf(" ]\n"); +} + void ktrstruct(char *buf, size_t buflen) { @@ -1977,6 +1998,7 @@ struct itimerval it; struct stat sb; struct sockaddr_storage ss; + struct bitset *set; for (name = buf, namelen = 0; namelen < buflen && name[namelen] != '\0'; @@ -1992,7 +2014,7 @@ goto invalid; /* sanity check */ for (i = 0; i < (int)namelen; ++i) - if (!isalpha(name[i])) + if (!isalpha(name[i]) && name[i] != '_') goto invalid; if (strcmp(name, "caprights") == 0) { if (datalen != sizeof(cap_rights_t)) @@ -2016,6 +2038,15 @@ if (datalen != ss.ss_len) goto invalid; ktrsockaddr((struct sockaddr *)&ss); + } else if (strcmp(name, "cpuset_t") == 0) { + if (datalen < 1) + goto invalid; + set = malloc(datalen); + if (set == NULL) + errx(1, "%s", strerror(ENOMEM)); + memcpy(set, data, datalen); + ktrbitset(name, set, datalen); + free(set); } else { printf("unknown structure\n"); }