Lines Matching defs:fd
27 #include "fd-util.h"
30 int chattr_fd(int fd, unsigned value, unsigned mask) {
34 assert(fd >= 0);
36 if (fstat(fd, &st) < 0)
51 if (ioctl(fd, FS_IOC_GETFLAGS, &old_attr) < 0)
58 if (ioctl(fd, FS_IOC_SETFLAGS, &new_attr) < 0)
65 _cleanup_close_ int fd = -1;
72 fd = open(p, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
73 if (fd < 0)
76 return chattr_fd(fd, value, mask);
79 int read_attr_fd(int fd, unsigned *ret) {
82 assert(fd >= 0);
84 if (fstat(fd, &st) < 0)
90 if (ioctl(fd, FS_IOC_GETFLAGS, ret) < 0)
97 _cleanup_close_ int fd = -1;
102 fd = open(p, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
103 if (fd < 0)
106 return read_attr_fd(fd, ret);