summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2000-01-26 06:22:52 +0000
committerderaadt <deraadt@openbsd.org>2000-01-26 06:22:52 +0000
commit7be0ef421acffcfc473a7557bcb1c99428cba5c5 (patch)
treea3b8a34405c06ab1707eb5344b863d51808aa269 /lib/libc
parentnew bindresvport() semantics that itojun, shin, jean-luc and i have agreed on, which will be happy for the future. bindresvport_sa() for sockaddr *, too. docs later.. (diff)
downloadwireguard-openbsd-7be0ef421acffcfc473a7557bcb1c99428cba5c5.tar.xz
wireguard-openbsd-7be0ef421acffcfc473a7557bcb1c99428cba5c5.zip
man page updates from itojun
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/rcmd.34
-rw-r--r--lib/libc/rpc/Makefile.inc4
-rw-r--r--lib/libc/rpc/bindresvport.342
3 files changed, 36 insertions, 14 deletions
diff --git a/lib/libc/net/rcmd.3 b/lib/libc/net/rcmd.3
index a010b648187..fa7be72c8d9 100644
--- a/lib/libc/net/rcmd.3
+++ b/lib/libc/net/rcmd.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rcmd.3,v 1.15 1999/12/30 20:50:13 deraadt Exp $
+.\" $OpenBSD: rcmd.3,v 1.16 2000/01/26 06:22:52 deraadt Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -225,7 +225,7 @@ is overloaded to mean
.Xr rsh 1 ,
.Xr intro 2 ,
.Xr bindresvport 3 ,
-.Xr bindresvport_af 3 ,
+.Xr bindresvport_sa 3 ,
.Xr rcmdsh 3 ,
.Xr rexec 3 ,
.Xr rexecd 8 ,
diff --git a/lib/libc/rpc/Makefile.inc b/lib/libc/rpc/Makefile.inc
index 4df12abfb9d..3a3b3599939 100644
--- a/lib/libc/rpc/Makefile.inc
+++ b/lib/libc/rpc/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.9 1999/12/16 21:30:35 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.10 2000/01/26 06:22:54 deraadt Exp $
# librpc sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE}/rpc ${LIBCSRCDIR}/rpc
@@ -13,7 +13,7 @@ SRCS+= auth_none.c auth_unix.c authunix_prot.c bindresvport.c \
xdr_rec.c xdr_reference.c xdr_stdio.c
MAN+= bindresvport.3 getrpcent.3 getrpcport.3 rpc.3 xdr.3 rpcauth.3
-MLINKS+= bindresvport.3 bindresvport_af.3 \
+MLINKS+= bindresvport.3 bindresvport_sa.3 \
getrpcent.3 getrpcbyname.3 \
getrpcent.3 getrpcbynumber.3 \
getrpcent.3 endrpcent.3 \
diff --git a/lib/libc/rpc/bindresvport.3 b/lib/libc/rpc/bindresvport.3
index 6fa38f7e6d9..1516374e29f 100644
--- a/lib/libc/rpc/bindresvport.3
+++ b/lib/libc/rpc/bindresvport.3
@@ -1,11 +1,11 @@
-.\" $OpenBSD: bindresvport.3,v 1.13 1999/12/30 20:50:13 deraadt Exp $
+.\" $OpenBSD: bindresvport.3,v 1.14 2000/01/26 06:22:55 deraadt Exp $
.\"
.Dd August 9, 1997
.Dt BINDRESVPORT 3
-.Os
+.Os KAME
.Sh NAME
.Nm bindresvport ,
-.Nm bindresvport_af
+.Nm bindresvport_sa
.Nd bind a socket to a privileged IP port
.Sh SYNOPSIS
.Fd #include <sys/types.h>
@@ -13,11 +13,11 @@
.Ft int
.Fn bindresvport "int sd" "struct sockaddr_in *sin"
.Ft int
-.Fn bindresvport_af "int sd" "struct sockaddr *sa" "int af"
+.Fn bindresvport_sa "int sd" "struct sockaddr *sa"
.Sh DESCRIPTION
.Fn bindresvport
and
-.Fn bindresvport_af
+.Fn bindresvport_sa
are used to bind a socket descriptor to a privileged
.Tn IP
port, that is, a port number in the range 0-1023.
@@ -28,6 +28,12 @@ is a socket descriptor that was returned by a call to
Only root can bind to a privileged port; this call will fail for any
other users.
.Pp
+When
+.Va sin
+is not null,
+.Va sin->sin_family
+must initialized to the address family of the socket, passed by
+.Va sd .
If the value of
.Va sin->sin_port
is non-zero,
@@ -35,10 +41,25 @@ is non-zero,
attempts to use the specified port. If that fails, it
chooses another privileged port number automatically.
.Pp
-.Fn bindresvport_af
-acts in a similar way, but supports other protocols as well, such
-as
-.Va AF_INET6 .
+It is legal to pass null pointer to
+.Va sin .
+In this case, the caller cannot get the port number
+.Fn bindresvport
+has picked.
+.Pp
+Function prototype of
+.Fn bindresvport
+is biased to
+.Dv AF_INET
+socket.
+.Fn bindresvport_sa
+acts exactly the same, with more neutral function prototype.
+Note that both functions behave exactly the same, and
+both support
+.Dv AF_INET6
+sockets as well as
+.Dv AF_INET
+sockets.
.Sh RETURN VALUES
.Fn bindresvport
returns 0 if it is successful, otherwise \-1 is returned and
@@ -74,7 +95,8 @@ Insufficient resources were available in the system
to perform the operation.
.It Bq Er EPFNOSUPPORT
The protocol family has not been configured into the
-system or no implementation for it exists.
+system, no implementation for it exists,
+or address family did not match between arguments.
.El
.Sh SEE ALSO
.Xr bind 2 ,