Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108058019
D34982.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D34982.diff
View Options
diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c
--- a/sys/kern/kern_cpuset.c
+++ b/sys/kern/kern_cpuset.c
@@ -34,6 +34,7 @@
__FBSDID("$FreeBSD$");
#include "opt_ddb.h"
+#include "opt_ktrace.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -61,6 +62,7 @@
#include <sys/bus.h>
#include <sys/interrupt.h>
#include <sys/vmmeter.h>
+#include <sys/ktrace.h>
#include <vm/uma.h>
#include <vm/vm.h>
@@ -1995,6 +1997,10 @@
cp++;
}
}
+#ifdef KTRACE
+ if ( KTRPOINT(td, KTR_STRUCT))
+ ktrcpuset(mask, size);
+#endif
}
out:
free(mask, M_TEMP);
@@ -2028,6 +2034,10 @@
struct proc *p;
int error;
+#ifdef KTRACE
+ if (KTRPOINT(td, KTR_STRUCT))
+ ktrcpuset(mask, sizeof(cpuset_t));
+#endif
error = cpuset_check_capabilities(td, level, which, id);
if (error != 0)
return (error);
diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h
--- a/sys/sys/ktrace.h
+++ b/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(s, l) \
+ ktrstruct("cpuset_t", (s), l)
extern u_int ktr_geniosize;
#ifdef KTRACE
extern int ktr_filesize_limit_signal;
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -48,8 +48,11 @@
#define _WANT_KEVENT32
#endif
#define _WANT_FREEBSD11_KEVENT
+#define _WANT_FREEBSD_BITSET
#include <sys/param.h>
#include <sys/capsicum.h>
+#include <sys/_bitset.h>
+#include <sys/bitset.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/uio.h>
@@ -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,30 @@
printf(" }\n");
}
+void
+ktrbitset(char *name, struct bitset *set, size_t setlen)
+{
+ int i, maxi, c = 0;
+
+ if (setlen > INT32_MAX)
+ setlen = INT32_MAX;
+ maxi = setlen * CHAR_BIT;
+ printf("%s [ ", name);
+ for (i = 0; i < maxi; i++) {
+ if (!BIT_ISSET(setlen, i, set))
+ continue;
+ if (c == 0)
+ printf("%d", i);
+ else
+ printf(", %d", i);
+ c++;
+ }
+ if (c == 0)
+ printf(" empty ]\n");
+ else
+ printf(" ]\n");
+}
+
void
ktrstruct(char *buf, size_t buflen)
{
@@ -1977,6 +2005,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 +2021,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 +2045,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");
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 12:18 AM (20 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16022260
Default Alt Text
D34982.diff (3 KB)
Attached To
Mode
D34982: kdump: Decode cpuset_t.
Attached
Detach File
Event Timeline
Log In to Comment