basic/random-util: add new header for getrandom()
There's some confusion: older man pages specify that linux/random.h contains getrandom, but newer glibc has it in sys/random.h. Detect if the newer header is available and include it. We still need the older header for the flags.
This commit is contained in:
parent
d1c536f502
commit
5224c2c706
|
@ -328,7 +328,6 @@ AC_CHECK_DECLS([
|
||||||
pivot_root,
|
pivot_root,
|
||||||
name_to_handle_at,
|
name_to_handle_at,
|
||||||
setns,
|
setns,
|
||||||
getrandom,
|
|
||||||
renameat2,
|
renameat2,
|
||||||
kcmp,
|
kcmp,
|
||||||
keyctl,
|
keyctl,
|
||||||
|
@ -343,6 +342,13 @@ AC_CHECK_DECLS([
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <linux/loop.h>
|
#include <linux/loop.h>
|
||||||
|
]])
|
||||||
|
|
||||||
|
AC_CHECK_DECLS([getrandom],
|
||||||
|
[AC_DEFINE([USE_SYS_RANDOM_H], [], [sys/random.h is usable])],
|
||||||
|
[AC_CHECK_DECLS([getrandom], [], [], [[
|
||||||
|
#include <sys/random.h>
|
||||||
|
]])], [[
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,13 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_AUXV_H
|
#ifdef HAVE_SYS_AUXV_H
|
||||||
#include <sys/auxv.h>
|
# include <sys/auxv.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_SYS_RANDOM_H
|
||||||
|
# include <sys/random.h>
|
||||||
|
#else
|
||||||
|
# include <linux/random.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
|
|
Loading…
Reference in a new issue