History log of /freebsd-current/usr.bin/truss/syscall.h
Revision Date Author Comments
# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# b9b86b67 22-Jun-2022 Dmitry Chagin <dchagin@FreeBSD.org>

kdump: Decode getitimer, setitimer which argument

Reviewed by: jhb (previous version, without truss)
Differential revision: https://reviews.freebsd.org/D35231
MFC after: 2 weeks


# b1ad6a90 28-Mar-2022 Brooks Davis <brooks@FreeBSD.org>

syscallarg_t: Add a type for system call arguments

This more clearly differentiates system call arguments from integer
registers and return values. On current architectures it has no effect,
but on architectures where pointers are not integers (CHERI) and may
not even share registers (CHERI-MIPS) it is necessiary to differentiate
between system call arguments (syscallarg_t) and integer register values
(register_t).

Obtained from: CheriBSD

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D33780


# f3f3e3c4 03-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

fd: add close_range(..., CLOSE_RANGE_CLOEXEC)

For compatibility with Linux.

MFC after: 3 days
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34424


# 0910a41e 12-Jan-2022 Brooks Davis <brooks@FreeBSD.org>

Revert "syscallarg_t: Add a type for system call arguments"

Missed issues in truss on at least armv7 and powerpcspe need to be
resolved before recommit.

This reverts commit 3889fb8af0b611e3126dc250ebffb01805152104.
This reverts commit 1544e0f5d1f1e3b8c10a64cb899a936976ca7ea4.


# 1544e0f5 12-Jan-2022 Brooks Davis <brooks@FreeBSD.org>

syscallarg_t: Add a type for system call arguments

This more clearly differentiates system call arguments from integer
registers and return values. On current architectures it has no effect,
but on architectures where pointers are not integers (CHERI) and may
not even share registers (CHERI-MIPS) it is necessiary to differentiate
between system call arguments (syscallarg_t) and integer register values
(register_t).

Obtained from: CheriBSD

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D33780


# cf0ee873 12-Sep-2021 Konstantin Belousov <kib@FreeBSD.org>

Drop cloudabi

According to https://github.com/NuxiNL/cloudlibc:
CloudABI is no longer being maintained. It was an awesome experiment,
but it never got enough traction to be sustainable.

There is no reason to keep it in FreeBSD.

Approved by: ed (private mail)
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D31923


# 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


# 90da2c79 05-Feb-2021 Mark Johnston <markj@FreeBSD.org>

truss: Decode sendfile(2) arguments

MFC after: 2 weeks


# bb24ee2b 10-Dec-2020 Thomas Munro <tmunro@FreeBSD.org>

truss: Add AIO syscalls.

Display the arguments of aio_read(2), aio_write(2), aio_suspend(2),
aio_error(2), aio_return(2), aio_cancel(2), aio_fsync(2), aio_mlock(2),
aio_waitcomplete(2) and lio_listio(2) in human-readable form.

Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D27518


# bcca3425 19-Feb-2020 Kyle Evans <kevans@FreeBSD.org>

truss: decode shm_open2

shm_open2 is similar to shm_open, except it also takes shmflags and optional
name to label the anonymous region for, e.g., debugging purposes.

The appropriate support for decoding shmflags was added to libsysdecode in
r358115.

This is a part of D23733.

Reviewed by: kaktus


# 43ce0d90 18-Sep-2019 Konstantin Belousov <kib@FreeBSD.org>

truss: decode sysctl names.

Submitted by: Pawel Biernacki
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21688


# caa449b6 16-Jul-2019 John Baldwin <jhb@FreeBSD.org>

Use PT_GET_SC_ARGS and PT_GET_SC_RET in truss.

This removes all of the architecture-specific functions from truss.

A per-ABI structure is still needed to map syscall numbers to names
and FreeBSD errno values to ABI error values as well as hold syscall
counters. However, the linker set of ABI structures is now replaced
with a simple table mapping ABI names to structures. This approach
permits sharing the same ABI structure among separate names such as
i386 a.out and ELF binaries as well as ELF v1 vs ELF v2 for powerpc64.

