GETNUCRED(2)

NAME
getnucred - obtain the credentials that correspond to the given endpoint.

SYNOPSIS
#include <sys/socket.h>
#include <sys/ucred.h>
int getnucred(endpoint_t proc_ep, struct uucred * ucred);

DESCRIPTION
Given an endpoint proc_ep, this function will fill in ucred with the pid, uid, and gid that correspond to that endpoint.

RETURN VALUES
On success, this function returns 0 and ucred will be filled in. On error, -1 is returned and errno is set.

ERRORS

[EFAULT]
    The address pointed to by ucred is not in a valid part of the process address space. [EPERM] The user calling this function has insufficient privileges. Only a user with an euid of 0 may call this function. [ESRCH] The endpoint was not found. This is caused by an invalid endpoint or an endpoint for a process that no longer exists.

SEE ALSO
getpid(2), getuid(2), getgid(2), getnpid(2), getnuid(2), getngid(2)

HISTORY
This function first appeared in Minix 3.1.8.