255 const char *epname =
"MSS_Stat";
256 char ftype, mtype[10], *resp;
258 long xt_uid, xt_gid, atime, ctime, mtime, xt_blksize, xt_blocks;
264 if (strlen(path) > MAXPATHLEN)
265 {
OssEroute.Emsg(epname,
"mss path too long - ", path);
266 return -ENAMETOOLONG;
271 if (!buff)
return MSS_Xeq(0, ENOENT, (
isMSSC ?
"statx" :
"exists"), path);
272 if ((retc =
MSS_Xeq(&sfd, ENOENT,
"statx", path)))
return retc;
276 if ( !(resp = sfd ->GetLine()))
281 sscanf(resp,
"%c %9s %d %ld %ld %ld %ld %ld %lld %ld %ld", &ftype, mtype,
282 &xt_nlink, &xt_uid, &xt_gid, &atime, &ctime, &mtime,
283 &xt_size, &xt_blksize, &xt_blocks);
287 memset( (
char *)buff, 0,
sizeof(
struct stat) );
288 buff->st_nlink =
static_cast<nlink_t
>(xt_nlink);
289 buff->st_uid =
static_cast<uid_t
>(xt_uid);
290 buff->st_gid =
static_cast<gid_t
>(xt_gid);
291 buff->st_atime =
static_cast<time_t
>(atime);
292 buff->st_ctime =
static_cast<time_t
>(ctime);
293 buff->st_mtime =
static_cast<time_t
>(mtime);
294 buff->st_size =
static_cast<off_t
>(xt_size);
295 buff->st_blksize=
static_cast<long>(xt_blksize);
297 buff->st_blocks = xt_blocks;
299 buff->st_blocks =
static_cast<blkcnt_t
>(xt_blocks);
302 if (ftype ==
'd') buff->st_mode |= S_IFDIR;
303 else if (ftype ==
'l') buff->st_mode |= S_IFLNK;
304 else buff->st_mode |= S_IFREG;
306 buff->st_mode |=
tranmode(&mtype[0]) << 6;
307 buff->st_mode |=
tranmode(&mtype[3]) << 3;
308 buff->st_mode |=
tranmode(&mtype[6]);