History log of /openbsd-current/usr.bin/ktrace/ktrace.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.40 08-Mar-2023 guenther

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.39 22-Feb-2022 deraadt

MAXCOMLEN is no longer needed in these programs, so remove the annotation
from sys/param.h include lines, or remove the include lines entirely if
it this was the least requirement.
ok millert


Revision tags: OPENBSD_7_0_BASE
# 1.38 01-Sep-2021 deraadt

A couple commands don't need sys/param.h, but they do need sys/signal.h


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.37 16-Jul-2020 tedu

add -T option to make time related system calls more prominent.
ok deraadt


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.35 06-Jan-2019 tedu

set tracefile to null when clearing points.
ok kn


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.34 11-Jun-2017 awolk

usr/bin/ktrace: replace snprintf(3)/write(2) with dprintf(3)

Brought to attention by BlackFrog on #openbsd-daily

OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 18-Jul-2016 guenther

Add 'p' trace point for KTRFAC_PLEDGE, as noted by
Michal Mazurek <akfaew@jasminek.net>

While here, fix handling of -t+ in ltrace.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.32 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


Revision tags: OPENBSD_5_7_BASE
# 1.31 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.30 24-May-2014 deraadt

when ktrace() return ESRCH, the error is regarding the pid, not the pathname
ok miod


# 1.29 07-Apr-2014 jmc

add -t to usage() for ltrace;


# 1.28 04-Apr-2014 miod

Add the -t ktrace(1) option to ltrace(1), so that you can trigger both
library function call trace and other kernel events trace at the same time.

Suggested by kurt@ a long time ago, I have been sitting on this diff for no
good reason.


Revision tags: OPENBSD_5_5_BASE
# 1.27 06-Nov-2013 sobrado

fix spacing in usage()


Revision tags: OPENBSD_5_4_BASE
# 1.26 05-Jun-2013 sthen

typo in usage, comand/command; Arto Jonsson


# 1.25 01-Jun-2013 miod

Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the
public function call level.

To do so, ltrace(1) sets up some environment variables to enable plt tracing
in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy
binding and will send an utrace record in the plt resolver, without updating
the plt.

Minimal filtering capabilities are provided, inspired by Solaris' truss -u,
to limit tracing to libraries and/or symbol names. Non-traced libraries and
symbols will have the regular resolver processing, with the expected plt
update.

"Get it in" deraadt


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 12-Jul-2012 jmc

add -B to usage();


# 1.23 12-Jul-2012 guenther

Add -B option to pass down LD_BIND_NOW to suppress ld.so blather

ok pirofti@ deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.21 23-Feb-2009 tedu

matthew haub pointed out that pid may be used uninitialized in some contexts
ok deraadt


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.20 03-Mar-2007 jmc

let synopsis, options description, and usage() agree;
from Igor Sobrado, tweaked by myself


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.19 21-Dec-2005 millert

Userland programs should include <errno.h> not <sys/errno.h>
OK deraadt@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.18 14-Sep-2004 deraadt

ARGSUSED before signal handler with unused signo


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.17 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.16 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.15 19-Feb-2003 deraadt

improve docs; raj@cerias.purdue.edu


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.14 25-Mar-2002 deraadt

bring in prototypes


# 1.13 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.12 14-Nov-2001 deraadt

get rid of signal race


Revision tags: OPENBSD_3_0_BASE
# 1.11 18-Aug-2001 espie

Add lots of missing prototypes, constify a few things. Add explicit ints.
Makes gcc much happier, less warnings.


# 1.10 12-Jul-2001 deraadt

first pass at a -Wall cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.9 30-Jun-2000 millert

warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant). These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.8 17-Aug-1999 millert

branches: 1.8.4;
More <sys/file.h> vs. <fcntl.h> and open() flags fixes.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.7 25-Apr-1998 deraadt

fix usage; nathanw@MIT.EDU


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.6 19-Jun-1997 angelos

Someone forgot to declare the "sb" variable...


# 1.5 18-Jun-1997 deraadt

