📄 posix_trace_trygetnext_event.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>posix_trace_getnext_event</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="posix_trace_getnext_event"></a> <a name="tag_03_472"></a><!-- posix_trace_getnext_event --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_472_01"></a>NAME</h4><blockquote>posix_trace_getnext_event, posix_trace_timedgetnext_event, posix_trace_trygetnext_event - retrieve a trace event(<b>TRACING</b>)</blockquote><h4><a name="tag_03_472_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('TRC')">TRC</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include <<a href="../basedefs/sys/types.h.html">sys/types.h</a>><br> #include <<a href="../basedefs/trace.h.html">trace.h</a>><br><br> int posix_trace_getnext_event(trace_id_t</tt> <i>trid</i><tt>,<br> struct posix_trace_event_info *restrict</tt> <i>event</i><tt>,<br> void *restrict</tt> <i>data</i><tt>, size_t</tt> <i>num_bytes</i><tt>,<br> size_t *restrict</tt> <i>data_len</i><tt>, int *restrict</tt> <i>unavailable</i><tt>);<br> <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><div class="box"><code><tt><sup>[<a href="javascript:open_code('TRC TMO')">TRC TMO</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> int posix_trace_timedgetnext_event(trace_id_t</tt> <i>trid</i><tt>,<br> struct posix_trace_event_info *restrict</tt> <i>event</i><tt>,<br> void *restrict</tt> <i>data</i><tt>, size_t</tt> <i>num_bytes</i><tt>,<br> size_t *restrict</tt> <i>data_len</i><tt>, int *restrict</tt> <i>unavailable</i><tt>,<br> const struct timespec *restrict</tt> <i>abs_timeout</i><tt>);<br> <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><div class="box"><code><tt><sup>[<a href="javascript:open_code('TRC')">TRC</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> int posix_trace_trygetnext_event(trace_id_t</tt> <i>trid</i><tt>,<br> struct posix_trace_event_info *restrict</tt> <i>event</i><tt>,<br> void *restrict</tt> <i>data</i><tt>, size_t</tt> <i>num_bytes</i><tt>,<br> size_t *restrict</tt> <i>data_len</i><tt>, int *restrict</tt> <i>unavailable</i><tt>); <imgsrc="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_472_03"></a>DESCRIPTION</h4><blockquote><p>The <i>posix_trace_getnext_event</i>() function shall report a recorded trace event either from an active trace stream withoutlog <sup>[<a href="javascript:open_code('TRL')">TRL</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> or a pre-recorded trace stream identified by the <i>trid</i> argument. <img src="../images/opt-end.gif" alt="[Option End]"border="0"> The <i>posix_trace_trygetnext_event</i>() function shall report a recorded trace event from an active trace streamwithout log identified by the <i>trid</i> argument.</p><p>The trace event information associated with the recorded trace event shall be copied by the function into the structure pointedto by the argument <i>event</i> and the data associated with the trace event shall be copied into the buffer pointed to by the<i>data</i> argument.</p><p>The <i>posix_trace_getnext_event</i>() function shall block if the <i>trid</i> argument identifies an active trace stream andthere is currently no trace event ready to be retrieved. When returning, if a recorded trace event was reported, the variablepointed to by the <i>unavailable</i> argument shall be set to zero. Otherwise, the variable pointed to by the <i>unavailable</i>argument shall be set to a value different from zero.</p><p><sup>[<a href="javascript:open_code('TMO')">TMO</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> The <i>posix_trace_timedgetnext_event</i>() function shall attempt to get another trace event from an active trace streamwithout log, as in the <i>posix_trace_getnext_event</i>() function. However, if no trace event is available from the trace stream,the implied wait shall be terminated when the timeout specified by the argument <i>abs_timeout</i> expires, and the function shallreturn the error [ETIMEDOUT].</p><p>The timeout shall expire when the absolute time specified by <i>abs_timeout</i> passes, as measured by the clock upon whichtimeouts are based (that is, when the value of that clock equals or exceeds <i>abs_timeout</i>), or if the absolute time specifiedby <i>abs_timeout</i> has already passed at the time of the call. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><p><sup>[<a href="javascript:open_code('TMO TMR')">TMO TMR</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> If the Timers option is supported, the timeout shall be based on the CLOCK_REALTIME clock; if the Timers optionis not supported, the timeout shall be based on the system clock as returned by the <a href="../functions/time.html"><i>time</i>()</a> function. The resolution of the timeout shall be the resolution of the clock on which itis based. The <b>timespec</b> data type is defined in the <a href="../basedefs/time.h.html"><i><time.h></i></a> header. <imgsrc="../images/opt-end.gif" alt="[Option End]" border="0"></p><p><sup>[<a href="javascript:open_code('TMO')">TMO</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Under no circumstance shall the function fail with a timeout if a trace event is immediately available from the trace stream. Thevalidity of the <i>abs_timeout</i> argument need not be checked if a trace event is immediately available from the tracestream.</p><p>The behavior of this function for a pre-recorded trace stream is unspecified. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><p>The <i>posix_trace_trygetnext_event</i>() function shall not block. <sup>[<a href="javascript:open_code('TRL')">TRL</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0"> This function shall return an error if the <i>trid</i>argument identifies a pre-recorded trace stream. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> If a recordedtrace event was reported, the variable pointed to by the <i>unavailable</i> argument shall be set to zero. Otherwise, if no traceevent was reported, the variable pointed to by the <i>unavailable</i> argument shall be set to a value different from zero.</p><p>The argument <i>num_bytes</i> shall be the size of the buffer pointed to by the <i>data</i> argument. The argument<i>data_len</i> reports to the application the length in bytes of the data record just transferred. If <i>num_bytes</i> is greaterthan or equal to the size of the data associated with the trace event pointed to by the <i>event</i> argument, all the recordeddata shall be transferred. In this case, the <i>truncation-status</i> member of the trace event structure shall be eitherPOSIX_TRACE_NOT_TRUNCATED, if the trace event data was recorded without truncation while tracing, or POSIX_TRACE_TRUNCATED_RECORD,if the trace event data was truncated when it was recorded. If the <i>num_bytes</i> argument is less than the length of recordedtrace event data, the data transferred shall be truncated to a length of <i>num_bytes</i>, the value stored in the variable pointedto by <i>data_len</i> shall be equal to <i>num_bytes</i>, and the <i>truncation-status</i> member of the <i>event</i> structureargument shall be set to POSIX_TRACE_TRUNCATED_READ (see the <b>posix_trace_event_info</b> structure defined in <a href="../basedefs/trace.h.html"><i><trace.h></i></a>).</p><p>The report of a trace event shall be sequential starting from the oldest recorded trace event. Trace events shall be reported inthe order in which they were generated, up to an implementation-defined time resolution that causes the ordering of trace eventsoccurring very close to each other to be unknown. Once reported, a trace event cannot be reported again from an active tracestream. Once a trace event is reported from an active trace stream without log, the trace stream shall make the resourcesassociated with that trace event available to record future generated trace events.</p></blockquote><h4><a name="tag_03_472_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, these functions shall return a value of zero. Otherwise, they shall return the corresponding errornumber.</p><p>If successful, these functions store:</p><ul><li><p>The recorded trace event in the object pointed to by <i>event</i></p></li><li><p>The trace event information associated with the recorded trace event in the object pointed to by <i>data</i></p></li><li><p>The length of this trace event information in the object pointed to by <i>data_len</i></p></li><li><p>The value of zero in the object pointed to by <i>unavailable</i></p></li></ul></blockquote><h4><a name="tag_03_472_05"></a>ERRORS</h4><blockquote><p>These functions shall fail if:</p><dl compact><dt>[EINVAL]</dt><dd>The trace stream identifier argument <i>trid</i> is invalid.</dd></dl><p>The <i>posix_trace_getnext_event</i>() and <i>posix_trace_timedgetnext_event</i>() functions shall fail if:</p><dl compact><dt>[EINTR]</dt><dd>The operation was interrupted by a signal, and so the call had no effect.</dd></dl><p>The <i>posix_trace_trygetnext_event</i>() function shall fail if:</p><dl compact><dt>[EINVAL]</dt><dd>The trace stream identifier argument <i>trid</i> does not correspond to an active trace stream.</dd></dl><p><sup>[<a href="javascript:open_code('TMO')">TMO</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The <i>posix_trace_timedgetnext_event</i>() function shall fail if:</p><dl compact><dt>[EINVAL]</dt><dd>There is no trace event immediately available from the trace stream, and the <i>timeout</i> argument is invalid.</dd><dt>[ETIMEDOUT]</dt><dd>No trace event was available from the trace stream before the specified timeout <i>timeout</i> expired.</dd></dl><img src="../images/opt-end.gif" alt="[Option End]" border="0"></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_472_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_472_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_472_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_472_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_472_10"></a>SEE ALSO</h4><blockquote><p><a href="posix_trace_create.html"><i>posix_trace_create</i>()</a> , <a href="posix_trace_open.html"><i>posix_trace_open</i>()</a> , the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/sys/types.h.html"><i><sys/types.h></i></a>, <a href="../basedefs/trace.h.html"><i><trace.h></i></a></p></blockquote><h4><a name="tag_03_472_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 6. Derived from IEEE Std 1003.1q-2000.</p><p>IEEE PASC Interpretation 1003.1 #123 is applied.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -