/systemd-251/src/test/ |
D | test-chown-rec.c | 45 struct stat st; in TEST() local 55 assert_se(lstat(p, &st) >= 0); in TEST() 56 assert_se(S_ISDIR(st.st_mode)); in TEST() 57 assert_se((st.st_mode & 07777) == 0755); in TEST() 58 assert_se(st.st_uid == uid); in TEST() 59 assert_se(st.st_gid == gid); in TEST() 64 assert_se(lstat(p, &st) >= 0); in TEST() 65 assert_se(S_ISLNK(st.st_mode)); in TEST() 66 assert_se((st.st_mode & 07777) == 0777); in TEST() 67 assert_se(st.st_uid == uid); in TEST() [all …]
|
D | test-dev-setup.c | 14 struct stat st; in main() local 27 assert_se(stat(f, &st) >= 0); in main() 28 assert_se(S_ISREG(st.st_mode)); in main() 29 assert_se((st.st_mode & 07777) == 0000); in main() 32 assert_se(stat(f, &st) >= 0); in main() 33 assert_se(S_ISDIR(st.st_mode)); in main() 34 assert_se((st.st_mode & 07777) == 0000); in main() 37 assert_se(stat(f, &st) >= 0); in main() 38 assert_se(S_ISFIFO(st.st_mode)); in main() 39 assert_se((st.st_mode & 07777) == 0000); in main() [all …]
|
D | test-fs-util.c | 35 struct stat st; in TEST() local 319 assert_se(fstat(pfd, &st) >= 0); in TEST() 320 assert_se(S_ISLNK(st.st_mode)); in TEST() 333 assert_se(fstat(pfd, &st) >= 0); in TEST() 334 assert_se(S_ISLNK(st.st_mode)); in TEST() 553 struct stat st; in TEST() local 574 assert_se(lstat(a, &st) >= 0); in TEST() 575 assert_se(st.st_uid == test_uid); in TEST() 576 assert_se(st.st_gid == test_gid); in TEST() 577 assert_se(S_ISREG(st.st_mode)); in TEST() [all …]
|
D | test-mount-util.c | 217 struct stat st; in TEST() local 233 assert_se(stat(dst_dir, &st) == 0); in TEST() 234 assert_se(S_ISDIR(st.st_mode)); in TEST() 235 assert_se(stat(dst_file, &st) == 0); in TEST() 236 assert_se(S_ISREG(st.st_mode)); in TEST() 237 assert_se(!(S_IXUSR & st.st_mode)); in TEST() 238 assert_se(!(S_IXGRP & st.st_mode)); in TEST() 239 assert_se(!(S_IXOTH & st.st_mode)); in TEST() 244 assert_se(stat(src_file, &st) == 0); in TEST() 245 assert_se(make_mount_point_inode_from_stat(&st, dst_file, 0755) >= 0); in TEST() [all …]
|
D | test-devnum-util.c | 64 struct stat st; in test_device_path_make_canonical_one() local 71 if (stat(path, &st) < 0) { in test_device_path_make_canonical_one() 77 r = device_path_make_canonical(st.st_mode, st.st_rdev, &resolved); in test_device_path_make_canonical_one() 88 assert_se(device_path_make_major_minor(st.st_mode, st.st_rdev, &raw) >= 0); in test_device_path_make_canonical_one() 91 assert_se(st.st_rdev == devno); in test_device_path_make_canonical_one() 92 assert_se((st.st_mode & S_IFMT) == (mode & S_IFMT)); in test_device_path_make_canonical_one()
|
/systemd-251/src/basic/ |
D | stat-util.c | 39 struct stat st; in is_dir() local 45 r = stat(path, &st); in is_dir() 47 r = lstat(path, &st); in is_dir() 51 return !!S_ISDIR(st.st_mode); in is_dir() 55 struct stat st; in is_dir_fd() local 57 if (fstat(fd, &st) < 0) in is_dir_fd() 60 return !!S_ISDIR(st.st_mode); in is_dir_fd() 127 bool null_or_empty(struct stat *st) { in null_or_empty() argument 128 assert(st); in null_or_empty() 130 if (S_ISREG(st->st_mode) && st->st_size <= 0) in null_or_empty() [all …]
|
D | fs-util.c | 213 struct stat st; in fchmod_and_chown_with_fallback() local 228 if (fstat(fd, &st) < 0) in fchmod_and_chown_with_fallback() 232 (uid != UID_INVALID && st.st_uid != uid) || in fchmod_and_chown_with_fallback() 233 (gid != GID_INVALID && st.st_gid != gid); in fchmod_and_chown_with_fallback() 236 !S_ISLNK(st.st_mode) && /* chmod is not defined on symlinks */ in fchmod_and_chown_with_fallback() 237 ((mode != MODE_INVALID && ((st.st_mode ^ mode) & 07777) != 0) || in fchmod_and_chown_with_fallback() 242 …mode = st.st_mode; /* If we only shall do a chown(), save original mode, since chown() might break… in fchmod_and_chown_with_fallback() 243 else if ((mode & S_IFMT) != 0 && ((mode ^ st.st_mode) & S_IFMT) != 0) in fchmod_and_chown_with_fallback() 247 mode_t minimal = st.st_mode & mode; /* the subset of the old and the new mask */ in fchmod_and_chown_with_fallback() 249 if (((minimal ^ st.st_mode) & 07777) != 0) { in fchmod_and_chown_with_fallback() [all …]
|
D | chase-symlinks.c | 29 struct stat st; in log_unsafe_transition() local 37 if (fstat(a, &st) == 0) in log_unsafe_transition() 38 user_a = uid_to_name(st.st_uid); in log_unsafe_transition() 39 if (fstat(b, &st) == 0) in log_unsafe_transition() 40 user_b = uid_to_name(st.st_uid); in log_unsafe_transition() 212 struct stat st; in chase_symlinks() local 259 if (fstat(fd_parent, &st) < 0) in chase_symlinks() 262 if (unsafe_transition(&previous_stat, &st)) in chase_symlinks() 265 previous_stat = st; in chase_symlinks() 294 if (fstat(child, &st) < 0) in chase_symlinks() [all …]
|
D | chattr-util.c | 26 struct stat st; in chattr_full() local 36 if (fstat(fd, &st) < 0) in chattr_full() 44 if (!S_ISDIR(st.st_mode) && !S_ISREG(st.st_mode)) in chattr_full() 138 struct stat st; in read_attr_fd() local 142 if (fstat(fd, &st) < 0) in read_attr_fd() 145 if (!S_ISDIR(st.st_mode) && !S_ISREG(st.st_mode)) in read_attr_fd()
|
D | mkdir.c | 26 struct stat st; in mkdir_safe_internal() local 39 if (lstat(path, &st) < 0) in mkdir_safe_internal() 42 if ((flags & MKDIR_FOLLOW_SYMLINK) && S_ISLNK(st.st_mode)) { in mkdir_safe_internal() 45 r = chase_symlinks_and_stat(path, NULL, 0, &p, &st, NULL); in mkdir_safe_internal() 57 if (!S_ISDIR(st.st_mode)) in mkdir_safe_internal() 61 if ((st.st_mode & ~mode & 0777) != 0) in mkdir_safe_internal() 64 path, st.st_mode & 0777, mode); in mkdir_safe_internal() 66 if ((uid != UID_INVALID && st.st_uid != uid) || in mkdir_safe_internal() 67 (gid != GID_INVALID && st.st_gid != gid)) { in mkdir_safe_internal() 76 path, st.st_uid, st.st_gid, u, g); in mkdir_safe_internal()
|
D | locale-util.c | 100 struct stat st; in add_locales_from_archive() local 107 if (fstat(fd, &st) < 0) in add_locales_from_archive() 110 if (!S_ISREG(st.st_mode)) in add_locales_from_archive() 113 if (st.st_size < (off_t) sizeof(struct locarhead)) in add_locales_from_archive() 116 if (file_offset_beyond_memory_size(st.st_size)) in add_locales_from_archive() 119 p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); in add_locales_from_archive() 125 h->namehash_offset + h->namehash_size > st.st_size || in add_locales_from_archive() 126 h->string_offset + h->string_size > st.st_size || in add_locales_from_archive() 127 h->locrectab_offset + h->locrectab_size > st.st_size || in add_locales_from_archive() 128 h->sumhash_offset + h->sumhash_size > st.st_size) { in add_locales_from_archive()
|
/systemd-251/src/shared/ |
D | copy.c | 75 struct stat st; in fd_is_nonblock_pipe() local 80 if (fstat(fd, &st) < 0) in fd_is_nonblock_pipe() 83 if (!S_ISFIFO(st.st_mode)) in fd_is_nonblock_pipe() 466 const struct stat *st, in fd_copy_symlink() argument 477 assert(st); in fd_copy_symlink() 496 uid_is_valid(override_uid) ? override_uid : st->st_uid, in fd_copy_symlink() 497 gid_is_valid(override_gid) ? override_gid : st->st_gid, in fd_copy_symlink() 501 … (void) utimensat(dt, to, (struct timespec[]) { st->st_atim, st->st_mtim }, AT_SYMLINK_NOFOLLOW); in fd_copy_symlink() 618 const struct stat *st, in try_hardlink() argument 624 assert(st); in try_hardlink() [all …]
|
D | chown-recursive.c | 19 const struct stat *st, in chown_one() argument 27 assert(st); in chown_one() 38 r = fchmod_and_chown(fd, st->st_mode & mask, uid, gid); in chown_one() 47 const struct stat *st, in chown_recursive_internal() argument 57 assert(st); in chown_recursive_internal() 103 r = chown_one(dirfd(d), st, uid, gid, mask); in chown_recursive_internal() 117 struct stat st; in path_chown_recursive() local 126 if (fstat(fd, &st) < 0) in path_chown_recursive() 131 if ((!uid_is_valid(uid) || st.st_uid == uid) && in path_chown_recursive() 132 (!gid_is_valid(gid) || st.st_gid == gid) && in path_chown_recursive() [all …]
|
D | discover-image.c | 210 const struct stat *st, in image_make() argument 228 if (!st) { in image_make() 232 st = &stbuf; in image_make() 246 if (S_ISDIR(st->st_mode)) { in image_make() 266 if (btrfs_might_be_subvol(st)) { in image_make() 329 } else if (S_ISREG(st->st_mode) && endswith(filename, ".raw")) { in image_make() 351 !(st->st_mode & 0222) || read_only, in image_make() 353 timespec_load(&st->st_mtim), in image_make() 358 (*ret)->usage = (*ret)->usage_exclusive = st->st_blocks * 512; in image_make() 359 (*ret)->limit = (*ret)->limit_exclusive = st->st_size; in image_make() [all …]
|
D | data-fd-util.c | 165 struct stat st; in copy_data_fd() local 174 if (fstat(fd, &st) < 0) in copy_data_fd() 178 if (S_ISDIR(st.st_mode)) in copy_data_fd() 180 if (S_ISLNK(st.st_mode)) in copy_data_fd() 182 …if (!S_ISREG(st.st_mode) && !S_ISSOCK(st.st_mode) && !S_ISFIFO(st.st_mode) && !S_ISCHR(st.st_mode)) in copy_data_fd() 189 if (!S_ISREG(st.st_mode) || st.st_size < DATA_FD_MEMORY_LIMIT) { in copy_data_fd() 262 if ((!S_ISREG(st.st_mode) || st.st_size < DATA_FD_TMP_LIMIT) && in copy_data_fd()
|
D | install-file.c | 16 struct stat st; in fs_make_very_read_only() local 37 if (fstat(fd, &st) < 0) in fs_make_very_read_only() 40 switch (st.st_mode & S_IFMT) { in fs_make_very_read_only() 43 if (btrfs_might_be_subvol(&st)) { in fs_make_very_read_only() 59 if ((st.st_mode & 0222) != 0) in fs_make_very_read_only() 60 if (fchmod(fd, st.st_mode & 07555) < 0) in fs_make_very_read_only() 122 struct stat st; in install_file() local 130 if (fstat(pfd, &st) < 0) in install_file() 133 switch (st.st_mode & S_IFMT) { in install_file()
|
D | loop-util.c | 407 struct stat st; in loop_device_make_internal() local 413 if (fstat(fd, &st) < 0) in loop_device_make_internal() 416 if (S_ISBLK(st.st_mode)) { in loop_device_make_internal() 457 .devno = st.st_rdev, in loop_device_make_internal() 467 r = stat_verify_regular(&st); in loop_device_make_internal() 598 if (fstat(loop_with_fd, &st) < 0) in loop_device_make_internal() 600 assert(S_ISBLK(st.st_mode)); in loop_device_make_internal() 614 .devno = st.st_rdev, in loop_device_make_internal() 775 struct stat st; in loop_device_open() local 787 if (fstat(loop_fd, &st) < 0) in loop_device_open() [all …]
|
D | rm-rf.c | 33 struct stat st; in patch_dirfd_mode() local 38 if (fstat(dfd, &st) < 0) in patch_dirfd_mode() 40 if (!S_ISDIR(st.st_mode)) in patch_dirfd_mode() 42 if (FLAGS_SET(st.st_mode, 0700)) /* Already set? */ in patch_dirfd_mode() 44 if (st.st_uid != geteuid()) /* this only works if the UID matches ours */ in patch_dirfd_mode() 47 if (fchmod(dfd, (st.st_mode | 0700) & 07777) < 0) in patch_dirfd_mode() 50 *ret_old_mode = st.st_mode; in patch_dirfd_mode() 126 struct stat st; in rm_rf_inner_child() local 136 r = fstatat_harder(fd, fname, &st, AT_SYMLINK_NOFOLLOW, flags); in rm_rf_inner_child() 140 is_dir = S_ISDIR(st.st_mode); in rm_rf_inner_child() [all …]
|
/systemd-251/src/nspawn/ |
D | nspawn-patch-uid.c | 153 static int patch_acls(int fd, const char *name, const struct stat *st, uid_t shift) { in patch_acls() argument 159 assert(st); in patch_acls() 162 if (S_ISLNK(st->st_mode)) in patch_acls() 182 if (S_ISDIR(st->st_mode)) { in patch_acls() 209 static int patch_acls(int fd, const char *name, const struct stat *st, uid_t shift) { in patch_acls() argument 215 static int patch_fd(int fd, const char *name, const struct stat *st, uid_t shift) { in patch_fd() argument 222 assert(st); in patch_fd() 224 new_uid = shift | (st->st_uid & UINT32_C(0xFFFF)); in patch_fd() 225 new_gid = (gid_t) shift | (st->st_gid & UINT32_C(0xFFFF)); in patch_fd() 230 if (st->st_uid != new_uid || st->st_gid != new_gid) { in patch_fd() [all …]
|
/systemd-251/src/resolve/ |
D | resolved-resolv-conf.c | 25 struct stat st, own; in manager_check_resolv_conf() local 35 if (stat("/etc/resolv.conf", &st) < 0) { in manager_check_resolv_conf() 44 stat_inode_same(&st, &own)) in manager_check_resolv_conf() 52 static bool file_is_our_own(const struct stat *st) { in file_is_our_own() argument 53 assert(st); in file_is_our_own() 64 stat_inode_same(st, &own)) in file_is_our_own() 73 struct stat st; in manager_read_resolv_conf() local 85 r = stat("/etc/resolv.conf", &st); in manager_read_resolv_conf() 95 if (stat_inode_unmodified(&st, &m->resolv_conf_stat)) in manager_read_resolv_conf() 98 if (file_is_our_own(&st)) in manager_read_resolv_conf() [all …]
|
/systemd-251/src/libsystemd/sd-journal/ |
D | journal-vacuum.c | 53 const struct stat *st, in patch_realtime() argument 63 assert(st); in patch_realtime() 66 x = timespec_load(&st->st_ctim); in patch_realtime() 70 x = timespec_load(&st->st_atim); in patch_realtime() 74 x = timespec_load(&st->st_mtim); in patch_realtime() 88 struct stat st; in journal_file_empty() local 100 if (fstat(fd, &st) < 0) in journal_file_empty() 104 if (st.st_size < (off_t) sizeof(Header)) in journal_file_empty() 150 struct stat st; in journal_directory_vacuum() local 153 if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0) { in journal_directory_vacuum() [all …]
|
/systemd-251/src/hibernate-resume/ |
D | hibernate-resume.c | 14 struct stat st; in main() local 33 if (stat(device, &st) < 0) { in main() 38 if (!S_ISBLK(st.st_mode)) { in main() 43 …r = write_string_file("/sys/power/resume", FORMAT_DEVNUM(st.st_rdev), WRITE_STRING_FILE_DISABLE_BU… in main() 45 …"Failed to write '" DEVNUM_FORMAT_STR "' to /sys/power/resume: %m", DEVNUM_FORMAT_VAL(st.st_rdev)); in main() 56 …info("Could not resume from '%s' (" DEVNUM_FORMAT_STR ").", device, DEVNUM_FORMAT_VAL(st.st_rdev)); in main()
|
/systemd-251/test/fuzz/fuzz-udev-rules/ |
D | 60-persistent-storage-tape.rules | 22 KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID… 23 KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" 24 KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", E… 25 KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --whitelisted --export… 26 KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" 27 KERNEL=="st*[0-9]", ENV{ID_SCSI_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SCSI_SERI… 32 KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{builtin}="path_id" 33 KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}"
|
/systemd-251/src/udev/ |
D | udevadm-lock.c | 149 struct stat st; in find_devno() local 161 if (fstat(fd, &st) < 0) in find_devno() 164 if (S_ISBLK(st.st_mode)) in find_devno() 165 devt = st.st_rdev; in find_devno() 168 else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) in find_devno() 170 else if (major(st.st_dev) != 0) in find_devno() 171 devt = st.st_dev; in find_devno() 214 struct stat st; in lock_device() local 221 if (fstat(fd, &st) < 0) in lock_device() 225 if (!S_ISBLK(st.st_mode) || st.st_rdev != devno) in lock_device()
|
/systemd-251/rules.d/ |
D | 60-persistent-storage-tape.rules | 22 KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID… 23 KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" 24 KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", E… 25 KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --whitelisted --export… 26 KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}",… 27 KERNEL=="st*[0-9]", ENV{ID_SCSI_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SCSI_SERI… 32 KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{builtin}="path_id" 33 KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}"
|