PERFORCE change 23436 for review
Brian Feldman
green at freebsd.org
Wed Jan 8 18:56:34 GMT 2003
http://perforce.freebsd.org/chv.cgi?CH=23436
Change 23436 by green at green_laptop_2 on 2003/01/08 10:56:25
Print out more info in truss(1) for sysctl(2) calls.
Affected files ...
.. //depot/projects/trustedbsd/mac/usr.bin/truss/syscall.h#4 edit
.. //depot/projects/trustedbsd/mac/usr.bin/truss/syscalls.c#8 edit
Differences ...
==== //depot/projects/trustedbsd/mac/usr.bin/truss/syscall.h#4 (text+ko) ====
@@ -22,7 +22,7 @@
*/
enum Argtype { None = 1, Hex, Octal, Int, String, Ptr, Stat, Ioctl, Quad,
- Signal, Sockaddr, StringArray };
+ Signal, Sockaddr, StringArray, HexArray };
#define ARG_MASK 0xff
#define OUT 0x100
==== //depot/projects/trustedbsd/mac/usr.bin/truss/syscalls.c#8 (text+ko) ====
@@ -108,6 +108,9 @@
{ { String | IN, 0 }, { StringArray | IN, 1 }, { StringArray | IN, 2 } } },
{ "linux_execve", 1, 3,
{ { String | IN, 0 }, { StringArray | IN, 1 }, { StringArray | IN, 2 } } },
+ { "__sysctl", 1, 6,
+ { { HexArray | IN, 0 }, { Int, 1 }, { Ptr | IN, 2 }, { Ptr | IN, 3 },
+ { Ptr | OUT, 4 }, { Int, 5 } } },
{ 0, 0, 0, { { 0, 0 }}},
};
@@ -241,6 +244,33 @@
tmp = malloc(12);
sprintf(tmp, "%ld", args[sc->offset]);
break;
+ case HexArray:
+ {
+ char *old;
+ int num, i, *ary;
+
+ num = (int)args[sc[1].offset];
+ if (num <= 0) {
+ asprintf(&tmp, "[]");
+ break;
+ }
+ ary = malloc(sizeof(int) * num);
+ if (get_struct(fd, (void *)args[sc->offset], (void *)ary,
+ sizeof(int) * num) == -1) {
+ err(1, "get_struct %p", (void *)args[sc->offset]);
+ }
+ asprintf(&tmp, "[%#lx", ((int *)args[sc->offset])[0]);
+ for (i = 1; i < num; i++) {
+ old = tmp;
+ asprintf(&tmp, "%s, %#lx", old, ary[i]);
+ free(old);
+ }
+ old = tmp;
+ asprintf(&tmp, "%s]", old);
+ free(old);
+ free(ary);
+ }
+ break;
case String:
{
char *tmp2;
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list