32 #include <sys/sysmacros.h> 52 const bool checkVariants,
53 const bool followLink,
54 const unsigned int maxTime
58 volatile bool locIsValid =
false;
60 timer myTimer(maxTime);
64 int (*getFileStatus)(
const char *,
struct stat *) =
65 followLink ? ::stat : ::lstat;
67 if (getFileStatus(fName.c_str(), &status_) == 0)
71 else if (checkVariants)
76 if (getFileStatus(fNameVar.c_str(), &status_) == 0)
85 isValid_ = locIsValid;
102 major(status_.st_dev) == major(stat2.
status().st_dev)
103 && minor(status_.st_dev) == minor(stat2.
status().st_dev)
110 return isValid_ && (status_.st_ino == stat2.
status().st_ino);
116 return isValid_ && (status_.st_ino == ino_t(iNode));
126 fStat.isValid_ = stat[0];
128 dev_t st_dev = makedev(stat[1], stat[2]);
129 fStat.status_.st_dev = st_dev;
131 fStat.status_.st_ino = stat[3];
132 fStat.status_.st_mode = stat[4];
133 fStat.status_.st_uid = stat[5];
134 fStat.status_.st_gid = stat[6];
136 dev_t st_rdev = makedev(stat[7], stat[8]);
137 fStat.status_.st_rdev = st_rdev;
139 fStat.status_.st_size = stat[9];
140 fStat.status_.st_atime = stat[10];
141 fStat.status_.st_mtime = stat[11];
142 fStat.status_.st_ctime = stat[12];
145 is.
check(
"Istream& operator>>(Istream&, fileStat&)");
155 stat[0] =
label(fStat.isValid_);
156 stat[1] =
label(major(fStat.status_.st_dev));
157 stat[2] =
label(minor(fStat.status_.st_dev));
158 stat[3] =
label(fStat.status_.st_ino);
159 stat[4] =
label(fStat.status_.st_mode);
160 stat[5] =
label(fStat.status_.st_uid);
161 stat[6] =
label(fStat.status_.st_gid);
162 stat[7] =
label(major(fStat.status_.st_rdev));
163 stat[8] =
label(minor(fStat.status_.st_rdev));
164 stat[9] =
label(fStat.status_.st_size);
165 stat[10] =
label(fStat.status_.st_atime);
166 stat[11] =
label(fStat.status_.st_mtime);
167 stat[12] =
label(fStat.status_.st_ctime);
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
static const label nVariants_
Number of file variants.
A 1D vector of objects of type <T> with a fixed size <Size>.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Implements a timeout mechanism via sigalarm.
fileStat()
Empty constructor.
bool sameINode(const fileStat &stat2) const
Compare two fileStats for same Inode.
const struct stat & status() const
Raw status.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
bool sameDevice(const fileStat &stat2) const
Compare two fileStats for same device.
Istream & operator>>(Istream &, directionInfo &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Wrapper for stat() system call.
#define timedOut(x)
Check it a timeout has occurred.
Ostream & operator<<(Ostream &, const ensightPart &)
static const char * variantExts_[]
Extensions of the file variants.