2 .\" Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH TNFCTL_BUFFER_ALLOC 3TNF "Mar 4, 1997"
8 tnfctl_buffer_alloc, tnfctl_buffer_dealloc \- allocate or deallocate a buffer
13 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-ltnfctl\fR [ \fIlibrary\fR ... ]
14 #include <tnf/tnfctl.h>
15 \fBtnfctl_errcode_t\fR \fBtnfctl_buffer_alloc\fR(\fBtnfctl_handle_t *\fR\fIhndl\fR,
16 \fBconst char *\fR\fItrace_file_name\fR, \fBsize_t\fR \fItrace_buffer_size\fR);
21 \fB\fR\fBtnfctl_buffer_dealloc\fR(\fBtnfctl_handle_t *\fR\fIhndl\fR);
27 \fBtnfctl_buffer_alloc()\fR allocates a buffer to which trace events are
28 logged. When tracing a process using a \fBtnfctl\fR handle returned by
29 \fBtnfctl_pid_open\fR(3TNF), \fBtnfctl_exec_open\fR(3TNF),
30 \fBtnfctl_indirect_open\fR(3TNF), and \fBtnfctl_internal_open\fR(3TNF)),
31 \fItrace_file_name\fR is the name of the trace file to which trace events
32 should be logged. It can be an absolute path specification or a relative path
33 specification. If it is relative, the current working directory of the process
34 that is calling \fBtnfctl_buffer_alloc()\fR is prefixed to
35 \fItrace_file_name\fR. If the named trace file already exists, it is
36 overwritten. For kernel tracing, that is, for a tnfctl handle returned by
37 \fBtnfctl_kernel_open\fR(3TNF), trace events are logged to a trace buffer in
38 memory; therefore, \fItrace_file_name\fR is ignored. Use \fBtnfxtract\fR(1) to
39 extract a kernel buffer into a file.
42 \fItrace_buffer_size\fR is the size in bytes of the trace buffer that should be
43 allocated. An error is returned if an attempt is made to allocate a buffer when
44 one already exists. \fBtnfctl_buffer_alloc()\fR affects the trace attributes;
45 use \fBtnfctl_trace_attrs_get\fR(3TNF) to get the latest trace attributes
46 after a buffer is allocated.
49 \fBtnfctl_buffer_dealloc()\fR is used to deallocate a kernel trace buffer that
50 is no longer needed. \fIhndl\fR must be a kernel handle, returned by
51 \fBtnfctl_kernel_open\fR(3TNF). A process's trace file cannot be deallocated
52 using \fBtnfctl_buffer_dealloc()\fR. Instead, once the trace file is no longer
53 needed for analysis and after the process being traced exits, use \fBrm\fR(1)
54 to remove the trace file. Do not remove the trace file while the process being
55 traced is still alive. \fBtnfctl_buffer_dealloc()\fR affects the trace
56 attributes; use \fBtnfctl_trace_attrs_get\fR(3TNF) to get the latest trace
57 attributes after a buffer is deallocated.
60 For a complete discussion of \fBtnf tracing\fR, see \fBtracing\fR(3TNF).
64 \fBtnfctl_buffer_alloc()\fR and \fBtnfctl_buffer_dealloc()\fR return
65 \fBTNFCTL_ERR_NONE\fR upon success.
69 The following error codes apply to \fBtnfctl_buffer_alloc()\fR:
73 \fB\fBTNFCTL_ERR_BUFEXISTS\fR\fR
76 A buffer already exists.
82 \fB\fBTNFCTL_ERR_ACCES\fR\fR
85 Permission denied; could not create a trace file.
91 \fB\fBTNFCTL_ERR_SIZETOOSMALL\fR\fR
94 The \fItrace_buffer_size\fR requested is smaller than the minimum trace buffer
95 size needed. Use \fBtrace_min_size\fR of trace attributes in
96 \fBtnfctl_trace_attrs_get\fR(3TNF) to determine the minimum size of the buffer.
102 \fB\fBTNFCTL_ERR_SIZETOOBIG\fR\fR
105 The requested trace file size is too big.
111 \fB\fBTNFCTL_ERR_BADARG\fR\fR
114 \fItrace_file_name\fR is \fINULL\fR or the absolute path name is longer than
115 \fBMAX\fR\fBPATH\fR\fBLEN.\fR
121 \fB\fBTNFCTL_ERR_ALLOCFAIL\fR\fR
124 A memory allocation failure occurred.
130 \fB\fBTNFCTL_ERR_INTERNAL\fR\fR
133 An internal error occurred.
138 The following error codes apply to \fBtnfctl_buffer_dealloc()\fR:
142 \fB\fBTNFCTL_ERR_BADARG\fR\fR
145 \fIhndl\fR is not a kernel handle.
151 \fB\fBTNFCTL_ERR_NOBUF\fR\fR
154 No buffer exists to deallocate.
160 \fB\fBTNFCTL_ERR_BADDEALLOC\fR\fR
163 Cannot deallocate a trace buffer unless tracing is stopped. Use
164 \fBtnfctl_trace_state_set\fR(3TNF) to stop tracing.
170 \fB\fBTNFCTL_ERR_INTERNAL\fR\fR
173 An internal error occurred.
179 See \fBattributes\fR(5) for descriptions of the following attributes:
187 ATTRIBUTE TYPE ATTRIBUTE VALUE
195 \fBprex\fR(1), \fBrm\fR(1), \fBtnfxtract\fR(1), \fBTNF_PROBE\fR(3TNF),
196 \fBlibtnfctl\fR(3TNF), \fBtnfctl_exec_open\fR(3TNF),
197 \fBtnfctl_indirect_open\fR(3TNF), \fBtnfctl_internal_open\fR(3TNF),
198 \fBtnfctl_kernel_open\fR(3TNF), \fBtnfctl_pid_open\fR(3TNF),
199 \fBtnfctl_trace_attrs_get\fR(3TNF), \fBtracing\fR(3TNF), \fBattributes\fR(5)