History log of /freebsd-10.0-release/usr.bin/truss/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


255708 19-Sep-2013 jhb

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


255493 12-Sep-2013 jhb

- 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


255426 09-Sep-2013 jhb

Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a mapping use
an address in the first 2GB of the process's address space. This flag should
have the same semantics as the same flag on Linux.

To facilitate this, add a new parameter to vm_map_find() that specifies an
optional maximum virtual address. While here, fix several callers of
vm_map_find() to use a VMFS_* constant for the findspace argument instead of
TRUE and FALSE.

Reviewed by: alc
Approved by: re (kib)


254538 19-Aug-2013 jhb

Remove incorrect 'const' qualifier from pointers to dynamic string
buffers I added in the previous commit.

Pointy hat to: jhb
MFC after: 1 month


254430 16-Aug-2013 jhb

Add new mmap(2) flags to permit applications to request specific virtual
address alignment of mappings.
- MAP_ALIGNED(n) requests a mapping aligned on a boundary of (1 << n).
Requests for n >= number of bits in a pointer or less than the size of
a page fail with EINVAL. This matches the API provided by NetBSD.
- MAP_ALIGNED_SUPER is a special case of MAP_ALIGNED. It can be used
to optimize the chances of using large pages. By default it will align
the mapping on a large page boundary (the system is free to choose any
large page size to align to that seems best for the mapping request).
However, if the object being mapped is already using large pages, then
it will align the virtual mapping to match the existing large pages in
the object instead.
- Internally, VMFS_ALIGNED_SPACE is now renamed to VMFS_SUPER_SPACE, and
VMFS_ALIGNED_SPACE(n) is repurposed for specifying a specific alignment.
MAP_ALIGNED(n) maps to using VMFS_ALIGNED_SPACE(n), while
MAP_ALIGNED_SUPER maps to VMFS_SUPER_SPACE.
- mmap() of a device object now uses VMFS_OPTIMAL_SPACE rather than
explicitly using VMFS_SUPER_SPACE. All device objects are forced to
use a specific color on creation, so VMFS_OPTIMAL_SPACE is effectively
equivalent.

Reviewed by: alc
MFC after: 1 month


253850 01-Aug-2013 markj

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

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


252414 30-Jun-2013 mjg

truss: recognize O_DIRECTORY, O_EXEC, O_TTY_INIT and O_CLOEXEC

MFC after: 3 days


247975 07-Mar-2013 cognet

Add arm bits to truss.


247338 26-Feb-2013 delphij

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


247300 26-Feb-2013 delphij

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


245957 27-Jan-2013 mjg

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


245956 27-Jan-2013 mjg

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

MFC after: 3 days


240562 16-Sep-2012 zont

- Make truss thread-aware.

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


240393 12-Sep-2012 zont

- 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


240364 11-Sep-2012 zont

- Remove unused variables.
- Remove redundant return after err(3) call.

Approved by: kib (mentor)


240005 02-Sep-2012 zont

- Style(9) cleanup.

Approved by: kib (mentor)


239898 30-Aug-2012 zont

- Remove unused variables.
- Fix warnings about comparing signed and unsigned ints.

Approved by: kib (mentor)


239611 23-Aug-2012 zont

- Put arguments for print_syscall_ret() function in proper order.
Bug was introduced in r192025.

Approved by: kib (mentor)


239501 21-Aug-2012 zont

- Use pid_t type instead of just int.

Approved by: kib (mentor)


234060 09-Apr-2012 dim

Since truss also uses kdump's mkioctls script, pass the value of ${CPP}
there too, similar to r234058.

MFC after: 1 week


228396 10-Dec-2011 ed

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.


228261 04-Dec-2011 kib

Use explicit information from the kernel to detect the traps due to
syscall entry and leave.

Based on submision by: Dan Nelson <dnelson allantgroup com>
MFC after: 1 month


226608 21-Oct-2011 des

It turns out that truss also used kdump's mkioctls script, and expected
ioctlname() to return a pointer to the name rather than print it. This did
not show up in testing because truss had its own prototype for ioctlname(),
so it would build fine and run fine as long as the program being traced did
not issue an ioctl.

