History log of /freebsd-current/usr.bin/truss/main.c
Revision Date Author Comments
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 31dddc6a 16-Jun-2021 Alex Richardson <arichardson@FreeBSD.org>

truss: minor cleanup and pedantic warning fixes

Noticed while porting the recent truss compat32 changes to CheriBSD.
This also fixes i386 tracing by zero-extending user addresses instead
of sign-extending them.

Reviewed By: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30211


# 6019514b 04-Mar-2021 Alex Richardson <arichardson@FreeBSD.org>

truss: split counting of syscalls and syscall calling convention

This change is a refactoring cleanup to improve support for compat32
syscalls (and compat64 on CHERI systems). Each process ABI now has it's
own struct sycall instead of using one global list. The list of all
syscalls is replaced with a list of seen syscalls. Looking up the syscall
argument passing convention now interates over the fixed-size array instead
of using a link-list that's populated on startup so we no longer need the
init_syscall() function.
The actual functional changes are in D27625.

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D27636


# c1745bf5 10-Dec-2018 John Baldwin <jhb@FreeBSD.org>

Validate the string size parameter passed to -s.

Use strtonum() to reject negative sizes instead of core dumping.

PR: 232206
Submitted by: David Carlier <devnexen@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D17537


# df57947f 18-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

spdx: initial adoption of licensing ID tags.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes: yes
Differential Revision: https://reviews.freebsd.org/D13133


# fe7f211c 13-Oct-2017 Ed Maste <emaste@FreeBSD.org>

truss: mention 'H' in usage

r295930 introduced the 'H' option to display thread IDs, but did not add
the option to usage().

PR: 222837
Submitted by: Oliver Kiddle <okiddle@yahoo.co.uk>
MFC after: 1 week


# 9289f547 17-Oct-2016 John Baldwin <jhb@FreeBSD.org>

Move mksubr from kdump into libsysdecode.

Restructure this script so that it generates a header of tables instead
of a source file. The tables are included in a flags.c source file which
provides functions to decode various system call arguments.

For functions that decode an enumeration, the function returns a pointer
to a string for known values and NULL for unknown values.

For functions that do more complex decoding (typically of a bitmask), the
function accepts a pointer to a FILE object (open_memstream() can be used
as a string builder) to which decoded values are written. If the
function operates on a bitmask, the function returns true if any bits
were decoded or false if the entire value was valid. Additionally, the
third argument accepts a pointer to a value to which any undecoded bits
are stored. This pointer can be NULL if the caller doesn't care about
remaining bits.

Convert kdump over to using decoder functions from libsysdecode instead of
mksubr. truss also uses decoders from libsysdecode instead of private
lookup tables, though lookup tables for objects not decoded by kdump remain
in truss for now. Eventually most of these tables should move into
libsysdecode as the automated table generation approach from mksubr is
less stale than the static tables in truss.

Some changes have been made to truss and kdump output:
- The flags passed to open() are now properly decoded in that one of
O_RDONLY, O_RDWR, O_WRONLY, or O_EXEC is always included in a decoded
mask.
- Optional arguments to open(), openat(), and fcntl() are only printed
in kdump if they exist (e.g. the mode is only printed for open() if
O_CREAT is set in the flags).
- Print argument to F_GETLK/SETLK/SETLKW in kdump as a pointer, not int.
- Include all procctl() commands.
- Correctly decode pipe2() flags in truss by not assuming full
open()-like flags with O_RDONLY, etc.
- Decode file flags passed to *chflags() as file flags (UF_* and SF_*)
rather than as a file mode.
- Fix decoding of quotactl() commands by splitting out the two command
components instead of assuming the raw command value matches the
primary command component.

In addition, truss and kdump now build without triggering any warnings.
All of the sysdecode manpages now include the required headers in the
synopsis.

Reviewed by: kib (several older versions), wblock (manpages)
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D7847


# d70876fd 23-Feb-2016 John Baldwin <jhb@FreeBSD.org>

Add support for displaying thread IDs to truss(1).

