MCPcopy Create free account
hub / github.com/coreutils/coreutils / cache_fstatat

Function cache_fstatat

src/remove.c:58–79  ·  view source on GitHub ↗

Like fstatat, but cache on POSIX-compatible systems. */

Source from the content-addressed store, hash-verified

56
57/* Like fstatat, but cache on POSIX-compatible systems. */
58static int
59cache_fstatat (int fd, char const *file, struct stat *st, int flag)
60{
61#if HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
62 /* If ST->st_atim.tv_nsec is -1, the status has not been gotten yet.
63 If less than -1, fstatat failed with errno == ST->st_ino.
64 Otherwise, the status has already been gotten, so return 0. */
65 if (0 <= st->st_atim.tv_nsec)
66 return 0;
67 if (st->st_atim.tv_nsec == -1)
68 {
69 if (fstatat (fd, file, st, flag) == 0)
70 return 0;
71 st->st_atim.tv_nsec = -2;
72 st->st_ino = errno;
73 }
74 errno = st->st_ino;
75 return -1;
76#else
77 return fstatat (fd, file, st, flag);
78#endif
79}
80
81/* Initialize a fstatat cache *ST. Return ST for convenience. */
82static inline struct stat *

Callers 2

promptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected