HP-UX Reference (11i v2 07/12) - 2 System Calls (vol 5)
g
getaccess(2) getaccess(2)
[ENOENT] The named file does not exist (for example, path is null or a component of path does
not exist).
[ENOTDIR] A component of the path prefix is not a directory.
[EOPNOTSUPP]
getaccess() is not supported on some types of remote files.
EXAMPLES
The following call determines the caller’s effective access rights to file
test and succeeds if the user has
read access:
#include <unistd.h>
#include <sys/getaccess.h>
int mode;
mode = getaccess ("test", UID_EUID, NGROUPS_EGID_SUPP,
(int *) 0, (void *) 0, (void *) 0);
if ((mode >= 0) && (mode & R_OK)) ...
Here is one way to test access rights to file
/tmp/hold for user ID 23, group ID
109:
int gid = 109;
int mode;
mode = getaccess ("/tmp/hold", 23, 1, & gid,
(void *) 0, (void *) 0);
Should the need arise, the following code builds a gidset that includes the process’s effective group ID:
#include <limits.h>
int gidset [NGROUPS_MAX + 1];
int ngroups;
gidset [0] = getegid();
ngroups=1+getgroups (NGROUPS_MAX, & gidset [1]);
AUTHOR
getaccess() was developed by HP.
SEE ALSO
access(2), acl(2), chmod(2), getacl(2), setacl(2), stat(2), acl(5), aclv(5), privileges(5), unistd(5).
HP-UX 11i Version 2: December 2007 Update − 3 − Hewlett-Packard Company 109