search for: gr_flags

Displaying 3 results from an estimated 3 matches for "gr_flags".

Did you mean: g_flags
2016 Jul 29
0
getrandom waits for a long time when /dev/random is insufficiently read from
...ot GRND_NONBLOCK is set). The following revised program demonstrates this: #include <fcntl.h> #include <linux/random.h> #include <stdlib.h> #include <string.h> #include <syscall.h> #include <unistd.h> int main(int argc, char *argv[]) { char buf[1]; int gr_flags; const char *iters; if (!strcmp(argv[1], "-r")) { gr_flags = GRND_RANDOM; iters = argv[2]; } else { gr_flags = 0; iters = argv[1]; } for (int i = 0; i < atoi(iters); i++) { int fd; if ((fd = open("/dev/random&qu...
2016 Jul 29
2
getrandom waits for a long time when /dev/random is insufficiently read from
On Fri, Jul 29, 2016 at 7:40 AM, Stephan Mueller <smueller at chronox.de> wrote: > And finally, you have a coding error that is very very common but fatal when > reading from /dev/random: you do not account for short reads which implies > that your loop continues even in the case of short reads. > > Fix your code with something like the following: > int read_random(char
2016 Jul 29
2
getrandom waits for a long time when /dev/random is insufficiently read from
On Fri, Jul 29, 2016 at 7:40 AM, Stephan Mueller <smueller at chronox.de> wrote: > And finally, you have a coding error that is very very common but fatal when > reading from /dev/random: you do not account for short reads which implies > that your loop continues even in the case of short reads. > > Fix your code with something like the following: > int read_random(char