#include <sys/types.h> #include <priv.h>
The file also contains macro definitions for the command arguments to the filepriv(2), procpriv(2), and procprivl(3C) calls in addition to the typedef for the user-level definition of a privilege type and privilege set.
Finally, this file also contains user-level macro definitions used in privilege-related calls made by various commands. Four macros, described below, are used to simplify construction of privilege representation. Rather than taking the representation of the individual privilege and OR'ing it with the representation of the desired privilege type, the user can simply call the desired macro with the privilege position. All of these macros return -1 if called with an invalid privilege.
The above four macros can then used in defining macros to simplify calls to routines that handle privileges. The file contains a number of macro definitions using the pm_work macro, used in the source code in calls to procprivl(3C). For example, if a programmer wished to set the macread and dacread privileges in the working set of the process, a call to procprivl might be made as follows:
procprivl(SETPRV,(P_MACREAD|PS_WKG),(P_DACREAD|PS_WKG),(priv_t)0);
Using the macros MACREAD_W and DACREAD_W defined in this file, the call could be simplified to:
procprivl(SETPRV, MACREAD_W, DACREAD_W, (priv_t)0);
Further simplification would be possible in this instance using the READ_W macro defined in the file.