- Consolidate duplicate code for printing the metadata at the start of
each line into a shared function.
- Add an -H option which will log the thread ID of the relevant thread
for each event.

While here, remove some extraneous calls to clock_gettime() in
print_syscall() and print_syscall_ret(). The caller of print_syscall_ret()
always updates the current thread's "after" time before it is called.

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D5363


# a5f14abf 26-Jan-2016 John Baldwin <jhb@FreeBSD.org>

Add support to libsysdecode for decoding system call names.

A new sysdecode_syscallname() function accepts a system call code and
returns a string of the corresponding name (or NULL if the code is
unknown). To support different process ABIs, the new function accepts a
value from a new sysdecode_abi enum as its first argument to select the
ABI in use. Current ABIs supported include FREEBSD (native binaries),
FREEBSD32, LINUX, LINUX32, and CLOUDABI64. Note that not all ABIs are
supported by all platforms. In general, a given ABI is only supported
if a platform can execute binaries for that ABI.

To simplify the implementation, libsysdecode's build reuses the
existing pre-generated files from the kernel source tree rather than
duplicating new copies of said files during the build.

kdump(1) and truss(1) now use these functions to map system call
identifiers to names. For kdump(1), a new 'syscallname()' function
consolidates duplicated code from ktrsyscall() and ktrsyscallret().
The Linux ABI no longer requires custom handling for ktrsyscall() and
linux_ktrsyscall() has been removed as a result.

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D4823


# 7096af2e 09-Oct-2015 Bryan Drewery <bdrewery@FreeBSD.org>

Let -c imply -S (hide signal output).

Without this, the signals are shown seemingly randomly in the output before
the final summary is shown. This is especially noticeable when there is
not much output from the application being traced.

Discussed with: jhb
Relnotes: yes


# 6c61b0f3 05-Oct-2015 Bryan Drewery <bdrewery@FreeBSD.org>

Fix tracking of unknown syscalls for 'truss -c'.

This is done by changing get_syscall() to either lookup the known syscall
or add it into the list with the default handlers for printing.

This also simplifies some code to not have to check if the syscall variable
is set or NULL.

Reviewed by: jhb
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D3792


# 2b75c8ad 30-Sep-2015 John Baldwin <jhb@FreeBSD.org>

Several changes to truss.
- Refactor the interface between the ABI-independent code and the
ABI-specific backends. The backends now provide smaller hooks to
fetch system call arguments and return values. The rest of the
system call entry and exit handling that was previously duplicated
among all the backends has been moved to one place.
- Merge the loop when waiting for an event with the loop for handling stops.
This also means not emulating a procfs-like interface on top of ptrace().
Instead, use a single event loop that fetches process events via waitid().
Among other things this allows us to report the full 32-bit exit value.
- Use PT_FOLLOW_FORK to follow new child processes instead of forking a new
truss process for each new child. This allows one truss process to monitor
a tree of processes and truss -c should now display one total for the
entire tree instead of separate summaries per process.
- Use the recently added fields to ptrace_lwpinfo to determine the current
system call number and argument count. The latter is especially useful
and fixes a regression since the conversion from procfs. truss now
generally prints the correct number of arguments for most system calls
rather than printing extra arguments for any call not listed in the
table in syscalls.c.
- Actually check the new ABI when processes call exec. The comments claimed
that this happened but it was not being done (perhaps this was another
regression in the conversion to ptrace()). If the new ABI after exec
is not supported, truss detaches from the process. If truss does not
support the ABI for a newly executed process the process is killed
before it returns from exec.
- Along with the refactor, teach the various ABI-specific backends to
fetch both return values, not just the first. Use this to properly
report the full 64-bit return value from lseek(). In addition, the
handler for "pipe" now pulls the pair of descriptors out of the
return values (which is the true kernel system call interface) but
displays them as an argument (which matches the interface exported by
libc).
- Each ABI handler adds entries to a linker set rather than requiring
a statically defined table of handlers in main.c.
- The arm and mips system call fetching code was changed to follow the
same pattern as amd64 (and the in-kernel handler) of fetching register
arguments first and then reading any remaining arguments from the
stack. This should fix indirect system call arguments on at least
arm.
- The mipsn32 and n64 ABIs will now look for arguments in A4 through A7.
- Use register %ebp for the 6th system call argument for Linux/i386 ABIs
to match the in-kernel argument fetch code.
- For powerpc binaries on a powerpc64 system, fetch the extra arguments
on the stack as 32-bit values that are then copied into the 64-bit
argument array instead of reading the 32-bit values directly into the
64-bit array.

Reviewed by: kib (earlier version)
Tested on: amd64 (FreeBSD/amd64 & i386), i386, arm (earlier version)
Tested on: powerpc64 (FreeBSD/powerpc64 & powerpc)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D3575


# a1436773 19-Aug-2015 John Baldwin <jhb@FreeBSD.org>

Always use %j with an intmax_t cast to print time_t values. time_t is
longer than long on 32-bit platforms with a 64-bit time_t.

Inspired by: mail from bde


# f083f689 18-Aug-2015 John Baldwin <jhb@FreeBSD.org>

Change the argument formatting function to use a stdio FILE object opened
with open_memstream() to build the string for each argument. This allows
for more complicated argument building without resorting to intermediate
malloc's, etc.

Related, the strsig*() functions no longer return allocated strings but
use a static global buffer instead.


# e7d939bd 06-Jul-2014 Marcel Moolenaar <marcel@FreeBSD.org>

Remove ia64.

This includes:
o All directories named *ia64*
o All files named *ia64*
o All ia64-specific code guarded by __ia64__
o All ia64-specific makefile logic
o Mention of ia64 in comments and documentation

This excludes:
o Everything under contrib/
o Everything under crypto/
o sys/xen/interface
o sys/sys/elf_common.h

Discussed at: BSDcan


# 57fb38ba 07-Mar-2013 Olivier Houchard <cognet@FreeBSD.org>

Add arm bits to truss.


# d9dcc463 26-Feb-2013 Xin LI <delphij@FreeBSD.org>

Revert r247300 for now. I'll post a new changeset for review.


# 285a4c7c 25-Feb-2013 Xin LI <delphij@FreeBSD.org>

Expose timespec and timeval macros when __BSD_VISIBLE is defined. This
allows userland application to use the following macros:

timespecclear, timespecisset, timespeccmp, timespecadd,
timespecsub;

timevalclear, timevalisset, timevalcmp.

MFC after: 1 month


# c2b51d44 26-Jan-2013 Mateusz Guzik <mjg@FreeBSD.org>

truss: use 'e' flag for fopen instead of fcntl(.., FD_CLOEXEC)


# 8ff44cbb 26-Jan-2013 Mateusz Guzik <mjg@FreeBSD.org>

truss: if file requested with -o flag could not be opened print the reason

MFC after: 3 days


# 5695afde 16-Sep-2012 Andrey Zonov <zont@FreeBSD.org>

- Make truss thread-aware.

Approved by: kib (mentor)
MFC after: 2 weeks


# 896fc463 12-Sep-2012 Andrey Zonov <zont@FreeBSD.org>

- Fix detaching under some circumstances.

When truss is detaching from very active process it is possible to
hang on waitpid(2) in restore_proc() forever, because
ptrace(PT_SYSCALL) must be called before detaching, to allow the
debugging process to continue execution. Also when truss called with
'-c' argument, it does not print anything after detach, because it
immediately exits from restore_proc().

To fix these two problems make detaching deferred, but then it is
impossible to detach from a process which does not do any system call.
To fix this issue use sigaction(2) instead of signal(3) to disable
SA_RESTART flag for waitpid(2) that makes it non-restartable. Remove
global variable child_pid, because now detaching is handled in context
where child's pid is known.

Reported by: mjg
Tested by: mjg, swills
Approved by: kib (mentor)
MFC after: 2 weeks


# 94355cfd 02-Sep-2012 Andrey Zonov <zont@FreeBSD.org>

