afsd: Improve syscall tracing 58/11858/13
authorPerry Ruiter <pruiter@sinenomine.net>
Fri, 24 Apr 2015 04:33:27 +0000 (21:33 -0700)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 10 Aug 2018 13:30:19 +0000 (09:30 -0400)
commitcc1724e6f5a8f485197aba6246c909869e58d0b2
treeb81a5c6f745f08ccc8d85a6fdedbfde3dc5cd901
parent1f29c9f05f53966df1bbd9ece479155f78f995e0
afsd: Improve syscall tracing

When afsd is started with the -debug flag, extensive debug output is
generated including tracing for each syscall.  Unfortunately the
existing syscall tracing is not especially helpful.  It dumps out two
constants that we already knew at compile time, the first parameter of
the syscall along with the syscall's return code.  Specifically it does
not tell you which syscall is currently being traced.  Here's a current
example of afsd -debug:

    afsd: cacheFiles autotuned to 581250
    afsd: dCacheSize autotuned to 10000
    afsd: cacheStatEntries autotuned to 15000
    SScall(183, 28, 6860800)=0
    SScall(183, 28, -847416368)=0
    SScall(183, 28, 1)=0
    afsd: Forking rx listener daemon.
    afsd: Forking rx callback listener.
    afsd: Forking rxevent daemon.
    SScall(183, 28, 0)=0
    SScall(183, 28, 1)=0
    ...

This patch drops the compile time constants (183 and 28 in the above
sample output) and replaces them with the name of the syscall being
traced.  Additionally the first parameter to a syscall is as likely to
be an address as a decimal value so display it in hex. Here's an example
of afsd -debug with these changes:

    afsd: cacheFiles autotuned to 581250
    afsd: dCacheSize autotuned to 10000
    afsd: cacheStatEntries autotuned to 15000
    os_syscall(AFSOP_SET_THISCELL, 0x68bf80)=0
    os_syscall(AFSOP_SEED_ENTROPY, 0x7fff9ce40c10)=0
    os_syscall(AFSOP_ADVISEADDR, 0x1)=0
    afsd: Forking rx listener daemon.
    afsd: Forking rx callback listener.
    afsd: Forking rxevent daemon.
    os_syscall(AFSOP_RXEVENT_DAEMON, 0x0)=0
    os_syscall(AFSOP_BASIC_INIT, 0x1)=0
    ...

[mmeffie@sinenomine.net: avoid c99 array initialization.]

Change-Id: I4f3d46d420d19abeddbf719efa04aef7e553d51f
Reviewed-on: https://gerrit.openafs.org/11858
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afsd/afsd_kernel.c
src/config/afs_args.h