9.61 getpeername

int getpeername(int sockfd, struct sockaddr *restrict addr, socklen_t *restrict addrlen);

This syscall fetches the address of a socket’s peer.

The syscall returns 0 on success or -1 on failure, with the following errno:

EINVAL

The passed FD was a non bound socket.

EBADF

The passed file is valid but it was not a physical file in a filesystem.