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

Function get_birthtime

src/stat.c:1419–1449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1417#else /* USE_STATX */
1418
1419static struct timespec
1420get_birthtime (int fd, char const *filename, struct stat const *st)
1421{
1422 struct timespec ts = get_stat_birthtime (st);
1423
1424# if HAVE_GETATTRAT
1425 if (ts.tv_nsec < 0)
1426 {
1427 nvlist_t *response;
1428 if ((fd < 0
1429 ? getattrat (AT_FDCWD, XATTR_VIEW_READWRITE, filename, &response)
1430 : fgetattr (fd, XATTR_VIEW_READWRITE, &response))
1431 == 0)
1432 {
1433 uint64_t *val;
1434 uint_t n;
1435 if (nvlist_lookup_uint64_array (response, A_CRTIME, &val, &n) == 0
1436 && 2 <= n
1437 && val[0] <= TYPE_MAXIMUM (time_t)
1438 && val[1] < 1000000000 * 2 /* for leap seconds */)
1439 {
1440 ts.tv_sec = val[0];
1441 ts.tv_nsec = val[1];
1442 }
1443 nvlist_free (response);
1444 }
1445 }
1446# endif
1447
1448 return ts;
1449}
1450
1451
1452/* stat the file and print what we find */

Callers 1

print_statFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected