xref: /openbsd-src/lib/libc/sys/utrace.2 (revision 06a07dade4f8c6360a33dfc24ee77662d485c8ed)
1.\"	$OpenBSD: utrace.2,v 1.4 2023/02/23 01:34:27 deraadt Exp $
2.\"	$NetBSD: utrace.2,v 1.13 2008/05/02 18:38:32 martin Exp $
3.\"
4.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
5.\" All rights reserved.
6.\"
7.\" This code is derived from software contributed to The NetBSD Foundation
8.\" by Gregory McGarry <g.mcgarry@ieee.org>.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29.\" POSSIBILITY OF SUCH DAMAGE.
30.\"
31.Dd $Mdocdate: February 23 2023 $
32.Dt UTRACE 2
33.Os
34.Sh NAME
35.Nm utrace
36.Nd insert user record in ktrace log
37.Sh SYNOPSIS
38.In sys/types.h
39.In sys/ktrace.h
40.Ft int
41.Fn utrace "const char *label" "void *addr" "size_t len"
42.Sh DESCRIPTION
43Adds a record to the process trace with information supplied by the user.
44The record is identified by
45.Fa label
46and contains
47.Fa len
48bytes from memory pointed to by
49.Fa addr .
50This call only has an effect if the calling process is being traced.
51.Sh RETURN VALUES
52.Rv -std
53.Sh ERRORS
54.Bl -tag -width Er
55.It Bq Er ENOSYS
56The currently running kernel was compiled without
57.Xr ktrace 2
58support (option KTRACE).
59.It Bq Er ENAMETOOLONG
60The length of the
61.Fa label
62string was longer than
63.Dv KTR_USER_MAXIDLEN\-1 .
64.It Bq Er EINVAL
65The specified data length
66.Fa len
67was bigger than
68.Dv KTR_USER_MAXLEN .
69.El
70.Sh SEE ALSO
71.Xr kdump 1 ,
72.Xr ktrace 1 ,
73.Xr ktrace 2 ,
74.Xr options 4
75.Sh HISTORY
76The
77.Fn utrace
78system call first appeared in
79.Fx 2.2 .
80It was added to
81.Ox
82in
83.Ox 5.4 .
84The
85.Fa label
86argument is an extension.
87