1POSIX_TRACE_GETNEXT_EVENT(P)POSIX Programmer's ManuaPlOSIX_TRACE_GETNEXT_EVENT(P)
2
3
4
6 posix_trace_getnext_event, posix_trace_timedgetnext_event,
7 posix_trace_trygetnext_event - retrieve a trace event (TRACING)
8
10 #include <sys/types.h>
11 #include <trace.h>
12
13 int posix_trace_getnext_event(trace_id_t trid,
14 struct posix_trace_event_info *restrict event,
15 void *restrict data, size_t num_bytes,
16 size_t *restrict data_len, int *restrict unavailable);
17
18
19 int posix_trace_timedgetnext_event(trace_id_t trid,
20 struct posix_trace_event_info *restrict event,
21 void *restrict data, size_t num_bytes,
22 size_t *restrict data_len, int *restrict unavailable,
23 const struct timespec *restrict abs_timeout);
24
25
26 int posix_trace_trygetnext_event(trace_id_t trid,
27 struct posix_trace_event_info *restrict event,
28 void *restrict data, size_t num_bytes,
29 size_t *restrict data_len, int *restrict unavailable);
30
31
33 The posix_trace_getnext_event() function shall report a recorded trace
34 event either from an active trace stream without log or a pre-recorded
35 trace stream identified by the trid argument. The posix_trace_tryget‐
36 next_event() function shall report a recorded trace event from an
37 active trace stream without log identified by the trid argument.
38
39 The trace event information associated with the recorded trace event
40 shall be copied by the function into the structure pointed to by the
41 argument event and the data associated with the trace event shall be
42 copied into the buffer pointed to by the data argument.
43
44 The posix_trace_getnext_event() function shall block if the trid argu‐
45 ment identifies an active trace stream and there is currently no trace
46 event ready to be retrieved. When returning, if a recorded trace event
47 was reported, the variable pointed to by the unavailable argument shall
48 be set to zero. Otherwise, the variable pointed to by the unavailable
49 argument shall be set to a value different from zero.
50
51 The posix_trace_timedgetnext_event() function shall attempt to get
52 another trace event from an active trace stream without log, as in the
53 posix_trace_getnext_event() function. However, if no trace event is
54 available from the trace stream, the implied wait shall be terminated
55 when the timeout specified by the argument abs_timeout expires, and the
56 function shall return the error [ETIMEDOUT].
57
58 The timeout shall expire when the absolute time specified by abs_time‐
59 out passes, as measured by the clock upon which timeouts are based
60 (that is, when the value of that clock equals or exceeds abs_timeout),
61 or if the absolute time specified by abs_timeout has already passed at
62 the time of the call.
63
64 If the Timers option is supported, the timeout shall be based on the
65 CLOCK_REALTIME clock; if the Timers option is not supported, the time‐
66 out shall be based on the system clock as returned by the time() func‐
67 tion. The resolution of the timeout shall be the resolution of the
68 clock on which it is based. The timespec data type is defined in the
69 <time.h> header.
70
71 Under no circumstance shall the function fail with a timeout if a trace
72 event is immediately available from the trace stream. The validity of
73 the abs_timeout argument need not be checked if a trace event is imme‐
74 diately available from the trace stream.
75
76 The behavior of this function for a pre-recorded trace stream is
77 unspecified.
78
79 The posix_trace_trygetnext_event() function shall not block. This
80 function shall return an error if the trid argument identifies a pre-
81 recorded trace stream. If a recorded trace event was reported, the
82 variable pointed to by the unavailable argument shall be set to zero.
83 Otherwise, if no trace event was reported, the variable pointed to by
84 the unavailable argument shall be set to a value different from zero.
85
86 The argument num_bytes shall be the size of the buffer pointed to by
87 the data argument. The argument data_len reports to the application the
88 length in bytes of the data record just transferred. If num_bytes is
89 greater than or equal to the size of the data associated with the trace
90 event pointed to by the event argument, all the recorded data shall be
91 transferred. In this case, the truncation-status member of the trace
92 event structure shall be either POSIX_TRACE_NOT_TRUNCATED, if the trace
93 event data was recorded without truncation while tracing, or
94 POSIX_TRACE_TRUNCATED_RECORD, if the trace event data was truncated
95 when it was recorded. If the num_bytes argument is less than the length
96 of recorded trace event data, the data transferred shall be truncated
97 to a length of num_bytes, the value stored in the variable pointed to
98 by data_len shall be equal to num_bytes, and the truncation-status mem‐
99 ber of the event structure argument shall be set to POSIX_TRACE_TRUN‐
100 CATED_READ (see the posix_trace_event_info structure defined in
101 <trace.h>).
102
103 The report of a trace event shall be sequential starting from the old‐
104 est recorded trace event. Trace events shall be reported in the order
105 in which they were generated, up to an implementation-defined time res‐
106 olution that causes the ordering of trace events occurring very close
107 to each other to be unknown. Once reported, a trace event cannot be
108 reported again from an active trace stream. Once a trace event is
109 reported from an active trace stream without log, the trace stream
110 shall make the resources associated with that trace event available to
111 record future generated trace events.
112
114 Upon successful completion, these functions shall return a value of
115 zero. Otherwise, they shall return the corresponding error number.
116
117 If successful, these functions store:
118
119 * The recorded trace event in the object pointed to by event
120
121 * The trace event information associated with the recorded trace event
122 in the object pointed to by data
123
124 * The length of this trace event information in the object pointed to
125 by data_len
126
127 * The value of zero in the object pointed to by unavailable
128
130 These functions shall fail if:
131
132 EINVAL The trace stream identifier argument trid is invalid.
133
134
135 The posix_trace_getnext_event() and posix_trace_timedgetnext_event()
136 functions shall fail if:
137
138 EINTR The operation was interrupted by a signal, and so the call had
139 no effect.
140
141
142 The posix_trace_trygetnext_event() function shall fail if:
143
144 EINVAL The trace stream identifier argument trid does not correspond to
145 an active trace stream.
146
147
148 The posix_trace_timedgetnext_event() function shall fail if:
149
150 EINVAL There is no trace event immediately available from the trace
151 stream, and the timeout argument is invalid.
152
153 ETIMEDOUT
154 No trace event was available from the trace stream before the
155 specified timeout timeout expired.
156
157
158 The following sections are informative.
159
161 None.
162
164 None.
165
167 None.
168
170 None.
171
173 posix_trace_create() , posix_trace_open() , the Base Definitions volume
174 of IEEE Std 1003.1-2001, <sys/types.h>, <trace.h>
175
177 Portions of this text are reprinted and reproduced in electronic form
178 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
179 -- Portable Operating System Interface (POSIX), The Open Group Base
180 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
181 Electrical and Electronics Engineers, Inc and The Open Group. In the
182 event of any discrepancy between this version and the original IEEE and
183 The Open Group Standard, the original IEEE and The Open Group Standard
184 is the referee document. The original Standard can be obtained online
185 at http://www.opengroup.org/unix/online.html .
186
187
188
189IEEE/The Open Group 2003 POSIX_TRACE_GETNEXT_EVENT(P)