9.60 getsockname

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

This syscall fetches the address of an already bound socket.

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.