- Style(9) cleanup.

Approved by: kib (mentor)


# a02c83af 10-Dec-2011 Ed Schouten <ed@FreeBSD.org>

Add more static keywords to truss(1) source code.

There are some tables in the source code that are only used by the
individual source files themselves. Therefore there is no need to export
them.


# b2bf146e 19-May-2011 Benedict Reuschling <bcr@FreeBSD.org>

Fix typos in comments, no functional changes.

Found by: codespell
Reviewed by: alfred
MFC after: 1 week


# de555084 06-Mar-2011 Jilles Tjoelker <jilles@FreeBSD.org>

Simplify various code that allowed for sys_signame being lower case.

This was changed in r218285.


# 12dacf62 04-Feb-2011 Jilles Tjoelker <jilles@FreeBSD.org>

Make sys_signame upper case.

This matches the constants from <signal.h> with 'SIG' removed, which POSIX
requires kill and trap to accept and 'kill -l' to write.

'kill -l', 'trap', 'trap -l' output is now upper case.

In Turkish locales, signal names with an upper case 'I' are now accepted,
while signal names with a lower case 'i' are no longer accepted, and the
output of 'killall -l' now contains proper capital 'I' without dot instead
of a dotted capital 'I'.


# e04c3786 13-Nov-2010 Jaakko Heinonen <jh@FreeBSD.org>

Set FD_CLOEXEC for the output file only when the file has been specified
with the -o option. Setting the flag for stderr (the default) could
cause the traced process to redirect stderr to a random file.

PR: bin/152151
Submitted by: ashish
MFC after: 5 days


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 4e583321 28-Aug-2010 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Fix breakage introduced in r211725 and improve functionality of truss on
64-bit powerpc by adding 32-bit compatibility features.


# 0a6c71f8 10-Mar-2010 Warner Losh <imp@FreeBSD.org>

Fix copyright spelling.

PR: 139825
Submitted by: Ruslan Mahmatkhanov


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 3ede63a7 08-Feb-2010 Jaakko Heinonen <jh@FreeBSD.org>

MFC r200752:

Avoid sharing the file descriptor of the output file with traced
processes by setting the FD_CLOEXEC flag for the output file.

PR: bin/140493


# ecbb6d34 20-Dec-2009 Jaakko Heinonen <jh@FreeBSD.org>

Avoid sharing the file descriptor of the output file with traced
processes by setting the FD_CLOEXEC flag for the output file.

PR: bin/140493
Submitted by: Erik Lax
OK'ed by: delphij
Approved by: trasz (mentor)


# 821df508 12-Dec-2009 Xin LI <delphij@FreeBSD.org>

Revert most part of 200420 as requested, as more review and polish is
needed.


# 6f2d3221 11-Dec-2009 Xin LI <delphij@FreeBSD.org>

Remove unneeded header includes from usr.bin/ except contributed code.

Tested with: make universe


# 216fa4c6 15-May-2009 Xin LI <delphij@FreeBSD.org>

Reduce diff against my local version: replace malloc+memset() cases to calloc().


# ee3b0f6e 12-May-2009 Diomidis Spinellis <dds@FreeBSD.org>

Add -c option to summarize number of calls, errors, and system time.

Reviewed by: alfred


# d5303c80 13-Apr-2009 Xin LI <delphij@FreeBSD.org>

Don't exit until all truss children were exit.


# 89fe547f 14-Feb-2009 Warner Losh <imp@FreeBSD.org>

Add preliminary support for truss on MIPS. It compiles, but has not
been extensively tested. And the ELF64 stuff likely is not quite
right...

# There's a lot of cut-n-paste code here that could easily be
# refactored, at least for FreeBSD syscalls.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 8d0c1fa2 16-May-2008 John Baldwin <jhb@FreeBSD.org>

Retire some stale alpha references.


# 9a55503e 16-May-2008 John Baldwin <jhb@FreeBSD.org>

Teach truss about 32-bit FreeBSD and Linux binaries on amd64. Some
additional work is needed to handle ABI-specific syscall argument parsing,
but this gets the basic tracing working.

