Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

os_trace_error(3) [mojave man page]

os_trace(3)						   BSD Library Functions Manual 					       os_trace(3)

NAME
os_trace, os_trace_debug, os_trace_error, os_trace_fault -- trace message for the current activity SYNOPSIS
#include <os/trace.h> void os_trace(const char *format, ...); void os_trace_debug(const char *format, ...); void os_trace_error(const char *format, ...); void os_trace_fault(const char *format, ...); DESCRIPTION
This interface is deprecated and replaced by os_log(3). os_trace and its variants use a memory-only buffer to store the provided trace message. Trace messages are correlated based on a new identi- fier assigned when an activity is created by the system, see os_activity_initiate(3). The identifier is automatically carried across GCD and XPC boundaries. This identifier provides a correlation point for intra and inter-process work based on that activity. Trace messages should never be done in tight loops as they may overrun the buffer pushing relevant trace messages out. Loss of those entries reduces the effectiveness of the trace mechanism. The API was designed to prevent strings from being recorded in the buffers for performance and privacy protection. See os_log(3) for string and object support, among other features. The os_trace API set only supports scalar types (float,double, etc.). All unsupported types will emit UNSUP to the trace output. The format string length does not factor into the trace buffer memory, although there is a maximum supported length of 100 characters. Inappropriate use of strings in messages: os_trace("user %s logged in from hostname %s", username, host); Will output: user UNSUP logged in from hostname UNSUP There are four (4) types of trace messages: default, debug, error, and fault. os_trace is a "default" trace message. The default category of messages are always recorded into the memory buffers regardless of the state of the process. Limit use to messages that would help diagnose a failure, crash, etc. os_trace("issue query for record type: %d, timeout: %d", recType, timeout); os_trace_debug is a "debug" trace message. The debug category of messages are only recorded if the process is under a debugger or is specif- ically requested to include debug messages. Debug messages should be used for development use while debugging a problem. os_trace_error is an "error" trace message. The error category of messages should be used when a process encounters a soft-error (i.e., an unexpected error that was successfully avoided). os_trace_fault is a "fault" trace message. The fault category of messages should be used when a process is about to crash or would otherwise crash but recovered. This call causes a collection of all buffers related to activity that triggered the fault. The buffers are analyzed and may be provided in crash/spin reports. EXAMPLES
Example use of trace messages. #include <os/trace.h> #include <pwd.h> uid_t uid; os_trace("looking up user %d", uid); struct passwd *pwd = getpwuid(uid); if (pwd == NULL) { os_trace_error("failed to lookup user %d", uid); return ENOENT; } error = _openPref(pwd->pw_name, pwd->pw_dir); if (error) { os_trace_error("failed to open prefs %d", error); return error; } CAVEATS
Please note that os_trace is printf-like, but not printf-compatible. Format specifiers should be exactly matched to the types of the argu- ments being used to fill them. SEE ALSO
os_log(3), os_log_create(3), os_activity_initiate(3) Darwin June 2, 2016 Darwin

Check Out this Related Man Page

strace(1M)																strace(1M)

NAME
strace - write STREAMS event trace messages to standard output SYNOPSIS
mod sub pri DESCRIPTION
gets STREAMS event trace messages from STREAMS drivers and modules via the STREAMS log driver and writes these messages to standard output. By default, without arguments writes all STREAMS trace messages from all drivers and modules. with command-line arguments limits the trace messages received. The arguments, which must be specified in groups of three, are: mod Specifies the STREAMS module identification number from the streamtab entry. sub Specifies a subidentification number (often corresponding to a minor device). pri Specifies a tracing priority level. gets messages of a level equal to or less than the value specified by pri. Only posi- tive integer values are allowed. The value can be used for any argument in the command line to indicate that there are no restrictions for that argument. Multiple sets of the three arguments can be specified to obtain the messages from more than one driver or module. Only one process can open the STREAMS log driver at a time. When is invoked, the log driver compares the sets of command line arguments with actual trace messages, returning only messages that sat- isfy the specified criteria. STREAMS event trace messages have the following format: seq time tick pri ind mod sub text Components are interpreted as follows: seq Trace event sequence number. time Time the message was sent expressed in hh:mm:ss. tick Time the message was sent expressed in machine ticks since the last boot. pri Tracing priority level as defined by the STREAMS driver or module that originates the messages. ind Can be any combination of the following three message indicators: The message has also been saved in the error log. The message signaled a fatal error. The message has also been mailed to the system administrator. mod Module identification number of the trace message source. sub Subidentification number of the trace message source. text Trace message text. runs until terminated by the user. EXAMPLES
Display all trace messages received from the driver or module identified by mod Display trace messages of any tracing priority level from the driver or module identified by mod and its minor devices identified by the sub or Display the trace messages from the same driver or module and subs but limit the priority levels to 0 for subs 2 and 3; 1 for sub 4, driver or module WARNINGS
Running with several sets of arguments can impair STREAMS performance, particularly for those modules and drivers that are sending the mes- sages. Also be aware that may not be able to handle a large number of messages. If drivers and modules return messages to too quickly, some may be lost. FILES
NLS catalog for SEE ALSO
strclean(1M), strerr(1M), strlog(7). strace(1M)
Man Page