summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/rand.3
diff options
context:
space:
mode:
authord <>1998-11-20 11:18:51 +0000
committerd <>1998-11-20 11:18:51 +0000
commitc1f295aa8666eb1c08a1edf944ac5617659a066c (patch)
treeefe0a5dfb4f9767f96ab03ce9c00dc5bcc98074c /src/lib/libc/stdlib/rand.3
parent5a11336d3f08469f2747ebcf26ae777dba46fd22 (diff)
downloadopenbsd-c1f295aa8666eb1c08a1edf944ac5617659a066c.tar.gz
openbsd-c1f295aa8666eb1c08a1edf944ac5617659a066c.tar.bz2
openbsd-c1f295aa8666eb1c08a1edf944ac5617659a066c.zip
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 'src/lib/libc/stdlib/rand.3')
-rw-r--r--src/lib/libc/stdlib/rand.319
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/libc/stdlib/rand.3 b/src/lib/libc/stdlib/rand.3
index 32d32761f1..28496ec12a 100644
--- a/src/lib/libc/stdlib/rand.3
+++ b/src/lib/libc/stdlib/rand.3
@@ -33,7 +33,7 @@
33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34.\" SUCH DAMAGE. 34.\" SUCH DAMAGE.
35.\" 35.\"
36.\" $OpenBSD: rand.3,v 1.4 1998/07/05 19:54:22 millert Exp $ 36.\" $OpenBSD: rand.3,v 1.5 1998/11/20 11:18:50 d Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt RAND 3 39.Dt RAND 3
@@ -48,6 +48,8 @@
48.Fn srand "unsigned seed" 48.Fn srand "unsigned seed"
49.Ft int 49.Ft int
50.Fn rand void 50.Fn rand void
51.Ft int
52.Fn rand_r "unsigned int *seed"
51.Sh DESCRIPTION 53.Sh DESCRIPTION
52.Bf -symbolic 54.Bf -symbolic
53These interfaces are obsoleted by 55These interfaces are obsoleted by
@@ -73,6 +75,14 @@ with the same seed value.
73.Pp 75.Pp
74If no seed value is provided, the functions are automatically 76If no seed value is provided, the functions are automatically
75seeded with a value of 1. 77seeded with a value of 1.
78.Pp
79The
80.Fn rand_r
81is a thread-safe version of
82.Fn rand .
83Storage for the seed must be provided through the
84.Ar seed
85argument, and needs to have been initialized by the caller.
76.Sh SEE ALSO 86.Sh SEE ALSO
77.Xr arc4random 3 , 87.Xr arc4random 3 ,
78.Xr rand48 3 , 88.Xr rand48 3 ,
@@ -85,3 +95,10 @@ and
85functions 95functions
86conform to 96conform to
87.St -ansiC . 97.St -ansiC .
98.Pp
99The
100.Fn rand_r
101function
102conforms to ISO/IEC 9945-1 ANSI/IEEE
103.Pq Dq Tn POSIX
104Std 1003.1c Draft 10.