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

getsockopt.3p (4042B)


  1. '\" et
  2. .TH GETSOCKOPT "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. getsockopt
  12. \(em get the socket options
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <sys/socket.h>
  17. .P
  18. int getsockopt(int \fIsocket\fP, int \fIlevel\fP, int \fIoption_name,\fP
  19. void *restrict \fIoption_value\fP, socklen_t *restrict \fIoption_len\fP);
  20. .fi
  21. .SH DESCRIPTION
  22. The
  23. \fIgetsockopt\fR()
  24. function manipulates options associated with a socket.
  25. .P
  26. The
  27. \fIgetsockopt\fR()
  28. function shall retrieve the value for the option specified by the
  29. .IR option_name
  30. argument for the socket specified by the
  31. .IR socket
  32. argument. If the size of the option value is greater than
  33. .IR option_len ,
  34. the value stored in the object pointed to by the
  35. .IR option_value
  36. argument shall be silently truncated. Otherwise, the object pointed to
  37. by the
  38. .IR option_len
  39. argument shall be modified to indicate the actual length of the value.
  40. .P
  41. The
  42. .IR level
  43. argument specifies the protocol level at which the option resides. To
  44. retrieve options at the socket level, specify the
  45. .IR level
  46. argument as SOL_SOCKET. To retrieve options at other levels, supply the
  47. appropriate level identifier for the protocol controlling the option.
  48. For example, to indicate that an option is interpreted by the TCP
  49. (Transmission Control Protocol), set
  50. .IR level
  51. to IPPROTO_TCP as defined in the
  52. .IR <netinet/in.h>
  53. header.
  54. .P
  55. The socket in use may require the process to have appropriate
  56. privileges to use the
  57. \fIgetsockopt\fR()
  58. function.
  59. .P
  60. The
  61. .IR option_name
  62. argument specifies a single option to be retrieved. It can be one of
  63. the socket-level options defined in
  64. .IR "\fB<sys_socket.h>\fP"
  65. and described in
  66. .IR "Section 2.10.16" ", " "Use of Options".
  67. .SH "RETURN VALUE"
  68. Upon successful completion,
  69. \fIgetsockopt\fR()
  70. shall return 0; otherwise, \-1 shall be returned and
  71. .IR errno
  72. set to indicate the error.
  73. .SH ERRORS
  74. The
  75. \fIgetsockopt\fR()
  76. function shall fail if:
  77. .TP
  78. .BR EBADF
  79. The
  80. .IR socket
  81. argument is not a valid file descriptor.
  82. .TP
  83. .BR EINVAL
  84. The specified option is invalid at the specified socket level.
  85. .TP
  86. .BR ENOPROTOOPT
  87. .br
  88. The option is not supported by the protocol.
  89. .TP
  90. .BR ENOTSOCK
  91. The
  92. .IR socket
  93. argument does not refer to a socket.
  94. .P
  95. The
  96. \fIgetsockopt\fR()
  97. function may fail if:
  98. .TP
  99. .BR EACCES
  100. The calling process does not have appropriate privileges.
  101. .TP
  102. .BR EINVAL
  103. The socket has been shut down.
  104. .TP
  105. .BR ENOBUFS
  106. Insufficient resources are available in the system to complete the
  107. function.
  108. .LP
  109. .IR "The following sections are informative."
  110. .SH "EXAMPLES"
  111. None.
  112. .SH "APPLICATION USAGE"
  113. None.
  114. .SH "RATIONALE"
  115. None.
  116. .SH "FUTURE DIRECTIONS"
  117. None.
  118. .SH "SEE ALSO"
  119. .IR "Section 2.10.16" ", " "Use of Options",
  120. .IR "\fIbind\fR\^(\|)",
  121. .IR "\fIclose\fR\^(\|)",
  122. .IR "\fIendprotoent\fR\^(\|)",
  123. .IR "\fIsetsockopt\fR\^(\|)",
  124. .IR "\fIsocket\fR\^(\|)"
  125. .P
  126. The Base Definitions volume of POSIX.1\(hy2017,
  127. .IR "\fB<sys_socket.h>\fP",
  128. .IR "\fB<netinet_in.h>\fP"
  129. .\"
  130. .SH COPYRIGHT
  131. Portions of this text are reprinted and reproduced in electronic form
  132. from IEEE Std 1003.1-2017, Standard for Information Technology
  133. -- Portable Operating System Interface (POSIX), The Open Group Base
  134. Specifications Issue 7, 2018 Edition,
  135. Copyright (C) 2018 by the Institute of
  136. Electrical and Electronics Engineers, Inc and The Open Group.
  137. In the event of any discrepancy between this version and the original IEEE and
  138. The Open Group Standard, the original IEEE and The Open Group Standard
  139. is the referee document. The original Standard can be obtained online at
  140. http://www.opengroup.org/unix/online.html .
  141. .PP
  142. Any typographical or formatting errors that appear
  143. in this page are most likely
  144. to have been introduced during the conversion of the source files to
  145. man page format. To report such errors, see
  146. https://www.kernel.org/doc/man-pages/reporting_bugs.html .