dte test coverage


Directory: ./
File: src/util/xreadwrite.h
Date: 2024-12-21 16:03:22
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 1 1 100.0%
Branches: 3 4 75.0%

Line Branch Exec Source
1 #ifndef UTIL_XREADWRITE_H
2 #define UTIL_XREADWRITE_H
3
4 #include <errno.h>
5 #include <fcntl.h>
6 #include <sys/types.h>
7 #include "macros.h"
8
9 NONNULL_ARGS WARN_UNUSED_RESULT
10 196 static inline int xopen(const char *path, int flags, mode_t mode)
11 {
12 196 int fd;
13 196 do {
14 196 fd = open(path, flags | O_NOCTTY, mode);
15
3/4
✓ Branch 0 taken 75 times.
✓ Branch 1 taken 121 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 75 times.
196 } while (fd < 0 && errno == EINTR);
16
17 196 return fd;
18 }
19
20 ssize_t xread(int fd, void *buf, size_t count) NONNULL_ARGS WARN_UNUSED_RESULT;
21 ssize_t xwrite(int fd, const void *buf, size_t count) NONNULL_ARGS WARN_UNUSED_RESULT;
22 ssize_t xread_all(int fd, void *buf, size_t count) NONNULL_ARGS WARN_UNUSED_RESULT;
23 ssize_t xwrite_all(int fd, const void *buf, size_t count) WARN_UNUSED_RESULT;
24 int xclose(int fd);
25
26 #endif
27