mailing list of musl libc
 help / color / mirror / code / Atom feed
6788476a212374392328b9e7b8122230e8df3199 blob 1174 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
#define _GNU_SOURCE
#include <sys/stat.h>
#include <syscall.h>
#include <sys/sysmacros.h>
#include <errno.h>

int statx(int dirfd, const char *restrict path, int flags, unsigned mask, struct statx *restrict stx)
{
	int ret = __syscall(SYS_statx, dirfd, path, flags, mask, stx);
	if (ret != -ENOSYS) return __syscall_ret(ret);

	#if defined(SYS_fstatat)
	struct stat st;
	ret = fstatat(dirfd, path, &st, flags);
	if (ret == -ENOSYS) return -1;

	stx->stx_dev_major = major(st.st_dev);
	stx->stx_dev_minor = minor(st.st_dev);
	stx->stx_ino = st.st_ino;
	stx->stx_mode = st.st_mode;
	stx->stx_nlink = st.st_nlink;
	stx->stx_uid = st.st_uid;
	stx->stx_gid = st.st_gid;
	stx->stx_size = st.st_size;
	stx->stx_blksize = st.st_blksize;
	stx->stx_blocks = st.st_blocks;
	stx->stx_atime.tv_sec = st.st_atim.tv_sec;
	stx->stx_atime.tv_nsec = st.st_atim.tv_nsec;
	stx->stx_mtime.tv_sec = st.st_mtim.tv_sec;
	stx->stx_mtime.tv_nsec = st.st_mtim.tv_nsec;
	stx->stx_ctime.tv_sec = st.st_ctim.tv_sec;
	stx->stx_ctime.tv_nsec = st.st_ctim.tv_nsec;
	stx->stx_btime = (struct statx_timestamp){.tv_sec=0, .tv_nsec=0};
	stx->stx_mask = STATX_BASIC_STATS;
	ret = EINVAL;
	#endif

	return ret;
}
debug log:

solving 6788476a ...
found 6788476a in https://inbox.vuxu.org/musl/20220827231143.3324909-2-dunk@denkimushi.com/

applying [1/1] https://inbox.vuxu.org/musl/20220827231143.3324909-2-dunk@denkimushi.com/
diff --git a/src/stat/statx.c b/src/stat/statx.c
new file mode 100644
index 00000000..6788476a

Checking patch src/stat/statx.c...
Applied patch src/stat/statx.c cleanly.

index at:
100644 6788476a212374392328b9e7b8122230e8df3199	src/stat/statx.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).