3 getpeereid \- get the effective user ID and effective group ID of a peer
4 connected through a Unix domain socket.
7 #include <sys/socket.h>
11 int getpeereid(int \fIsd\fP, uid_t *\fIeuid\fP, gid_t *\fIegid\fP);
15 getpeereid() is often used to authenticate clients connecting to a
16 server through a Unix domain socket. The server can call this function
17 with a socket descriptor \fIsd\fP and this function will fill\-in
18 \fIeuid\fP and \fIegid\fP with the effective user ID and the effective
19 group ID of the client process.
21 On success, this function returns 0, \fIeuid\fP is set to the effective
22 user ID of the peer connected through Unix domain socket \fIsd\fP, and
23 \fIegid\fP is set to the effective group ID of the peer connected
24 through Unix domain socket \fIsd\fP. On error, -1 is returned and
29 The argument \fIsd\fP is not a descriptor.
32 The argument \fIsd\fP is a descriptor, but not a socket descriptor.
35 The address pointed to by \fIeuid\fP and/or \fIegid\fP is not in a
36 valid part of the process address space.
42 This function first appeared in Minix 3.1.8.