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

endservent.3p (5063B)


  1. '\" et
  2. .TH ENDSERVENT "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. endservent,
  12. getservbyname,
  13. getservbyport,
  14. getservent,
  15. setservent
  16. \(em network services database functions
  17. .SH SYNOPSIS
  18. .LP
  19. .nf
  20. #include <netdb.h>
  21. .P
  22. void endservent(void);
  23. struct servent *getservbyname(const char *\fIname\fP, const char *\fIproto\fP);
  24. struct servent *getservbyport(int \fIport\fP, const char *\fIproto\fP);
  25. struct servent *getservent(void);
  26. void setservent(int \fIstayopen\fP);
  27. .fi
  28. .SH DESCRIPTION
  29. These functions shall retrieve information about network services. This
  30. information is considered to be stored in a database that can be
  31. accessed sequentially or randomly. The implementation of this database
  32. is unspecified.
  33. .P
  34. The
  35. \fIsetservent\fR()
  36. function shall open a connection to the database, and set the next
  37. entry to the first entry. If the
  38. .IR stayopen
  39. argument is non-zero, the
  40. .IR net
  41. database shall not be closed after each call to the
  42. \fIgetservent\fR()
  43. function (either directly, or indirectly through one of the other
  44. .IR getserv* (\|)
  45. functions), and the implementation may maintain an open file descriptor
  46. for the database.
  47. .P
  48. The
  49. \fIgetservent\fR()
  50. function shall read the next entry of the database, opening and closing
  51. a connection to the database as necessary.
  52. .P
  53. The
  54. \fIgetservbyname\fR()
  55. function shall search the database from the beginning and find the
  56. first entry for which the service name specified by
  57. .IR name
  58. matches the
  59. .IR s_name
  60. member and the protocol name specified by
  61. .IR proto
  62. matches the
  63. .IR s_proto
  64. member, opening and closing a connection to the database as necessary.
  65. If
  66. .IR proto
  67. is a null pointer, any value of the
  68. .IR s_proto
  69. member shall be matched.
  70. .P
  71. The
  72. \fIgetservbyport\fR()
  73. function shall search the database from the beginning and find the
  74. first entry for which the port specified by
  75. .IR port
  76. matches the
  77. .IR s_port
  78. member and the protocol name specified by
  79. .IR proto
  80. matches the
  81. .IR s_proto
  82. member, opening and closing a connection to the database as necessary.
  83. If
  84. .IR proto
  85. is a null pointer, any value of the
  86. .IR s_proto
  87. member shall be matched. The
  88. .IR port
  89. argument shall be a value obtained by converting a
  90. .BR uint16_t
  91. in network byte order to
  92. .BR int .
  93. .P
  94. The
  95. \fIgetservbyname\fR(),
  96. \fIgetservbyport\fR(),
  97. and
  98. \fIgetservent\fR()
  99. functions shall each return a pointer to a
  100. .BR servent
  101. structure, the members of which shall contain the fields of an entry in
  102. the network services database.
  103. .P
  104. The
  105. \fIendservent\fR()
  106. function shall close the database, releasing any open file descriptor.
  107. .P
  108. These functions need not be thread-safe.
  109. .SH "RETURN VALUE"
  110. Upon successful completion,
  111. \fIgetservbyname\fR(),
  112. \fIgetservbyport\fR(),
  113. and
  114. \fIgetservent\fR()
  115. return a pointer to a
  116. .BR servent
  117. structure if the requested entry was found, and a null pointer if the
  118. end of the database was reached or the requested entry was not found.
  119. Otherwise, a null pointer is returned.
  120. .P
  121. The application shall not modify the structure to which the return
  122. value points, nor any storage areas pointed to by pointers within the
  123. structure. The returned pointer, and pointers within the structure,
  124. might be invalidated or the structure or the storage areas might be
  125. overwritten by a subsequent call to
  126. \fIgetservbyname\fR(),
  127. \fIgetservbyport\fR(),
  128. or
  129. \fIgetservent\fR().
  130. The returned pointer, and pointers within the structure, might also be
  131. invalidated if the calling thread is terminated.
  132. .SH ERRORS
  133. No errors are defined.
  134. .LP
  135. .IR "The following sections are informative."
  136. .SH "EXAMPLES"
  137. None.
  138. .SH "APPLICATION USAGE"
  139. The
  140. .IR port
  141. argument of
  142. \fIgetservbyport\fR()
  143. need not be compatible with the port values of all address families.
  144. .SH "RATIONALE"
  145. None.
  146. .SH "FUTURE DIRECTIONS"
  147. None.
  148. .SH "SEE ALSO"
  149. .IR "\fIendhostent\fR\^(\|)",
  150. .IR "\fIendprotoent\fR\^(\|)",
  151. .IR "\fIhtonl\fR\^(\|)",
  152. .IR "\fIinet_addr\fR\^(\|)"
  153. .P
  154. The Base Definitions volume of POSIX.1\(hy2017,
  155. .IR "\fB<netdb.h>\fP"
  156. .\"
  157. .SH COPYRIGHT
  158. Portions of this text are reprinted and reproduced in electronic form
  159. from IEEE Std 1003.1-2017, Standard for Information Technology
  160. -- Portable Operating System Interface (POSIX), The Open Group Base
  161. Specifications Issue 7, 2018 Edition,
  162. Copyright (C) 2018 by the Institute of
  163. Electrical and Electronics Engineers, Inc and The Open Group.
  164. In the event of any discrepancy between this version and the original IEEE and
  165. The Open Group Standard, the original IEEE and The Open Group Standard
  166. is the referee document. The original Standard can be obtained online at
  167. http://www.opengroup.org/unix/online.html .
  168. .PP
  169. Any typographical or formatting errors that appear
  170. in this page are most likely
  171. to have been introduced during the conversion of the source files to
  172. man page format. To report such errors, see
  173. https://www.kernel.org/doc/man-pages/reporting_bugs.html .