A few differences are visible due to using PT_GET_SC_RET to fetch the
error value of a system call. Note that ktrace/kdump have had the
"new" behaviors for a long time already:
- System calls that return with EJUSTRETURN or ERESTART will now be
noticed and logged as such. Previously sigreturn (which uses
EJUSTRETURN) would report whatever random value was in the register
holding errno from the previous system call for example. Now it
reports EJUSTRETURN.
- System calls that return errno as their error value such as
posix_fallocate() and posix_fadvise() now report non-zero return
values as errors instead of success with a non-zero return value.

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


# 5b05dc5a 28-Oct-2018 Thomas Munro <tmunro@FreeBSD.org>

truss: Fix display of shm_open(SHM_ANON, ...).

Currently truss(1) shows shm_open(SHM_ANON, ...) as shm_open("(null)", ...).
Detect the special value and display it by name.

Reviewed by: jhb, allanjude, tuexen
Approved by: mjg (mentor)
MFC with: r339224
Differential Revision: https://reviews.freebsd.org/D17461


# c8300696 28-Mar-2018 John Baldwin <jhb@FreeBSD.org>

Reformat the enum of syscall argument types.

List enum values on separate lines to minimize diffs as new types are
added. Split the enum values up into groups and use some simple sorting
within groups (scalar enums are sorted by size, then base, all other
groups are generally sorted alphabetically).

No functional change.


# eee07389 28-Mar-2018 John Baldwin <jhb@FreeBSD.org>

Rename ClouduABIFDSFlags to CloudABIFDSFlags.


# a2674e03 15-Jan-2018 Michael Tuexen <tuexen@FreeBSD.org>

Decode msghdr argument of sendmsg() and recvmsg().

Sponsored by: Netflix, Inc.


# 4d7b9809 14-Jan-2018 Michael Tuexen <tuexen@FreeBSD.org>

Improve support for sctp_generic_recvmsg() and sctp_generic_sendmsg()
and add support for sctp_generic_sendmsg_iov().

Handle the struct iovec argument and the struct sctp_sndrcvinfo
arguments.


# ee6e58b2 13-Jan-2018 Michael Tuexen <tuexen@FreeBSD.org>

Add support for readv() and writev() to truss.

Sponsored by: Netflix, Inc.


# 9d9fee3e 28-Nov-2017 John Baldwin <jhb@FreeBSD.org>

Replace a reference to a license in another file with the license text.

The relevant file was recently renamed, so the reference was stale.
In addition, explicit licenses are more typical in our sources.


# ffb66079 24-Nov-2017 John Baldwin <jhb@FreeBSD.org>

Decode kevent structures logged via ktrace(2) in kdump.

- Add a new KTR_STRUCT_ARRAY ktrace record type which dumps an array of
structures.

The structure name in the record payload is preceded by a size_t
containing the size of the individual structures. Use this to
replace the previous code that dumped the kevent arrays dumped for
kevent(). kdump is now able to decode the kevent structures rather
than dumping their contents via a hexdump.

