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)
Sun, Mar 31, 8:01 PM
Unknown Object (File)
Jan 31 2024, 8:55 PM
Unknown Object (File)
Dec 23 2023, 3:59 AM
Unknown Object (File)
Dec 22 2023, 12:06 AM
Unknown Object (File)
Dec 21 2023, 11:42 PM
Unknown Object (File)
Dec 13 2023, 3:46 PM
Unknown Object (File)
Nov 27 2023, 1:35 PM
Unknown Object (File)
Nov 8 2023, 1:32 AM
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

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

usr.bin/truss/syscalls.c
2299

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.

2327

spaces around '*'

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

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)

2303

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

2329

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
2288

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.

2303

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

usr.bin/truss/syscalls.c
2288

Spaces around '+'.

2303

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

2321

print numeric value as well

2331

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.

2305

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.