Teach mkioctls to generate different versions of ioctlname() based on its
first command-line argument.

Pointed out by: Garrett Cooper <yanegomi@gmail.com>


222103 19-May-2011 bcr

Fix typos in comments, no functional changes.

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


219347 06-Mar-2011 jilles

Simplify various code that allowed for sys_signame being lower case.

This was changed in r218285.


218707 15-Feb-2011 jhb

Properly check for errors from waitpid().

Submitted by: gcooper
MFC after: 1 week


218285 04-Feb-2011 jilles

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


216224 06-Dec-2010 jh

Don't write the terminating NUL past end of buffer.

PR: bin/152345
Submitted by: Mateusz Guzik


215235 13-Nov-2010 jh

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


214105 20-Oct-2010 ed

Remove setpgid() call before executing child process.

Using a separate process group here is bad, since (for example) job
control in the TTY layer prevents interaction with the TTY, causing the
child process to hang.

Mentioned on: current@
MFC after: 2 weeks


213799 13-Oct-2010 bcr

s/sytem/system in comments, no functional changes.

Reviewed by: alfred@


211935 28-Aug-2010 nwhitehorn

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


211725 23-Aug-2010 imp

MFtbemd:

Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.


209921 12-Jul-2010 nwhitehorn

Teach truss and xlint how to operate on 64-bit PowerPC systems.


204977 10-Mar-2010 imp

Fix copyright spelling.

PR: 139825
Submitted by: Ruslan Mahmatkhanov


203429 03-Feb-2010 rrs

This fix makes it so the args are malloc'd before
we use them (always a good idea ;-0)

This was found and fixed by JC

Obtained from: JC (c.jayachandran@gmail.com)


201386 02-Jan-2010 ed

Build usr.bin/ with WARNS=6 by default.

Also add some missing $FreeBSD$ to keep svn happy.


201350 31-Dec-2009 brooks

The devices that supported EVFILT_NETDEV kqueue filters were removed in
r195175. Remove all definitions, documentation, and usage.

fifo_misc.c:
Remove all kqueue tests as fifo_io.c performs all those that
would have remained.

Reviewed by: rwatson
MFC after: 3 weeks
X-MFC note: don't change vlan_link_state() function signature


200902 23-Dec-2009 ed

Allow proper tracing of posix_openpt(2).


200781 21-Dec-2009 jh

Cast time_t values to intmax_t and use %jd with printf.

OK'ed by: delphij
Approved by: trasz (mentor)


200780 21-Dec-2009 jh

Remove non-working special case for pipe(2) from amd64-fbsd32.c and
i386-fbsd.c. Add pipe(2) to syscall table to decode it's pointer
argument properly and re-add special handling for pipe(2) return value
to print_syscall_ret().

PR: bin/120870
Approved by: trasz (mentor)


200752 20-Dec-2009 jh

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)


200751 20-Dec-2009 jh

Add fork(2), getegid(2), geteuid(2), getgid(2), getpid(2), getpgid(2),
getpgrp(2), getppid(2), getsid(2) and getuid(2) to syscall table to
decode their arguments correctly.

OK'ed by: delphij
Approved by: trasz (mentor)


200462 13-Dec-2009 delphij

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


200420 11-Dec-2009 delphij

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

Tested with: make universe


192943 28-May-2009 delphij

Correct off-by-one issue in truss(1) which happens when system call number
is nsyscalls.

PR: bin/134916
Submitted by: Steven Hartland <steven hartland multiplay co uk>
MFC after: 2 weeks


192153 15-May-2009 delphij

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


192041 13-May-2009 dds

Fix print_syscall_ret parameter order.


192040 13-May-2009 dds

Fix compilation error introduced in r192025.


192025 12-May-2009 dds

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

Reviewed by: alfred


191005 13-Apr-2009 delphij

Don't exit until all truss children were exit.


191004 13-Apr-2009 delphij

Correct a bug where pr_data should have been assigned.


188628 15-Feb-2009 imp

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.


187607 23-Jan-2009 trhodes

