1tnfctl_buffer_alloc(3TNF)    TNF Library Functions   tnfctl_buffer_alloc(3TNF)
2
3
4

NAME

6       tnfctl_buffer_alloc,  tnfctl_buffer_dealloc  - allocate or deallocate a
7       buffer for trace data
8

SYNOPSIS

10       cc [ flag ... ] file ... -ltnfctl [ library ... ]
11       #include <tnf/tnfctl.h>
12       tnfctl_errcode_t tnfctl_buffer_alloc(tnfctl_handle_t *hndl,
13            const char *trace_file_name, size_t trace_buffer_size);
14
15
16       tnfctl_buffer_dealloc(tnfctl_handle_t *hndl);
17
18

DESCRIPTION

20       tnfctl_buffer_alloc() allocates a buffer  to  which  trace  events  are
21       logged.  When  tracing  a  process  using  a  tnfctl handle returned by
22       tnfctl_pid_open(3TNF),       tnfctl_exec_open(3TNF),       tnfctl_indi‐
23       rect_open(3TNF),  and  tnfctl_internal_open(3TNF)),  trace_file_name is
24       the name of the trace file to which trace events should be  logged.  It
25       can be an absolute path specification or a relative path specification.
26       If it is relative, the current working directory of the process that is
27       calling   tnfctl_buffer_alloc() is prefixed to  trace_file_name. If the
28       named trace file already exists, it is overwritten. For kernel tracing,
29       that  is,  for  a  tnfctl  handle returned by tnfctl_kernel_open(3TNF),
30       trace events are  logged  to  a  trace  buffer  in  memory;  therefore,
31       trace_file_name  is ignored.  Use tnfxtract(1) to extract a kernel buf‐
32       fer into a file.
33
34
35       trace_buffer_size is the size in bytes of the trace buffer that  should
36       be  allocated. An error is returned if an attempt is made to allocate a
37       buffer when one already  exists.    tnfctl_buffer_alloc()  affects  the
38       trace  attributes;  use  tnfctl_trace_attrs_get(3TNF) to get the latest
39       trace attributes after a buffer is allocated.
40
41
42       tnfctl_buffer_dealloc() is used to deallocate  a  kernel  trace  buffer
43       that  is  no  longer  needed. hndl must be a kernel handle, returned by
44       tnfctl_kernel_open(3TNF). A process's trace file cannot be  deallocated
45       using  tnfctl_buffer_dealloc().  Instead,  once  the  trace  file is no
46       longer needed for analysis and after  the process being  traced  exits,
47       use  rm(1) to remove the trace file. Do not remove the trace file while
48       the  process  being  traced  is  still  alive.  tnfctl_buffer_dealloc()
49       affects  the trace attributes; use  tnfctl_trace_attrs_get(3TNF) to get
50       the latest trace attributes after a buffer is deallocated.
51
52
53       For a complete discussion of  tnf tracing, see tracing(3TNF).
54

RETURN VALUES

56       tnfctl_buffer_alloc()      and      tnfctl_buffer_dealloc()      return
57       TNFCTL_ERR_NONE upon success.
58

ERRORS

60       The following error codes apply to tnfctl_buffer_alloc():
61
62       TNFCTL_ERR_BUFEXISTS       A buffer already exists.
63
64
65       TNFCTL_ERR_ACCES           Permission  denied; could not create a trace
66                                  file.
67
68
69       TNFCTL_ERR_SIZETOOSMALL    The  trace_buffer_size requested is  smaller
70                                  than  the  minimum trace buffer size needed.
71                                  Use trace_min_size of  trace  attributes  in
72                                  tnfctl_trace_attrs_get(3TNF)   to  determine
73                                  the minimum size of the buffer.
74
75
76       TNFCTL_ERR_SIZETOOBIG      The requested trace file size is too big.
77
78
79       TNFCTL_ERR_BADARG          trace_file_name is   NULL  or  the  absolute
80                                  path name is longer than MAXPATHLEN.
81
82
83       TNFCTL_ERR_ALLOCFAIL       A memory allocation failure occurred.
84
85
86       TNFCTL_ERR_INTERNAL        An internal error occurred.
87
88
89
90       The following error codes apply to tnfctl_buffer_dealloc():
91
92       TNFCTL_ERR_BADARG        hndl is not a kernel handle.
93
94
95       TNFCTL_ERR_NOBUF         No buffer exists to deallocate.
96
97
98       TNFCTL_ERR_BADDEALLOC    Cannot  deallocate a trace buffer unless trac‐
99                                ing          is          stopped.          Use
100                                tnfctl_trace_state_set(3TNF) to stop tracing.
101
102
103       TNFCTL_ERR_INTERNAL      An internal error occurred.
104
105

ATTRIBUTES

107       See attributes(5) for descriptions of the following attributes:
108
109
110
111
112       ┌─────────────────────────────┬─────────────────────────────┐
113       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
114       ├─────────────────────────────┼─────────────────────────────┤
115       │Availability                 │SUNWtnfc                     │
116       ├─────────────────────────────┼─────────────────────────────┤
117       │MT Level                     │MT-Safe                      │
118       └─────────────────────────────┴─────────────────────────────┘
119

SEE ALSO

121       prex(1),   rm(1),   tnfxtract(1),   TNF_PROBE(3TNF),   libtnfctl(3TNF),
122       tnfctl_exec_open(3TNF),    tnfctl_indirect_open(3TNF),    tnfctl_inter‐
123       nal_open(3TNF),     tnfctl_kernel_open(3TNF),    tnfctl_pid_open(3TNF),
124       tnfctl_trace_attrs_get(3TNF), tracing(3TNF), attributes(5)
125
126
127
128SunOS 5.11                        4 Mar 1997         tnfctl_buffer_alloc(3TNF)
Impressum