1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
27 .\" Modified Sat Jul 24 19:19:11 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified Wed Oct 18 20:23:54 1995 by Martin Schulze <joey@infodrom.north.de>
29 .\" Modified Mon Apr 22 01:50:54 1996 by Martin Schulze <joey@infodrom.north.de>
30 .\" 2001-07-25 added a clause about NULL proto (Martin Michlmayr or David N. Welton)
32 .\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved.
33 .\" Translated Fri Mar 15 1998 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
34 .\" Updated Thu 16 Aug 2001 by NAKANO Takeo
35 .\" Updated 2008-09-19, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
37 .TH GETSERVENT 3 2008-08-19 "GNU" "Linux Programmer's Manual"
39 .\"O getservent, getservbyname, getservbyport, setservent, endservent \-
40 .\"O get service entry
42 getservent, getservbyname, getservbyport, setservent, endservent \- ¥µ¡¼¥Ó¥¹¤Î¥¨¥ó¥È¥ê¤ò¼èÆÀ¤¹¤ë
48 .B struct servent *getservent(void);
50 .BI "struct servent *getservbyname(const char *" name ", const char *" proto );
52 .BI "struct servent *getservbyport(int " port ", const char *" proto );
54 .BI "void setservent(int " stayopen );
56 .B void endservent(void);
61 .\"O .BR getservent ()
62 .\"O function reads the next entry from the services database (see
63 .\"O .BR services (5))
64 .\"O and returns a \fIservent\fP structure containing
65 .\"O the broken-out fields from the entry.
66 .\"O A connection is opened to the database if necessary.
68 ´Ø¿ô¤Ï¥µ¡¼¥Ó¥¹¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹
70 »²¾È) ¤«¤é¼¡¤Î¥¨¥ó¥È¥ê¤òÆɤ߹þ¤ß¡¢
71 ¤½¤Î¥¨¥ó¥È¥ê¤ò \fIservent\fP ¹½Â¤ÂΤÎÍ×ÁÇÊ̤Υե£¡¼¥ë¥É¤Ë³ÊǼ¤·¡¢
73 ɬÍפǤ¢¤ì¤Ð¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤ÎÀܳ¤¬¥ª¡¼¥×¥ó¤µ¤ì¤ë¡£
76 .\"O .BR getservbyname ()
77 .\"O function returns a \fIservent\fP structure
78 .\"O for the entry from the database
79 .\"O that matches the service \fIname\fP using protocol \fIproto\fP.
80 .\"O If \fIproto\fP is NULL, any protocol will be matched.
81 .\"O A connection is opened to the database if necessary.
84 ¥×¥í¥È¥³¥ë \fIproto\fP ¤òÍѤ¤¤ë¥µ¡¼¥Ó¥¹¤Î̾Á° \fIname\fP
85 ¤Ë¥Þ¥Ã¥Á¤¹¤ë¥¨¥ó¥È¥ê¤ò¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤éõ¤·¡¢
86 ¤½¤Î¥¨¥ó¥È¥ê¤ò¼ý¤á¤¿ \fIservent\fP ¹½Â¤ÂΤòÊÖ¤¹¡£
87 \fIproto\fP ¤¬ NULL ¤Î¾ì¹ç¤Ï¡¢Ç¤°Õ¤Î¥×¥í¥È¥³¥ë¤Ë¥Þ¥Ã¥Á¤¹¤ë¡£
88 ɬÍפǤ¢¤ì¤Ð¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤ÎÀܳ¤¬¥ª¡¼¥×¥ó¤µ¤ì¤ë¡£
91 .\"O .BR getservbyport ()
92 .\"O function returns a \fIservent\fP structure
93 .\"O for the entry from the database
94 .\"O that matches the port \fIport\fP (given in network byte order)
95 .\"O using protocol \fIproto\fP.
96 .\"O If \fIproto\fP is NULL, any protocol will be matched.
97 .\"O A connection is opened to the database if necessary.
100 ¥×¥í¥È¥³¥ë \fIproto\fP ¤òÍѤ¤¤ë¥µ¡¼¥Ó¥¹¤Î¥Ý¡¼¥ÈÈÖ¹æ \fIport\fP
101 ¤Ë¥Þ¥Ã¥Á¤¹¤ë¥¨¥ó¥È¥ê¤ò¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤éõ¤·¡¢
102 ¤½¤Î¥¨¥ó¥È¥ê¤ÎÆâÍƤò¼ý¤á¤¿ \fIservent\fP ¹½Â¤ÂΤòÊÖ¤¹
103 (¥Ý¡¼¥ÈÈÖ¹æ \fIport\fP ¤Ï¥Í¥Ã¥È¥ï¡¼¥¯¡¦¥Ð¥¤¥È¥ª¡¼¥À¤Ç»ØÄꤹ¤ë)¡£
104 \fIproto\fP ¤¬ NULL ¤Î¾ì¹ç¤ÏǤ°Õ¤Î¥×¥í¥È¥³¥ë¤Ë¥Þ¥Ã¥Á¤¹¤ë¡£
105 ɬÍפǤ¢¤ì¤Ð¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤ÎÀܳ¤¬¥ª¡¼¥×¥ó¤µ¤ì¤ë¡£
108 .\"O .BR setservent ()
109 .\"O function opens a connection to the database,
110 .\"O and sets the next entry to the first entry.
111 .\"O If \fIstayopen\fP is nonzero,
112 .\"O then the connection to the database
113 .\"O will not be closed between calls to one of the
117 ´Ø¿ô¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤ÎÀܳ¤ò¥ª¡¼¥×¥ó¤·¡¢
118 ¼¡¤ÎÆɤ߹þ¤ß¥¨¥ó¥È¥ê¤òÀèƬ¤Î¥¨¥ó¥È¥ê¤ËÀßÄꤹ¤ë¡£
119 \fIstayopen\fP ¤¬ 0 ¤Ç¤Ê¤¤¾ì¹ç¡¢
122 ´Ø¿ô¤Î¸Æ¤Ó½Ð¤·´Ö¤Ç¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤ÎÀܳ¤ò¥¯¥í¡¼¥º¤·¤Ê¤¤¡£
125 .\"O .BR endservent ()
126 .\"O function closes the connection to the database.
128 ´Ø¿ô¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤ÎÀܳ¤ò¥¯¥í¡¼¥º¤¹¤ë¡£
130 .\"O The \fIservent\fP structure is defined in \fI<netdb.h>\fP as follows:
131 \fIservent\fP ¹½Â¤ÂÎ¤Ï \fI<netdb.h>\fP ¤Ç°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
136 char *s_name; /* official service name */
137 char **s_aliases; /* alias list */
138 int s_port; /* port number */
139 char *s_proto; /* protocol to use */
144 .\"O The members of the \fIservent\fP structure are:
145 \fIservent\fP ¹½Â¤ÂΤΥá¥ó¥Ð¡¼¤Ï°Ê²¼¤ÎÄ̤ꡣ
149 .\"O The official name of the service.
150 ¥µ¡¼¥Ó¥¹¤ÎÀµ¼°Ì¾ (official name)¡£
153 .\"O A NULL-terminated list of alternative names for the service.
154 ¥µ¡¼¥Ó¥¹¤ÎÊÌ̾¤Î¥ê¥¹¥È¡£
155 ¥ê¥¹¥È¤Ï NULL ¤Ç½ªÃ¼¤µ¤ì¤ë¡£
158 .\"O The port number for the service given in network byte order.
159 ¥µ¡¼¥Ó¥¹¤Î¥Ý¡¼¥ÈÈֹ档¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¤Ç»ØÄꤵ¤ì¤ë¡£
162 .\"O The name of the protocol to use with this service.
163 ¤³¤Î¥µ¡¼¥Ó¥¹¤È¶¦¤ËÍѤ¤¤ë¥×¥í¥È¥³¥ë¤Î̾Á°¡£
165 .\"O .SH "RETURN VALUE"
168 .\"O .BR getservent (),
169 .\"O .BR getservbyname ()
171 .\"O .BR getservbyport ()
172 .\"O functions return a pointer to a
173 .\"O statically allocated \fIservent\fP structure, or a NULL pointer if an
174 .\"O error occurs or the end of the file is reached.
176 .BR getservbyname (),
179 ÀÅŪ¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿ \fIservent\fP ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òÊÖ¤¹¡£
180 ¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¤ê¡¢¥Õ¥¡¥¤¥ë¤ÎËöÈø¤Ë㤷¤¿¾ì¹ç¤Ï NULL ¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
185 .\"O services database file
186 ¥µ¡¼¥Ó¥¹¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë
187 .\"O .SH "CONFORMING TO"
189 4.3BSD, POSIX.1-2001.
194 .BR getservent_r (3),