One change from before is that the 'changes' and 'events' arrays are
not marked with separate 'read' and 'write' annotations in kdump
output. Instead, the first array is the 'changes' array, and the
second array (only present if kevent doesn't fail with an error) is
the 'events' array. For kevent(), empty arrays are denoted by an
entry with an array containing zero entries rather than no record.

- Move kevent decoding tables from truss to libsysdecode.

This adds three new functions to decode members of struct kevent:
sysdecode_kevent_filter, sysdecode_kevent_flags, and
sysdecode_kevent_fflags.

kdump uses these helper functions to pretty-print kevent fields.

- Move structure definitions for freebsd11 and freebsd32 kevent
structures to <sys/event.h> so that they can be shared with userland.
The 32-bit structures are only exposed if _WANT_KEVENT32 is defined.
The freebsd11 structures are only exposed if _WANT_FREEBSD11_KEVENT is
defined. The 32-bit freebsd11 structure requires both.

- Decode freebsd11 kevent structures in truss for the compat11.kevent()
system call.

- Log 32-bit kevent structures via ktrace for 32-bit compat kevent()
system calls.

- While here, constify the 'void *data' argument to ktrstruct().

Reviewed by: kib (earlier version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D12470


# 13e5e6b6 30-Aug-2017 John Baldwin <jhb@FreeBSD.org>

Decode signal information returned by system calls.

Specifically, decode the siginfo structure returned by sigtimedwait(),
sigwaitinfo(), and wait6(). While here, also decode the signal number
returned in the second argument to sigwait().


# 8207f12d 23-Jun-2017 Warner Losh <imp@FreeBSD.org>

Decode FreeBSD 11 compat stat, fstat and lstat calls.


# a4110f9f 16-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments to sched_* family of system calls.

This includes decoding both scheduler policy constants and the sched_param
structure for sched_get_priority_max(), sched_get_priority_min(),
sched_getparam(), sched_getscheduler(), sched_rr_get_interval(),
sched_setparam(), and sched_setscheduler().


# 3cd40bc3 09-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments to rtprio() and rtprio_thread().


# 4152441f 09-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode the 'howto' argument to reboot().


# dd0c462c 09-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode the arguments to quotactl().


# 5ac1c7ac 09-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode the arguments to ptrace().

This does not decode structures returned by ptrace().


# ad419d33 09-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments to getpriority() and setpriority().


# 114aeee0 08-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments passed to msync().


# 8acc8e78 08-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode flags passed to mount(), nmount(), and unmount().


# 94bde755 07-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments to mlock(), mlockall(), and munlock().


# 2d9c9988 07-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments to minherit().


# 26606dca 07-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments passed to extended attribute related system calls.

The cmd argument passed to extattrctl() is not decoded as a string constant
but is just printed in hex. The value is filesystem-specific but in
practice is only used with UFS1 filesystems.


# 7ce44f08 07-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments to ACL related system calls.

This only decodes the raw arguments but not the contents of the struct acl
objects.


# b60a095b 04-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments to dup, dup2, getdirentries, pread, and pwrite.

- dup and dup2 print fd arguments in decimal.
- pread and pwrite are similar to read and write with the addition of the
file offset.
- getdirentries displays the output entries as a string for now and also
prints the value returned in *basep. Eventually the buffer for
getdirentries should perhaps be decoded as an array of dirent
structures.

PR: 214885
Submitted by: Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM>


# ee8aa41d 03-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode the 'who' argument passed to getrusage().

Add a new sysdecode_getrusage_who() which decodes the RUSAGE_* constant
passed as the first argument to getrusage(). Use this function in both
kdump and truss to decode the first argument to getrusage().

PR: 215448
Submitted by: Anton Yuzhaninov <citrin+pr@citrin.ru>
MFC after: 1 month


# ebb2cc40 02-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode the argument passed to cap_getmode().

The returned integer value is output.


# 7136a1d9 02-Jun-2017 John Baldwin <jhb@FreeBSD.org>

Decode the arguments passed to __cap_rights_get() and cap_rights_limit().

Submitted by: tobik


# 8b429b65 02-May-2017 Michael Tuexen <tuexen@FreeBSD.org>

Decode the fourth argument of sendto and recvfrom call.


# 832af457 02-May-2017 Michael Tuexen <tuexen@FreeBSD.org>

Add support for [gs]etsockopt().


# ecac235b 03-May-2017 Michael Tuexen <tuexen@FreeBSD.org>

Decode the third argument of socket().


# 58227c60 03-May-2017 Michael Tuexen <tuexen@FreeBSD.org>

Add Socklent for handling args of type socklen_t.


# 98fdbeec 18-Mar-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments to madvise().


# e261fb2a 18-Mar-2017 John Baldwin <jhb@FreeBSD.org>

Add a Sizet type for 'size_t' values and use it instead of Int.

Various size_t arguments were previously decoded as Int values instead
which would have truncated values above 2^31 on 64-bit systems.


# 94e854c5 18-Mar-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments passed to kldsym() and kldunloadf().

This does not currently decode the kld_sym_lookup structure passed to
kldsym().


# ab43bedc 18-Mar-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments passed to getfsstat().

Note that this does not yet decode the statfs structures returned by
getfsstat().


# dd92181f 18-Mar-2017 John Baldwin <jhb@FreeBSD.org>

Decode flock() operation.


# 27459358 18-Mar-2017 John Baldwin <jhb@FreeBSD.org>

Decode file flags passed to *chflags*().

While here, decode arguments passed to fchflags() and chflagsat().


# d2a97485 18-Mar-2017 John Baldwin <jhb@FreeBSD.org>

Decode arguments passed to posix_fadvise().


# bed418c8 18-Mar-2017 John Baldwin <jhb@FreeBSD.org>

Decode the arguments passed to cap_fcntls_get() and cap_fcntls_limit().


# 1175b23f 05-Dec-2016 John Baldwin <jhb@FreeBSD.org>

Rework syscall structure lookups.

Avoid always using an O(n^2) loop over known syscall structures with
strcmp() on each system call. Instead, use a per-ABI cache indexed by
the system call number. The first 1024 system calls (which should cover
all of the normal system calls in currently-supported ABIs) use a flat array
indexed by the system call number to find system call structure. For other
system calls, a linked list of structures storing an integer to structure
mapping is stored in the ABI. The linked list isn't very smart, but it
should only be used by buggy applications invoking unknown system calls.

This also fixes handling of unknown system calls which currently trigger
a NULL pointer dereference.

Reviewed by: kib
MFC after: 2 weeks


# 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


# 00ddbdf2 16-Feb-2016 John Baldwin <jhb@FreeBSD.org>

Fetch the current thread and it's syscall state from the trussinfo object
instead of passing some of that state as arguments to print_syscall() and
print_syscallret(). This just makes the calls of these functions shorter
and easier to read.


# 808d9805 07-Oct-2015 Ed Schouten <ed@FreeBSD.org>

Properly format pointer size independent CloudABI system calls.

CloudABI has approximately 50 system calls that do not depend on the
pointer size of the system. As the ABI is pretty compact, it takes
little effort to each truss(8) the formatting rules for these system
calls. Start off by formatting pointer size independent system calls.

Changes:

- Make it possible to include the CloudABI system call definitions in
FreeBSD userspace builds. Add ${root}/sys to the truss(8) Makefile so
we can pull in <compat/cloudabi/cloudabi_syscalldefs.h>.
- Refactoring: patch up amd64-cloudabi64.c to use the CLOUDABI_*
constants instead of rolling our own table.
- Add table entries for all of the system calls.
- Add new generic formatting types (UInt, IntArray) that we'll be using
to format unsigned integers and arrays of integers.
- Add CloudABI specific formatting types.

Approved by: jhb
Differential Revision: https://reviews.freebsd.org/D3836


# 195aef99 06-Oct-2015 Bryan Drewery <bdrewery@FreeBSD.org>

truss: Add support for utrace(2).

This uses the kdump(1) utrace support code directly until a common library
is created.

This allows malloc(3) tracing with MALLOC_CONF=utrace:true and rtld tracing
with LD_UTRACE=1. Unknown utrace(2) data is just printed as hex.

PR: 43819 [inspired by]
Reviewed by: jhb
MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D3819


# 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


# a776866b 03-Oct-2015 Bryan Drewery <bdrewery@FreeBSD.org>

Add decoding for struct statfs.

Reviewed by: jhb (briefly)


# 72df19e7 01-Oct-2015 John Baldwin <jhb@FreeBSD.org>

The id_t type used to pass IDs to wait6(2) and procctl(6) is a 64-bit
integer. Fix the argument decoding to treat this as a quad instead of an
int. This includes using QUAD_ALIGN and QUAD_SLOTS as necessary. To
continue printing IDs in decimal, add a new QuadHex argument type that
prints a 64-bit integer in hex, use QuadHex for the existing off_t arguments,
repurpose Quad to print a 64-bit integer in decimal, and use Quad for id_t
arguments.

This fixes the decoding of wait6(2) and procctl(2) on 32-bit platforms.


# 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


# 9e07e493 29-Sep-2015 John Baldwin <jhb@FreeBSD.org>

Trim trailing whitespace.


# 68055893 20-Aug-2015 John Baldwin <jhb@FreeBSD.org>

Handle the conditional decoding of execve() argument and environment
arrays generically rather than duplicating a hack in all of the backends.
- Add two new system call argument types and use them instead of StringArray
for the argument and environment arguments execve and linux_execve.
- Honor the -a/-e flags in the handling of these new types.
- Instead of printing "<missing argument>" when the decoding is disabled,
print the raw pointer value.


# b289a8d7 17-Aug-2015 John Baldwin <jhb@FreeBSD.org>

- Decode the arguments for several signal-related system calls: sigpending,
sigqueue, sigreturn, sigsuspend, sigtimedwait, sigwait, sigwaitinfo, and
thr_kill.
- Print signal sets as a structure (with {}'s) and in particular use this to
differentiate empty sets from a NULL pointer.
- Decode arguments for some other system calls: issetugid, pipe2, sysarch
(operations are only decoded for amd64 and i386), and thr_self.


# 7d897327 06-Aug-2015 John Baldwin <jhb@FreeBSD.org>

Decode the arguments passed to the *at() family of system calls. This is
especially useful now that libc's open() always calls openat(). While here,
fix a few other things:
- Decode the mode argument passed to access(), eaccess(), and faccessat().
- Decode the atfd paramete to pretty-print AT_FDCWD.
- Decode the special AT_* flags used with some of the *at() system calls.
- Decode arguments for fchmod(), lchmod(), fchown(), lchown(), eaccess(),
and futimens().
- Decode both of the timeval structures passed to futimes() instead of just
the first one.


# fdb5bf37 13-Oct-2014 John Baldwin <jhb@FreeBSD.org>

Decode the arguments passed to _umtx_op(). In particular, decode the
opcode.

MFC after: 1 week
Sponsored by: Norse


# 1c99a22a 24-Apr-2014 Steven Hartland <smh@FreeBSD.org>

Add Linux socket call decoding to truss

MFC after: 1 month


# ce42e793 18-Mar-2014 Attilio Rao <attilio@FreeBSD.org>

Remove dead code from umtx support:
- Retire long time unused (basically always unused) sys__umtx_lock()
and sys__umtx_unlock() syscalls
- struct umtx and their supporting definitions
- UMUTEX_ERROR_CHECK flag
- Retire UMTX_OP_LOCK/UMTX_OP_UNLOCK from _umtx_op() syscall

__FreeBSD_version is not bumped yet because it is expected that further
breakages to the umtx interface will follow up in the next days.
However there will be a final bump when necessary.

Sponsored by: EMC / Isilon storage division
Reviewed by: jhb


# 55648840 19-Sep-2013 John Baldwin <jhb@FreeBSD.org>

Extend the support for exempting processes from being killed when swap is
exhausted.
- Add a new protect(1) command that can be used to set or revoke protection
from arbitrary processes. Similar to ktrace it can apply a change to all
existing descendants of a process as well as future descendants.
- Add a new procctl(2) system call that provides a generic interface for
control operations on processes (as opposed to the debugger-specific
operations provided by ptrace(2)). procctl(2) uses a combination of
idtype_t and an id to identify the set of processes on which to operate
similar to wait6().
- Add a PROC_SPROTECT control operation to manage the protection status
of a set of processes. MADV_PROTECT still works for backwards
compatability.
- Add a p_flag2 to struct proc (and a corresponding ki_flag2 to kinfo_proc)
the first bit of which is used to track if P_PROTECT should be inherited
by new child processes.

Reviewed by: kib, jilles (earlier version)
Approved by: re (delphij)
MFC after: 1 month


# 34763d1c 12-Sep-2013 John Baldwin <jhb@FreeBSD.org>

- Decode the idtype argument passed to wait6() in kdump and truss.
- Don't treat an options argument of 0 to wait4() as an error in
kdump.
- Decode the wait options passed to wait4() and wait6() in truss
and decode the returned rusage and exit status.

Approved by: re (kib)
MFC after: 1 week


# 9e1db66e 31-Jul-2013 Mark Johnston <markj@FreeBSD.org>

Properly print arguments to vfork(2) and rfork(2).

PR: 180976
Submitted by: Yuri <yuri@tsoft.com> (original patch)
MFC after: 1 week


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

- Style(9) cleanup.

Approved by: kib (mentor)


# 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.


# 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.


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

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

Reviewed by: alfred


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

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


# d8984f48 31-Jul-2008 Dag-Erling Smørgrav <des@FreeBSD.org>

Try to make this code slightly less painful to read.


# 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


# 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


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

Support readlink(2) better. Readlink does not nul terminate the
result buffer, so we need to format it ourselves. The problem is
that the length is stored as the return value from readlink, so we
need to pass the return value from our syscall into print_arg.

Motivated by: truss garbage on my screen from reading /etc/malloc.conf.


# fde3a7d1 10-Jul-2004 Alfred Perlstein <alfred@FreeBSD.org>

Decode the "wence" arg to lseek and linux_lseek.


# e45a5a0d 22-Mar-2004 David Malone <dwmalone@FreeBSD.org>

Add support for decoding Timespec, Timeval, Itimerval, Pollfd,
Fd_set and Sigaction structures. Use these for printing the arguments
to sigaction(), nanosleep(), select(), poll(), gettimeofday(),
clock_gettime(), recvfrom(), getitimer() and setitimer().

This is based on Dan's patch from the PR but I've hacked it for
style and some other issues. While Dan has checked this patch, any
goofs are probably my fault.

(The PR also contains support for the dual return values of pipe().
These will follow once I've ported that support to platforms other
than i386.)

PR: 52190
Submitted by: Dan Nelson <dnelson@allantgroup.com>


# 894b8f7a 23-Mar-2004 Alfred Perlstein <alfred@FreeBSD.org>

decode fcntl and mmap arguments.


# 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.


# 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


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

Parameterize globals.

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


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

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


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

Teach truss(1) to display sockaddrs. It currently knows about AF_INET,
AF_INET6 and AF_UNIX sockaddrs, and will recognize accept(), bind(),
connect(), getpeername() and getsockname() as syscalls taking sockaddr
arguments. Some enterprising soul might want to add (and test) support
for the send() / recv() family of syscalls as well.

MFC after: 1 week


# 6cb533fe 18-Mar-2000 Sean Eric Fagan <sef@FreeBSD.org>

Change the output of truss to more closely resemble SysV's. (Yes, it
really is much nicer looking.)

Submitted by: "Matthew N. Dodd" <winter@jurai.net>


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

$Id$ -> $FreeBSD$


# f0ebbc29 10-Aug-1999 Dag-Erling Smørgrav <des@FreeBSD.org>

Teach truss to print symbolic signal names (e.g. SIGHUP instead of 0x01).


# 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.


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

First cut at printing out ioctl names intelligently. Note that this doesn't
handle linux ioctls (yet?). This uses the mkioctl script from kdump,
bless its little heart.

Reviewed by: Mike Smith


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

Truss program. Requires procfs.