slog2_dump_logs_to_file()

Write a snapshot of slog2 logs to a file

Synopsis:

#include <sys/slog2.h>

int slog2_dump_logs_to_file( FILE *file,
                             uint32_t flags, ... );

Arguments:

file
The stream where you want to dump the logs.
flags
0 to dump the logs only for the calling process, or SLOG2_DUMP_LOGS_ALL to dump all the logs.
Additional arguments
Reserved for future use.

Library:

libslog2-extra

Use the -l slog2-extra option to qcc to link against this library.

Description:

The slog2_dump_logs_to_file() writes a snapshot of slog2 logs to a file, using the same log line format as slog2info.

Returns:

0 on success, or -1 if an error occurred (errno is set).

Errors:

EACCES
The slog2 parsing library couldn't be opened.
EINVAL
The file argument is NULL.

Examples:

Write only the logs from the current process:

FILE *file = fopen( "mylogs", "w" );
slog2_dump_logs_to_file( file, 0 );
fclose( file );

Implement the equivalent of slog2info > mylogs:

FILE *file = fopen( "mylogs", "w" );
slog2_dump_logs_to_file( file, SLOG2_DUMP_LOGS_ALL );
fclose( file );

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes