1POSIX_TRACE_EVENT(P) POSIX Programmer's Manual POSIX_TRACE_EVENT(P)
2
3
4
6 posix_trace_event, posix_trace_eventid_open - trace functions for
7 instrumenting application code (TRACING)
8
10 #include <sys/types.h>
11 #include <trace.h>
12
13 void posix_trace_event(trace_event_id_t event_id,
14 const void *restrictdata_ptr, size_t data_len);
15 int posix_trace_eventid_open(const char *restrict event_name,
16 trace_event_id_t *restrict event_id);
17
18
20 The posix_trace_event() function shall record the event_id and the user
21 data pointed to by data_ptr in the trace stream into which the calling
22 process is being traced and in which event_id is not filtered out. If
23 the total size of the user trace event data represented by data_len is
24 not greater than the declared maximum size for user trace event data,
25 then the truncation-status attribute of the trace event recorded is
26 POSIX_TRACE_NOT_TRUNCATED. Otherwise, the user trace event data is
27 truncated to this declared maximum size and the truncation-status
28 attribute of the trace event recorded is POSIX_TRACE_TRUNCATED_RECORD.
29
30 If there is no trace stream created for the process or if the created
31 trace stream is not running, or if the trace event specified by
32 event_id is filtered out in the trace stream, the posix_trace_event()
33 function shall have no effect.
34
35 The posix_trace_eventid_open() function shall associate a user trace
36 event name with a trace event type identifier for the calling process.
37 The trace event name is the string pointed to by the argument
38 event_name. It shall have a maximum of {TRACE_EVENT_NAME_MAX} charac‐
39 ters (which has the minimum value {_POSIX_TRACE_EVENT_NAME_MAX}). The
40 number of user trace event type identifiers that can be defined for any
41 given process is limited by the maximum value {TRACE_USER_EVENT_MAX},
42 which has the minimum value {POSIX_TRACE_USER_EVENT_MAX}.
43
44 If the Trace Inherit option is not supported, the posix_trace_even‐
45 tid_open() function shall associate the user trace event name pointed
46 to by the event_name argument with a trace event type identifier that
47 is unique for the traced process, and is returned in the variable
48 pointed to by the event_id argument. If the user trace event name has
49 already been mapped for the traced process, then the previously
50 assigned trace event type identifier shall be returned. If the per-
51 process user trace event name limit represented by
52 {TRACE_USER_EVENT_MAX} has been reached, the pre-defined
53 POSIX_TRACE_UNNAMED_USEREVENT (see Trace Option: User Trace Event )
54 user trace event shall be returned.
55
56 If the Trace Inherit option is supported, the posix_trace_even‐
57 tid_open() function shall associate the user trace event name pointed
58 to by the event_name argument with a trace event type identifier that
59 is unique for all the processes being traced in this same trace stream,
60 and is returned in the variable pointed to by the event_id argument. If
61 the user trace event name has already been mapped for the traced pro‐
62 cesses, then the previously assigned trace event type identifier shall
63 be returned. If the per-process user trace event name limit represented
64 by {TRACE_USER_EVENT_MAX} has been reached, the pre-defined
65 POSIX_TRACE_UNNAMED_USEREVENT ( Trace Option: User Trace Event ) user
66 trace event shall be returned.
67
68 Note: The above procedure, together with the fact that multiple pro‐
69 cesses can only be traced into the same trace stream by inheri‐
70 tance, ensure that all the processes that are traced into a
71 trace stream have the same mapping of trace event names to trace
72 event type identifiers.
73
74
75 If there is no trace stream created, the posix_trace_eventid_open()
76 function shall store this information for future trace streams created
77 for this process.
78
80 No return value is defined for the posix_trace_event() function.
81
82 Upon successful completion, the posix_trace_eventid_open() function
83 shall return a value of zero. Otherwise, it shall return the corre‐
84 sponding error number. The posix_trace_eventid_open() function stores
85 the trace event type identifier value in the object pointed to by
86 event_id, if successful.
87
89 The posix_trace_eventid_open() function shall fail if:
90
91 ENAMETOOLONG
92 The size of the name pointed to by the event_name argument was
93 longer than the implementation-defined value
94 {TRACE_EVENT_NAME_MAX}.
95
96
97 The following sections are informative.
98
100 None.
101
103 None.
104
106 None.
107
109 None.
110
112 Trace Option: User Trace Event , posix_trace_start() ,
113 posix_trace_trid_eventid_open() , the Base Definitions volume of
114 IEEE Std 1003.1-2001, <sys/types.h>, <trace.h>
115
117 Portions of this text are reprinted and reproduced in electronic form
118 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
119 -- Portable Operating System Interface (POSIX), The Open Group Base
120 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
121 Electrical and Electronics Engineers, Inc and The Open Group. In the
122 event of any discrepancy between this version and the original IEEE and
123 The Open Group Standard, the original IEEE and The Open Group Standard
124 is the referee document. The original Standard can be obtained online
125 at http://www.opengroup.org/unix/online.html .
126
127
128
129IEEE/The Open Group 2003 POSIX_TRACE_EVENT(P)