aclx_print or aclx_printStr Subroutine

Purpose

Converts the binary access control information into nonbinary, readable format.

Library

Security Library (libc.a)

Syntax

#include <sys/acl.h>

int aclx_print (acl_file, acl, acl_sz, acl_type, fs_obj_path, flags)
FILE * acl_file;
void  * acl;
size_t    acl_sz;
acl_type_t   acl_type;
char  * fs_obj_path;
int32_t    flags;

int aclx_printStr (str, str_sz, acl, acl_sz, acl_type, fs_obj_path, flags)
char * str;
size_t * str_sz;
void  * acl;
size_t    acl_sz;
acl_type_t   acl_type;
char  * fs_obj_path;
int32_t    flags;

Description

The aclx_print and aclx_printStr subroutines print the access control information in a nonbinary, readable text format. These subroutines take the ACL information in binary format as input, convert it into text format, and print that text format output to either a file or a string. The aclx_print subroutine prints the ACL text to the file specified by acl_file. The aclx_printStr subroutine prints the ACL text to str. The amount of space available in str is specified in str_sz. If this memory is insufficient, the subroutine sets str_sz to the needed amount of memory and returns an ENOSPC error.

Parameters

Item Description
acl_file Points to the file into which the textual output is printed.
str Points to the string into which the textual output should be printed.
str_sz Indicates the amount of memory in bytes available in str. If the text representation of acl requires more space than str_sz, this subroutine updates the str_sz with the amount of memory required and fails by setting errno to ENOSPC.
acl Points to a buffer which contains the binary ACL data that has to be printed. The size of this buffer is indicated by the acl_sz parameter.
acl_sz Indicates the size of the buffer area passed through the acl parameter.
acl_type Indicates the ACL type information of the acl. The ACL type is 64 bits in size and is unique on the system. If the given ACL type is not supported in the system, this function fails and errno is set to EINVAL.

The supported ACL types are ACLX and NFS4.

fs_obj_path File System Object Path for which the ACL data format and print are being requested. Gets information about the object (such as whether the object is a file or directory, who the owner is, and the associated group ID).
flags Allows for control over the print operation. A value of ACL_VERBOSE indicates whether additional information has to be printed in text format in comments. This bit is set when the aclget command is issued with the -v (verbose) option.

Return Values

On successful completion, the aclx_print and aclx_printStr subroutines return a value of 0. Otherwise, -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The aclx_print subroutine fails if one or more of the following is true:
Note: The errors in the following list occur only because aclx_print calls the fprintf subroutine internally. For more information about these errors, refer to the fprintf subroutine.
Item Description
EAGAIN The O_NONBLOCK flag is set for the file descriptor underlying the file specified by the acl_file parameter, and the process would be delayed in the write operation.
EBADF The file descriptor underlying the file specified by the acl_file parameter is not a valid file descriptor open for writing.
EFBIG An attempt was made to write to a file that exceeds the file size limit of this process or the maximum file size. For more information, refer to the ulimit subroutine.
EINTR The write operation terminated because of a signal was received, and either no data was transferred or a partial transfer was not reported.
EIO The process is a member of a background process group attempting to perform a write to its controlling terminal, the TOSTOP flag is set, the process is neither ignoring nor blocking the SIGTTOU signal, and the process group of the process has no parent process.
ENOSPC No free space remains on the device that contains the file.
ENOSPC Insufficient storage space is available.
ENXIO A request was made of a nonexistent device, or the request was outside the capabilities of the device.
EPIPE An attempt was made to write to a pipe or first-in-first-out (FIFO) that is not open for reading by any process. A SIGPIPE signal is sent to the process.

The aclx_printStr subroutine fails if the following is true:

Item Description
ENOSPC Input buffer size strSz is not sufficient to store the text representation of acl in str.
ENOSPC Insufficient storage space is available. This error is returned by sprintf, which is called by the aclx_printStr subroutine internally.

The aclx_print or aclx_printStr subroutine fails if the following is true:

Item Description
EINVAL Invalid input parameter. The same error can be returned if an invalid acl_type is specified as input to this routine. This errno can also be returned if the acl is not of the type specified by acl_type.