Attaching to the init process returns EINVAL,
so give an example that is more likely to work.
Stolen from the ktrace(1) manual page.

PR: 128222
Submitted by: Mateusz Guzik <mjguzik@gmail.com>


181061 31-Jul-2008 des

Try to make this code slightly less painful to read.


179059 16-May-2008 jhb

Retire some stale alpha references.


179051 16-May-2008 jhb

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


175980 05-Feb-2008 des

Revert CLEANDEPFILES commit per ru@'s request; it does not really solve
the problem. The correct fix will follow.


175937 03-Feb-2008 des

Normally, when a header file is removed from the build (as i4b headers
were recently), a simple 'make cleandepend; make depend' is sufficient
to keep the tree buildable after a cvs update when doing incremental
builds.

However, kdump and truss use a script which searches for header files
that define ioctls, and generates C code that includes them. This
script will usually not need updating when a header file is removed,
so the normal dependency mechanism will not realize that it needs to
be re-run. One is therefore left with code that references dead files
but will only be removed by a full 'make clean', which defeats the
purpose of incremental builds.

To work around this, modify the cleandepend target in bsd.dep.mk to
also remove any files listed in a new variable named CLEANDEPFILES,
and modify kdump's and truss's Makefiles accordingly.

MFC after: 2 weeks


175062 03-Jan-2008 jasone

The break() system call takes a pointer argument, not an integer. This
change fixes output for break() on LP64 systems.


171647 28-Jul-2007 marcel

Print integer-typed arguments as integers. This makes sure that
on 64-bit platforms the result is more reliable. For example,
-1 was previously printed as 0xffffffff.

Approved by: re (kensmith)


171646 28-Jul-2007 marcel

Fix handling of Quad-type arguments. Previously, syscalls
containing 64-bit arguments would have explicit padding.
On 64-bit platforms there was no padding, so the dummy
argument was not covering anything. On 32-bit platforms
with weak alignment (i.e. i386) the 64-bit argument did
not need to be aligned, so there too an aditional argument
was introduced. On 32-bit platforms with strong alignment
(i.e. PowerPC) the dummy argument in fact cover the padding.
By elimininating the dummy argument, 64-bit platforms now
have 1 argument less. This also applies to 32-bit platforms
with weak alignment. On PowerPC this doesn't matter, because
the padding is still there. We just don't "name" it.
Deal with those 3 cases.

Approved by: re (kensmith)


171645 28-Jul-2007 marcel

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)


171055 26-Jun-2007 delphij

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)


169861 22-May-2007 ru

Don't want a stray systrace_args.c in objdir.


169845 21-May-2007 keramida

Remove duplicate ' 2' manpage section number.

Submitted by: Rui Paulo
MFC after: 3 days


168569 10-Apr-2007 delphij

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


165100 11-Dec-2006 ru

Add missing markup bits.


162792 29-Sep-2006 ru

Markup fixes.


161547 23-Aug-2006 ru

Remove alpha-specific stuff.


160701 26-Jul-2006 delphij

Make sure that the sc pointer gets initialized. No functional change
should happen with this change.


158631 15-May-2006 pav

- Fix warning when compiling with -DDEBUG

Approved by: alfred


158630 15-May-2006 pav

- 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


158626 15-May-2006 pav

- Fix crash when hitting unknown syscall. Copied from i386-fbsd.c

Approved by: alfred


154047 05-Jan-2006 grehan

Add powerpc support for truss.

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


153963 02-Jan-2006 brian

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


151361 15-Oct-2005 alfred

The kernel accepts sockaddrs with len set to zero for sockaddr_in
types, so refactor the code here to grab them when length is zero.


148580 31-Jul-2005 keramida

Fix all the spelling mistakes I could find in the man pages for words
that have at least 3 characters.

MFC after: 1 week
Thanks to: Music band ``Chingon''
for keeping me company while searching for these.


147389 14-Jun-2005 alfred

Decode chroot(2) args.

Approved by: re


146658 26-May-2005 alfred

decode utimes, lutimes, futimes, chflags, lchflags.


146652 26-May-2005 alfred

