summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2017-08-13 19:34:13 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2017-08-13 19:34:13 +0000
commitae8e69c654d292be2ed4685745ef55d511839ccf (patch)
treedeeeb9f05767fd6dfd63c684ef7d2c0a391e2bbe
parent5a6b85dca4db5fe09d1b6b9df58f18a7e55d3b46 (diff)
add fktrace to libc
-rw-r--r--lib/libc/sys/Makefile.inc4
-rw-r--r--lib/libc/sys/ktrace.215
2 files changed, 14 insertions, 5 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 2c015872a0d..3942aaaae41 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.151 2017/08/12 00:07:35 guenther Exp $
+# $OpenBSD: Makefile.inc,v 1.152 2017/08/13 19:34:12 tedu Exp $
# $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $
# @(#)Makefile.inc 8.1 (Berkeley) 6/17/93
@@ -47,7 +47,7 @@ ASM= __semctl.o __syscall.o __thrsigdivert.o \
dup.o dup2.o dup3.o \
execve.o \
faccessat.o fchdir.o fchflags.o fchmod.o fchmodat.o fchown.o \
- fchownat.o fhopen.o fhstat.o fhstatfs.o \
+ fchownat.o fhopen.o fhstat.o fhstatfs.o fktrace.o \
flock.o fpathconf.o fstat.o fstatat.o fstatfs.o \
futimens.o futimes.o \
getentropy.o getdents.o getfh.o getfsstat.o \
diff --git a/lib/libc/sys/ktrace.2 b/lib/libc/sys/ktrace.2
index 8aa64d66bdf..1f62904da1a 100644
--- a/lib/libc/sys/ktrace.2
+++ b/lib/libc/sys/ktrace.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ktrace.2,v 1.31 2016/06/18 04:24:19 guenther Exp $
+.\" $OpenBSD: ktrace.2,v 1.32 2017/08/13 19:34:12 tedu Exp $
.\" $NetBSD: ktrace.2,v 1.2 1995/02/27 12:33:58 cgd Exp $
.\"
.\" Copyright (c) 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)ktrace.2 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: June 18 2016 $
+.Dd $Mdocdate: August 13 2017 $
.Dt KTRACE 2
.Os
.Sh NAME
@@ -43,6 +43,8 @@
.In sys/ktrace.h
.Ft int
.Fn ktrace "const char *tracefile" "int ops" "int trpoints" "pid_t pid"
+.Ft int
+.Fn fktrace "int tracefd" "int ops" "int trpoints" "pid_t pid"
.Sh DESCRIPTION
The
.Fn ktrace
@@ -58,6 +60,10 @@ option.
gives the pathname of the file to be used for tracing.
The file must exist, be writable by the calling process, and
not be a symbolic link.
+An existing file descriptor
+.Fa tracefd
+may be used with
+.Fn fktrace .
All trace records are always appended to the file,
so the file must be truncated to zero length to discard
previous trace data.
@@ -66,7 +72,10 @@ If tracing points are being disabled (see
below),
.Fa tracefile
may be
-.Dv NULL .
+.Dv NULL
+or
+.Fa tracefd
+may be -1.
.Pp
The
.Fa ops