Don't include <unistd.h> unless HAVE_UNISTD_H. Include <process.h> on

2004-01-23  Tor Lillqvist  <tml@iki.fi>

	* glib/grand.c: Don't include <unistd.h> unless
	HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
	(g_rand_new): Use getppid() only on G_OS_UNIX.
This commit is contained in:
Tor Lillqvist 2004-01-23 02:10:46 +00:00 committed by Tor Lillqvist
parent e009f72e5d
commit 876b7efdbd
7 changed files with 52 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2004-01-23 Tor Lillqvist <tml@iki.fi>
* glib/grand.c: Don't include <unistd.h> unless
HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
(g_rand_new): Use getppid() only on G_OS_UNIX.
Thu Jan 22 15:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.2 ===
@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen <maclas@gmx.de>
* configure.in: Don't blindly set glib_cv_long_long_format to
"ll" when using the included printf. As long as the native
printf supports 64bit printing, use the native format.
(#119525, Tor Lillquist)
(#119525, Tor Lillqvist)
Fri Nov 14 00:28:46 2003 Matthias Clasen <maclas@gmx.de>

View File

@ -1,3 +1,9 @@
2004-01-23 Tor Lillqvist <tml@iki.fi>
* glib/grand.c: Don't include <unistd.h> unless
HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
(g_rand_new): Use getppid() only on G_OS_UNIX.
Thu Jan 22 15:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.2 ===
@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen <maclas@gmx.de>
* configure.in: Don't blindly set glib_cv_long_long_format to
"ll" when using the included printf. As long as the native
printf supports 64bit printing, use the native format.
(#119525, Tor Lillquist)
(#119525, Tor Lillqvist)
Fri Nov 14 00:28:46 2003 Matthias Clasen <maclas@gmx.de>

View File

@ -1,3 +1,9 @@
2004-01-23 Tor Lillqvist <tml@iki.fi>
* glib/grand.c: Don't include <unistd.h> unless
HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
(g_rand_new): Use getppid() only on G_OS_UNIX.
Thu Jan 22 15:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.2 ===
@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen <maclas@gmx.de>
* configure.in: Don't blindly set glib_cv_long_long_format to
"ll" when using the included printf. As long as the native
printf supports 64bit printing, use the native format.
(#119525, Tor Lillquist)
(#119525, Tor Lillqvist)
Fri Nov 14 00:28:46 2003 Matthias Clasen <maclas@gmx.de>

View File

@ -1,3 +1,9 @@
2004-01-23 Tor Lillqvist <tml@iki.fi>
* glib/grand.c: Don't include <unistd.h> unless
HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
(g_rand_new): Use getppid() only on G_OS_UNIX.
Thu Jan 22 15:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.2 ===
@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen <maclas@gmx.de>
* configure.in: Don't blindly set glib_cv_long_long_format to
"ll" when using the included printf. As long as the native
printf supports 64bit printing, use the native format.
(#119525, Tor Lillquist)
(#119525, Tor Lillqvist)
Fri Nov 14 00:28:46 2003 Matthias Clasen <maclas@gmx.de>

View File

@ -1,3 +1,9 @@
2004-01-23 Tor Lillqvist <tml@iki.fi>
* glib/grand.c: Don't include <unistd.h> unless
HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
(g_rand_new): Use getppid() only on G_OS_UNIX.
Thu Jan 22 15:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.2 ===
@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen <maclas@gmx.de>
* configure.in: Don't blindly set glib_cv_long_long_format to
"ll" when using the included printf. As long as the native
printf supports 64bit printing, use the native format.
(#119525, Tor Lillquist)
(#119525, Tor Lillqvist)
Fri Nov 14 00:28:46 2003 Matthias Clasen <maclas@gmx.de>

View File

@ -1,3 +1,9 @@
2004-01-23 Tor Lillqvist <tml@iki.fi>
* glib/grand.c: Don't include <unistd.h> unless
HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
(g_rand_new): Use getppid() only on G_OS_UNIX.
Thu Jan 22 15:16:11 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.2 ===
@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen <maclas@gmx.de>
* configure.in: Don't blindly set glib_cv_long_long_format to
"ll" when using the included printf. As long as the native
printf supports 64bit printing, use the native format.
(#119525, Tor Lillquist)
(#119525, Tor Lillqvist)
Fri Nov 14 00:28:46 2003 Matthias Clasen <maclas@gmx.de>

View File

@ -43,11 +43,17 @@
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "glib.h"
#include "gthreadinit.h"
#ifdef G_OS_WIN32
#include <process.h> /* For getpid() */
#endif
G_LOCK_DEFINE_STATIC (global_random);
static GRand* global_random = NULL;
@ -202,7 +208,11 @@ g_rand_new (void)
seed[0] = now.tv_sec;
seed[1] = now.tv_usec;
seed[2] = getpid ();
#ifdef G_OS_UNIX
seed[3] = getppid ();
#else
seed[3] = 0;
#endif
}
return g_rand_new_with_seed_array (seed, 4);