From cc01c2dca4f62e36505570d5cb15f868aa44bf54 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 11 Dec 2016 11:43:37 +0000 Subject: 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 Signed-off-by: Sami Kerola --- configure.ac | 1 + 1 file changed, 1 insertion(+) (limited to 'configure.ac') 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 \ -- cgit v1.2.3-55-g7522