Commit Graph

19 Commits

Author SHA1 Message Date
Andrey Zonov
5695afded4 - Make truss thread-aware.
Approved by:	kib (mentor)
MFC after:	2 weeks
2012-09-16 14:38:01 +00:00
Andrey Zonov
94355cfdfd - Style(9) cleanup.
Approved by:	kib (mentor)
2012-09-02 11:03:18 +00:00
Benedict Reuschling
b2bf146e3e Fix typos in comments, no functional changes.
Found by:       codespell
Reviewed by:    alfred
MFC after:      1 week
2011-05-19 20:35:40 +00:00
Benedict Reuschling
05844c563e s/sytem/system in comments, no functional changes.
Reviewed by:    alfred@
2010-10-13 20:08:02 +00:00
Warner Losh
0a6c71f8fa Fix copyright spelling.
PR:		139825
Submitted by:	Ruslan Mahmatkhanov
2010-03-10 20:31:30 +00:00
Xin LI
948c1a68c6 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
2009-05-28 00:38:24 +00:00
Xin LI
216fa4c607 Reduce diff against my local version: replace malloc+memset() cases to calloc(). 2009-05-15 19:41:10 +00:00
Diomidis Spinellis
ee3b0f6e2e Add -c option to summarize number of calls, errors, and system time.
Reviewed by:	alfred
2009-05-12 20:42:12 +00:00
Xin LI
ef29ac7f76 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)
2007-06-26 22:42:37 +00:00
Xin LI
5d2d083c92 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
2007-04-10 04:03:34 +00:00
Pav Lucistnik
1675c32154 - Fix crash when hitting unknown syscall. Copied from i386-fbsd.c
Approved by:	alfred
2006-05-15 21:03:02 +00:00
Brian Somers
0cf21b4f58 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
2006-01-02 08:36:25 +00:00
Alfred Perlstein
2bae4eb308 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.
2004-07-17 19:48:49 +00:00
David Malone
1bc99f1144 Move declarations of Procfd to a header file. 2004-01-07 14:29:45 +00:00
Marcel Moolenaar
1bcb5f5a96 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.
2003-11-09 03:48:13 +00:00
David Malone
eb9741e47d 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.
2002-11-09 22:46:51 +00:00
Matthew N. Dodd
37169f9446 - Use time.h not sys/time.h.
- Fix printf format errors.

Submitted by:	 bde
2002-08-06 12:46:14 +00:00
Matthew N. Dodd
42a389ac3e Diff reduction. 2002-08-05 13:23:41 +00:00
Jake Burkholder
f84c971a6f Ported to sparc64. 2002-08-04 17:57:01 +00:00