summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/rand.3
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1998-11-20 11:19:02 +0000
committerDavid Leonard <d@cvs.openbsd.org>1998-11-20 11:19:02 +0000
commitf547068f88348f54941dc06da46491f99701933e (patch)
tree8548a6b78719cba1de575b7f49e5f8ac4e6f1683 /lib/libc/stdlib/rand.3
parent394c7a9821726b84f284c0c4385b1a9198afa0b0 (diff)
Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10) (more md stuff is needed for other libc/arch/*) (setlogin is no longer a special syscall) Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS). Doc some re-entrant routines Add libc_r to intro(3) dig() uses some libc srcs and an extra -I was needed there. Add more md stuff to libc_r. Update includes for the pthreads api Update libc_r TODO
Diffstat (limited to 'lib/libc/stdlib/rand.3')
-rw-r--r--lib/libc/stdlib/rand.319
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/libc/stdlib/rand.3 b/lib/libc/stdlib/rand.3
index 32d32761f19..28496ec12aa 100644
--- a/lib/libc/stdlib/rand.3
+++ b/lib/libc/stdlib/rand.3
@@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: rand.3,v 1.4 1998/07/05 19:54:22 millert Exp $
+.\" $OpenBSD: rand.3,v 1.5 1998/11/20 11:18:50 d Exp $
.\"
.Dd June 29, 1991
.Dt RAND 3
@@ -48,6 +48,8 @@
.Fn srand "unsigned seed"
.Ft int
.Fn rand void
+.Ft int
+.Fn rand_r "unsigned int *seed"
.Sh DESCRIPTION
.Bf -symbolic
These interfaces are obsoleted by
@@ -73,6 +75,14 @@ with the same seed value.
.Pp
If no seed value is provided, the functions are automatically
seeded with a value of 1.
+.Pp
+The
+.Fn rand_r
+is a thread-safe version of
+.Fn rand .
+Storage for the seed must be provided through the
+.Ar seed
+argument, and needs to have been initialized by the caller.
.Sh SEE ALSO
.Xr arc4random 3 ,
.Xr rand48 3 ,
@@ -85,3 +95,10 @@ and
functions
conform to
.St -ansiC .
+.Pp
+The
+.Fn rand_r
+function
+conforms to ISO/IEC 9945-1 ANSI/IEEE
+.Pq Dq Tn POSIX
+Std 1003.1c Draft 10.