unlink ktrace file more carefully; wosch/joerg


Revision tags: OPENBSD_2_1_BASE
# 1.4 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


Revision tags: OPENBSD_2_0_BASE
# 1.3 21-Sep-1996 deraadt

gen ktrace.out with restrictive umask; from joerg@freebsd.org


# 1.2 26-Jun-1996 deraadt

rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.39 22-Feb-2022 deraadt

MAXCOMLEN is no longer needed in these programs, so remove the annotation
from sys/param.h include lines, or remove the include lines entirely if
it this was the least requirement.
ok millert


Revision tags: OPENBSD_7_0_BASE
# 1.38 01-Sep-2021 deraadt

A couple commands don't need sys/param.h, but they do need sys/signal.h


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.37 16-Jul-2020 tedu

add -T option to make time related system calls more prominent.
ok deraadt


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.35 06-Jan-2019 tedu

set tracefile to null when clearing points.
ok kn


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.34 11-Jun-2017 awolk

usr/bin/ktrace: replace snprintf(3)/write(2) with dprintf(3)

Brought to attention by BlackFrog on #openbsd-daily

OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 18-Jul-2016 guenther

Add 'p' trace point for KTRFAC_PLEDGE, as noted by
Michal Mazurek <akfaew@jasminek.net>

While here, fix handling of -t+ in ltrace.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.32 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


Revision tags: OPENBSD_5_7_BASE
# 1.31 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.30 24-May-2014 deraadt

when ktrace() return ESRCH, the error is regarding the pid, not the pathname
ok miod


# 1.29 07-Apr-2014 jmc

add -t to usage() for ltrace;


# 1.28 04-Apr-2014 miod

Add the -t ktrace(1) option to ltrace(1), so that you can trigger both
library function call trace and other kernel events trace at the same time.

Suggested by kurt@ a long time ago, I have been sitting on this diff for no
good reason.


Revision tags: OPENBSD_5_5_BASE
# 1.27 06-Nov-2013 sobrado

fix spacing in usage()


Revision tags: OPENBSD_5_4_BASE
# 1.26 05-Jun-2013 sthen

typo in usage, comand/command; Arto Jonsson


# 1.25 01-Jun-2013 miod

Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the
public function call level.

To do so, ltrace(1) sets up some environment variables to enable plt tracing
in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy
binding and will send an utrace record in the plt resolver, without updating
the plt.

Minimal filtering capabilities are provided, inspired by Solaris' truss -u,
to limit tracing to libraries and/or symbol names. Non-traced libraries and
symbols will have the regular resolver processing, with the expected plt
update.

"Get it in" deraadt


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 12-Jul-2012 jmc

add -B to usage();


# 1.23 12-Jul-2012 guenther

Add -B option to pass down LD_BIND_NOW to suppress ld.so blather

ok pirofti@ deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.21 23-Feb-2009 tedu

matthew haub pointed out that pid may be used uninitialized in some contexts
ok deraadt


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.20 03-Mar-2007 jmc

let synopsis, options description, and usage() agree;
from Igor Sobrado, tweaked by myself


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.19 21-Dec-2005 millert

Userland programs should include <errno.h> not <sys/errno.h>
OK deraadt@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.18 14-Sep-2004 deraadt

ARGSUSED before signal handler with unused signo


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.17 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.16 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.15 19-Feb-2003 deraadt

improve docs; raj@cerias.purdue.edu


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.14 25-Mar-2002 deraadt

bring in prototypes


# 1.13 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.12 14-Nov-2001 deraadt

get rid of signal race


Revision tags: OPENBSD_3_0_BASE
# 1.11 18-Aug-2001 espie

Add lots of missing prototypes, constify a few things. Add explicit ints.
Makes gcc much happier, less warnings.


# 1.10 12-Jul-2001 deraadt

first pass at a -Wall cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.9 30-Jun-2000 millert

warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant). These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.8 17-Aug-1999 millert

branches: 1.8.4;
More <sys/file.h> vs. <fcntl.h> and open() flags fixes.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.7 25-Apr-1998 deraadt

