mtcp_getsockname 3 2017-02-01 "Linux" "mOS Library Functions Manual"
NAME
mtcp_getsockname - get socket name
SYNOPSIS
#include <mtcp_api.h> "int mtcp_getsockname(mctx_t " mctx ", int " sockfd ", struct sockaddr *" addr ", socklen_t *" addrlen );
DESCRIPTION
mtcp_getsockname () returns the current address to which the socket "sockfd" is bound, in the buffer pointed to by "addr." The "addrlen" argument should be initialized to indicate the amount of space (in bytes) pointed to by "addr." On return it contains the actual size of the socket address. An mtcp_getsockname () call takes an additional argument named "mctx" that represents the per-core mTCP context in an application (see mtcp_create_context() for details). """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
RETURN VALUE
Returns zero on success; -1 on failure. In case of failure, "errno" is set appropriately. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
ERRORS

10 "EBADF" The argument "sockfd" is not a valid socket descriptor.

10 "EINVAL" "addrlen" argument is invalid (e.g., is negative).

10 "ENOTSOCK" The argument "sockfd" is pointing to an invalid mTCP socket. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""".SH CONFORMING TO
""""POSIX.1-2001.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

NOTES
The third argument of mtcp_getsockname() is in reality an "int *" (and this is what 4.x BSD and libc4 and libc5 have). Some POSIX confusion resulted in the present "socklen_t", also used by glibc. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
AUTHORS
mTCP development team <[email protected]> """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
SEE ALSO
mtcp_bind (), mtcp_socket () """""""""""""""""""""""""""""""""""""""""""""""""""""
COLOPHON
This page is part of mOS release 0.3 "docs" section. A description of the project, and information about reporting bugs, can be found at \%http://mos.kaist.edu/. """""""""""""""""""""""""""""""""""""""""""""""""""""