setacl.2 (2010 09)
s
setacl(2) setacl(2)
[ENOSYS] The function is not supported by this file system type.
[ENOSPC] Not enough space on the file system.
[ENFILE] System file table is full.
[EDQUOT] User’s disk quota block or inode limit has been reached for this file system.
EXAMPLES
The following code fragment defines and sets an ACL on file
../shared which allows the file’s owner to
read, write, and execute or search the file, and allows user 103, group 204 to read the file.
#include <unistd.h>
#include <sys/stat.h>
#include <sys/acl.h>
char *filename = "../shared";
struct acl_entry acl [2];
struct stat statbuf;
if (stat (filename, & statbuf) < 0)
error (...);
acl [0] . uid = statbuf . st_uid; /* file owner */
acl [0] . gid = ACL_NSGROUP;
acl [0] . mode = R_OK | W_OK | X_OK;
acl [1] . uid = 103;
acl [1] . gid = 204;
acl [1] . mode = R_OK;
if (setacl (filename, 2, acl))
error (...);
The following call deletes all optional ACL entries from file1:
setacl ("file1", ACL_DELOPT, (struct acl_entry *) 0);
DEPENDENCIES
NFS
setacl() and fsetacl() are not supported on remote files.
HFS
ACLs are only supported on HFS file systems.
AUTHOR
setacl() and fsetacl() were developed by HP.
SEE ALSO
access(2), chmod(2), getaccess(2), getacl(2), stat(2), acl(5), privileges(5), unistd(5).
HP-UX 11i Version 3: September 2010 − 3 − Hewlett-Packard Company 3