fix usage; nathanw@MIT.EDU


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.6 19-Jun-1997 angelos

Someone forgot to declare the "sb" variable...


# 1.5 18-Jun-1997 deraadt

unlink ktrace file more carefully; wosch/joerg


Revision tags: OPENBSD_2_1_BASE
# 1.4 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


Revision tags: OPENBSD_2_0_BASE
# 1.3 21-Sep-1996 deraadt

gen ktrace.out with restrictive umask; from joerg@freebsd.org


# 1.2 26-Jun-1996 deraadt

rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.38 01-Sep-2021 deraadt

A couple commands don't need sys/param.h, but they do need sys/signal.h


Revision tags: OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.37 16-Jul-2020 tedu

add -T option to make time related system calls more prominent.
ok deraadt


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.35 06-Jan-2019 tedu

set tracefile to null when clearing points.
ok kn


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.34 11-Jun-2017 awolk

usr/bin/ktrace: replace snprintf(3)/write(2) with dprintf(3)

Brought to attention by BlackFrog on #openbsd-daily

OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 18-Jul-2016 guenther

Add 'p' trace point for KTRFAC_PLEDGE, as noted by
Michal Mazurek <akfaew@jasminek.net>

While here, fix handling of -t+ in ltrace.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.32 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


Revision tags: OPENBSD_5_7_BASE
# 1.31 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.30 24-May-2014 deraadt

when ktrace() return ESRCH, the error is regarding the pid, not the pathname
ok miod


# 1.29 07-Apr-2014 jmc

add -t to usage() for ltrace;


# 1.28 04-Apr-2014 miod

Add the -t ktrace(1) option to ltrace(1), so that you can trigger both
library function call trace and other kernel events trace at the same time.

Suggested by kurt@ a long time ago, I have been sitting on this diff for no
good reason.


Revision tags: OPENBSD_5_5_BASE
# 1.27 06-Nov-2013 sobrado

fix spacing in usage()


Revision tags: OPENBSD_5_4_BASE
# 1.26 05-Jun-2013 sthen

typo in usage, comand/command; Arto Jonsson


# 1.25 01-Jun-2013 miod

Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the
public function call level.

To do so, ltrace(1) sets up some environment variables to enable plt tracing
in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy
binding and will send an utrace record in the plt resolver, without updating
the plt.

Minimal filtering capabilities are provided, inspired by Solaris' truss -u,
to limit tracing to libraries and/or symbol names. Non-traced libraries and
symbols will have the regular resolver processing, with the expected plt
update.

"Get it in" deraadt


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 12-Jul-2012 jmc

add -B to usage();


# 1.23 12-Jul-2012 guenther

Add -B option to pass down LD_BIND_NOW to suppress ld.so blather

ok pirofti@ deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.21 23-Feb-2009 tedu

matthew haub pointed out that pid may be used uninitialized in some contexts
ok deraadt


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.20 03-Mar-2007 jmc

let synopsis, options description, and usage() agree;
from Igor Sobrado, tweaked by myself


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.19 21-Dec-2005 millert

Userland programs should include <errno.h> not <sys/errno.h>
OK deraadt@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.18 14-Sep-2004 deraadt

ARGSUSED before signal handler with unused signo


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.17 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.16 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.15 19-Feb-2003 deraadt

improve docs; raj@cerias.purdue.edu


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.14 25-Mar-2002 deraadt

bring in prototypes


# 1.13 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.12 14-Nov-2001 deraadt

get rid of signal race


Revision tags: OPENBSD_3_0_BASE
# 1.11 18-Aug-2001 espie

Add lots of missing prototypes, constify a few things. Add explicit ints.
Makes gcc much happier, less warnings.


# 1.10 12-Jul-2001 deraadt

first pass at a -Wall cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.9 30-Jun-2000 millert

warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant). These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.8 17-Aug-1999 millert

branches: 1.8.4;
More <sys/file.h> vs. <fcntl.h> and open() flags fixes.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.7 25-Apr-1998 deraadt

