The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/tools/trace/ktruss.lua

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/usr/local/bin/recon
    2 
    3 local ktrace = require 'ktrace'
    4 
    5 if not arg[1] or arg[1] == '-h' then
    6   print[[
    7 usage: ktruss <syscall-name> [<more-names> ...]
    8 
    9 Use Kernel TRace to print User Space Syscalls (ktruss).]]
   10   os.exit(arg[1] == nil)
   11 end
   12 
   13 local sess = ktrace.Session.new()
   14 
   15 for i = 1, #arg do
   16   sess:add_callback_pair('BSC_' .. arg[i], function (start, finish)
   17     print(('%s[%d]: %s(0x%x, 0x%x, 0x%x, 0x%x) -> %d'):format(
   18         sess:procname_for_threadid(start.threadid),
   19         sess:pid_for_threadid(start.threadid), arg[1], start[1], start[2],
   20         start[3], start[4], finish[2]))
   21   end)
   22 end
   23 
   24 local ok, err = sess:start()
   25 if not ok then
   26   io.stderr:write('tracing failed: ', err, '\n')
   27   os.exit(1)
   28 end

Cache object: 6737f7f19ac088d7664c05956239b6b2


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.