DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

procpriv(S)


procpriv -- add, retrieve, remove, count, or put privileges associated with the calling process

Synopsis

   #include <sys/types.h>
   #include <priv.h>
   

int procpriv(int cmd, priv_t *privp, int nentries);

Description

The procpriv system call is used to add, remove, retrieve, count, or put the privileges associated with the calling process. privp is a pointer to an array of privilege descriptors, each of which contains the privilege set and identity of the requested privilege. nentries is the number of entries contained in privp.

The recognized cmds and their functions are described below:


SETPRV
Set the working privilege set for the current process based on the privilege descriptor(s) contained in privp. All requested privileges not contained in the current maximum privilege set are ignored. All requested working privileges that are in the current maximum set are added to the working set. If any argument is invalid, none of the process privileges is changed.

CLRPRV
Clear the working and maximum privilege sets for the current process based on the privilege descriptor(s) contained in privp. All requested privileges are removed from their respective sets. The working set is adjusted to be a subset of the resulting maximum set. If any argument is invalid, none of the process privileges is changed.

PUTPRV
Set the working and maximum privilege sets for the current process based on the privilege descriptor(s) contained in privp. The setting is absolute. The working set is adjusted to be a subset of the resulting maximum set. Privileges contained in either privilege set that are not in the maximum set of the calling process are ignored. If any argument is invalid, none of the process privileges is changed.

GETPRV
Return in privp the working and maximum privilege sets for the current process in the form of privilege descriptors. None of the process privileges is changed.

CNTPRV
Return the number of privileges associated with the current process. The privp and nentries arguments are ignored. None of the process privileges is changed.

Return values

On success, procpriv returns the number of privileges associated with the current process (SETPRV, CLRPRV, PUTPRV, GETPRV, CNTPRV). On failure, procpriv returns -1 and sets errno to identify the error.

Errors

In the following conditions, procpriv fails and sets errno to:

EINVAL
cmd or privilege specified is invalid, or nentries is less than 0, or cmd is GETPRV and the process privileges exceeds nentries.

References

intro(S), filepriv(S), procprivl(S), priv(M), privilege(M)

Notices

Considerations for threads programming

Privileges are attributes of the containing process and are shared by sibling threads.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005