fix usage; nathanw@MIT.EDU


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.6 19-Jun-1997 angelos

Someone forgot to declare the "sb" variable...


# 1.5 18-Jun-1997 deraadt

unlink ktrace file more carefully; wosch/joerg


Revision tags: OPENBSD_2_1_BASE
# 1.4 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


Revision tags: OPENBSD_2_0_BASE
# 1.3 21-Sep-1996 deraadt

gen ktrace.out with restrictive umask; from joerg@freebsd.org


# 1.2 26-Jun-1996 deraadt

rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.37 16-Jul-2020 tedu

add -T option to make time related system calls more prominent.
ok deraadt


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.35 06-Jan-2019 tedu

set tracefile to null when clearing points.
ok kn


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.34 11-Jun-2017 awolk

usr/bin/ktrace: replace snprintf(3)/write(2) with dprintf(3)

Brought to attention by BlackFrog on #openbsd-daily

OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 18-Jul-2016 guenther

Add 'p' trace point for KTRFAC_PLEDGE, as noted by
Michal Mazurek <akfaew@jasminek.net>

While here, fix handling of -t+ in ltrace.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.32 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


Revision tags: OPENBSD_5_7_BASE
# 1.31 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.30 24-May-2014 deraadt

when ktrace() return ESRCH, the error is regarding the pid, not the pathname
ok miod


# 1.29 07-Apr-2014 jmc

add -t to usage() for ltrace;


# 1.28 04-Apr-2014 miod

Add the -t ktrace(1) option to ltrace(1), so that you can trigger both
library function call trace and other kernel events trace at the same time.

Suggested by kurt@ a long time ago, I have been sitting on this diff for no
good reason.


Revision tags: OPENBSD_5_5_BASE
# 1.27 06-Nov-2013 sobrado

fix spacing in usage()


Revision tags: OPENBSD_5_4_BASE
# 1.26 05-Jun-2013 sthen

typo in usage, comand/command; Arto Jonsson


# 1.25 01-Jun-2013 miod

Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the
public function call level.

To do so, ltrace(1) sets up some environment variables to enable plt tracing
in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy
binding and will send an utrace record in the plt resolver, without updating
the plt.

Minimal filtering capabilities are provided, inspired by Solaris' truss -u,
to limit tracing to libraries and/or symbol names. Non-traced libraries and
symbols will have the regular resolver processing, with the expected plt
update.

"Get it in" deraadt


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 12-Jul-2012 jmc

add -B to usage();


# 1.23 12-Jul-2012 guenther

Add -B option to pass down LD_BIND_NOW to suppress ld.so blather

ok pirofti@ deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.21 23-Feb-2009 tedu

matthew haub pointed out that pid may be used uninitialized in some contexts
ok deraadt


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.20 03-Mar-2007 jmc

let synopsis, options description, and usage() agree;
from Igor Sobrado, tweaked by myself


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.19 21-Dec-2005 millert

Userland programs should include <errno.h> not <sys/errno.h>
OK deraadt@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.18 14-Sep-2004 deraadt

ARGSUSED before signal handler with unused signo


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.17 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.16 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.15 19-Feb-2003 deraadt

improve docs; raj@cerias.purdue.edu


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.14 25-Mar-2002 deraadt

bring in prototypes


# 1.13 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.12 14-Nov-2001 deraadt

get rid of signal race


Revision tags: OPENBSD_3_0_BASE
# 1.11 18-Aug-2001 espie

Add lots of missing prototypes, constify a few things. Add explicit ints.
Makes gcc much happier, less warnings.


# 1.10 12-Jul-2001 deraadt

first pass at a -Wall cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.9 30-Jun-2000 millert

warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant). These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.8 17-Aug-1999 millert

branches: 1.8.4;
More <sys/file.h> vs. <fcntl.h> and open() flags fixes.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.7 25-Apr-1998 deraadt

fix usage; nathanw@MIT.EDU


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.6 19-Jun-1997 angelos

Someone forgot to declare the "sb" variable...


