Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144704582
D21688.id62241.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D21688.id62241.diff
View Options
Index: usr.bin/truss/syscall.h
===================================================================
--- usr.bin/truss/syscall.h
+++ usr.bin/truss/syscall.h
@@ -131,6 +131,7 @@
Sockprotocol,
Socktype,
Sysarch,
+ Sysctl,
Umtxop,
Waitoptions,
Whence,
Index: usr.bin/truss/syscalls.c
===================================================================
--- usr.bin/truss/syscalls.c
+++ usr.bin/truss/syscalls.c
@@ -51,6 +51,7 @@
#include <sys/socket.h>
#define _WANT_FREEBSD11_STAT
#include <sys/stat.h>
+#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/un.h>
#include <sys/wait.h>
@@ -506,6 +507,12 @@
.args = { { Name, 0 }, { Atfd, 1 }, { Name, 2 } } },
{ .name = "sysarch", .ret_type = 1, .nargs = 2,
.args = { { Sysarch, 0 }, { Ptr, 1 } } },
+ { .name = "__sysctl", .ret_type = 1, .nargs = 6,
+ .args = { { Sysctl, 0 }, { Int, 1 }, { Ptr, 2 }, { Ptr, 3 },
+ { Ptr, 4 }, { Int, 5 } } },
+ { .name = "__sysctlbyname", .ret_type = 1, .nargs = 6,
+ .args = { { Name, 0 }, { Int, 1 }, { Ptr, 2 }, { Ptr, 3 },
+ { Ptr, 4}, { Int, 5 } } },
{ .name = "thr_kill", .ret_type = 1, .nargs = 2,
.args = { { Long, 0 }, { Signal, 1 } } },
{ .name = "thr_self", .ret_type = 1, .nargs = 1,
@@ -2267,6 +2274,58 @@
print_integer_arg(sysdecode_sysarch_number, fp,
args[sc->offset]);
break;
+ case Sysctl: {
+ char name[BUFSIZ];
+ int oid[CTL_MAXNAME], qoid[CTL_MAXNAME+2];
+ size_t i;
+ int len;
+
+ memset(name, 0, sizeof(name));
+ len = args[sc->offset + 1];
+ if (get_struct(pid, (void *)args[sc->offset], oid,
+ len * sizeof(oid[0])) != -1) {
+ if (oid[0] == CTL_SYSCTL) {
+ fprintf(fp, "\"sysctl.");
+ switch (oid[1]) {
+ case CTL_SYSCTL_DEBUG:
+ fprintf(fp, "debug");
+ break;
+ case CTL_SYSCTL_NAME:
+ fprintf(fp, "name");
+ break;
+ case CTL_SYSCTL_NEXT:
+ fprintf(fp, "next");
+ break;
+ case CTL_SYSCTL_NAME2OID:
+ fprintf(fp, "name2oid");
+ break;
+ case CTL_SYSCTL_OIDFMT:
+ fprintf(fp, "oidfmt");
+ break;
+ case CTL_SYSCTL_OIDDESCR:
+ fprintf(fp, "oiddescr");
+ break;
+ case CTL_SYSCTL_OIDLABEL:
+ fprintf(fp, "oidlabel");
+ break;
+ default:
+ fprintf(fp, "unknown");
+ }
+ fprintf(fp,"\"");
+ } else {
+ qoid[0] = CTL_SYSCTL;
+ qoid[1] = CTL_SYSCTL_NAME;
+ memcpy(qoid+2, oid, len * sizeof(int));
+ i = sizeof(name);
+ if (sysctl(qoid, len + 2, name, &i, 0, 0) == -1)
+ fprintf(fp, "%p",
+ (void *)args[sc->offset]);
+ else
+ fprintf(fp, "\"%s\"", name);
+ }
+ }
+ break;
+ }
case PipeFds:
/*
* The pipe() system call in the kernel returns its
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 12, 10:08 AM (11 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28665881
Default Alt Text
D21688.id62241.diff (2 KB)
Attached To
Mode
D21688: make truss decode sysctl names
Attached
Detach File
Event Timeline
Log In to Comment