/usr/include/bobcat/stat is in libbobcat-dev 4.08.02-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | #ifndef INCLUDED_BOBCAT_STAT_
#define INCLUDED_BOBCAT_STAT_
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string>
#include <bobcat/datetime>
#include <bobcat/gs>
namespace FBB
{
class User;
class Stat: public GS__
{
struct stat d_stat;
bool d_errno;
std::string d_name;
public:
typedef struct stat stat; // Defines Stat::stat for clients
enum Combine
{
ALL,
ANY,
};
enum SpecialMode
{
SUID = 04000,
SGID = 02000,
SB = 01000,
};
enum Mode
{
UR = 0400,
UW = 0200,
UX = 0100,
GR = 040,
GW = 020,
GX = 010,
OR = 04,
OW = 02,
OX = 01,
READ = UR | GR | OR,
WRITE = UW | GW | OW,
EXEC = UX | GX | OX,
RWX = 0777,
};
Stat(); // 1
explicit Stat(std::string const &name); // 2
Stat(std::string const &name, std::string const &pathlist); // 1.f
Stat(Stat &&tmp); // 3
Stat &operator=(Stat const &other) = default;
Stat &operator=(Stat &&tmp);
bool access(User const &user, size_t mode,
bool useEffective = true) const;
DateTime lastAccess() const; // .f
DateTime lastChange() const; // .f
DateTime lastModification() const; // .f
Type type() const; // .f
bool isType(Type probe); // .f
bool mode(size_t mode, Combine combi = ALL) const;
bool set(std::string const &name);
bool set(std::string const &name, std::string const &pathlist);
bool specialMode(size_t specialMode, Combine combi = ALL) const;
off_t size() const; // .f
operator bool() const; // .f
size_t blockSize() const; // .f
size_t device() const; // .f
size_t deviceType() const; // .f
size_t error() const; // .f
size_t gid() const; // .f
size_t inode() const; // .f
size_t mode() const; // .f
size_t nBlocks() const; // .f
size_t nLinks() const; // .f
size_t uid() const; // .f
stat const &statStruct() const; // .f
std::string const &name(); // .f
std::string modeStr() const;
std::string path();
std::string typeStr() const;
private:
void init();
};
inline Stat::Stat(std::string const &name, std::string const &pathlist)
{
set(name, pathlist);
}
inline size_t Stat::blockSize() const
{
return d_stat.st_blksize;
}
inline size_t Stat::device() const
{
return d_stat.st_dev;
}
inline size_t Stat::deviceType() const
{
return d_stat.st_rdev;
}
inline size_t Stat::error() const
{
return d_errno;
}
inline size_t Stat::gid() const
{
return d_stat.st_gid;
}
inline size_t Stat::inode() const
{
return d_stat.st_ino;
}
inline bool Stat::isType(Type probe)
{
return type() == probe;
}
inline DateTime Stat::lastAccess() const
{
return DateTime(d_stat.st_atime, DateTime::UTC);
}
inline DateTime Stat::lastChange() const
{
return DateTime(d_stat.st_ctime, DateTime::UTC);
}
inline DateTime Stat::lastModification() const
{
return DateTime(d_stat.st_mtime, DateTime::UTC);
}
inline size_t Stat::mode() const
{
return d_stat.st_mode & RWX;
}
inline std::string const &Stat::name()
{
return d_name;
}
inline size_t Stat::nBlocks() const
{
return d_stat.st_blocks;
}
inline size_t Stat::nLinks() const
{
return d_stat.st_nlink;
}
inline Stat::operator bool() const
{
return d_errno == 0;
}
inline off_t Stat::size() const
{
return d_stat.st_size;
}
inline Stat::stat const &Stat::statStruct() const
{
return d_stat;
}
inline Stat::Type Stat::type() const
{
return static_cast<Type>(d_stat.st_mode & S_IFMT);
}
inline size_t Stat::uid() const
{
return d_stat.st_uid;
}
} // FBB
#endif
|