# 1.5 18-Jun-1997 deraadt

unlink ktrace file more carefully; wosch/joerg


Revision tags: OPENBSD_2_1_BASE
# 1.4 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


Revision tags: OPENBSD_2_0_BASE
# 1.3 21-Sep-1996 deraadt

gen ktrace.out with restrictive umask; from joerg@freebsd.org


# 1.2 26-Jun-1996 deraadt

rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.36 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.35 06-Jan-2019 tedu

set tracefile to null when clearing points.
ok kn


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.34 11-Jun-2017 awolk

usr/bin/ktrace: replace snprintf(3)/write(2) with dprintf(3)

Brought to attention by BlackFrog on #openbsd-daily

OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 18-Jul-2016 guenther

Add 'p' trace point for KTRFAC_PLEDGE, as noted by
Michal Mazurek <akfaew@jasminek.net>

While here, fix handling of -t+ in ltrace.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.32 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


Revision tags: OPENBSD_5_7_BASE
# 1.31 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.30 24-May-2014 deraadt

when ktrace() return ESRCH, the error is regarding the pid, not the pathname
ok miod


# 1.29 07-Apr-2014 jmc

add -t to usage() for ltrace;


# 1.28 04-Apr-2014 miod

Add the -t ktrace(1) option to ltrace(1), so that you can trigger both
library function call trace and other kernel events trace at the same time.

Suggested by kurt@ a long time ago, I have been sitting on this diff for no
good reason.


Revision tags: OPENBSD_5_5_BASE
# 1.27 06-Nov-2013 sobrado

fix spacing in usage()


Revision tags: OPENBSD_5_4_BASE
# 1.26 05-Jun-2013 sthen

typo in usage, comand/command; Arto Jonsson


# 1.25 01-Jun-2013 miod

Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the
public function call level.

To do so, ltrace(1) sets up some environment variables to enable plt tracing
in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy
binding and will send an utrace record in the plt resolver, without updating
the plt.

Minimal filtering capabilities are provided, inspired by Solaris' truss -u,
to limit tracing to libraries and/or symbol names. Non-traced libraries and
symbols will have the regular resolver processing, with the expected plt
update.

"Get it in" deraadt


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 12-Jul-2012 jmc

add -B to usage();


# 1.23 12-Jul-2012 guenther

Add -B option to pass down LD_BIND_NOW to suppress ld.so blather

ok pirofti@ deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.21 23-Feb-2009 tedu

matthew haub pointed out that pid may be used uninitialized in some contexts
ok deraadt


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.20 03-Mar-2007 jmc

let synopsis, options description, and usage() agree;
from Igor Sobrado, tweaked by myself


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.19 21-Dec-2005 millert

Userland programs should include <errno.h> not <sys/errno.h>
OK deraadt@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.18 14-Sep-2004 deraadt

ARGSUSED before signal handler with unused signo


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.17 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.16 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.15 19-Feb-2003 deraadt

improve docs; raj@cerias.purdue.edu


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.14 25-Mar-2002 deraadt

bring in prototypes


# 1.13 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.12 14-Nov-2001 deraadt

get rid of signal race


Revision tags: OPENBSD_3_0_BASE
# 1.11 18-Aug-2001 espie

Add lots of missing prototypes, constify a few things. Add explicit ints.
Makes gcc much happier, less warnings.


# 1.10 12-Jul-2001 deraadt

first pass at a -Wall cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.9 30-Jun-2000 millert

warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant). These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.8 17-Aug-1999 millert

branches: 1.8.4;
More <sys/file.h> vs. <fcntl.h> and open() flags fixes.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.7 25-Apr-1998 deraadt

fix usage; nathanw@MIT.EDU


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.6 19-Jun-1997 angelos

Someone forgot to declare the "sb" variable...


# 1.5 18-Jun-1997 deraadt

unlink ktrace file more carefully; wosch/joerg


Revision tags: OPENBSD_2_1_BASE
# 1.4 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


Revision tags: OPENBSD_2_0_BASE
# 1.3 21-Sep-1996 deraadt

