diff options
author | Mark H Weaver <mhw@netris.org> | 2013-02-25 13:38:55 -0500 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2013-02-25 13:53:49 -0500 |
commit | 587f4edd3947880fb0235f84cc18b62f133a9255 (patch) | |
tree | 38b6dc9bf9ab72dccff57b227b7f8f8bfd0e4d47 /libguile/random.c | |
parent | 3ec19a7884ba789a9b4f91f61415aa4b84642690 (diff) | |
download | guile-587f4edd3947880fb0235f84cc18b62f133a9255.tar.gz |
random_state_of_last_resort: use getpid directly, instead of scm_getpid
* libguile/random.c: Include <sys/types.h> and <unistd.h> (if present).
(random_state_of_last_resort): Use getpid directly.
Diffstat (limited to 'libguile/random.c')
-rw-r--r-- | libguile/random.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libguile/random.c b/libguile/random.c index 2db19f729..f97213b86 100644 --- a/libguile/random.c +++ b/libguile/random.c @@ -17,7 +17,7 @@ -/* Author: Mikael Djurfeldt <djurfeldt@nada.kth.se> */ +/* Original Author: Mikael Djurfeldt <djurfeldt@nada.kth.se> */ #ifdef HAVE_CONFIG_H # include <config.h> @@ -29,6 +29,12 @@ #include <stdio.h> #include <math.h> #include <string.h> +#include <sys/types.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #include "libguile/smob.h" #include "libguile/numbers.h" #include "libguile/feature.h" @@ -665,7 +671,8 @@ random_state_of_last_resort (void) SCM time_of_day = scm_gettimeofday (); SCM sources = scm_list_n (scm_from_unsigned_integer (SCM_UNPACK (time_of_day)), /* heap addr */ - scm_getpid (), /* process ID */ + /* Avoid scm_getpid, since it depends on HAVE_POSIX. */ + scm_from_unsigned_integer (getpid ()), /* process ID */ scm_get_internal_real_time (), /* high-resolution process timer */ scm_from_unsigned_integer ((scm_t_bits) &time_of_day), /* stack addr */ scm_car (time_of_day), /* seconds since midnight 1970-01-01 UTC */ |