get effective user and group
identification of locally-connected peer
s, uid_t *euid,
returns the effective user ID and group ID of the peer connected to a
UNIX-domain socket (see
unix(4)). The argument s must be of type
One common use is for UNIX-domain servers to determine the credentials of clients that have connected to it.
takes three parameters:
- s contains the file descriptor of the socket whose peer credentials should be looked up.
- euid points to a
uid_tvariable into which the effective user ID for the connected peer will be stored.
- egid points to a
gid_tvariable into which the effective group ID for the connected peer will be stored.
If the call succeeds, a 0 is returned and euid and egid are set to the effective user ID and group ID of the connected peer. Otherwise, errno is set and a value of -1 is returned.
On failure, errno is set to one of the following:
- The argument s is not a valid descriptor.
- The argument s is a file, not a socket.
- The socket is not in the UNIX-domain.
- The socket is not connected.
- Insufficient resources were available in the system to perform the operation.
accept(2), bind(2), getpeername(2), getsockname(2), getsockopt(2), socket(2), unix(4)
getpeereid() function call appeared in