Annotation of cci/usr/src/man/man2/chown.2, revision 1.1.1.1

1.1       root        1: .TH CHOWN 2 "27 July 1983"
                      2: .UC 4
                      3: .SH NAME
                      4: chown \- change owner and group of a file
                      5: .SH SYNOPSIS
                      6: .nf
                      7: .ft B
                      8: chown(path, owner, group)
                      9: char *path;
                     10: int owner, group;
                     11: .PP
                     12: .ft B
                     13: fchown(fd, owner, group)
                     14: int fd, owner, group;
                     15: .fi
                     16: .SH DESCRIPTION
                     17: The file
                     18: which is named by \fIpath\fP or referenced by \fIfd\fP
                     19: has its
                     20: .I owner
                     21: and 
                     22: .I group
                     23: changed as specified.
                     24: Only the super-user may
                     25: execute this call,
                     26: because if users were able to give files away,
                     27: they could defeat the file-space accounting procedures.
                     28: .PP
                     29: On some systems,
                     30: .I chown
                     31: clears the set-user-id and set-group-id bits
                     32: on the file
                     33: to prevent accidental creation of
                     34: set-user-id and set-group-id programs
                     35: owned by the super-user.
                     36: .PP
                     37: .I Fchown
                     38: is particularly useful when used in conjunction
                     39: with the file locking primitives (see
                     40: .IR flock (2)).
                     41: .PP
                     42: Only one of the owner and group id's
                     43: may be set by specifying the other as \-1.
                     44: .SH "RETURN VALUE
                     45: Zero is returned if the operation was successful;
                     46: \-1 is returned if an error occurs, with a more specific
                     47: error code being placed in the global variable \fIerrno\fP.
                     48: .SH "ERRORS
                     49: .I Chown
                     50: will fail and the file will be unchanged if:
                     51: .TP 15
                     52: [EINVAL]
                     53: The argument path does not refer to a file.
                     54: .TP 15
                     55: [ENOTDIR]
                     56: A component of the path prefix is not a directory.
                     57: .TP 15
                     58: [ENOENT]
                     59: The argument pathname is too long.
                     60: .TP 15
                     61: [EPERM]
                     62: The argument contains a byte with the high-order bit set.
                     63: .TP 15
                     64: [ENOENT]
                     65: The named file does not exist.
                     66: .TP 15
                     67: [EACCES]
                     68: Search permission is denied on a component of the path prefix.
                     69: .TP 15
                     70: [EPERM]
                     71: The effective user ID does not match the owner of the file and
                     72: the effective user ID is not the super-user.
                     73: .TP 15
                     74: [EROFS]
                     75: The named file resides on a read-only file system.
                     76: .TP 15
                     77: [EFAULT]
                     78: .I Path
                     79: points outside the process's allocated address space.
                     80: .TP 15
                     81: [ELOOP]
                     82: Too many symbolic links were encountered in translating the pathname.
                     83: .PP
                     84: .I Fchown
                     85: will fail if:
                     86: .TP 15
                     87: [EBADF]
                     88: .I Fd
                     89: does not refer to a valid descriptor.
                     90: .TP 15
                     91: [EINVAL]
                     92: .I Fd
                     93: refers to a socket, not a file.
                     94: .SH "SEE ALSO"
                     95: chmod(2), flock(2)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.