diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-07-18 09:36:51 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-07-18 09:36:51 +0000 |
commit | e05990b64643e87848b0dce135ca2fb307685c12 (patch) | |
tree | cf04f85114e0541b01e318fc1950f23e1d49584c /usr.bin/ktrace | |
parent | 2c847ce2ccc6b0c0da8fe944714c0935b29f341c (diff) |
Add 'p' trace point for KTRFAC_PLEDGE, as noted by
Michal Mazurek <akfaew@jasminek.net>
While here, fix handling of -t+ in ltrace.
Diffstat (limited to 'usr.bin/ktrace')
-rw-r--r-- | usr.bin/ktrace/extern.h | 6 | ||||
-rw-r--r-- | usr.bin/ktrace/ktrace.1 | 22 | ||||
-rw-r--r-- | usr.bin/ktrace/ktrace.c | 6 | ||||
-rw-r--r-- | usr.bin/ktrace/ltrace.1 | 21 | ||||
-rw-r--r-- | usr.bin/ktrace/subr.c | 19 |
5 files changed, 38 insertions, 36 deletions
diff --git a/usr.bin/ktrace/extern.h b/usr.bin/ktrace/extern.h index 2a8a42150da..aca47f7b9c4 100644 --- a/usr.bin/ktrace/extern.h +++ b/usr.bin/ktrace/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.2 2002/02/16 21:27:47 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.3 2016/07/18 09:36:50 guenther Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -25,5 +25,5 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -extern int getpoints(const char *); -extern const char *ioctlname(unsigned long); +int getpoints(const char *, int); +const char *ioctlname(unsigned long); diff --git a/usr.bin/ktrace/ktrace.1 b/usr.bin/ktrace/ktrace.1 index aec875e6152..7ecbb113394 100644 --- a/usr.bin/ktrace/ktrace.1 +++ b/usr.bin/ktrace/ktrace.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ktrace.1,v 1.28 2016/03/06 20:25:27 guenther Exp $ +.\" $OpenBSD: ktrace.1,v 1.29 2016/07/18 09:36:50 guenther Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)ktrace.1 8.1 (Berkeley) 6/6/93 .\" -.Dd $Mdocdate: March 6 2016 $ +.Dd $Mdocdate: July 18 2016 $ .Dt KTRACE 1 .Os .Sh NAME @@ -111,16 +111,10 @@ Enable (disable) tracing on the indicated process ID (only one flag is permitted). .It Fl t Ar trstr The string argument represents the kernel trace points, one per letter. -The default flags are -.Cm c , -.Cm i , -.Cm n , -.Cm s , -.Cm t , -.Cm u , -and -.Cm x . -The following table equates the letters with the tracepoints: +By default all trace points except for +.Cm X +are enabled. +The following table equates the letters with the trace points: .Pp .Bl -tag -width flag -offset indent -compact .It Cm c @@ -129,6 +123,10 @@ trace system calls trace I/O .It Cm n trace namei translations +.It Cm p +trace violation of +.Xr pledge 2 +restrictions .It Cm s trace signal processing .It Cm t diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c index 94180ca769a..7864bc5bfea 100644 --- a/usr.bin/ktrace/ktrace.c +++ b/usr.bin/ktrace/ktrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ktrace.c,v 1.32 2015/04/18 18:28:37 deraadt Exp $ */ +/* $OpenBSD: ktrace.c,v 1.33 2016/07/18 09:36:50 guenther Exp $ */ /* $NetBSD: ktrace.c,v 1.4 1995/08/31 23:01:44 jtc Exp $ */ /*- @@ -87,7 +87,7 @@ main(int argc, char *argv[]) inherit = 1; break; case 't': - trpoints = getpoints(optarg); + trpoints = getpoints(optarg, KTRFAC_USER); if (trpoints < 0) { warnx("unknown facility in %s", optarg); usage(); @@ -133,7 +133,7 @@ main(int argc, char *argv[]) pidset = 1; break; case 't': - trpoints = getpoints(optarg); + trpoints = getpoints(optarg, DEF_POINTS); if (trpoints < 0) { warnx("unknown facility in %s", optarg); usage(); diff --git a/usr.bin/ktrace/ltrace.1 b/usr.bin/ktrace/ltrace.1 index 64f015e79f8..55717db6f65 100644 --- a/usr.bin/ktrace/ltrace.1 +++ b/usr.bin/ktrace/ltrace.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ltrace.1,v 1.9 2016/03/06 20:25:27 guenther Exp $ +.\" $OpenBSD: ltrace.1,v 1.10 2016/07/18 09:36:50 guenther Exp $ .\" .\" Copyright (c) 2013 Miodrag Vallat. .\" @@ -43,7 +43,7 @@ .\" .\" from: @(#)ktrace.1 8.1 (Berkeley) 6/6/93 .\" -.Dd $Mdocdate: March 6 2016 $ +.Dd $Mdocdate: July 18 2016 $ .Dt LTRACE 1 .Os .Sh NAME @@ -102,16 +102,9 @@ Inherit; pass the trace flags to all future children of the designated processes. .It Fl t Ar trstr The string argument represents the kernel trace points, one per letter. -The default flags are -.Cm c , -.Cm i , -.Cm n , -.Cm s , -.Cm t , -.Cm u , -and -.Cm x . -The following table equates the letters with the tracepoints: +The default is just +.Cm u . +The following table equates the letters with the trace points: .Pp .Bl -tag -width flag -offset indent -compact .It Cm c @@ -120,6 +113,10 @@ trace system calls trace I/O .It Cm n trace namei translations +.It Cm p +trace violation of +.Xr pledge 2 +restrictions .It Cm s trace signal processing .It Cm t diff --git a/usr.bin/ktrace/subr.c b/usr.bin/ktrace/subr.c index 5dd90123b17..43a5717ced7 100644 --- a/usr.bin/ktrace/subr.c +++ b/usr.bin/ktrace/subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr.c,v 1.12 2016/03/06 20:25:27 guenther Exp $ */ +/* $OpenBSD: subr.c,v 1.13 2016/07/18 09:36:50 guenther Exp $ */ /* $NetBSD: subr.c,v 1.6 1995/08/31 23:01:45 jtc Exp $ */ /*- @@ -42,9 +42,13 @@ #include "ktrace.h" #include "extern.h" +/* + * If you change the trace point letters, then update to match: + * ktrace/ktrace.1, ktrace/ltrace.1, kdump/kdump.1, and + * usage() in kdump/kdump.c + */ int -getpoints(s) - const char *s; +getpoints(const char *s, int defpoints) { int facs = 0; @@ -53,11 +57,14 @@ getpoints(s) case 'c': facs |= KTRFAC_SYSCALL | KTRFAC_SYSRET; break; + case 'i': + facs |= KTRFAC_GENIO; + break; case 'n': facs |= KTRFAC_NAMEI; break; - case 'i': - facs |= KTRFAC_GENIO; + case 'p': + facs |= KTRFAC_PLEDGE; break; case 's': facs |= KTRFAC_PSIG; @@ -75,7 +82,7 @@ getpoints(s) facs |= KTRFAC_EXECENV; break; case '+': - facs |= DEF_POINTS; + facs |= defpoints; break; default: return (-1); |