gpfs_putacl() subroutine

Restores the access control information for a GPFS file.

Library

GPFS Library (libgpfs.a for AIX®, libgpfs.so for Linux®)

Synopsis

#include <gpfs.h>
int gpfs_putacl(const char *pathname,
                int flags,
                void *acl);  

Description

The gpfs_putacl() subroutine together with the gpfs_getacl() subroutine is intended for use by a backup program to save (gpfs_getacl()) and restore (gpfs_putacl()) the ACL information for the file.

Notes:
  1. The use of gpfs_fgetattrs() and gpfs_fputattrs() is preferred.
  2. You must have write access to the file.
  3. Compile any program that uses this subroutine with the -lgpfs flag from the following library:
    • libgpfs.a for AIX
    • libgpfs.so for Linux

Parameters

pathname
Path name of the file for which the ACLs is to be set.
flags
Consists of one of these values:
0
Indicates that the acl parameter is to be mapped with the gpfs_opaque_acl_t structure.

The gpfs_opaque_acl_t structure should be used by backup and restore programs.

GPFS_PUTACL_STRUCT
Indicates that the acl parameter is to be mapped with the gpfs_acl_t structure.

The gpfs_acl_t structure is provided for applications that need to change the ACL.

acl
Pointer to a buffer mapped by the structure gpfs_opaque_acl_t or gpfs_acl_t, depending on the value of flags.

This is where the ACL data is stored, and should be the result of a previous invocation of gpfs_getacl().

Exit status

If the gpfs_putacl() subroutine is successful, it returns a value of 0.

If the gpfs_putacl() subroutine is unsuccessful, it returns a value of -1 and sets the global error variable errno to indicate the nature of the error.

Start of change

Security

The caller must be the file or directory owner, the root user, or someone with control permission in the ACL, in order for gpfs_putacl() to complete successfully.

End of change

Exceptions

None.

Error status

Error codes include but are not limited to the following:

EINVAL
The path name does not refer to a GPFS file or a regular file.
ENOMEM
Unable to allocate memory for the request.
ENOSYS
The gpfs_putacl() subroutine is not supported under the current file system format.
ENOTDIR
Start of changeGPFS_ACL_TYPE_DEFAULT is specified as the ACL type and pathname is not a directory.End of change
Start of changeEPERMEnd of change
Start of changeThe caller does not hold the appropriate privileges.End of change
Start of changeEOPNOTSUPP End of change
Start of changeThe file system setting does not allow the provided ACL type.End of change
Start of changeEAGAINEnd of change
Start of changeResource temporarily unavailable due to conflicting command running, try again later.End of change

Location

/usr/lpp/mmfs/lib/libgpfs.a for AIX

/usr/lpp/mmfs/lib/libgpfs.so for Linux