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.
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
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.
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
187 .\"O .SH "CONFORMING TO"
189 4.3BSD, POSIX.1-2001.
194 .BR getservent_r (3),