cpacl(3C)cpacl(3C)NAMEcpacl(), fcpacl() - copy the access control list (ACL) and mode bits
from one file to another (HFS and JFS File Systems only)
To ensure continued conformance with emerging industry standards, fea‐
tures described in this manual entry are likely to change in a future
Both (HFS and JFS file systems) and (HFS file systems only) copy the
access control list and mode bits (that is, file access permission bits
and miscellaneous mode bits; see chmod(2)) from one file to another,
and transfer ownership much like chown(2).
can only copy HFS ACLs to other HFS files and JFS ACLS to other JFS
files; it does not covert HFS ACLs to JFS ACLs or vice versa. and take
the following parameters:
· Path names (fromfile and tofile) or open file descriptors
(fromfd and tofd).
· A mode value (frommode, typically the value returned by − see
stat(2)) containing file miscellaneous mode bits which are
always copied, and file access permission bits which are
copied instead of the access control list if either file is
· User ID and group ID of the file (fromuid, touid and fromgid,
togid) for transferring ownership. (Typically fromuid and
fromgid are the and values returned by and touid and togid
are the return values from and − see geteuid(2) and gete‐
gid(2) in getuid(2)).
When both files are local, the routines copy the access control list
and call (HFS only; see chownacl(3C)) to transfer ownership from the
fromfile to the tofile, if necessary.
handles remote copying (via NFS) and copying from HFS to JFS or vice
versa after recognizing failures of or (see acl(2) and setacl(2)).
When copying the mode from fromfile (fromfd) to tofile (tofd), copies
the entire frommode (that is, the file miscellaneous mode bits and the
file access permission bits) to tofile (tofd) using Some of the miscel‐
laneous mode bits can be turned off; see chmod(2).
can copy an access control list from fromfile (fromfd) to tofile (tofd)
without transferring ownership, but ensuring error checking and han‐
dling of remote files. This is done by passing fromuid equal to touid
and fromgid equal to togid (that is, four zeros). For remote files,
fromuid, touid, fromgid, and togid are ignored.
If successful, and return zero. If an error occurs, they set to indi‐
cate the cause of failure and return a negative value, as follows:
−1 Unable to perform or on a local fromfile (fromfd).
−2 Unable to perform on tofile (tofd) to set its file miscellaneous
mode bits. attempts this regardless of whether a file is local
or remote, as long as fromfile (fromfd) is local.
−3 Unable to perform or on a local tofile (tofd). As a conse‐
quence, the file's optional ACL entries are deleted (HFS only),
its file access permission bits are zeroed, and its miscella‐
neous mode bits might be altered.
−4 Unable to perform on tofile (tofd) to set its mode. As a conse‐
quence, if fromfile (fromfd) is local, tofile's (tofd's)
optional ACL entries are deleted (HFS only), its access permis‐
sion bits are zeroed, and its file miscellaneous mode bits might
be altered, regardless of whether the file is local or remote.
The following code fragment gets stat information on and copies its
file miscellaneous bits and access control list to owned by the caller.
If either file is remote, only the on is copied.
and are only supported on HFS and JFS file systems on standard HP-UX
and were developed by HP.
SEE ALSOacl(2), chown(2), getacl(2), getegid(2), geteuid(2), getuid(2),
setacl(2), stat(2), acltostr(3C), chownacl(3C), strtoacl(3C), acl(5),