This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] stdlib/stdlib.h: add missing __USE_BSD ifdef


This patch addes missing __USE_BSD in stdlib/stdlib.h.

The section of libc's documentation that covers random() (info libc
mathematics pseudo BSD) states:

	This section describes a set of random number generation
	functions that are derived from BSD.  There is no advantage to
	using these functions with the GNU C library; we support them
	for BSD compatibility only.
	   The prototypes for these functions are in `stdlib.h'.

Similarly, random(3) states "CONFORMING TO BSD 4.3".  So, random(),
srandom(), initstate(), setstate() declaration should be geverned by
__USE_BSD.  But the current prototype for random() is not available if
solely compiling -D_USE_BSD:

	zensunni ray 15:38 ~ > cpp /usr/include/stdlib.h | grep '\<random\>'
	extern long int random (void)  ;                                    
	zensunni ray 15:38 ~ > cpp -D_BSD_SOURCE /usr/include/stdlib.h | grep '\<random\>'

This patch fixes this problem, please apply it.

-- gotom

2003-03-01  GOTO Masanori  <gotom at debian dot or dot jp>

	* stdlib/stdlib.h: Add missing __USE_BSD enclosure for BSD derived
	random functions.

--- stdlib/stdlib.h	2002-08-28 17:01:10.000000000 +0900
+++ stdlib/stdlib.h	2003-01-05 21:09:19.000000000 +0900
@@ -410,7 +410,9 @@
 /* Read a number from a string S in base 64 as above.  */
 extern long int a64l (__const char *__s) __THROW __attribute_pure__;
+#endif	/* Use SVID || extended X/Open.  */
+#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD
 # include <sys/types.h>	/* we need int32_t... */
 /* These are the functions that actually do things.  The `random', `srandom',
@@ -463,7 +465,7 @@
 extern int setstate_r (char *__restrict __statebuf,
 		       struct random_data *__restrict __buf) __THROW;
 # endif	/* Use misc.  */
-#endif	/* Use SVID || extended X/Open.  */
+#endif	/* Use SVID || extended X/Open || BSD. */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]