dte test coverage


Directory: ./
File: src/util/xreadwrite.h
Date: 2025-02-14 16:55: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 283 static inline int xopen(const char *path, int flags, mode_t mode)
11 {
12 283 int fd;
13 283 do {
14 283 fd = open(path, flags | O_NOCTTY, mode);
15
3/4
✓ Branch 0 (4→5) taken 82 times.
✓ Branch 1 (4→6) taken 201 times.
✗ Branch 2 (5→3) not taken.
✓ Branch 3 (5→6) taken 82 times.
283 } while (fd < 0 && errno == EINTR);
16
17 283 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