vslog2fa()

Updated: April 19, 2023

Log a printf-style string in a slog2 buffer (varargs)

Synopsis:

#include <sys/slog2.h>

int vslog2fa( slog2_buffer_t buffer,
              uint16_t code,
              uint8_t severity,
              const char* format,
              va_list arglist );

Arguments:

buffer
The handle of the buffer you want to log the message in, or NULL to use the default buffer that you specified earlier with slog2_set_default_buffer().
code
A user-specified code that you want to be associated with the message. The slog2 system doesn't interpret this code in any way.
severity
The severity level of this log item; one of:
  • SLOG2_SHUTDOWN
  • SLOG2_CRITICAL
  • SLOG2_ERROR
  • SLOG2_WARNING
  • SLOG2_NOTICE
  • SLOG2_INFO
  • SLOG2_DEBUG1
  • SLOG2_DEBUG2

For more information, see the entry for slog2_register().

format
A printf-formatted character string used to define the log.
arglist
A va_list of the additional arguments required by the format string.

Library:

libslog2

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

Description:

The vslog2fa() function logs a printf-style ASCII-text string in the specified slog2 buffer. It's a “varargs” version of slog2fa().

CAUTION:
Don't use vslog2fa() after using slog2_reset(). The slog2_reset() function unmaps all instances, which releases all buffer handles and triggers the SIGSEGV signal if vslog2fa() tries to dereference the buffer pointer.

Returns:

0 on success, or -1 if an error occurred.

Errors:

EBUSY
The logger couldn't obtain a buffer within the number of retries that you specified when you registered the buffer set; see slog2_register().
EFAULT
You specified NULL for buffer, but there's no default buffer.
EINVAL
The format string is invalid.
ENOMEM
The resulting packet size would be greater than the maximum packet size allowed.
EPERM
The process hasn't registered with slog2.

Classification:

QNX Neutrino

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