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

listen.3p (4070B)


  1. '\" et
  2. .TH LISTEN "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. listen
  12. \(em listen for socket connections and limit the queue of incoming
  13. connections
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <sys/socket.h>
  18. .P
  19. int listen(int \fIsocket\fP, int \fIbacklog\fP);
  20. .fi
  21. .SH DESCRIPTION
  22. The
  23. \fIlisten\fR()
  24. function shall mark a connection-mode socket, specified by the
  25. .IR socket
  26. argument, as accepting connections.
  27. .P
  28. The
  29. .IR backlog
  30. argument provides a hint to the implementation which the implementation
  31. shall use to limit the number of outstanding connections in the
  32. socket's listen queue. Implementations may impose a limit on
  33. .IR backlog
  34. and silently reduce the specified value. Normally, a larger
  35. .IR backlog
  36. argument value shall result in a larger or equal length of the listen
  37. queue. Implementations shall support values of
  38. .IR backlog
  39. up to SOMAXCONN, defined in
  40. .IR <sys/socket.h> .
  41. .P
  42. The implementation may include incomplete connections in its listen
  43. queue. The limits on the number of incomplete connections and completed
  44. connections queued may be different.
  45. .P
  46. The implementation may have an upper limit on the length of the listen
  47. queue\(emeither global or per accepting socket. If
  48. .IR backlog
  49. exceeds this limit, the length of the listen queue is set to the
  50. limit.
  51. .P
  52. If
  53. \fIlisten\fR()
  54. is called with a
  55. .IR backlog
  56. argument value that is less than 0, the function behaves as if it had
  57. been called with a
  58. .IR backlog
  59. argument value of 0.
  60. .P
  61. A
  62. .IR backlog
  63. argument of 0 may allow the socket to accept connections, in which case
  64. the length of the listen queue may be set to an
  65. implementation-defined minimum value.
  66. .P
  67. The socket in use may require the process to have appropriate
  68. privileges to use the
  69. \fIlisten\fR()
  70. function.
  71. .SH "RETURN VALUE"
  72. Upon successful completions,
  73. \fIlisten\fR()
  74. shall return 0; otherwise, \-1 shall be returned and
  75. .IR errno
  76. set to indicate the error.
  77. .SH ERRORS
  78. The
  79. \fIlisten\fR()
  80. function shall fail if:
  81. .TP
  82. .BR EBADF
  83. The
  84. .IR socket
  85. argument is not a valid file descriptor.
  86. .TP
  87. .BR EDESTADDRREQ
  88. .br
  89. The socket is not bound to a local address, and the protocol does not
  90. support listening on an unbound socket.
  91. .TP
  92. .BR EINVAL
  93. The
  94. .IR socket
  95. is already connected.
  96. .TP
  97. .BR ENOTSOCK
  98. The
  99. .IR socket
  100. argument does not refer to a socket.
  101. .TP
  102. .BR EOPNOTSUPP
  103. The socket protocol does not support
  104. \fIlisten\fR().
  105. .P
  106. The
  107. \fIlisten\fR()
  108. function may fail if:
  109. .TP
  110. .BR EACCES
  111. The calling process does not have appropriate privileges.
  112. .TP
  113. .BR EINVAL
  114. The
  115. .IR socket
  116. has been shut down.
  117. .TP
  118. .BR ENOBUFS
  119. Insufficient resources are available in the system to complete the
  120. call.
  121. .LP
  122. .IR "The following sections are informative."
  123. .SH "EXAMPLES"
  124. None.
  125. .SH "APPLICATION USAGE"
  126. None.
  127. .SH "RATIONALE"
  128. None.
  129. .SH "FUTURE DIRECTIONS"
  130. None.
  131. .SH "SEE ALSO"
  132. .IR "\fIaccept\fR\^(\|)",
  133. .IR "\fIconnect\fR\^(\|)",
  134. .IR "\fIsocket\fR\^(\|)"
  135. .P
  136. The Base Definitions volume of POSIX.1\(hy2017,
  137. .IR "\fB<sys_socket.h>\fP"
  138. .\"
  139. .SH COPYRIGHT
  140. Portions of this text are reprinted and reproduced in electronic form
  141. from IEEE Std 1003.1-2017, Standard for Information Technology
  142. -- Portable Operating System Interface (POSIX), The Open Group Base
  143. Specifications Issue 7, 2018 Edition,
  144. Copyright (C) 2018 by the Institute of
  145. Electrical and Electronics Engineers, Inc and The Open Group.
  146. In the event of any discrepancy between this version and the original IEEE and
  147. The Open Group Standard, the original IEEE and The Open Group Standard
  148. is the referee document. The original Standard can be obtained online at
  149. http://www.opengroup.org/unix/online.html .
  150. .PP
  151. Any typographical or formatting errors that appear
  152. in this page are most likely
  153. to have been introduced during the conversion of the source files to
  154. man page format. To report such errors, see
  155. https://www.kernel.org/doc/man-pages/reporting_bugs.html .