mirror of
https://github.com/systemd/systemd.git
synced 2025-03-09 12:58:26 +03:00
fd-util: introduce a simple helper to check a file descriptor has O_PATH
This commit is contained in:
parent
ca8b1d68c5
commit
ea61e2e9bd
@ -808,6 +808,18 @@ int fd_reopen_condition(
|
||||
return new_fd;
|
||||
}
|
||||
|
||||
int fd_is_opath(int fd) {
|
||||
int r;
|
||||
|
||||
assert(fd >= 0);
|
||||
|
||||
r = fcntl(fd, F_GETFL);
|
||||
if (r < 0)
|
||||
return -errno;
|
||||
|
||||
return FLAGS_SET(r, O_PATH);
|
||||
}
|
||||
|
||||
int read_nr_open(void) {
|
||||
_cleanup_free_ char *nr_open = NULL;
|
||||
int r;
|
||||
|
@ -104,6 +104,7 @@ static inline int make_null_stdio(void) {
|
||||
|
||||
int fd_reopen(int fd, int flags);
|
||||
int fd_reopen_condition(int fd, int flags, int mask, int *ret_new_fd);
|
||||
int fd_is_opath(int fd);
|
||||
int read_nr_open(void);
|
||||
int fd_get_diskseq(int fd, uint64_t *ret);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user