Commit 9f53057b authored by Gleb Popov's avatar Gleb Popov Committed by Wim Taymans
Browse files

Add userspace implementation of getrandom() for FreeBSD 11

parent 087811e1
......@@ -29,6 +29,24 @@
#endif
#include <sys/random.h>
#ifdef __FreeBSD__
#include <sys/param.h>
#include <fcntl.h>
// FreeBSD versions < 12 do not have getrandom() syscall
// Give a poor-man implementation here
// Can be removed after September 30, 2021
#if __FreeBSD_version < 1200000
ssize_t getrandom(void *buf, size_t buflen, unsigned int flags) {
int fd = open("/dev/random", O_CLOEXEC);
if (fd < 0)
return -1;
ssize_t bytes = read(fd, buf, buflen);
close(fd);
return bytes;
}
#endif
#endif
#include <spa/debug/types.h>
#include "pipewire/impl.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment