Coverage Report

Created: 2026-12-01 06:27

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
32
devrandom_t *devrandom_init(void) {
7
32
  devrandom_t *fds = xzalloc(sizeof(*fds));
8
9
32
  fds->urandomfd = linux_open("/dev/urandom", false);
10
32
  if (fds->urandomfd < 0)
11
0
    return ERR_PTR(-EPERM);
12
13
32
  return fds;
14
32
}
15
16
int devrandom_read(devrandom_t *devrandom, void *buf, size_t len, int wait)
17
32
{
18
32
  (void)wait; /* /dev/urandom won't block */
19
20
32
  return linux_read(devrandom->urandomfd, buf, len);
21
32
}