MFC after: 1 week


# 3e1b6078 28-Jul-2007 Marcel Moolenaar <marcel@FreeBSD.org>

Syscalls have at most 6 argument, not 5. See mmap(2) for example.
Previously the offset argument to mmap(2) would be bogus as we
weren't reading it in.

Approved by: re (kensmith)


# ef29ac7f 26-Jun-2007 Xin LI <delphij@FreeBSD.org>

MFp4: Bugfixes for truss(1):

- Fix logic handling execve(). We will not be able to
obtain information otherwise.
- truss coredump [1].
- truss does not work against itself [2].

PR: bin/58970 [1], bin/45193 [2]
Submitted by: Howard Su
Approved by: re (kensmith)


# 5d2d083c 09-Apr-2007 Xin LI <delphij@FreeBSD.org>

Make use of ptrace(2) instead of procfs in truss(1), eliminating
yet another need of an available /proc/ mount.

Tested with: make universe
Submitted by: howardsu
Reviewed by: alfred


# 081e5c48 15-May-2006 Pav Lucistnik <pav@FreeBSD.org>

- Add decoding of kse_release, kevent, sigprocmask, unmount, socket, getrusage,
rename, __getcwd, shutdown, getrlimit, setrlimit, _umtx_lock, _umtx_unlock,
pathconf, truncate, ftruncate, kill

- Decode more arguments of open, mprot, *stat, and fcntl.

- Convert all constant-macro and bitfield decoding to lookup tables; much
cleaner than previous code.

- Print the timestamp of process exit and signal reception when -d or -D are in
use

- Try six times with 1/2 second delay to debug the child

PR: bin/52190 (updated)
Submitted by: Dan Nelson <dnelson@allantgroup.com>
Approved by: alfred


# 7fa9dc1c 04-Jan-2006 Peter Grehan <grehan@FreeBSD.org>

Add powerpc support for truss.

Initial work by: Orlando Bassotto < orlando at break net >
Modified by: grehan


# 0cf21b4f 02-Jan-2006 Brian Somers <brian@FreeBSD.org>

Add a -s flag for the same functionality as strace. Introduce a Name
type which is a String type that has no -s limitations applied to it.
Change most Strings in the code to Names and add a few extra syscalls,
namely munmap, read, rename and symlink. This was enough to facilitate
following file descriptor allocations in the code more easily and
getting a hint at what's being read/written from/to files. More
syscalls should really be added.

While here, fix an off-by-one bug in the buffer truncation code and
add a fflush so that truss's output reflects the syscall that the
program is stuck in.

Sponsored by: Sophos/Activestate
MFC after: 2 weeks


# 72aa911a 26-Mar-2005 Alfred Perlstein <alfred@FreeBSD.org>

When doing the initial open of the proc via procfs, complain if we are
unable to open the /proc/pid/mem file. Otherwise doing a truss on
a nonexistant pid makes us return success even though no such process
exists.


# 5321ae86 26-Mar-2005 Alfred Perlstein <alfred@FreeBSD.org>

I've been working on this somewhat so I'm moving the
parts I'm touching to be as style(9) compliant as I can.


# d75300bf 17-Jul-2004 Alfred Perlstein <alfred@FreeBSD.org>

When reporting reciept of a signal, print the signal's name.


# a5d31d16 12-Jun-2004 David Malone <dwmalone@FreeBSD.org>

A first stab at truss support for amd64, basically cogged from i386.
It seems to work in my limited tests.


# 5cdf6a13 27-Dec-2003 Martin Cracauer <cracauer@FreeBSD.org>

Fix signal behaviour.

In my last change I made sure that the signal as reported from a truss
exit is the same as if truss wasn't between parent and trussed
program. I was smart enough to not have it coredump on SIGQUIT but it
didn't ocur to me SIGSEGV might cause a coredump, too :-)

So get rid of SIGQUIT extra hack and limit coredumpsize to zero
instead.

