From: Stefan O'Rear <sorear@fastmail.com>
To: musl@lists.openwall.com
Cc: Stefan O'Rear <sorear@fastmail.com>
Subject: [musl] [PATCH 05/14] Add src/internal/statx.h
Date: Thu, 3 Sep 2020 07:23:00 -0400 [thread overview]
Message-ID: <20200903112309.102601-6-sorear@fastmail.com> (raw)
In-Reply-To: <20200903112309.102601-1-sorear@fastmail.com>
We need to make internal syscalls to SYS_statx when SYS_fstatat is not
available without changing the musl API.
---
src/internal/statx.h | 28 ++++++++++++++++++++++++++++
src/stat/fstatat.c | 28 ++--------------------------
2 files changed, 30 insertions(+), 26 deletions(-)
create mode 100644 src/internal/statx.h
diff --git a/src/internal/statx.h b/src/internal/statx.h
new file mode 100644
index 00000000..46b16f62
--- /dev/null
+++ b/src/internal/statx.h
@@ -0,0 +1,28 @@
+struct statx {
+ uint32_t stx_mask;
+ uint32_t stx_blksize;
+ uint64_t stx_attributes;
+ uint32_t stx_nlink;
+ uint32_t stx_uid;
+ uint32_t stx_gid;
+ uint16_t stx_mode;
+ uint16_t pad1;
+ uint64_t stx_ino;
+ uint64_t stx_size;
+ uint64_t stx_blocks;
+ uint64_t stx_attributes_mask;
+ struct {
+ int64_t tv_sec;
+ uint32_t tv_nsec;
+ int32_t pad;
+ } stx_atime, stx_btime, stx_ctime, stx_mtime;
+ uint32_t stx_rdev_major;
+ uint32_t stx_rdev_minor;
+ uint32_t stx_dev_major;
+ uint32_t stx_dev_minor;
+ uint64_t spare[14];
+};
+
+#define STATX_TYPE 0x001U
+#define STATX_SIZE 0x200U
+#define STATX_BASIC_STATS 0x7ffU
diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c
index de165b5c..230a83fc 100644
--- a/src/stat/fstatat.c
+++ b/src/stat/fstatat.c
@@ -7,37 +7,13 @@
#include <sys/sysmacros.h>
#include "syscall.h"
#include "kstat.h"
-
-struct statx {
- uint32_t stx_mask;
- uint32_t stx_blksize;
- uint64_t stx_attributes;
- uint32_t stx_nlink;
- uint32_t stx_uid;
- uint32_t stx_gid;
- uint16_t stx_mode;
- uint16_t pad1;
- uint64_t stx_ino;
- uint64_t stx_size;
- uint64_t stx_blocks;
- uint64_t stx_attributes_mask;
- struct {
- int64_t tv_sec;
- uint32_t tv_nsec;
- int32_t pad;
- } stx_atime, stx_btime, stx_ctime, stx_mtime;
- uint32_t stx_rdev_major;
- uint32_t stx_rdev_minor;
- uint32_t stx_dev_major;
- uint32_t stx_dev_minor;
- uint64_t spare[14];
-};
+#include "statx.h"
static int fstatat_statx(int fd, const char *restrict path, struct stat *restrict st, int flag)
{
struct statx stx;
- int ret = __syscall(SYS_statx, fd, path, flag, 0x7ff, &stx);
+ int ret = __syscall(SYS_statx, fd, path, flag, STATX_BASIC_STATS, &stx);
if (ret) return ret;
*st = (struct stat){
--
2.25.4
next prev parent reply other threads:[~2020-09-03 11:24 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 11:22 [musl] [PATCH 00/14] riscv32 support Stefan O'Rear
2020-09-03 11:22 ` [musl] [PATCH 01/14] Remove ARMSUBARCH relic from configure Stefan O'Rear
2020-09-03 11:22 ` [musl] [PATCH 02/14] time64: Don't make aliases to nonexistent syscalls Stefan O'Rear
2020-09-03 15:56 ` Rich Felker
2020-09-03 19:36 ` Stefan O'Rear
2020-09-03 21:17 ` Rich Felker
2020-09-03 11:22 ` [musl] [PATCH 03/14] time64: Only getrlimit/setrlimit if they exist Stefan O'Rear
2020-09-03 11:22 ` [musl] [PATCH 04/14] time64: Only gettimeofday/settimeofday if exist Stefan O'Rear
2020-09-03 11:23 ` Stefan O'Rear [this message]
2020-09-03 15:39 ` [musl] [PATCH 05/14] Add src/internal/statx.h Arnd Bergmann
2020-09-03 15:51 ` Rich Felker
2020-09-03 18:08 ` Arnd Bergmann
2020-09-03 11:23 ` [musl] [PATCH 06/14] Only call fstatat if defined Stefan O'Rear
2020-09-03 16:05 ` Rich Felker
2020-09-04 1:47 ` Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 07/14] Emulate wait4 using waitid Stefan O'Rear
2020-09-03 14:56 ` Stefan O'Rear
2020-09-03 15:36 ` Arnd Bergmann
2020-09-03 15:40 ` Stefan O'Rear
2020-09-03 18:08 ` Arnd Bergmann
2020-09-03 15:49 ` Rich Felker
2020-09-03 16:25 ` Stefan O'Rear
2020-09-03 16:38 ` Rich Felker
2020-09-03 11:23 ` [musl] [PATCH 08/14] riscv: Fall back to syscall __riscv_flush_icache Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 09/14] riscv32: Target and subtarget detection Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 10/14] riscv32: add arch headers Stefan O'Rear
2020-09-03 15:49 ` Arnd Bergmann
2020-09-03 11:23 ` [musl] [PATCH 11/14] riscv32: Add fenv and math Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 12/14] riscv32: Add dlsym Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 13/14] riscv32: Add jmp_buf and sigreturn Stefan O'Rear
2020-09-03 11:23 ` [musl] [PATCH 14/14] riscv32: Add thread support Stefan O'Rear
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200903112309.102601-6-sorear@fastmail.com \
--to=sorear@fastmail.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).