[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    acltomode(3) manual page Table of Contents

Name

acltomode, aclfrommode - convert an ACL to/from permission bits

Synopsis

#include <sys/types.h>

#include <sys/acl.h>

int acltomode(aclent_t *aclbufp, int nentries, mode_t *modep);

int aclfrommode(aclent_t *aclbufp, int nentries, mode_t *modep);

Description

acltomode() converts an ACL pointed to by aclbufp into permission bits. If the USER_OBJ ACL entry, GROUP_OBJ ACL entry, or the OTHER_OBJ ACL entry cannot be found in the ACL buffer, then the function fails with errno set to EINVAL.

The USER_OBJ ACL entry permission bits are copied to the file owner class bits in the permission bits buffer. The OTHER_OBJ ACL entry permission bits are copied to the file other class bits in the permission bits buffer. If there is a CLASS_OBJ ACL entry, then the CLASS_OBJ ACL entry permission bits are copied to the file group class bits in the permission bits buffer. Otherwise, the GROUP_OBJ ACL entry permission bits are copied to the file group class bits in the permission bits buffer.

aclfrommode() converts permission bits into an ACL pointed to by aclbufp. If the USER_OBJ ACL entry, GROUP_OBJ ACL entry, or the OTHER_OBJ ACL entry cannot be found in the ACL buffer, then the function fails with errno set to EINVAL.

The file owner class bits from permission bits buffer are copied to the USER_OBJ ACL entry. The file other class bits from permission bits buffer are copied to the OTHER_OBJ ACL entry. If there is a CLASS_OBJ ACL entry, then the file group class bits from permission bits buffer are copied to the CLASS_OBJ ACL entry, and the GROUP_OBJ ACL entry is not modified. Otherwise, the file group class bits from permission bits buffer are copied to the GROUP_OBJ ACL entry.

nentries is the number of ACL entries in the buffer pointed to by aclbufp.

Return Values

Upon successful completion, the function returns 0. Otherwise, a value of -1 is returned and errno is set to indicate the error.

See Also

acl(2)


Table of Contents