Skip to content

Commit ffc30c5

Browse files
devnexennikic
authored andcommitted
getrandom support for DragonFlyBSD too.
supported since the 5.7.x release, actually 5.8.x is the stable one.
1 parent 052af90 commit ffc30c5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/standard/random.c

Lines changed: 4 additions & 4 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__)
32+
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
3333
# include <sys/param.h>
34-
# if __FreeBSD__ && __FreeBSD_version > 1200000
34+
# if (__FreeBSD__ && __FreeBSD_version > 1200000) || (__DragonFly__ && __DragonFly_version >= 500700)
3535
# include <sys/random.h>
3636
# endif
3737
#endif
@@ -99,8 +99,8 @@ 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)
103-
/* Linux getrandom(2) syscall or FreeBSD getrandom(2) function*/
102+
#if (defined(__linux__) && defined(SYS_getrandom)) || (defined(__FreeBSD__) && __FreeBSD_version >= 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700)
103+
/* Linux getrandom(2) syscall or FreeBSD/DragonFlyBSD getrandom(2) function*/
104104
/* Keep reading until we get enough entropy */
105105
while (read_bytes < size) {
106106
/* Below, (bytes + read_bytes) is pointer arithmetic.

0 commit comments

Comments
 (0)