⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 posix_trace_create_withlog.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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_create</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="posix_trace_create"></a> <a name="tag_03_462"></a><!-- posix_trace_create --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_462_01"></a>NAME</h4><blockquote>posix_trace_create, posix_trace_create_withlog, posix_trace_flush, posix_trace_shutdown - trace stream initialization,flush, and shutdown from a process (<b>TRACING</b>)</blockquote><h4><a name="tag_03_462_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 &lt;<a href="../basedefs/sys/types.h.html">sys/types.h</a>&gt;<br> #include &lt;<a href="../basedefs/trace.h.html">trace.h</a>&gt;<br><br> int posix_trace_create(pid_t</tt> <i>pid</i><tt>,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const trace_attr_t *restrict</tt> <i>attr</i><tt>,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; trace_id_t *restrict</tt> <i>trid</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 TRL')">TRC TRL</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> int posix_trace_create_withlog(pid_t</tt> <i>pid</i><tt>,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const trace_attr_t *restrict</tt> <i>attr</i><tt>, int</tt> <i>file_desc</i><tt>,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; trace_id_t *restrict</tt> <i>trid</i><tt>);<br> int posix_trace_flush(trace_id_t</tt> <i>trid</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_shutdown(trace_id_t</tt> <i>trid</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_462_03"></a>DESCRIPTION</h4><blockquote><p>The <i>posix_trace_create</i>() function shall create an active trace stream. It allocates all the resources needed by the tracestream being created for tracing the process specified by <i>pid</i> in accordance with the <i>attr</i> argument. The <i>attr</i>argument represents the initial attributes of the trace stream and shall have been initialized by the function <a href="../functions/posix_trace_attr_init.html"><i>posix_trace_attr_init</i>()</a> prior to the <i>posix_trace_create</i>() call. If theargument <i>attr</i> is NULL, the default attributes shall be used. The <i>attr</i> attributes object shall be manipulated througha set of functions described in the <i>posix_trace_attr</i> family of functions. If the attributes of the object pointed to by<i>attr</i> are modified later, the attributes of the trace stream shall not be affected. The <i>creation-time</i> attribute of thenewly created trace stream shall be set to the value of the system clock, if the Timers option is not supported, or to the value ofthe CLOCK_REALTIME clock, if the Timers option is supported.</p><p>The <i>pid</i> argument represents the target process to be traced. If the process executing this function does not haveappropriate privileges to trace the process identified by <i>pid</i>, an error shall be returned. If the <i>pid</i> argument iszero, the calling process shall be traced.</p><p>The <i>posix_trace_create</i>() function shall store the trace stream identifier of the new trace stream in the object pointedto by the <i>trid</i> argument. This trace stream identifier shall be used in subsequent calls to control tracing. The <i>trid</i>argument may only be used by the following functions:</p><table cellpadding="3"><tr valign="top"><td align="left"><p class="tent"><br><a href="../functions/posix_trace_clear.html"><i>posix_trace_clear</i>()</a><br><a href="../functions/posix_trace_eventid_equal.html"><i>posix_trace_eventid_equal</i>()</a><br><a href="../functions/posix_trace_eventid_get_name.html"><i>posix_trace_eventid_get_name</i>()</a><br><a href="../functions/posix_trace_eventtypelist_getnext_id.html"><i>posix_trace_eventtypelist_getnext_id</i>()</a><br><a href="../functions/posix_trace_eventtypelist_rewind.html"><i>posix_trace_eventtypelist_rewind</i>()</a><br><a href="../functions/posix_trace_get_attr.html"><i>posix_trace_get_attr</i>()</a><br><a href="../functions/posix_trace_get_status.html"><i>posix_trace_get_status</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/posix_trace_getnext_event.html"><i>posix_trace_getnext_event</i>()</a><br><i>posix_trace_shutdown</i>()<br><a href="../functions/posix_trace_start.html"><i>posix_trace_start</i>()</a><br><a href="../functions/posix_trace_stop.html"><i>posix_trace_stop</i>()</a><br><a href="../functions/posix_trace_timedgetnext_event.html"><i>posix_trace_timedgetnext_event</i>()</a><br><a href="../functions/posix_trace_trid_eventid_open.html"><i>posix_trace_trid_eventid_open</i>()</a><br><a href="../functions/posix_trace_trygetnext_event.html"><i>posix_trace_trygetnext_event</i>()</a><br>&nbsp;</p></td></tr></table><p><sup>[<a href="javascript:open_code('TEF')">TEF</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">If the Trace Event Filter option is supported, the following additional functions may use the <i>trid</i> argument:</p><table cellpadding="3"><tr valign="top"><td align="left"><p class="tent"><a href="../functions/posix_trace_get_filter.html"><i>posix_trace_get_filter</i>()</a> &nbsp;</p></td><td align="left"><p class="tent"><a href="../functions/posix_trace_set_filter.html"><i>posix_trace_set_filter</i>()</a> &nbsp;</p></td></tr></table><img src="../images/opt-end.gif" alt="[Option End]" border="0"> <p>In particular, notice that the operations normally used by a trace analyzer process, such as <a href="../functions/posix_trace_rewind.html"><i>posix_trace_rewind</i>()</a> or <a href="../functions/posix_trace_close.html"><i>posix_trace_close</i>()</a>, cannot be invoked using the trace stream identifier returnedby the <i>posix_trace_create</i>() function.</p><p>A trace stream shall be created in a suspended state. <sup>[<a href="javascript:open_code('TEF')">TEF</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;If the Trace Event Filter option is supported, its trace eventtype filter shall be empty. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><p>The <i>posix_trace_create</i>() function may be called multiple times from the same or different processes, with the system-widelimit indicated by the runtime invariant value {TRACE_SYS_MAX}, which has the minimum value {_POSIX_TRACE_SYS_MAX}.</p><p>The trace stream identifier returned by the <i>posix_trace_create</i>() function in the argument pointed to by <i>trid</i> isvalid only in the process that made the function call. If it is used from another process, that is a child process, in functionsdefined in IEEE&nbsp;Std&nbsp;1003.1-2001, these functions shall return with the error [EINVAL].</p><p><sup>[<a href="javascript:open_code('TRL')">TRL</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The <i>posix_trace_create_withlog</i>() function shall be equivalent to <i>posix_trace_create</i>(), except that it associates atrace log with this stream. The <i>file_desc</i> argument shall be the file descriptor designating the trace log destination. Thefunction shall fail if this file descriptor refers to a file with a file type that is not compatible with the log policy associatedwith the trace log. The list of the appropriate file types that are compatible with each log policy is implementation-defined.</p><p>The <i>posix_trace_create_withlog</i>() function shall return in the parameter pointed to by <i>trid</i> the trace streamidentifier, which uniquely identifies the newly created trace stream, and shall be used in subsequent calls to control tracing. The<i>trid</i> argument may only be used by the following functions:</p><table cellpadding="3"><tr valign="top"><td align="left"><p class="tent"><br><a href="../functions/posix_trace_clear.html"><i>posix_trace_clear</i>()</a><br><a href="../functions/posix_trace_eventid_equal.html"><i>posix_trace_eventid_equal</i>()</a><br><a href="../functions/posix_trace_eventid_get_name.html"><i>posix_trace_eventid_get_name</i>()</a><br><a href="../functions/posix_trace_eventtypelist_getnext_id.html"><i>posix_trace_eventtypelist_getnext_id</i>()</a><br><a href="../functions/posix_trace_eventtypelist_rewind.html"><i>posix_trace_eventtypelist_rewind</i>()</a><br><i>posix_trace_flush</i>()<br><a href="../functions/posix_trace_get_attr.html"><i>posix_trace_get_attr</i>()</a><br><a href="../functions/posix_trace_get_status.html"><i>posix_trace_get_status</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/posix_trace_getnext_event.html"><i>posix_trace_getnext_event</i>()</a><br><i>posix_trace_shutdown</i>()<br><a href="../functions/posix_trace_start.html"><i>posix_trace_start</i>()</a><br><a href="../functions/posix_trace_stop.html"><i>posix_trace_stop</i>()</a><br><a href="../functions/posix_trace_timedgetnext_event.html"><i>posix_trace_timedgetnext_event</i>()</a><br><a href="../functions/posix_trace_trid_eventid_open.html"><i>posix_trace_trid_eventid_open</i>()</a><br><a href="../functions/posix_trace_trygetnext_event.html"><i>posix_trace_trygetnext_event</i>()</a><br>&nbsp;</p></td></tr></table><img src="../images/opt-end.gif" alt="[Option End]" border="0"> <p><sup>[<a href="javascript:open_code('TRL TEF')">TRL TEF</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> If the Trace Event Filter option is supported, the following additional functions may use the <i>trid</i> argument:</p><table cellpadding="3"><tr valign="top"><td align="left"><p class="tent"><a href="../functions/posix_trace_get_filter.html"><i>posix_trace_get_filter</i>()</a> &nbsp;</p></td><td align="left"><p class="tent"><a href="../functions/posix_trace_set_filter.html"><i>posix_trace_set_filter</i>()</a> &nbsp;</p></td></tr></table><img src="../images/opt-end.gif" alt="[Option End]" border="0"> <p><sup>[<a href="javascript:open_code('TRL')">TRL</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">In particular, notice that the operations normally used by a trace analyzer process, such as <a href="../functions/posix_trace_rewind.html"><i>posix_trace_rewind</i>()</a> or <a href="../functions/posix_trace_close.html"><i>posix_trace_close</i>()</a>, cannot be invoked using the trace stream identifier returnedby the <i>posix_trace_create_withlog</i>() function.</p><p>The <i>posix_trace_flush</i>() function shall initiate a flush operation which copies the contents of the trace streamidentified by the argument <i>trid</i> into the trace log associated with the trace stream at the creation time. If no trace loghas been associated with the trace stream pointed to by <i>trid</i>, this function shall return an error. The termination of theflush operation can be polled by the <a href="../functions/posix_trace_get_status.html"><i>posix_trace_get_status</i>()</a>function. During the flush operation, it shall be possible to trace new trace events up to the point when the trace stream becomesfull. After flushing is completed, the space used by the flushed trace events shall be available for tracing new trace events.</p><p>If flushing the trace stream causes the resulting trace log to become full, the trace log full policy shall be applied. If thetrace <i>log-full-policy</i> attribute is set, the following occurs:</p><dl compact><dt>POSIX_TRACE_UNTIL_FULL</dt>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -