summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorSami Kerola2016-12-11 12:43:37 +0100
committerSami Kerola2016-12-11 12:46:54 +0100
commitcc01c2dca4f62e36505570d5cb15f868aa44bf54 (patch)
treebe88427c58172fd094fa135852fd3acb236aaf51 /configure.ac
parentMerge branch doc_fixes (diff)
downloadkernel-qcow2-util-linux-cc01c2dca4f62e36505570d5cb15f868aa44bf54.tar.gz
kernel-qcow2-util-linux-cc01c2dca4f62e36505570d5cb15f868aa44bf54.tar.xz
kernel-qcow2-util-linux-cc01c2dca4f62e36505570d5cb15f868aa44bf54.zip
lib/randutils: use getrandom(2) when it is available
System call getrandom(2) is relatively new, available since kernel 3.17 but not supported by glibc 2.24. That in mind autotools is made to check availability of this function and keep old code as fallback. It is reasonable assume it will take years before the syscall(2) and fallback are unproblematic to remove. One might ask why bother using getrandom(2). Main reason is to avoid unnecessary system calls to achieve exactly same end result. That demonstrated with 'strace -c ./mcookie' showing 36 calls before, and 32 after this change. Secondly the getrandom(2) function got to kernel with promise it can be used to avoid file descriptor run down, and since uuidd uses random_get_bytes() it should fulfill it's promise here. Reference: http://man7.org/linux/man-pages/man2/getrandom.2.html Reference: https://lwn.net/Articles/606141/ Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac1
1 files changed, 1 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index e0240b322..d301b3da2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -385,6 +385,7 @@ AC_CHECK_FUNCS([ \
getdtablesize \
getexecname \
getmntinfo \
+ getrandom \
getrlimit \
getsgnam \
inotify_init \