Coverage Report

Created: 2026-10-13 06:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/barebox/arch/sandbox/board/dev-random.c
Line
Count
Source
1
// SPDX-License-Identifier: GPL-2.0-only
2
3
#include <common.h>
4
#include <mach/linux.h>
5
6
26
devrandom_t *devrandom_init(void) {
7
26
  devrandom_t *fds = xzalloc(sizeof(*fds));
8
9
26
  fds->urandomfd = linux_open("/dev/urandom", false);
10
26
  if (fds->urandomfd < 0)
11
0
    return ERR_PTR(-EPERM);
12
13
26
  return fds;
14
26
}
15
16
int devrandom_read(devrandom_t *devrandom, void *buf, size_t len, int wait)
17
26
{
18
26
  (void)wait; /* /dev/urandom won't block */
19
20
26
  return linux_read(devrandom->urandomfd, buf, len);
21
26
}