Lines Matching defs:st
546 atf_fs_stat_init(atf_fs_stat_t *st, const atf_fs_path_t *p)
551 if (lstat(pstr, &st->m_sb) == -1) {
555 int type = st->m_sb.st_mode & S_IFMT;
558 case S_IFBLK: st->m_type = atf_fs_stat_blk_type; break;
559 case S_IFCHR: st->m_type = atf_fs_stat_chr_type; break;
560 case S_IFDIR: st->m_type = atf_fs_stat_dir_type; break;
561 case S_IFIFO: st->m_type = atf_fs_stat_fifo_type; break;
562 case S_IFLNK: st->m_type = atf_fs_stat_lnk_type; break;
563 case S_IFREG: st->m_type = atf_fs_stat_reg_type; break;
564 case S_IFSOCK: st->m_type = atf_fs_stat_sock_type; break;
566 case S_IFWHT: st->m_type = atf_fs_stat_wht_type; break;
584 atf_fs_stat_fini(atf_fs_stat_t *st ATF_DEFS_ATTRIBUTE_UNUSED)
593 atf_fs_stat_get_device(const atf_fs_stat_t *st)
595 return st->m_sb.st_dev;
599 atf_fs_stat_get_inode(const atf_fs_stat_t *st)
601 return st->m_sb.st_ino;
605 atf_fs_stat_get_mode(const atf_fs_stat_t *st)
607 return st->m_sb.st_mode & ~S_IFMT;
611 atf_fs_stat_get_size(const atf_fs_stat_t *st)
613 return st->m_sb.st_size;
617 atf_fs_stat_get_type(const atf_fs_stat_t *st)
619 return st->m_type;
623 atf_fs_stat_is_owner_readable(const atf_fs_stat_t *st)
625 return st->m_sb.st_mode & S_IRUSR;
629 atf_fs_stat_is_owner_writable(const atf_fs_stat_t *st)
631 return st->m_sb.st_mode & S_IWUSR;
635 atf_fs_stat_is_owner_executable(const atf_fs_stat_t *st)
637 return st->m_sb.st_mode & S_IXUSR;
641 atf_fs_stat_is_group_readable(const atf_fs_stat_t *st)
643 return st->m_sb.st_mode & S_IRGRP;
647 atf_fs_stat_is_group_writable(const atf_fs_stat_t *st)
649 return st->m_sb.st_mode & S_IWGRP;
653 atf_fs_stat_is_group_executable(const atf_fs_stat_t *st)
655 return st->m_sb.st_mode & S_IXGRP;
659 atf_fs_stat_is_other_readable(const atf_fs_stat_t *st)
661 return st->m_sb.st_mode & S_IROTH;
665 atf_fs_stat_is_other_writable(const atf_fs_stat_t *st)
667 return st->m_sb.st_mode & S_IWOTH;
671 atf_fs_stat_is_other_executable(const atf_fs_stat_t *st)
673 return st->m_sb.st_mode & S_IXOTH;
694 struct stat st;
700 if (lstat(atf_fs_path_cstring(p), &st) == -1) {
720 if (!ok && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
726 if (!ok && (atf_user_euid() == st.st_uid)) {
727 ok = ((mode & atf_fs_access_r) && (st.st_mode & S_IRUSR)) ||
728 ((mode & atf_fs_access_w) && (st.st_mode & S_IWUSR)) ||
729 ((mode & atf_fs_access_x) && (st.st_mode & S_IXUSR));
731 if (!ok && atf_user_is_member_of_group(st.st_gid)) {
732 ok = ((mode & atf_fs_access_r) && (st.st_mode & S_IRGRP)) ||
733 ((mode & atf_fs_access_w) && (st.st_mode & S_IWGRP)) ||
734 ((mode & atf_fs_access_x) && (st.st_mode & S_IXGRP));
736 if (!ok && ((atf_user_euid() != st.st_uid) &&
737 !atf_user_is_member_of_group(st.st_gid))) {
738 ok = ((mode & atf_fs_access_r) && (st.st_mode & S_IROTH)) ||
739 ((mode & atf_fs_access_w) && (st.st_mode & S_IWOTH)) ||
740 ((mode & atf_fs_access_x) && (st.st_mode & S_IXOTH));