Tested: still works, correct signal reported. No more codedumps from
SIGSEGV in the trussed proces. This file compiles cleanly on AMD64
(sledge).

PR:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
MFC after:


# 1bcb5f5a 08-Nov-2003 Marcel Moolenaar <marcel@FreeBSD.org>

Port truss(1) to 64-bit architectures:
o Syscall return values do not fit in int on 64-bit architectures.
Change the type of retval in <arch>_syscall_exit() to long and
change the prototype of said function to return a long as well.
o Change the prototype of print_syscall_ret() to take a long for
the return address and change the format string accordingly.
o Replace the code sequence
tmp = malloc(X);
sprintf(tmp, format, ...);
with X by definition too small on 64-bit platforms by
asprintf(&tmp, format, ...);

With these changes the output makes sense again, although it does
mess up the tabulation on ia64. Go widescreen...

Not tested on: alpha, sparc64.


# b956c13c 07-Sep-2003 Philippe Charnier <charnier@FreeBSD.org>

Add FBSDID. Do not \n terminate warnx() argument. fprint() -> warnx().


# a3e32192 09-Nov-2002 Marcel Moolenaar <marcel@FreeBSD.org>

Port to ia64. It builds, but usability is very limited.


# 1d631f7e 06-Oct-2002 Mike Barcroft <mike@FreeBSD.org>

Don't depend on <signal.h> to include <sys/time.h>, instead include
<sys/time.h> directly. This is mostly bogus since CLOCK_REALTIME
should be defined in <time.h>, which these files already include.


# 37169f94 05-Aug-2002 Matthew N. Dodd <mdodd@FreeBSD.org>

- Use time.h not sys/time.h.
- Fix printf format errors.

Submitted by: bde


# 203098d8 04-Aug-2002 Matthew N. Dodd <mdodd@FreeBSD.org>

Use timespec not timeval.


# f84c971a 04-Aug-2002 Jake Burkholder <jake@FreeBSD.org>

Ported to sparc64.


# c69d8442 04-Aug-2002 Bruce Evans <bde@FreeBSD.org>

Include <sys/time.h> for the declaration of struct timeval. Do not
depend on namespace pollution in <signal.h>. (truss shouldn't be
using timevals anyway, since it was implemented long after timevals
were obsoleted by timespecs.)


# 9897b203 03-Aug-2002 Matthew N. Dodd <mdodd@FreeBSD.org>

Add options to print the argument and environment string parameters to
execve().

This could be done in a more general manner but it still wouldn't
be very pretty.

MFC after: 3 weeks


# 0629483c 03-Aug-2002 Matthew N. Dodd <mdodd@FreeBSD.org>

Add a "FreeBSD ELF32" entry to ex_types[].


# 0d0bd00e 03-Aug-2002 Matthew N. Dodd <mdodd@FreeBSD.org>

Add options to print absolute and relative timestamps.

PR: bin/25587 (in part)
MFC after: 3 weeks


# c03bfcc8 03-Aug-2002 Matthew N. Dodd <mdodd@FreeBSD.org>

Allow tracking fork()ed children.

PR: bin/25587 (in part)
MFC after: 3 weeks


# ec0bed25 03-Aug-2002 Matthew N. Dodd <mdodd@FreeBSD.org>

Parameterize globals.

PR: bin/25587 (in part)
MFC after: 3 weeks


# bfc3d86a 19-Jul-2002 Mark Murray <markm@FreeBSD.org>

s/inline/__inline/


# f81e3ffe 16-May-2002 Peter Wemm <peter@FreeBSD.org>

OOPS! rev 1.16 accidently changed the default outfile from stderr to
stdout. Unfortunately, DES mfc'ed this change in 1.15.2.1 (this
part probably should not have been) so it is broken there too.
truss is documented to use stderr, and other implementations use stderr.

Submitted by: Arne Dag Fidjestøl <adf@idi.ntnu.no>


# 4525f3a8 07-Feb-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Fix the code that selects the default binary type if the actual type can't
be determined.