decode mkdir args.


144178 27-Mar-2005 alfred

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.


144177 27-Mar-2005 alfred

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.


143109 03-Mar-2005 alfred

Change fix a bug where the length of data written by snprintf was
being mishandled by using accumulation (into an uninitialized
variable) instead of direct assignment.

Reviewed by: scottl


136910 24-Oct-2004 ru

For variables that are only checked with defined(), don't provide
any fake value.


134901 07-Sep-2004 dd

Improve markup and language.


134799 05-Sep-2004 marcel

Fix Quad handling on 64-bit architectures. On 64-bit machines, a Quad
also occupies a single slot. There's no need for any special handling
of Quads. While here, remove the silly make_quad() function. We have
the 2 longs on 32-bit machines already lined up in the argument array,
so we can fetch the Quad with a simple cast.

Before:
lseek(1,0x123456789,0xd0d0d0d0d0d0d0d0) = 4886718345 (0x123456789)
After:
lseek(1,0x123456789,SEEK_SET) = 4886718345 (0x123456789)


134718 03-Sep-2004 alfred

Update doc dates.

Pointed out by: ru


134714 03-Sep-2004 alfred

xref and give a hint as to what procctl can be used for.


133349 08-Aug-2004 alfred

don't seg if the syscall is invalid for i386fbsd.


132799 28-Jul-2004 stefanf

Use the length modifier 'll' instead of 'q' to print long longs.


132308 17-Jul-2004 alfred

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.


132306 17-Jul-2004 alfred

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


131893 10-Jul-2004 alfred

Decode the "wence" arg to lseek and linux_lseek.


130421 13-Jun-2004 bms

Fix unterminated RCSID.

Submitted by: Liam J. Foy


130394 12-Jun-2004 dwmalone

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


130347 11-Jun-2004 phk

COMPAT_SUNOS is gone.


127332 23-Mar-2004 dwmalone

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>


127331 23-Mar-2004 dwmalone

Use pread to implement pread, rather than taking a detour throug stdio.

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


127329 23-Mar-2004 alfred

decode mprotect args while i'm here.


127328 23-Mar-2004 alfred

decode fcntl and mmap arguments.


124217 07-Jan-2004 dwmalone

Move declarations of Procfd to a header file.


124216 07-Jan-2004 dwmalone

Fix a printf format warning.


123916 28-Dec-2003 cracauer

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:


122606 13-Nov-2003 marcel

Do not ignore any possible errors that fseeko() may have. The fact
is that fseeko() fails in very predictable and frequent ways on ia64.
This is because the offset is actually an address in the process'
address space, which on ia64 can be larger than long (for lseek) or
off_t (for fseeko). The crux is the signedness. The register stack
and memory stack are in region 4 on ia64. This means that the sign bit
is 1. The large positive virtual address is wrongly interpreted as
a negative file offset.

There's no quick fix. Even if you get around the API by using a
SEEK_SET up to LONG_MAX and follow it up with a SEEK_CUR for the
remainder, the kernel simply cannot deal with it. and the second
seek will just fail.

Therefore, this change does not actually fix the root cause. It just
makes sure we're not spitting out all kinds of garbage or that the
get_struct() function in particular does not cause truss(1) to exit.
This, I might add, invariably happened way too soon for truss(1) to
be of any use on ia64...


122348 09-Nov-2003 marcel

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.


121606 27-Oct-2003 marcel

Fix truss so that it doesn't abort/exit when a syscall has been given
a NULL-pointer for a sockaddr argument.


119852 07-Sep-2003 charnier

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


118505 05-Aug-2003 des

send() and recv() are just wrappers, not actual syscalls.


118483 05-Aug-2003 des

Add recv(2), recvfrom(2), send(2) and sendfrom(2).


118367 02-Aug-2003 marcel

Fix truss on ia64. The syscall arguments are written to the trap
frame, occupying scratch registers r16 and up. We don't have to
save any scratch registers for syscalls, so we have plenty of
room there. Consequently, when we fetch the registers from the
process, we automaticly have all the arguments and don't need
to read them seperately.


