Searched defs:fd (Results 1 - 25 of 221) sorted by relevance

123456789

/systemd/src/basic/
H A Dlockfile-util.h29 int fd; member in struct:LockFile
39 #define LOCK_FILE_INIT { .fd = -1, .path = NULL }
H A Drandom-util.c33 #include "fd-util.h"
42 _cleanup_close_ int fd = -1; local
81 fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC|O_NOCTTY);
82 if (fd < 0)
85 return loop_read_exact(fd, p, n, true);
H A Drm-rf.c30 #include "fd-util.h"
39 int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev) { argument
43 assert(fd >= 0);
46 * tries to go on. This closes the passed fd. */
50 r = fd_is_temporary_fs(fd);
52 safe_close(fd);
64 safe_close(fd);
69 d = fdopendir(fd);
71 safe_close(fd);
93 if (fstatat(fd, d
178 int fd, r; local
[all...]
H A Dasync.c26 #include "fd-util.h"
76 int asynchronous_close(int fd) { argument
85 if (fd >= 0) {
88 r = asynchronous_job(close_thread, FD_TO_PTR(fd));
90 assert_se(close_nointr(fd) != -EBADF);
H A Daudit-util.c27 #include "fd-util.h"
92 int fd; local
94 fd = socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_AUDIT);
95 if (fd < 0)
99 safe_close(fd);
H A Dchattr-util.c27 #include "fd-util.h"
30 int chattr_fd(int fd, unsigned value, unsigned mask) { argument
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; local
72 fd = open(p, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
73 if (fd < 0)
76 return chattr_fd(fd, valu
79 read_attr_fd(int fd, unsigned *ret) argument
97 _cleanup_close_ int fd = -1; local
[all...]
H A Dfd-util.h29 /* Make sure we can distinguish fd 0 and NULL */
30 #define FD_TO_PTR(fd) INT_TO_PTR((fd)+1)
33 int close_nointr(int fd);
34 int safe_close(int fd);
43 static inline void closep(int *fd) { argument
44 safe_close(*fd);
64 int fd_nonblock(int fd, bool nonblock);
65 int fd_cloexec(int fd, bool cloexec);
H A Dlockfile-util.c28 #include "fd-util.h"
35 _cleanup_close_ int fd = -1; local
61 fd = open(p, O_CREAT|O_RDWR|O_NOFOLLOW|O_CLOEXEC|O_NOCTTY, 0600);
62 if (fd < 0)
65 r = fcntl(fd, (operation & LOCK_NB) ? F_OFD_SETLK : F_OFD_SETLKW, &fl);
70 r = flock(fd, operation);
82 r = fstat(fd, &st);
88 fd = safe_close(fd);
92 ret->fd
[all...]
/systemd/src/test/
H A Dtest-sigbus.c22 #include "fd-util.h"
27 _cleanup_close_ int fd = -1; local
36 assert_se((fd = mkostemp(template, O_RDWR|O_CREAT|O_EXCL)) >= 0);
38 assert_se(fallocate(fd, 0, 0, page_size() * 8) >= 0);
40 p = mmap(NULL, page_size() * 16, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
H A Dtest-acl-util.c26 #include "fd-util.h"
33 _cleanup_close_ int fd = -1; local
38 fd = mkostemp_safe(fn, O_RDWR|O_CLOEXEC);
39 assert_se(fd >= 0);
42 assert_se(fchmod(fd, 0640) == 0);
58 r = add_acls_for_user(fd, uid);
69 r = add_acls_for_user(fd, uid);
H A Dtest-async.c36 int fd; local
39 fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
40 assert_se(fd >= 0);
41 asynchronous_close(fd);
49 assert_se(fcntl(fd, F_GETFD) == -1);
H A Dtest-btrfs.c23 #include "fd-util.h"
32 int r, fd; local
34 fd = open("/", O_RDONLY|O_CLOEXEC|O_DIRECTORY);
35 if (fd < 0)
41 r = btrfs_subvol_get_info_fd(fd, 0, &info);
49 r = btrfs_qgroup_get_quota_fd(fd, 0, &quota);
59 r = btrfs_subvol_get_read_only_fd(fd);
65 safe_close(fd);
H A Dtest-hostname-util.c104 int fd; local
106 fd = mkostemp_safe(path, O_RDWR|O_CLOEXEC);
107 assert(fd > 0);
108 close(fd);
H A Dtest-terminal-util.c24 #include "fd-util.h"
51 int fd; local
53 fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
54 assert_se(fd >= 0);
55 file = fdopen(fd, "r+");
H A Dtest-tmpfiles.c26 #include "fd-util.h"
37 _cleanup_close_ int fd, fd2; local
43 fd = open_tmpfile(p, O_RDWR|O_CLOEXEC);
44 assert_se(fd >= 0);
46 assert_se(asprintf(&cmd, "ls -l /proc/"PID_FMT"/fd/%d", getpid(), fd) > 0);
53 assert_se(fd >= 0);
56 assert_se(asprintf(&cmd2, "ls -l /proc/"PID_FMT"/fd/%d", getpid(), fd2) > 0);
/systemd/src/login/
H A Dlogind-button.h34 int fd; member in struct:Button
H A Dlogind-session-device.h40 int fd; member in struct:SessionDevice
/systemd/src/udev/
H A Dudev-builtin-btrfs.c28 #include "fd-util.h"
35 _cleanup_close_ int fd = -1; local
41 fd = open("/dev/btrfs-control", O_RDWR|O_CLOEXEC);
42 if (fd < 0)
46 err = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args);
/systemd/src/udev/v4l_id/
H A Dv4l_id.c29 #include "fd-util.h"
37 _cleanup_close_ int fd = -1; local
62 fd = open(device, O_RDONLY);
63 if (fd < 0)
66 if (ioctl(fd, VIDIOC_QUERYCAP, &v2cap) == 0) {
/systemd/src/import/
H A Dimport-common.c27 #include "fd-util.h"
32 int import_make_read_only_fd(int fd) { argument
35 assert(fd >= 0);
39 r = btrfs_subvol_set_read_only_fd(fd, true);
47 r = fstat(fd, &st);
52 if (fchmod(fd, st.st_mode & 07555) < 0)
64 _cleanup_close_ int fd = 1; local
66 fd = open(path, O_RDONLY|O_NOCTTY|O_CLOEXEC);
67 if (fd < 0)
70 return import_make_read_only_fd(fd);
[all...]
/systemd/src/journal/
H A Dcat.c29 #include "fd-util.h"
119 _cleanup_close_ int fd = -1, saved_stderr = -1; local
129 fd = sd_journal_stream_fd(arg_identifier, arg_priority, arg_level_prefix);
130 if (fd < 0) {
131 r = log_error_errno(fd, "Failed to create stream fd: %m");
137 if (dup3(fd, STDOUT_FILENO, 0) < 0 ||
138 dup3(fd, STDERR_FILENO, 0) < 0) {
139 r = log_error_errno(errno, "Failed to duplicate fd: %m");
143 if (fd >
[all...]
/systemd/src/libsystemd/sd-bus/
H A Dbus-kernel.h58 int fd; member in struct:memfd_cache
76 void bus_kernel_push_memfd(sd_bus *bus, int fd, void *address, size_t mapped, size_t allocated);
87 int bus_kernel_drop_one(int fd);
/systemd/src/reply-password/
H A Dreply-password.c26 #include "fd-util.h"
32 static int send_on_socket(int fd, const char *socket_name, const void *packet, size_t size) { argument
40 assert(fd >= 0);
46 if (sendto(fd, packet, size, MSG_NOSIGNAL, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(socket_name)) < 0)
53 _cleanup_close_ int fd = -1; local
86 fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
87 if (fd < 0) {
92 r = send_on_socket(fd, argv[2], packet, length);
/systemd/src/timesync/
H A Dtimesyncd.c25 #include "fd-util.h"
34 _cleanup_close_ int fd = -1; local
46 fd = open("/var/lib/systemd/clock", O_RDWR|O_CLOEXEC, 0644);
47 if (fd >= 0) {
52 r = fstat(fd, &st);
61 (void) fchmod(fd, 0644);
62 (void) fchown(fd, uid, gid);
/systemd/src/update-done/
H A Dupdate-done.c20 #include "fd-util.h"
62 _cleanup_close_ int fd = -1; local
71 fd = open(path, O_CREAT|O_EXCL|O_WRONLY|O_TRUNC|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644);
74 if (fd < 0) {
81 (void) loop_write(fd, MESSAGE, strlen(MESSAGE), false);
83 if (futimens(fd, twice) < 0)

Completed in 86 milliseconds

123456789