logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

getsockname.3p (3308B)


  1. '\" et
  2. .TH GETSOCKNAME "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. getsockname
  12. \(em get the socket name
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <sys/socket.h>
  17. .P
  18. int getsockname(int \fIsocket\fP, struct sockaddr *restrict \fIaddress\fP,
  19. socklen_t *restrict \fIaddress_len\fP);
  20. .fi
  21. .SH DESCRIPTION
  22. The
  23. \fIgetsockname\fR()
  24. function shall retrieve the locally-bound name of the specified socket,
  25. store this address in the
  26. .BR sockaddr
  27. structure pointed to by the
  28. .IR address
  29. argument, and store the length of this address in the object pointed
  30. to by the
  31. .IR address_len
  32. argument.
  33. .P
  34. The
  35. .IR address_len
  36. argument points to a
  37. .BR socklen_t
  38. object which on input specifies the length of the supplied
  39. .BR sockaddr
  40. structure, and on output specifies the length of the stored address.
  41. If the actual length of the address is greater than the length of the
  42. supplied
  43. .BR sockaddr
  44. structure, the stored address shall be truncated.
  45. .P
  46. If the socket has not been bound to a local name, the value stored in
  47. the object pointed to by
  48. .IR address
  49. is unspecified.
  50. .SH "RETURN VALUE"
  51. Upon successful completion, 0 shall be returned, the
  52. .IR address
  53. argument shall point to the address of the socket, and the
  54. .IR address_len
  55. argument shall point to the length of the address. Otherwise, \-1
  56. shall be returned and
  57. .IR errno
  58. set to indicate the error.
  59. .SH ERRORS
  60. The
  61. \fIgetsockname\fR()
  62. function shall fail if:
  63. .TP
  64. .BR EBADF
  65. The
  66. .IR socket
  67. argument is not a valid file descriptor.
  68. .TP
  69. .BR ENOTSOCK
  70. The
  71. .IR socket
  72. argument does not refer to a socket.
  73. .TP
  74. .BR EOPNOTSUPP
  75. The operation is not supported for this socket's protocol.
  76. .P
  77. The
  78. \fIgetsockname\fR()
  79. function may fail if:
  80. .TP
  81. .BR EINVAL
  82. The socket has been shut down.
  83. .TP
  84. .BR ENOBUFS
  85. Insufficient resources were available in the system to complete the
  86. function.
  87. .LP
  88. .IR "The following sections are informative."
  89. .SH "EXAMPLES"
  90. None.
  91. .SH "APPLICATION USAGE"
  92. None.
  93. .SH "RATIONALE"
  94. None.
  95. .SH "FUTURE DIRECTIONS"
  96. None.
  97. .SH "SEE ALSO"
  98. .IR "\fIaccept\fR\^(\|)",
  99. .IR "\fIbind\fR\^(\|)",
  100. .IR "\fIgetpeername\fR\^(\|)",
  101. .IR "\fIsocket\fR\^(\|)"
  102. .P
  103. The Base Definitions volume of POSIX.1\(hy2017,
  104. .IR "\fB<sys_socket.h>\fP"
  105. .br
  106. .\"
  107. .SH COPYRIGHT
  108. Portions of this text are reprinted and reproduced in electronic form
  109. from IEEE Std 1003.1-2017, Standard for Information Technology
  110. -- Portable Operating System Interface (POSIX), The Open Group Base
  111. Specifications Issue 7, 2018 Edition,
  112. Copyright (C) 2018 by the Institute of
  113. Electrical and Electronics Engineers, Inc and The Open Group.
  114. In the event of any discrepancy between this version and the original IEEE and
  115. The Open Group Standard, the original IEEE and The Open Group Standard
  116. is the referee document. The original Standard can be obtained online at
  117. http://www.opengroup.org/unix/online.html .
  118. .PP
  119. Any typographical or formatting errors that appear
  120. in this page are most likely
  121. to have been introduced during the conversion of the source files to
  122. man page format. To report such errors, see
  123. https://www.kernel.org/doc/man-pages/reporting_bugs.html .