getppriv Subroutine

Purpose

Gets a privilege set associated with a process.

Library

Security Library (libc.a)

Syntax

#include <sys/types.h>
#include <sys/priv.h>
int getppriv(pid, which, privset, privsize)
pid_t pid;
int which;
privg_t *privset;
int privset;

Description

The getppriv subroutine returns the privilege set for the process specified by the pid parameter. If the value of the pid is negative, the calling process's privilege set is retrieved. The value of the which parameter is one of the PRIV_EFFECTIVE, PRIV_MAXIMUM, PRIV_INHERITED, PRIV_LIMITING or PRIV_USED values. The corresponding privilege set is copied to the privset parameter in the size specified by the privsize parameter. The PV_PROC_PRIV privilege is required in the effective set when a process wants to obtain privilege set from another process.

Parameters

Item Description
Pid Indicates the process that the privilege set is requested for.
Which Specifies the privilege set to get.
Privset Stores the privilege set.
Privsize Specifies the size of the privilege set.

Return Values

The getppriv subroutine returns one of the following values:

Item Description
0 The subroutine completes successfully.
-1 An error has occurred. An errno global variable is set to indicate the error.

Error Codes

The getppriv subroutine fails if any of the following values is true:

Item Description
EFAULT The privset parameter is pointing to an address that is not legal.
EINVAL The value of the privset parameter is NULL, or the value of the privsize parameter is not valid.
EPERM The process does not have the privilege (PV_PROC_PRIV or MAC read) to obtain another process' privilege set.
ESRCH No process has a process ID that is equal to the value of the Pid parameter.