115886 06-Jun-2003 marcel

Use cat(1) instead of cp(1) so as not to break -DNOCLEAN builds
when the file permissions of source files don't allow writing.


115084 16-May-2003 marcel

Revamp of the syscall path, exception and context handling. The
prime objectives are:
o Implement a syscall path based on the epc inststruction (see
sys/ia64/ia64/syscall.s).
o Revisit the places were we need to save and restore registers
and define those contexts in terms of the register sets (see
sys/ia64/include/_regset.h).

Secundairy objectives:
o Remove the requirement to use contigmalloc for kernel stacks.
o Better handling of the high FP registers for SMP systems.
o Switch to the new cpu_switch() and cpu_throw() semantics.
o Add a good unwinder to reconstruct contexts for the rare
cases we need to (see sys/contrib/ia64/libuwx)

Many files are affected by this change. Functionally it boils
down to:
o The EPC syscall doesn't preserve registers it does not need
to preserve and places the arguments differently on the stack.
This affects libc and truss.
o The address of the kernel page directory (kptdir) had to
be unstaticized for use by the nested TLB fault handler.
The name has been changed to ia64_kptdir to avoid conflicts.
The renaming affects libkvm.
o The trapframe only contains the special registers and the
scratch registers. For syscalls using the EPC syscall path
no scratch registers are saved. This affects all places where
the trapframe is accessed. Most notably the unaligned access
handler, the signal delivery code and the debugger.
o Context switching only partly saves the special registers
and the preserved registers. This affects cpu_switch() and
triggered the move to the new semantics, which additionally
affects cpu_throw().
o The high FP registers are either in the PCB or on some
CPU. context switching for them is done lazily. This affects
trap().
o The mcontext has room for all registers, but not all of them
have to be defined in all cases. This mostly affects signal
delivery code now. The *context syscalls are as of yet still
unimplemented.

Many details went into the removal of the requirement to use
contigmalloc for kernel stacks. The details are mostly CPU
specific and limited to exception_save() and exception_restore().
The few places where we create, destroy or switch stacks were
mostly simplified by not having to construct physical addresses
and additionally saving the virtual addresses for later use.

Besides more efficient context saving and restoring, which of
course yields a noticable speedup, this also fixes the dreaded
SMP bootup problem as a side-effect. The details of which are
still not fully understood.

This change includes all the necessary backward compatibility
code to have it handle older userland binaries that use the
break instruction for syscalls. Support for break-based syscalls
has been pessimized in favor of a clean implementation. Due to
the overall better performance of the kernel, this will still
be notived as an improvement if it's noticed at all.

Approved by: re@ (jhb)


113501 15-Apr-2003 mdodd

Decode a few more syscalls.


111178 20-Feb-2003 ru

Removed extra parentheses.


111176 20-Feb-2003 ru

Fixed comment.


107276 26-Nov-2002 ru

mdoc(7) police: markup polishing.

Approved by: re


106716 10-Nov-2002 marcel

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


106713 09-Nov-2002 dwmalone

Various cleanups of truss:
1) Missing include.
2) Constness.
3) ANSIfication.
4) Avoid some shadowing.
5) Add/clarify some error messages.
6) Some int functions were using return without a value.
7) Mark some parameters as unused.
8) Cast a value we know is non-negative to a size_t before comparing.


106712 09-Nov-2002 dwmalone

Check if name is NULL before we strcmp the syscall name. This was
sometimes triggered if you began trussing a process while it was
in a syscall, as the name is filled in when the syscall is made.


104581 06-Oct-2002 mike

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.


101458 07-Aug-2002 mdodd

Remove an unnecessary cast.


101423 06-Aug-2002 mdodd

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

Submitted by: bde


101381 05-Aug-2002 mdodd

Remove extra space in output.


101374 05-Aug-2002 mdodd

Diff reduction.


101373 05-Aug-2002 mdodd

Use timespec not timeval.


101320 04-Aug-2002 jake

Ported to sparc64.


101309 04-Aug-2002 bde

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


101289 04-Aug-2002 mdodd

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


101288 04-Aug-2002 mdodd

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


