1 GETSOCKNAME(3C)          Standard C Library Functions          GETSOCKNAME(3C)
   2 
   3 NAME
   4      getsockname - get socket name
   5 
   6 LIBRARY
   7      Standard C Library (libc, -lc)
   8 
   9 SYNOPSIS
  10      #include <sys/types.h>
  11      #include <sys/socket.h>
  12 
  13      int
  14      getsockname(int s, struct sockaddr *restrict name, socklen_t *namelen);
  15 
  16 DESCRIPTION
  17      getsockname() returns the current name for socket s.  The namelen
  18      parameter should be initialized to indicate the amount of space pointed
  19      to by name.  On return it contains the actual size in bytes of the name
  20      returned.
  21 
  22 RETURN VALUES
  23      If successful, getsockname() returns 0; otherwise it returns -1 and sets
  24      errno to indicate the error.
  25 
  26 ERRORS
  27      The call succeeds unless:
  28 
  29      [EBADF]            The argument s is not a valid file descriptor.
  30 
  31      [ENOMEM]           There was insufficient memory available for the
  32                         operation to complete.
  33 
  34      [ENOSR]            There were insufficient STREAMS resources available
  35                         for the operation to complete.
  36 
  37      [ENOTSOCK]         The argument s is not a socket.
  38 
  39 MT-LEVEL
  40      Safe
  41 
  42 SEE ALSO
  43      bind(3C), getpeername(3C), sockaddr(3C), socket(3C), attributes(5)
  44 
  45 illumos                         August 2, 2018                         illumos