Skip to content

Commit 59255bf

Browse files
authored
Enable getrandom() api on solaris-ish systems (#7417)
Been available long enough to be trustable source.
1 parent 634f2e2 commit 59255bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/standard/random.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
#ifdef __linux__
3030
# include <sys/syscall.h>
3131
#endif
32-
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
32+
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__sun)
3333
# include <sys/param.h>
34-
# if (__FreeBSD__ && __FreeBSD_version > 1200000) || (__DragonFly__ && __DragonFly_version >= 500700)
34+
# if (__FreeBSD__ && __FreeBSD_version > 1200000) || (__DragonFly__ && __DragonFly_version >= 500700) || defined(__sun)
3535
# include <sys/random.h>
3636
# endif
3737
#endif
@@ -99,7 +99,7 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, bool should_throw)
9999
#else
100100
size_t read_bytes = 0;
101101
ssize_t n;
102-
#if (defined(__linux__) && defined(SYS_getrandom)) || (defined(__FreeBSD__) && __FreeBSD_version >= 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700)
102+
#if (defined(__linux__) && defined(SYS_getrandom)) || (defined(__FreeBSD__) && __FreeBSD_version >= 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700) || defined(__sun)
103103
/* Linux getrandom(2) syscall or FreeBSD/DragonFlyBSD getrandom(2) function*/
104104
/* Keep reading until we get enough entropy */
105105
while (read_bytes < size) {

0 commit comments

Comments
 (0)