gen ktrace.out with restrictive umask; from joerg@freebsd.org


# 1.2 26-Jun-1996 deraadt

rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.35 06-Jan-2019 tedu

set tracefile to null when clearing points.
ok kn


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.34 11-Jun-2017 awolk

usr/bin/ktrace: replace snprintf(3)/write(2) with dprintf(3)

Brought to attention by BlackFrog on #openbsd-daily

OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 18-Jul-2016 guenther

Add 'p' trace point for KTRFAC_PLEDGE, as noted by
Michal Mazurek <akfaew@jasminek.net>

While here, fix handling of -t+ in ltrace.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.32 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


Revision tags: OPENBSD_5_7_BASE
# 1.31 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.30 24-May-2014 deraadt

when ktrace() return ESRCH, the error is regarding the pid, not the pathname
ok miod


# 1.29 07-Apr-2014 jmc

add -t to usage() for ltrace;


# 1.28 04-Apr-2014 miod

Add the -t ktrace(1) option to ltrace(1), so that you can trigger both
library function call trace and other kernel events trace at the same time.

Suggested by kurt@ a long time ago, I have been sitting on this diff for no
good reason.


Revision tags: OPENBSD_5_5_BASE
# 1.27 06-Nov-2013 sobrado

fix spacing in usage()


Revision tags: OPENBSD_5_4_BASE
# 1.26 05-Jun-2013 sthen

typo in usage, comand/command; Arto Jonsson


# 1.25 01-Jun-2013 miod

Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the
public function call level.

To do so, ltrace(1) sets up some environment variables to enable plt tracing
in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy
binding and will send an utrace record in the plt resolver, without updating
the plt.

Minimal filtering capabilities are provided, inspired by Solaris' truss -u,
to limit tracing to libraries and/or symbol names. Non-traced libraries and
symbols will have the regular resolver processing, with the expected plt
update.

"Get it in" deraadt


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 12-Jul-2012 jmc

add -B to usage();


# 1.23 12-Jul-2012 guenther

Add -B option to pass down LD_BIND_NOW to suppress ld.so blather

ok pirofti@ deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.21 23-Feb-2009 tedu

matthew haub pointed out that pid may be used uninitialized in some contexts
ok deraadt


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.20 03-Mar-2007 jmc

let synopsis, options description, and usage() agree;
from Igor Sobrado, tweaked by myself


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.19 21-Dec-2005 millert

Userland programs should include <errno.h> not <sys/errno.h>
OK deraadt@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.18 14-Sep-2004 deraadt

ARGSUSED before signal handler with unused signo


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.17 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.16 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.15 19-Feb-2003 deraadt

improve docs; raj@cerias.purdue.edu


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.14 25-Mar-2002 deraadt

bring in prototypes


# 1.13 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.12 14-Nov-2001 deraadt

get rid of signal race


Revision tags: OPENBSD_3_0_BASE
# 1.11 18-Aug-2001 espie

Add lots of missing prototypes, constify a few things. Add explicit ints.
Makes gcc much happier, less warnings.


# 1.10 12-Jul-2001 deraadt

first pass at a -Wall cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.9 30-Jun-2000 millert

warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant). These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.8 17-Aug-1999 millert

branches: 1.8.4;
More <sys/file.h> vs. <fcntl.h> and open() flags fixes.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.7 25-Apr-1998 deraadt

fix usage; nathanw@MIT.EDU


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.6 19-Jun-1997 angelos

Someone forgot to declare the "sb" variable...


# 1.5 18-Jun-1997 deraadt

unlink ktrace file more carefully; wosch/joerg


Revision tags: OPENBSD_2_1_BASE
# 1.4 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


Revision tags: OPENBSD_2_0_BASE
# 1.3 21-Sep-1996 deraadt

gen ktrace.out with restrictive umask; from joerg@freebsd.org


# 1.2 26-Jun-1996 deraadt

rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_2_BASE
# 1.34 11-Jun-2017 awolk

usr/bin/ktrace: replace snprintf(3)/write(2) with dprintf(3)

