HP-UX Reference (11i v2 07/12) - 2 System Calls (vol 5)

c
chmod(2) chmod(2)
If the effective user ID of the process is not that of a user with the
OBJSUID privilege, mode bit S_ISVTX
is cleared.
If the effective user ID of the process is not that of a user with the
OBJSUID privilege, and the effective
group ID of the process does not match the group ID of the file, and none of the group IDs in the supple-
mentary groups list match the group ID of the file, mode bit
S_ISGID is cleared.
If the mode bit
S_ISVTX (sticky bit) is set on a directory, files inside the directory can be renamed or
removed only by the owner of the file, the owner of the directory, the superuser, or a user with the
OWNER
privilege (even if the modes of the directory would otherwise allow such an operation).
See privileges(5) for more information about privileged access on systems that support fine-grained
privileges.
RETURN VALUE
chmod() returns the following values:
0 Successful completion.
-1 Failure.
errno is set to indicate the error.
ERRORS
If
chmod() fails, the file mode is unchanged. errno is set to one of the following values:
[EACCES] Search permission is denied on a component of the path prefix.
[EFAULT] path points outside the allocated address space of the process. The reliable detection
of this error is implementation dependent.
[EINVAL] path or fildes descriptor does not refer to an appropriate file.
[ELOOP] Too many symbolic links were encountered in translating path.
[ENAMETOOLONG]
A component of path exceeds NAME_MAX bytes while _POSIX_NO_TRUNC
is in
effect or path exceeds
PATH_MAX bytes.
[ENOENT] A component of path or the file named by path does not exist.
[ENOTDIR] A component of the path prefix is not a directory.
[EPERM] The effective user ID does not match that of the owner of the file or a user with the
OWNER privilege.
[EROFS] The named file resides on a read-only file system.
If fchmod() fails, the file mode is unchanged. errno is set to one of the following values:
[EBADF] fildes is not a valid file descriptor.
[EPERM] The effective user ID does not match that of the owner of the file or a user with
OWNER privilege.
[EINVAL] path or fildes descriptor does not refer to an appropriate file.
[EROFS] The named file resides on a read-only file system.
AUTHOR
chmod() was developed by AT&T, the University of California, Berkeley, and HP.
fchmod() was developed by the University of California, Berkeley.
SEE ALSO
chmod(1), getacl(1), chown(2), creat(2), fcntl(2), getacl(2), read(2), lockf(2), mknod(2), open(2), setacl(2),
write(2), acl(5), aclv(5), privileges(5).
STANDARDS CONFORMANCE
chmod(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
fchmod(): AES, SVID3
HP-UX 11i Version 2: December 2007 Update 2 Hewlett-Packard Company 61