Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153653743
D54924.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D54924.id.diff
View Options
diff --git a/usr.bin/procstat/procstat.h b/usr.bin/procstat/procstat.h
--- a/usr.bin/procstat/procstat.h
+++ b/usr.bin/procstat/procstat.h
@@ -33,7 +33,7 @@
#ifndef PROCSTAT_H
#define PROCSTAT_H
-#define PROCSTAT_XO_VERSION "1"
+#define PROCSTAT_XO_VERSION "2"
enum {
PS_OPT_CAPABILITIES = 0x01,
diff --git a/usr.bin/procstat/procstat_cs.c b/usr.bin/procstat/procstat_cs.c
--- a/usr.bin/procstat/procstat_cs.c
+++ b/usr.bin/procstat/procstat_cs.c
@@ -49,6 +49,7 @@
struct sbuf *cpusetbuf;
unsigned int count, i;
int once, twice, lastcpu, cpu;
+ char *threadid;
if ((procstat_opts & PS_OPT_NOHEADER) == 0)
xo_emit("{T:/%5s %6s %-19s %-19s %2s %4s %-7s}\n", "PID",
@@ -61,8 +62,13 @@
kinfo_proc_sort(kip, count);
for (i = 0; i < count; i++) {
kipp = &kip[i];
- xo_emit("{k:process_id/%5d/%d} ", kipp->ki_pid);
- xo_emit("{:thread_id/%6d/%d} ", kipp->ki_tid);
+ asprintf(&threadid, "%d", kipp->ki_tid);
+ if (threadid == NULL)
+ xo_errc(1, ENOMEM, "Failed to allocate memory in "
+ "procstat_threads()");
+ xo_open_container(threadid);
+ xo_emit("{:process_id/%5d/%d} ", kipp->ki_pid);
+ xo_emit("{k:thread_id/%6d/%d} ", kipp->ki_tid);
xo_emit("{:command/%-19s/%s} ", strlen(kipp->ki_comm) ?
kipp->ki_comm : "-");
xo_emit("{:thread_name/%-19s/%s} ",
@@ -111,6 +117,7 @@
sbuf_delete(cpusetbuf);
}
xo_emit("\n");
+ xo_close_container(threadid);
}
procstat_freeprocs(procstat, kip);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 23, 4:24 PM (3 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32033441
Default Alt Text
D54924.id.diff (1 KB)
Attached To
Mode
D54924: procstat: nest the threads in the cpuset libxo output
Attached
Detach File
Event Timeline
Log In to Comment