#include <sys/types.h>
#include <sys/acl.h>
int acltopbits(aclent_t *aclbufp, int nentries, mode_t *pbitsp );
int aclfrompbits(aclent_t *aclbufp, int nentries, mode_t *pbitsp );
The USER_OWNER ACL entry permission bits are copied to the file owner class bits in the permission bits buffer. The OTHER ACL entry permission bits are copied to the file other class bits in the permission bits buffer. If there is a MASK ACL entry, then the MASK ACL entry permission bits are copied to the file group class bits in the permission bits buffer. Otherwise, the GROUP_OWNER ACL entry permission bits are copied to the file group class bits in the permission bits buffer.
aclfrompbits() converts permission bits into an ACL pointed to by aclbufp. If the USER_OWNER ACL entry, GROUP_OWNER ACL entry, or the OTHER 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_OWNER ACL entry. The file other class bits from permission bits buffer are copied to the OTHER ACL entry. If there is a MASK ACL entry, then the file group class bits from permission bits buffer are copied to the MASK ACL entry, and the GROUP_OWNER ACL entry is not modified. Otherwise, the file group class bits from permission bits buffer are copied to the GROUP_OWNER ACL entry.
nentries is the number of ACL entries in the buffer pointed to by aclbufp.