101286 04-Aug-2002 mdodd

Terminate the output line when a non-returning syscall is printed.


101285 04-Aug-2002 mdodd

Add options to print absolute and relative timestamps.

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


101283 04-Aug-2002 mdodd

Allow tracking fork()ed children.

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


101282 04-Aug-2002 mdodd

Parameterize globals.

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


100357 19-Jul-2002 markm

s/inline/__inline/


96756 16-May-2002 peter

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>


95854 01-May-2002 peter

Do not bother with #include <machine/psl.h> since it is just a stub file
that says something like "/* Not used on Alpha */".


95225 21-Apr-2002 dwmalone

Use fseeko and uintptr_t to make sure that we get a sensible offset
when trying to read from the stack.

PR: 37104
Submitted by: Thomas Quinot <thomas@cuivre.fr.eu.org>
MFC after: 3 weeks


95124 20-Apr-2002 charnier

Use `The .Nm utility'


94432 11-Apr-2002 ru

I now don't seem to be able to reproduce the -DNOCLEAN buildworld
breakage with ioctl.c. The .depend file should track dependencies
just fine, and the worst we can have is to miss new ioctls.

But I still think it's a good idea to have -DNOCLEAN build produce
the same ioctl.c as it would without -DNOCLEAN.

Prodded for a long time by: bde


90416 08-Feb-2002 markm

Remove NO_WERRORs and WARNS=n's. To be revisited after GCC3.


90401 08-Feb-2002 des

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


88726 30-Dec-2001 alfred

Print open(2) flags in hex instread of decimal for clarity.


87703 11-Dec-2001 markm

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


86501 17-Nov-2001 des

Print the correct return code for successful Linux syscalls.

Submitted by: Vitezslav Novy <vita@fio.cz>
PR: 32036
MFC after: 1 week


86138 06-Nov-2001 green

Add missing include for <ctype.h>

Make sockaddr printing code unbad.

Always copy in sizeof(sockaddr_un) bytes for an AF_UNIX sockaddr,
despite what the length may be.


85317 22-Oct-2001 des

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


85301 22-Oct-2001 des

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


85292 21-Oct-2001 des

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


82471 28-Aug-2001 joerg

In get_string(), 0-terminate the contents of buf ``just in case'';
otherwise, if the very first fgetc() already yielded EOF, the returned
string won't get terminated at all.

MFC after: 1 day


81608 13-Aug-2001 peter

Initialize outfile in main()


79755 15-Jul-2001 dd

Remove whitespace at EOL.


79535 10-Jul-2001 ru

mdoc(7) police: removed HISTORY info from the .Os call.


70197 19-Dec-2000 ru

Prepare for mdoc(7)NG.


69860 11-Dec-2000 ru

mdoc(7) police: use canonical form of .Dd macro.


68963 20-Nov-2000 ru

mdoc(7) police: use the new features of the Nm macro.


65849 14-Sep-2000 jkh

cc -O -pipe -I/usr/src/usr.bin/kdump/../ktrace -I/usr/src/usr.bin/kdump/../.. Fix ioctl.c creation to deal with the depend case more properly.

Submitted by: Ruslan Ermilov <ru@sunbay.com>


65829 14-Sep-2000 jkh

remove .PHONY to avoid gratuitous rebuild of ioctl.c each time.

Approved by: sef


64102 01-Aug-2000 ru

Make auto-generated ioctl.c to be always considered out of date
since it could potentially depend on any ${DESTDIR}/usr/include
preprocessor file. This fixes the broken -DNOCLEAN world build
I experienced yesterday.


58224 18-Mar-2000 sef

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>


57245 15-Feb-2000 sef

Fix a leak. (Thanks Bruce, this was a bonehead mistake on my part :).)

Submitted by: Bruce Evans


56412 23-Jan-2000 mpp

Fxi various man pages to stop abusing the .Bx macro to generate
the string "FreeBSD". Use the .Fx macro instead. Also did some
minor re-wording/formatting to work around a deficiency with
the .Fx macro when it comes to puncuation characters other than
periods and commas.


55707 10-Jan-2000 sef

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>


54089 03-Dec-1999 marcel

Fix for the new usage of mkioctls


53152 14-Nov-1999 marcel

${MACHINE} -> ${MACHINE_ARCH}

All Makefiles now use MACHINE_ARCH for the target architecture.
Unification is required for cross-building.

Tags added to:
sys/boot/Makefile
sys/boot/arc/loader/Makefile
sys/kern/Makefile
usr.bin/cpp/Makefile
usr.bin/gcore/Makefile
usr.bin/truss/Makefile

usr.bin/gcore/Makefile:
fixed typo: MACHINDE -> MACHINE_ARCH


50534 28-Aug-1999 mpp

Add $FreeBSD$ lines to man pages that are missing them to make it
easier for translation teams.

PR: docs/13418
Submitted by: Alexey Zelkin <phantom@cris.net>


50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


49609 10-Aug-1999 des

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


49436 05-Aug-1999 des

Add access(2) to the list of recognized syscalls.


41970 21-Dec-1998 msmith

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


40370 15-Oct-1998 sef

Add lstat() as a known system call.


40301 13-Oct-1998 des

Calls one or more of malloc(), warn(), err(), syslog(), execlp() or
execvp() in the child branch of a vfork(). Changed to use fork()
instead.

Some of these (mv, find, apply, xargs) might benefit greatly from
being rewritten to use vfork() properly.

PR: Loosely related to bin/8252
Approved by: jkh and bde


40035 07-Oct-1998 kato

Use MACHINE_ARCH instead of MACHINE to detect x86 arch.

Pointed out by: Akio Morita <amorita@meadow.scphys.kyoto-u.ac.jp>


39929 03-Oct-1998 sef

Make it compile -Wall cleanly.

Submitted by: Alex Nash <nash@mcs.net>


39908 03-Oct-1998 sef

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.


38897 07-Sep-1998 sef

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.


38520 24-Aug-1998 cracauer

When exiting on SIGINT, exit with signal status


37453 06-Jul-1998 bde

Fixed printf format errors.


32757 25-Jan-1998 jb

Add a sysmk -> /dev/null definition ready for a coming change to
makesyscalls.sh.


32367 09-Jan-1998 sef

Revert the changes yet again, after some email from Bruce. Sorry.


32355 09-Jan-1998 sef

Proper way to do the previous mis-commit. Still not quite right, because
some header files (e.g., <err.h>) include <machine/something.h>, and this
will not pick up the right header files, so it may be removed eventually
anyway. But some people who are not willing to build the right way
apparantly want this, so this is for them.


32354 09-Jan-1998 sef

Get rid of the bogus include -- it is incomplete (as it doesn't handle
anything other than <sys/*.h>), and unnecessary in most cases. (The
situations where it is necesary can be dealt with by manually-made symlinks,
which is acceptable since they should only occur during testing. Remember:
the tree does not compile well if you do not have matching header files
installed. Half-baked -I directives don't cover enough of the cases.)


32306 07-Jan-1998 jmg

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


32275 05-Jan-1998 charnier

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.


31899 20-Dec-1997 sef

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


31691 13-Dec-1997 sef

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 :).


31605 07-Dec-1997 peter

s/ps/truss/


31597 07-Dec-1997 sef

Use the new PF_LINGER flag -- when this is set in a process' proc structure,
said process will not have its event mask cleared (and be restarted) on
the last close of a procfs/mem file for that pid. This reduces the chance
that a truss-monitored process will be left hanging with these bits set
and nobody looking for it.

This is the least-tested change of all of these, I'm afraid.


31582 06-Dec-1997 sef

Complain about empty command lines.


31581 06-Dec-1997 peter

err(3) already includes strerror(errno) and a trailing \n


31580 06-Dec-1997 peter

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


31579 06-Dec-1997 peter

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

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


31573 06-Dec-1997 sef

Set the close-on-exec flag in the child; otherwise, it eats up a
file descriptor that it shouldn't.


31571 06-Dec-1997 sef

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


31567 06-Dec-1997 sef

Truss program. Requires procfs.