|
|
HP-UX Reference > Ssetaclentry(3C)HP-UX 11i Version 2: December 2007 Update |
|
NAMEsetaclentry(), fsetaclentry() — add, modify, or delete one entry in file's access control list (ACL) (HFS File Systems only) SYNOPSIS#include <unistd.h> #include <acllib.h> int setaclentry(const char *path, uid_t uid, gid_t gid, int mode); int fsetaclentry(int fd, uid_t uid, gid_t gid, int mode); DESCRIPTIONBoth forms of this call add, modify, or delete one entry in a file's access control list (ACL). setaclentry() and fsetaclentry() take a path name (path) or open file descriptor (fd) and an entry identifier (uid, gid). They change the indicated entry's access mode bits to the given value (mode), meanings of which are defined in <unistd.h>. modes are represented as R_OK, W_OK, and X_OK. Irrelevant bits in mode values must be zero. If the file's ACL does not have an entry for the given uid and gid, the entry is created and added to the ACL. If mode is MODE_DEL (defined in <acllib.h>), the matching entry is deleted from the file's ACL if it is an optional entry, or its mode bits are set to zero (no access) if it is a base entry. uid or gid can be ACL_NSUSER or ACL_NSGROUP (defined in <sys/acl.h>), respectively, to represent non-specific entries u.%, %.g, or %.%. The file's u.% or %.g base entries can be referred to using ACL_FILEOWNER or ACL_FILEGROUP (defined in <acllib.h>), for the file's owner or group ID, respectively. setaclentry() and fsetaclentry() read the file's ACL with getacl() or fgetacl() and modify it with setacl() or fsetacl(), respectively. ERRORSIf an error occurs, setaclentry() and fsetaclentry() return the following negative values and set errno:
EXAMPLESThe following code fragment adds an entry to file ``work/list'' for user ID 115, group ID 32, or modifies the existing entry for that user and group, if any, with a new access mode of read only. It also changes the owner base entry to have all access rights, and deletes the entry, if any, for any user in group 109. #include <unistd.h> #include <acllib.h> char *filename = "work/list"; setaclentry (filename, 115, 32, R_OK); setaclentry (filename, ACL_FILEOWNER, ACL_NSGROUP, R_OK | W_OK | X_OK); setaclentry (filename, ACL_NSUSER, 109, MODE_DEL); DEPENDENCIES
SEE ALSOgetacl(2), setacl(2), stat(2), acltostr(3C), cpacl(3C), chownacl(3C), strtoacl(3C), acl(5), thread_safety(5). |
|