SUSER(9)

NAME
suser - check if we are superuser and note

SYNOPSIS
#include <sys/ucred.h>
int
suser(struct ucred *cred, u_short *acflag);

DESCRIPTION
The suser function checks if the credentials given include superuser powers.

The suser routine notes the fact that superuser powers have been used in the word pointed to by the second argument which should be a pointer to the p_acflags word of the proc structure. If the second argument is NULL then the usage is not noted. Because part of it's function is to notice whether super powers have been used, suser should be called after other permission possibilities have been exhausted.

RETURN VALUES
The suser function returns 0 if the user has super powers and EPERM otherwise. This is the reverse logic of some other implementations of suser in which a TRUE response indicates Super powers.