Brought to attention by BlackFrog on #openbsd-daily

OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.33 18-Jul-2016 guenther

Add 'p' trace point for KTRFAC_PLEDGE, as noted by
Michal Mazurek <akfaew@jasminek.net>

While here, fix handling of -t+ in ltrace.


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.32 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


Revision tags: OPENBSD_5_7_BASE
# 1.31 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.30 24-May-2014 deraadt

when ktrace() return ESRCH, the error is regarding the pid, not the pathname
ok miod


# 1.29 07-Apr-2014 jmc

add -t to usage() for ltrace;


# 1.28 04-Apr-2014 miod

Add the -t ktrace(1) option to ltrace(1), so that you can trigger both
library function call trace and other kernel events trace at the same time.

Suggested by kurt@ a long time ago, I have been sitting on this diff for no
good reason.


Revision tags: OPENBSD_5_5_BASE
# 1.27 06-Nov-2013 sobrado

fix spacing in usage()


Revision tags: OPENBSD_5_4_BASE
# 1.26 05-Jun-2013 sthen

typo in usage, comand/command; Arto Jonsson


# 1.25 01-Jun-2013 miod

Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the
public function call level.

To do so, ltrace(1) sets up some environment variables to enable plt tracing
in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy
binding and will send an utrace record in the plt resolver, without updating
the plt.

Minimal filtering capabilities are provided, inspired by Solaris' truss -u,
to limit tracing to libraries and/or symbol names. Non-traced libraries and
symbols will have the regular resolver processing, with the expected plt
update.

"Get it in" deraadt


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.24 12-Jul-2012 jmc

add -B to usage();


# 1.23 12-Jul-2012 guenther

Add -B option to pass down LD_BIND_NOW to suppress ld.so blather

ok pirofti@ deraadt@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.21 23-Feb-2009 tedu

matthew haub pointed out that pid may be used uninitialized in some contexts
ok deraadt


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.20 03-Mar-2007 jmc

let synopsis, options description, and usage() agree;
from Igor Sobrado, tweaked by myself


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.19 21-Dec-2005 millert

Userland programs should include <errno.h> not <sys/errno.h>
OK deraadt@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.18 14-Sep-2004 deraadt

ARGSUSED before signal handler with unused signo


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.17 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.16 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_3_BASE
# 1.15 19-Feb-2003 deraadt

improve docs; raj@cerias.purdue.edu


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.14 25-Mar-2002 deraadt

bring in prototypes


# 1.13 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.12 14-Nov-2001 deraadt

get rid of signal race


Revision tags: OPENBSD_3_0_BASE
# 1.11 18-Aug-2001 espie

Add lots of missing prototypes, constify a few things. Add explicit ints.
Makes gcc much happier, less warnings.


# 1.10 12-Jul-2001 deraadt

first pass at a -Wall cleanup


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.9 30-Jun-2000 millert

warnx?/errx? paranoia (use "%s" not a bare string unless it is a
constant). These are not security holes but it is worth fixing
them anyway both for robustness and so folks looking for examples
in the tree are not misled into doing something potentially dangerous.
Furthermore, it is a bad idea to assume that pathnames will not
include '%' in them and that error routines don't return strings
with '%' in them (especially in light of the possibility of locales).


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE
# 1.8 17-Aug-1999 millert

branches: 1.8.4;
More <sys/file.h> vs. <fcntl.h> and open() flags fixes.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.7 25-Apr-1998 deraadt

fix usage; nathanw@MIT.EDU


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.6 19-Jun-1997 angelos

Someone forgot to declare the "sb" variable...


# 1.5 18-Jun-1997 deraadt

unlink ktrace file more carefully; wosch/joerg


Revision tags: OPENBSD_2_1_BASE
# 1.4 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


Revision tags: OPENBSD_2_0_BASE
# 1.3 21-Sep-1996 deraadt

gen ktrace.out with restrictive umask; from joerg@freebsd.org


# 1.2 26-Jun-1996 deraadt

rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision