repo.or.cz
/
linux
/
fpc-iii.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Linux 4.19.133
[linux/fpc-iii.git]
/
tools
/
testing
/
selftests
/
bpf
/
urandom_read.c
blob
9de8b7cb4e6df6b5929c915566dff74163efbcf2
1
#include <stdio.h>
2
#include <unistd.h>
3
#include <sys/types.h>
4
#include <sys/stat.h>
5
#include <fcntl.h>
6
#include <stdlib.h>
7
8
#define BUF_SIZE 256
9
10
int
main
(
int
argc
,
char
*
argv
[])
11
{
12
int
fd
=
open
(
"/dev/urandom"
,
O_RDONLY
);
13
int
i
;
14
char
buf
[
BUF_SIZE
];
15
int
count
=
4
;
16
17
if
(
fd
<
0
)
18
return
1
;
19
20
if
(
argc
==
2
)
21
count
=
atoi
(
argv
[
1
]);
22
23
for
(
i
=
0
;
i
<
count
; ++
i
)
24
read
(
fd
,
buf
,
BUF_SIZE
);
25
26
close
(
fd
);
27
return
0
;
28
}