---
name: "posix_trace_attr_getinherited"
section: "3p"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/posix_trace_attr_getinherited"
---

# posix\_trace\_attr\_getinherited(3p)

retrieve and set the behavior of a trace stream (TRACING)

## PROLOG

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

## NAME

posix\_trace\_attr\_getinherited, posix\_trace\_attr\_getlogfullpolicy, posix\_trace\_attr\_getstreamfullpolicy, posix\_trace\_attr\_setinherited, posix\_trace\_attr\_setlogfullpolicy, posix\_trace\_attr\_setstreamfullpolicy — retrieve and set the behavior of a trace stream (**TRACING**)

## SYNOPSIS

```
#include <trace.h>
```

int posix\_trace\_attr\_getinherited(const trace\_attr\_t \*restrict *attr*,\
     int \*restrict *inheritancepolicy*); int posix\_trace\_attr\_getlogfullpolicy(const trace\_attr\_t \*restrict *attr*,\
     int \*restrict *logpolicy*); int posix\_trace\_attr\_getstreamfullpolicy(const trace\_attr\_t \*restrict\
     *attr*, int \*restrict *streampolicy*); int posix\_trace\_attr\_setinherited(trace\_attr\_t \**attr*,\
     int *inheritancepolicy*); int posix\_trace\_attr\_setlogfullpolicy(trace\_attr\_t \**attr*,\
     int *logpolicy*); int posix\_trace\_attr\_setstreamfullpolicy(trace\_attr\_t \**attr*,\
     int *streampolicy*);

## DESCRIPTION

The *posix\_trace\_attr\_getinherited*() and *posix\_trace\_attr\_setinherited*() functions, respectively, shall get and set the inheritance policy stored in the *inheritance* attribute for traced processes across the *fork*() and *spawn*() operations. The *inheritance* attribute of the attributes object pointed to by the *attr* argument shall be set to one of the following values defined by manifest constants in the *\<trace.h\>* header:

- POSIX\_TRACE\_CLOSE\_FOR\_CHILD

  After a *fork*() or *spawn*() operation, the child shall not be traced, and tracing of the parent shall continue.

- POSIX\_TRACE\_INHERITED

  After a *fork*() or *spawn*() operation, if the parent is being traced, its child shall be concurrently traced using the same trace stream.

The default value for the *inheritance* attribute is POSIX\_TRACE\_CLOSE\_FOR\_CHILD.

The *posix\_trace\_attr\_getlogfullpolicy*() and *posix\_trace\_attr\_setlogfullpolicy*() functions, respectively, shall get and set the trace log full policy stored in the *log-full-policy* attribute of the attributes object pointed to by the *attr* argument.

The *log-full-policy* attribute shall be set to one of the following values defined by manifest constants in the *\<trace.h\>* header:

- POSIX\_TRACE\_LOOP

  The trace log shall loop until the associated trace stream is stopped. This policy means that when the trace log gets full, the file system shall reuse the resources allocated to the oldest trace events that were recorded. In this way, the trace log will always contain the most recent trace events flushed.

- POSIX\_TRACE\_UNTIL\_FULL

  The trace stream shall be flushed to the trace log until the trace log is full. This condition can be deduced from the *posix\_log\_full\_status* member status (see the **posix\_trace\_status\_info** structure defined in *\<trace.h\>*). The last recorded trace event shall be the POSIX\_TRACE\_STOP trace event.

- POSIX\_TRACE\_APPEND

  The associated trace stream shall be flushed to the trace log without log size limitation. If the application specifies POSIX\_TRACE\_APPEND, the implementation shall ignore the *log-max-size* attribute.

The default value for the *log-full-policy* attribute is POSIX\_TRACE\_LOOP.

The *posix\_trace\_attr\_getstreamfullpolicy*() and *posix\_trace\_attr\_setstreamfullpolicy*() functions, respectively, shall get and set the trace stream full policy stored in the *stream-full-policy* attribute of the attributes object pointed to by the *attr* argument.

The *stream-full-policy* attribute shall be set to one of the following values defined by manifest constants in the *\<trace.h\>* header:

- POSIX\_TRACE\_LOOP

  The trace stream shall loop until explicitly stopped by the *posix\_trace\_stop*() function. This policy means that when the trace stream is full, the trace system shall reuse the resources allocated to the oldest trace events recorded. In this way, the trace stream will always contain the most recent trace events recorded.

- POSIX\_TRACE\_UNTIL\_FULL

  The trace stream will run until the trace stream resources are exhausted. Then the trace stream will stop. This condition can be deduced from *posix\_stream\_status* and *posix\_stream\_full\_status* (see the **posix\_trace\_status\_info** structure defined in *\<trace.h\>*). When this trace stream is read, a POSIX\_TRACE\_STOP trace event shall be reported after reporting the last recorded trace event. The trace system shall reuse the resources allocated to any trace events already reported—see the *posix\_trace\_getnext\_event*(), *posix\_trace\_trygetnext\_event*(), and *posix\_trace\_timedgetnext\_event*() functions—or already flushed for an active trace stream with log if the Trace Log option is supported; see the *posix\_trace\_flush*() function. The trace system shall restart the trace stream when it is empty and may restart it sooner. A POSIX\_TRACE\_START trace event shall be reported before reporting the next recorded trace event.

- POSIX\_TRACE\_FLUSH

  If the Trace Log option is supported, this policy is identical to the POSIX\_TRACE\_UNTIL\_FULL trace stream full policy except that the trace stream shall be flushed regularly as if *posix\_trace\_flush*() had been explicitly called. Defining this policy for an active trace stream without log shall be invalid.

The default value for the *stream-full-policy* attribute shall be POSIX\_TRACE\_LOOP for an active trace stream without log.

If the Trace Log option is supported, the default value for the *stream-full-policy* attribute shall be POSIX\_TRACE\_FLUSH for an active trace stream with log.

## RETURN VALUE

Upon successful completion, these functions shall return a value of zero. Otherwise, they shall return the corresponding error number.

If successful, the *posix\_trace\_attr\_getinherited*() function shall store the *inheritance* attribute value in the object pointed to by *inheritancepolicy*. Otherwise, the content of this object is undefined.

If successful, the *posix\_trace\_attr\_getlogfullpolicy*() function shall store the *log-full-policy* attribute value in the object pointed to by *logpolicy*. Otherwise, the content of this object is undefined.

If successful, the *posix\_trace\_attr\_getstreamfullpolicy*() function shall store the *stream-full-policy* attribute value in the object pointed to by *streampolicy*. Otherwise, the content of this object is undefined.

## ERRORS

These functions may fail if:

- **EINVAL**

  The value specified by at least one of the arguments is invalid.

*The following sections are informative.*

## EXAMPLES

None.

## APPLICATION USAGE

None.

## RATIONALE

None.

## FUTURE DIRECTIONS

The following functions:

```
posix_trace_attr_getinherited()
posix_trace_attr_getlogfullpolicy()
posix_trace_attr_getstreamfullpolicy()
posix_trace_attr_setinherited()
posix_trace_attr_setlogfullpolicy()
posix_trace_attr_setstreamfullpolicy()
```

may be removed in a future version.

## SEE ALSO

*fork()*, *posix\_trace\_attr\_destroy()*, *posix\_trace\_create()*, *posix\_trace\_get\_attr()*, *posix\_trace\_getnext\_event()*, *posix\_trace\_start()*

The Base Definitions volume of POSIX.1‐2017, ***\<trace.h\>***

## COPYRIGHT

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting\_bugs.html .
