Page MenuHomeFreeBSD

make truss decode sysctl names
ClosedPublic

Authored by kaktus on Sep 17 2019, 1:56 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 4, 9:39 PM
Unknown Object (File)
Fri, May 3, 1:19 AM
Unknown Object (File)
Sat, Apr 27, 12:27 PM
Unknown Object (File)
Sat, Apr 27, 12:24 PM
Unknown Object (File)
Sat, Apr 27, 12:15 PM
Unknown Object (File)
Sat, Apr 27, 12:15 PM
Unknown Object (File)
Sat, Apr 27, 12:15 PM
Unknown Object (File)
Sat, Apr 27, 12:15 PM
Subscribers

Details

Summary

It'd be nice to actually see the sysctl names not the pointers to arrays in truss.

Depends on D21693

Test Plan

truss w

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

usr.bin/truss/syscalls.c
2290

Are these available as symbolic constrants ? No, it seems.

Then it is time to add them to sys/sysctl.h and get rid of the numbers in the definition of sysctls from kern_sysctl.c and e.g. libc sysctlnametonib.

2318

spaces around '*'

asiciliano added inline comments.
usr.bin/truss/syscalls.c
2279

just a note: int oid[CTL_MAXNAME] is correct (an OID can have CTL_MAXNAME levels in the kernel) but it is useless because the "undocumented interface" can handle up to "CTL__MAXNAME - 2" levels (except 0.3 name2oid), CTL_MAXNAME + 2 for qoid does not solve (unfortunately this false solution is quite widespread)

2294

I would wait to document the magical nodes yet, https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240390

2320

here the problem (from the comment above), len + 2 could be 26 > CTL_MAXNAME

I apologize, I wrote some off-topic remark not important in this review (please don't consider them),
thanks to add the sysctl name support to truss.

kaktus added inline comments.
usr.bin/truss/syscalls.c
2279

I couldn't find any obvious CTL_MAXNAME - 2 (apart of libjail, TBC) so if there is a truncation, it's probably because one of the in-kernel functions doesn't use CTL_MAXNAME + 2. I'll take a look at this but it's out of scope for this review anyway.

2294

I matched the names with the names functions responsible as used by kern/kern_sysctl.c Hope that helps.

usr.bin/truss/syscalls.c
2279

Spaces around '+'.

2294

I suggest to print the rest of the input mib in numeric format.

2312

print numeric value as well

2322

Why not print the mib in <num>.<num>... format, esp. since you already fetched it ? The pointer as useless as it can be.

kaktus edited the summary of this revision. (Show Details)

Address @kib comments.

usr.bin/truss/syscalls.c
515

The types of the second and fifth args are size_t, not int. It practically matters on 64bit big-endian hosts.

2296

Spaces around '+' and '-', there and till the end of the chunk.

Style and s/Int/Sizet/ where appropriate.

This revision is now accepted and ready to land.Sep 18 2019, 2:06 PM
This revision was automatically updated to reflect the committed changes.