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:
EINVALThe passed FD was a non bound socket.
EBADFThe passed file is valid but it was not a physical file in a filesystem.