summaryrefslogtreecommitdiff
path: root/usr/src/man/man3tnf/tnfctl_buffer_alloc.3tnf
blob: 0c9080a0b07f2c02a610e0fe1efa25f430817db9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
'\" te
.\"  Copyright (c) 1996 Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH TNFCTL_BUFFER_ALLOC 3TNF "Mar 4, 1997"
.SH NAME
tnfctl_buffer_alloc, tnfctl_buffer_dealloc \- allocate or deallocate a buffer
for trace data
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-ltnfctl\fR [ \fIlibrary\fR ... ]
#include <tnf/tnfctl.h>
\fBtnfctl_errcode_t\fR \fBtnfctl_buffer_alloc\fR(\fBtnfctl_handle_t *\fR\fIhndl\fR,
     \fBconst char *\fR\fItrace_file_name\fR, \fBsize_t\fR \fItrace_buffer_size\fR);
.fi

.LP
.nf
\fB\fR\fBtnfctl_buffer_dealloc\fR(\fBtnfctl_handle_t *\fR\fIhndl\fR);
.fi

.SH DESCRIPTION
.sp
.LP
\fBtnfctl_buffer_alloc()\fR allocates a buffer to which trace events are
logged. When tracing a process using a  \fBtnfctl\fR handle returned by
\fBtnfctl_pid_open\fR(3TNF), \fBtnfctl_exec_open\fR(3TNF),
\fBtnfctl_indirect_open\fR(3TNF), and \fBtnfctl_internal_open\fR(3TNF)),
\fItrace_file_name\fR is the name of the trace file to which trace events
should be logged. It can be an absolute path specification or a relative path
specification. If it is relative, the current working directory of the process
that is calling  \fBtnfctl_buffer_alloc()\fR is prefixed to
\fItrace_file_name\fR. If the named trace file already exists, it is
overwritten. For kernel tracing, that is, for a tnfctl handle returned by
\fBtnfctl_kernel_open\fR(3TNF), trace events are logged to a trace buffer in
memory; therefore, \fItrace_file_name\fR is ignored.  Use \fBtnfxtract\fR(1) to
extract a kernel buffer into a file.
.sp
.LP
\fItrace_buffer_size\fR is the size in bytes of the trace buffer that should be
allocated. An error is returned if an attempt is made to allocate a buffer when
one already exists.   \fBtnfctl_buffer_alloc()\fR affects the trace attributes;
use  \fBtnfctl_trace_attrs_get\fR(3TNF) to get the latest trace attributes
after a buffer is allocated.
.sp
.LP
\fBtnfctl_buffer_dealloc()\fR is used to deallocate a kernel trace buffer that
is no longer needed. \fIhndl\fR must be a kernel handle, returned by
\fBtnfctl_kernel_open\fR(3TNF). A process's trace file cannot be deallocated
using \fBtnfctl_buffer_dealloc()\fR. Instead, once the trace file is no longer
needed for analysis and after  the process being traced exits, use \fBrm\fR(1)
to remove the trace file. Do not remove the trace file while the process being
traced is still alive. \fBtnfctl_buffer_dealloc()\fR affects the trace
attributes; use  \fBtnfctl_trace_attrs_get\fR(3TNF) to get the latest trace
attributes after a buffer is deallocated.
.sp
.LP
For a complete discussion of  \fBtnf tracing\fR, see \fBtracing\fR(3TNF).
.SH RETURN VALUES
.sp
.LP
\fBtnfctl_buffer_alloc()\fR and \fBtnfctl_buffer_dealloc()\fR return
\fBTNFCTL_ERR_NONE\fR upon success.
.SH ERRORS
.sp
.LP
The following error codes apply to \fBtnfctl_buffer_alloc()\fR:
.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_BUFEXISTS\fR\fR
.ad
.RS 27n
A buffer already exists.
.RE

.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_ACCES\fR\fR
.ad
.RS 27n
Permission denied; could not create a trace file.
.RE

.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_SIZETOOSMALL\fR\fR
.ad
.RS 27n
The  \fItrace_buffer_size\fR requested is smaller than the minimum trace buffer
size needed. Use \fBtrace_min_size\fR of trace attributes in
\fBtnfctl_trace_attrs_get\fR(3TNF) to determine the minimum size of the buffer.
.RE

.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_SIZETOOBIG\fR\fR
.ad
.RS 27n
The requested trace file size is too big.
.RE

.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_BADARG\fR\fR
.ad
.RS 27n
\fItrace_file_name\fR is  \fINULL\fR or the absolute path name is longer than
\fBMAX\fR\fBPATH\fR\fBLEN.\fR
.RE

.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_ALLOCFAIL\fR\fR
.ad
.RS 27n
A memory allocation failure occurred.
.RE

.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_INTERNAL\fR\fR
.ad
.RS 27n
An internal error occurred.
.RE

.sp
.LP
The following error codes apply to \fBtnfctl_buffer_dealloc()\fR:
.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_BADARG\fR\fR
.ad
.RS 25n
\fIhndl\fR is not a kernel handle.
.RE

.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_NOBUF\fR\fR
.ad
.RS 25n
No buffer exists to deallocate.
.RE

.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_BADDEALLOC\fR\fR
.ad
.RS 25n
Cannot deallocate a trace buffer unless tracing is stopped. Use
\fBtnfctl_trace_state_set\fR(3TNF) to stop tracing.
.RE

.sp
.ne 2
.na
\fB\fBTNFCTL_ERR_INTERNAL\fR\fR
.ad
.RS 25n
An internal error occurred.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
MT Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
\fBprex\fR(1), \fBrm\fR(1), \fBtnfxtract\fR(1), \fBTNF_PROBE\fR(3TNF),
\fBlibtnfctl\fR(3TNF), \fBtnfctl_exec_open\fR(3TNF),
\fBtnfctl_indirect_open\fR(3TNF), \fBtnfctl_internal_open\fR(3TNF),
\fBtnfctl_kernel_open\fR(3TNF), \fBtnfctl_pid_open\fR(3TNF),
\fBtnfctl_trace_attrs_get\fR(3TNF), \fBtracing\fR(3TNF), \fBattributes\fR(5)