summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/getprotoent.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/getprotoent.3')
-rw-r--r--src/lib/libc/net/getprotoent.359
1 files changed, 54 insertions, 5 deletions
diff --git a/src/lib/libc/net/getprotoent.3 b/src/lib/libc/net/getprotoent.3
index 5c41e6fb7c..2497f9f7ca 100644
--- a/src/lib/libc/net/getprotoent.3
+++ b/src/lib/libc/net/getprotoent.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: getprotoent.3,v 1.10 2004/02/01 19:45:00 nordin Exp $ 1.\" $OpenBSD: getprotoent.3,v 1.11 2004/10/17 20:24:23 millert Exp $
2.\" 2.\"
3.\" Copyright (c) 1983, 1991, 1993 3.\" Copyright (c) 1983, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
@@ -27,28 +27,43 @@
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE. 28.\" SUCH DAMAGE.
29.\" 29.\"
30.Dd June 4, 1993 30.Dd October 13, 2004
31.Dt GETPROTOENT 3 31.Dt GETPROTOENT 3
32.Os 32.Os
33.Sh NAME 33.Sh NAME
34.Nm getprotoent , 34.Nm getprotoent ,
35.Nm getprotoent_r ,
35.Nm getprotobynumber , 36.Nm getprotobynumber ,
37.Nm getprotobynumber_r ,
36.Nm getprotobyname , 38.Nm getprotobyname ,
39.Nm getprotobyname_r ,
37.Nm setprotoent , 40.Nm setprotoent ,
38.Nm endprotoent 41.Nm setprotoent_r ,
42.Nm endprotoent ,
43.Nm endprotoent_r
39.Nd get protocol entry 44.Nd get protocol entry
40.Sh SYNOPSIS 45.Sh SYNOPSIS
41.Fd #include <netdb.h> 46.Fd #include <netdb.h>
42.Ft struct protoent * 47.Ft struct protoent *
43.Fn getprotoent "void" 48.Fn getprotoent "void"
44.Ft struct protoent * 49.Ft struct protoent *
50.Fn getprotoent_r "struct protoent *protoent" "struct protoent_data *protoent_data"
51.Ft struct protoent *
45.Fn getprotobyname "const char *name" 52.Fn getprotobyname "const char *name"
46.Ft struct protoent * 53.Ft struct protoent *
54.Fn getprotobyname_r "const char *name" "struct protoent *protoent" "struct protoent_data *protoent_data"
55.Ft struct protoent *
47.Fn getprotobynumber "int proto" 56.Fn getprotobynumber "int proto"
57.Ft struct protoent *
58.Fn getprotobynumber_r "int proto" "struct protoent *protoent" "struct protoent_data *protoent_data"
48.Ft void 59.Ft void
49.Fn setprotoent "int stayopen" 60.Fn setprotoent "int stayopen"
50.Ft void 61.Ft void
62.Fn setprotoent_r "int stayopen" "struct protoent_data *protoent_data"
63.Ft void
51.Fn endprotoent "void" 64.Fn endprotoent "void"
65.Ft void
66.Fn endprotoent_r "void" "struct protoent_data *protoent_data"
52.Sh DESCRIPTION 67.Sh DESCRIPTION
53The 68The
54.Fn getprotoent , 69.Fn getprotoent ,
@@ -104,6 +119,30 @@ functions sequentially search from the beginning of the file until a
104matching protocol name or protocol number is found, or until 119matching protocol name or protocol number is found, or until
105.Dv EOF 120.Dv EOF
106is encountered. 121is encountered.
122.Pp
123The
124.Fn getprotoent_r ,
125.Fn getprotobyport_r ,
126.Fn getprotobyname_r ,
127.Fn setprotoent_r ,
128and
129.Fn endprotoent_r
130functions are reentrant versions of the above functions that take a
131pointer to a
132.Fa protoent_data
133structure which is used to store state information.
134The structure must be zero-filled before it is used
135and should be considered opaque for the sake of portability.
136.Pp
137The
138.Fn getprotoent_r ,
139.Fn getprotobyport_r ,
140and
141.Fn getprotobyname_r
142functions
143also take a pointer to a
144.Fa protoent
145structure which is used to store the results of the database lookup.
107.Sh RETURN VALUES 146.Sh RETURN VALUES
108Null pointer (0) returned on 147Null pointer (0) returned on
109.Dv EOF 148.Dv EOF
@@ -124,7 +163,17 @@ and
124.Fn endprotoent 163.Fn endprotoent
125functions appeared in 164functions appeared in
126.Bx 4.2 . 165.Bx 4.2 .
166.Pp
167The
168.Fn getprotoent_r ,
169.Fn getprotobyport_r ,
170.Fn getprotobyname_r ,
171.Fn setprotoent_r ,
172and
173.Fn endprotoent_r
174functions appeared in
175.Ox 3.7 .
127.Sh BUGS 176.Sh BUGS
128These functions use a static data space; if the data is needed for future use, 177The non-reentrant functions use a static data space; if the data is needed
129it should be copied before any subsequent calls overwrite it. 178for future use, it should be copied before any subsequent calls overwrite it.
130Only the Internet protocols are currently understood. 179Only the Internet protocols are currently understood.