summaryrefslogtreecommitdiff
path: root/lib/libc/net/getprotoent.3
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/net/getprotoent.3')
-rw-r--r--lib/libc/net/getprotoent.359
1 files changed, 54 insertions, 5 deletions
diff --git a/lib/libc/net/getprotoent.3 b/lib/libc/net/getprotoent.3
index 5c41e6fb7cd..2497f9f7cab 100644
--- a/lib/libc/net/getprotoent.3
+++ b/lib/libc/net/getprotoent.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: getprotoent.3,v 1.10 2004/02/01 19:45:00 nordin Exp $
+.\" $OpenBSD: getprotoent.3,v 1.11 2004/10/17 20:24:23 millert Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,28 +27,43 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd June 4, 1993
+.Dd October 13, 2004
.Dt GETPROTOENT 3
.Os
.Sh NAME
.Nm getprotoent ,
+.Nm getprotoent_r ,
.Nm getprotobynumber ,
+.Nm getprotobynumber_r ,
.Nm getprotobyname ,
+.Nm getprotobyname_r ,
.Nm setprotoent ,
-.Nm endprotoent
+.Nm setprotoent_r ,
+.Nm endprotoent ,
+.Nm endprotoent_r
.Nd get protocol entry
.Sh SYNOPSIS
.Fd #include <netdb.h>
.Ft struct protoent *
.Fn getprotoent "void"
.Ft struct protoent *
+.Fn getprotoent_r "struct protoent *protoent" "struct protoent_data *protoent_data"
+.Ft struct protoent *
.Fn getprotobyname "const char *name"
.Ft struct protoent *
+.Fn getprotobyname_r "const char *name" "struct protoent *protoent" "struct protoent_data *protoent_data"
+.Ft struct protoent *
.Fn getprotobynumber "int proto"
+.Ft struct protoent *
+.Fn getprotobynumber_r "int proto" "struct protoent *protoent" "struct protoent_data *protoent_data"
.Ft void
.Fn setprotoent "int stayopen"
.Ft void
+.Fn setprotoent_r "int stayopen" "struct protoent_data *protoent_data"
+.Ft void
.Fn endprotoent "void"
+.Ft void
+.Fn endprotoent_r "void" "struct protoent_data *protoent_data"
.Sh DESCRIPTION
The
.Fn getprotoent ,
@@ -104,6 +119,30 @@ functions sequentially search from the beginning of the file until a
matching protocol name or protocol number is found, or until
.Dv EOF
is encountered.
+.Pp
+The
+.Fn getprotoent_r ,
+.Fn getprotobyport_r ,
+.Fn getprotobyname_r ,
+.Fn setprotoent_r ,
+and
+.Fn endprotoent_r
+functions are reentrant versions of the above functions that take a
+pointer to a
+.Fa protoent_data
+structure which is used to store state information.
+The structure must be zero-filled before it is used
+and should be considered opaque for the sake of portability.
+.Pp
+The
+.Fn getprotoent_r ,
+.Fn getprotobyport_r ,
+and
+.Fn getprotobyname_r
+functions
+also take a pointer to a
+.Fa protoent
+structure which is used to store the results of the database lookup.
.Sh RETURN VALUES
Null pointer (0) returned on
.Dv EOF
@@ -124,7 +163,17 @@ and
.Fn endprotoent
functions appeared in
.Bx 4.2 .
+.Pp
+The
+.Fn getprotoent_r ,
+.Fn getprotobyport_r ,
+.Fn getprotobyname_r ,
+.Fn setprotoent_r ,
+and
+.Fn endprotoent_r
+functions appeared in
+.Ox 3.7 .
.Sh BUGS
-These functions use a static data space; if the data is needed for future use,
-it should be copied before any subsequent calls overwrite it.
+The non-reentrant functions use a static data space; if the data is needed
+for future use, it should be copied before any subsequent calls overwrite it.
Only the Internet protocols are currently understood.