PR: bin/34698
Submitted by: (in part) Stefan Farfeleder <e0026813@stud3.tuwien.ac.at>
MFC after: 1 weeks


# 1be5d704 11-Dec-2001 Mark Murray <markm@FreeBSD.org>

Partial WARNS=1 fizes with NO_WERROR set to prevent world breakage.
Use __FBSDID().


# 6303ee4e 22-Oct-2001 Dag-Erling Smørgrav <des@FreeBSD.org>

Back out part of previous commit: remove #include <sys/proc.h>.


# 580e0a2b 21-Oct-2001 Dag-Erling Smørgrav <des@FreeBSD.org>

#include <sys/proc.h> where needed (for the stop event definitions) and
reorder includes everywhere to conform to style(9).


# 9a2e7f15 13-Aug-2001 Peter Wemm <peter@FreeBSD.org>

Initialize outfile in main()


# 89361835 09-Jan-2000 Sean Eric Fagan <sef@FreeBSD.org>

Handle the case where we truss an SUGID program -- in particular, we need
to wake up any processes waiting via PIOCWAIT on process exit, and truss
needs to be more aware that a process may actually disappear while it's
waiting.

Reviewed by: Paul Saab <ps@yahoo-inc.com>


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# dcbdc0b9 20-Dec-1998 Mike Smith <msmith@FreeBSD.org>

Flush the output file before exiting; short-lived programs don't even fill
the stdio buffer.


# 50cc4492 02-Oct-1998 Sean Eric Fagan <sef@FreeBSD.org>

Alpha support for truss. I tested this on both bento and beast (thanks,
Jordan, for pointing me at beast!). There should be no change for the
i386 version.


# 3625b514 06-Sep-1998 Sean Eric Fagan <sef@FreeBSD.org>

Use a default execution type if none of the listed ones match. This
uses the first type listed in the array as the default type. This isn't
perfect, but I thought it would be better than nothing.


# 9a4902a9 24-Aug-1998 Martin Cracauer <cracauer@FreeBSD.org>

When exiting on SIGINT, exit with signal status


# 22694eba 06-Jul-1998 Bruce Evans <bde@FreeBSD.org>

Fixed printf format errors.


# ad6af66e 06-Jan-1998 John-Mark Gurney <jmg@FreeBSD.org>

include sys so it builds on 2.2.x
also, fix misspelling of -1 (as EOF for getopt)


# 3cf51049 05-Jan-1998 Philippe Charnier <charnier@FreeBSD.org>

Sort Xrefs. Use err(3). Remove uneeded #include.
Correct usage: one of {-p pid, command} is required.
Open output file when command line is fully analyzed: incorrect `truss -o f'
command does not create an empty file anymore.


# 09d64da3 20-Dec-1997 Sean Eric Fagan <sef@FreeBSD.org>

Add some copyright and license terms, at Jordan's request. Note that
syscall.h just refers to another file for the copyright notice.


# d7b7dcba 12-Dec-1997 Sean Eric Fagan <sef@FreeBSD.org>

Change the ioctls for procfs around a bit; in particular, whever possible,
change from

ioctl(fd, PIOC<foo>, &i);

to

ioctl(fd, PIOC<foo>, i);

This is going from the _IOW to _IO ioctl macro. The kernel, procctl, and
truss must be in synch for it all to work (not doing so will get errors about
inappropriate ioctl's, fortunately). Hopefully I didn't forget anything :).


# ad9e0260 06-Dec-1997 Sean Eric Fagan <sef@FreeBSD.org>

Complain about empty command lines.


# 87893934 06-Dec-1997 Peter Wemm <peter@FreeBSD.org>

recognize "FreeBSD ELF" as an executable type
close() takes a fd, not a char * :-)


# 95c4ef65 06-Dec-1997 Peter Wemm <peter@FreeBSD.org>

#include <unistd.h> to get it to compile

Submitted by: Andreas Klemm <andreas@klemm.gtn.com>


# bbeaf6c0 05-Dec-1997 Sean Eric Fagan <sef@FreeBSD.org>

Truss program. Requires procfs.