MCPcopy Create free account
hub / github.com/boostorg/filesystem / statx_fstatat

Function statx_fstatat

src/operations.cpp:353–383  ·  view source on GitHub ↗

statx emulation through fstatat

Source from the content-addressed store, hash-verified

351
352//! statx emulation through fstatat
353int statx_fstatat(int dirfd, const char* path, int flags, unsigned int mask, struct ::statx* stx)
354{
355 struct ::stat st;
356 flags &= AT_EMPTY_PATH | AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW;
357 int res = ::fstatat(dirfd, path, &st, flags);
358 if (BOOST_LIKELY(res == 0))
359 {
360 std::memset(stx, 0, sizeof(*stx));
361 stx->stx_mask = STATX_BASIC_STATS;
362 stx->stx_blksize = st.st_blksize;
363 stx->stx_nlink = st.st_nlink;
364 stx->stx_uid = st.st_uid;
365 stx->stx_gid = st.st_gid;
366 stx->stx_mode = st.st_mode;
367 stx->stx_ino = st.st_ino;
368 stx->stx_size = st.st_size;
369 stx->stx_blocks = st.st_blocks;
370 stx->stx_atime.tv_sec = st.st_atim.tv_sec;
371 stx->stx_atime.tv_nsec = st.st_atim.tv_nsec;
372 stx->stx_ctime.tv_sec = st.st_ctim.tv_sec;
373 stx->stx_ctime.tv_nsec = st.st_ctim.tv_nsec;
374 stx->stx_mtime.tv_sec = st.st_mtim.tv_sec;
375 stx->stx_mtime.tv_nsec = st.st_mtim.tv_nsec;
376 stx->stx_rdev_major = major(st.st_rdev);
377 stx->stx_rdev_minor = minor(st.st_rdev);
378 stx->stx_dev_major = major(st.st_dev);
379 stx->stx_dev_minor = minor(st.st_dev);
380 }
381
382 return res;
383}
384
385typedef int statx_t(int dirfd, const char* path, int flags, unsigned int mask, struct ::statx* stx);
386

Callers 1

statx_syscallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected