1POSIX_TRACE_GETNEXT_EVENT(3PP)OSIX Programmer's ManuPaOlSIX_TRACE_GETNEXT_EVENT(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       posix_trace_getnext_event,              posix_trace_timedgetnext_event,
13       posix_trace_trygetnext_event — retrieve a trace event (TRACING)
14

SYNOPSIS

16       #include <sys/types.h>
17       #include <trace.h>
18
19       int posix_trace_getnext_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       int posix_trace_timedgetnext_event(trace_id_t trid,
24           struct posix_trace_event_info *restrict event,
25           void *restrict data, size_t num_bytes,
26           size_t *restrict data_len, int *restrict unavailable,
27           const struct timespec *restrict abstime);
28       int posix_trace_trygetnext_event(trace_id_t trid,
29           struct posix_trace_event_info *restrict event,
30           void *restrict data, size_t num_bytes,
31           size_t *restrict data_len, int *restrict unavailable);
32

DESCRIPTION

34       The  posix_trace_getnext_event() function shall report a recorded trace
35       event either from an active trace stream without log or a  pre-recorded
36       trace  stream identified by the trid argument.  The posix_trace_tryget‐
37       next_event() function shall report  a  recorded  trace  event  from  an
38       active trace stream without log identified by the trid argument.
39
40       The  trace  event  information associated with the recorded trace event
41       shall be copied by the function into the structure pointed  to  by  the
42       argument  event  and  the data associated with the trace event shall be
43       copied into the buffer pointed to by the data argument.
44
45       The posix_trace_getnext_event() function shall block if the trid  argu‐
46       ment  identifies an active trace stream and there is currently no trace
47       event ready to be retrieved. When returning, if a recorded trace  event
48       was reported, the variable pointed to by the unavailable argument shall
49       be set to zero. Otherwise, the variable pointed to by  the  unavailable
50       argument shall be set to a value different from zero.
51
52       The  posix_trace_timedgetnext_event()  function  shall  attempt  to get
53       another trace event from an active trace stream without log, as in  the
54       posix_trace_getnext_event()  function.  However,  if  no trace event is
55       available from the trace stream, the implied wait shall  be  terminated
56       when  the  timeout  specified  by the argument abstime expires, and the
57       function shall return the error [ETIMEDOUT].
58
59       The timeout shall expire when the absolute time  specified  by  abstime
60       passes,  as  measured  by the clock upon which timeouts are based (that
61       is, when the value of that clock equals or exceeds abstime), or if  the
62       absolute  time  specified  by abstime has already passed at the time of
63       the call.
64
65       The timeout shall be based on the CLOCK_REALTIME clock.  The resolution
66       of  the  timeout  shall  be  the resolution of the clock on which it is
67       based. The timespec data type is defined in the <time.h> header.
68
69       Under no circumstance shall the function fail with a timeout if a trace
70       event  is  immediately available from the trace stream. The validity of
71       the abstime argument need not be checked if a trace  event  is  immedi‐
72       ately available from the trace stream.
73
74       The  behavior  of  this  function  for  a  pre-recorded trace stream is
75       unspecified.
76
77       The posix_trace_trygetnext_event()  function  shall  not  block.   This
78       function  shall  return an error if the trid argument identifies a pre-
79       recorded trace stream.  If a recorded trace  event  was  reported,  the
80       variable  pointed  to by the unavailable argument shall be set to zero.
81       Otherwise, if no trace event was reported, the variable pointed  to  by
82       the unavailable argument shall be set to a value different from zero.
83
84       The  argument  num_bytes  shall be the size of the buffer pointed to by
85       the data argument. The argument data_len reports to the application the
86       length  in  bytes  of the data record just transferred. If num_bytes is
87       greater than or equal to the size of the data associated with the trace
88       event  pointed to by the event argument, all the recorded data shall be
89       transferred. In this case, the truncation-status member  of  the  trace
90       event structure shall be either POSIX_TRACE_NOT_TRUNCATED, if the trace
91       event  data  was  recorded  without  truncation   while   tracing,   or
92       POSIX_TRACE_TRUNCATED_RECORD,  if  the  trace  event data was truncated
93       when it was recorded. If the num_bytes argument is less than the length
94       of  recorded  trace event data, the data transferred shall be truncated
95       to a length of num_bytes, the value stored in the variable  pointed  to
96       by data_len shall be equal to num_bytes, and the truncation-status mem‐
97       ber of the event structure argument shall be set  to  POSIX_TRACE_TRUN‐
98       CATED_READ   (see   the  posix_trace_event_info  structure  defined  in
99       <trace.h>).
100
101       The report of a trace event shall be sequential starting from the  old‐
102       est  recorded  trace event. Trace events shall be reported in the order
103       in which they were generated, up to an implementation-defined time res‐
104       olution  that  causes the ordering of trace events occurring very close
105       to each other to be unknown. Once reported, a  trace  event  cannot  be
106       reported  again  from  an  active  trace  stream. Once a trace event is
107       reported from an active trace stream  without  log,  the  trace  stream
108       shall  make the resources associated with that trace event available to
109       record future generated trace events.
110

RETURN VALUE

112       Upon successful completion, these functions shall  return  a  value  of
113       zero. Otherwise, they shall return the corresponding error number.
114
115       If successful, these functions store:
116
117        *  The recorded trace event in the object pointed to by event
118
119        *  The  trace  event  information  associated  with the recorded trace
120           event in the object pointed to by data
121
122        *  The length of this trace event information in the object pointed to
123           by data_len
124
125        *  The value of zero in the object pointed to by unavailable
126

ERRORS

128       These functions shall fail if:
129
130       EINVAL The trace stream identifier argument trid is invalid.
131
132       The  posix_trace_getnext_event()  and  posix_trace_timedgetnext_event()
133       functions shall fail if:
134
135       EINTR  The operation was interrupted by a signal, and so the  call  had
136              no effect.
137
138       The posix_trace_trygetnext_event() function shall fail if:
139
140       EINVAL The trace stream identifier argument trid does not correspond to
141              an active trace stream.
142
143       The posix_trace_timedgetnext_event() function shall fail if:
144
145       EINVAL There is no trace event immediately  available  from  the  trace
146              stream, and the timeout argument is invalid.
147
148       ETIMEDOUT
149              No  trace  event  was available from the trace stream before the
150              specified timeout timeout expired.
151
152       The following sections are informative.
153

EXAMPLES

155       None.
156

APPLICATION USAGE

158       None.
159

RATIONALE

161       None.
162

FUTURE DIRECTIONS

164       These functions may be removed in a future version.
165

SEE ALSO

167       posix_trace_close(), posix_trace_create()
168
169       The Base Definitions volume of POSIX.1‐2017, <sys_types.h>, <trace.h>
170
172       Portions of this text are reprinted and reproduced in  electronic  form
173       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
174       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
175       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
176       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
177       event of any discrepancy between this version and the original IEEE and
178       The Open Group Standard, the original IEEE and The Open Group  Standard
179       is  the  referee document. The original Standard can be obtained online
180       at http://www.opengroup.org/unix/online.html .
181
182       Any typographical or formatting errors that appear  in  this  page  are
183       most likely to have been introduced during the conversion of the source
184       files to man page format. To report such errors,  see  https://www.ker
185       nel.org/doc/man-pages/reporting_bugs.html .
186
187
188
189IEEE/The Open Group                  2017        POSIX_TRACE_GETNEXT_EVENT(3P)
Impressum