HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
c
cpacl(3C) cpacl(3C)
NAME
cpacl(), fcpacl() - copy the access control list (ACL) and mode bits from one file to another (HFS and JFS
File Systems only)
SYNOPSIS
#include <acllib.h>
int cpacl(
const char *fromfile,
const char *tofile,
mode_t frommode,
uid_t fromuid,
gid_t fromgid,
uid_t touid,
gid_t togid
);
int fcpacl(
int fromfd,
int tofd,
mode_t frommode,
uid_t fromuid,
gid_t fromgid,
uid_t touid,
gid_t togid
);
Remarks:
To ensure continued conformance with emerging industry standards, features described in this
manual entry are likely to change in a future release.
DESCRIPTION
Both cpacl() (HFS and JFS file systems) and fcpacl() (HFS file systems only) copy the access con-
trol 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).
cpacl() can only copy HFS ACLs to
other HFS files and JFS ACLs to other JFS files; it does not convert HFS ACLs to JFS ACLs or vice versa.
cpacl() and fcpacl() take the following parameters:
Path names (fromfile and tofile) or open file descriptors (fromfd and tofd).
A mode value (frommode, typically the
st_mode value returned by stat() see stat(2)) con-
taining 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 remote.
User
ID and group ID of the file (fromuid, touid and fromgid, togid) for transferring ownership.
(Typically fromuid and fromgid are the st_uid and st_gid values returned by stat(), and
touid and togid are the return values from geteuid() and getegid() see geteuid(2) and
getegid(2).)
When both files are local, the cpacl() routines copy the access control list and call chownacl()
(HFS
only; see chownacl(3C)) to transfer ownership from the fromfile to the tofile, if necessary.
cpacl() (fcpacl()) handles remote copying (via NFS) and copying from HFS to JFS or vice versa after
recognizing failures of acl(), getacl() (fgetacl())or setacl() (fsetacl()) (see acl(2) and
setacl(2)). When copying the mode from fromfile (fromfd)totofile (tofd),
cpacl() copies the entire from-
mode (that is, the file miscellaneous mode bits and the file access permission bits) to tofile (tofd) using
chmod() (fchmod()). Some of the miscellaneous mode bits can be turned off; see chmod(2).
cpacl() (fcpacl()) can copy an access control list from fromfile (fromfd)totofile (tofd) without
transferring ownership, but ensuring error checking and handling 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.
APPLICATION USAGE
cpacl() and fcpacl() are thread-safe. These interfaces are not async-cancel-safe.
Section 388 1 HP-UX Release 11i: December 2000
___
___