auditpack Subroutine

Purpose

Compresses and uncompresses audit bins.

Library

Security Library (libc.a)

Syntax

#include <sys/audit.h>
#include <stdio.h>

char *auditpack ( Expand Buffer)
int Expand;
char *Buffer;

Description

The auditpack subroutine can be used to compress or uncompress bins of audit records.

Parameters

Item Description
Expand Specifies the operation. Valid values, as defined in the sys/audit.h header file, are one of the following:
AUDIT_PACK
Performs standard compression on the audit bin.
AUDIT_UNPACK
Unpacks the compressed audit bin.
Buffer Specifies the buffer containing the bin to be compressed or uncompressed. This buffer must contain a standard bin as described in the audit.h file.

Return Values

If the auditpack subroutine is successful, a pointer to a buffer containing the processed audit bin is returned. If unsuccessful, a null pointer is returned and the errno global variable is set to indicate the error.

Error Codes

The auditpack subroutine fails if one or more of the following values is true:

Item Description
EINVAL The Expand parameter is not one of the valid values (AUDIT_PACK or AUDIT_UNPACK).
EINVAL The Expand parameter is AUDIT_UNPACK and the packed data in Buffer does not unpack to its original size.
EINVAL The Expand parameter is AUDIT_PACK and the bin in the Buffer parameter is already compressed, or the Expand parameter is AUDIT_UNPACK and the bin in the Buffer parameter is already unpacked.
ENOSPC The auditpack subroutine is unable to allocate space for a new buffer.