summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/aarch64/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/alpha/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/alpha/bits/stat.h2
-rwxr-xr-xlibc/sysdeps/linux/arc/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/arm/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/avr32/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/bfin/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/c6x/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/common/Makefile.in3
-rw-r--r--libc/sysdeps/linux/common/bits/fcntl-linux.h34
-rw-r--r--libc/sysdeps/linux/common/bits/mman-shared.h2
-rw-r--r--libc/sysdeps/linux/common/bits/stat.h4
-rw-r--r--libc/sysdeps/linux/common/lseek.c2
-rw-r--r--libc/sysdeps/linux/common/memfd_create.c13
-rw-r--r--libc/sysdeps/linux/common/process_vm_readv.c32
-rw-r--r--libc/sysdeps/linux/common/process_vm_writev.c32
-rw-r--r--libc/sysdeps/linux/common/sys/random.h4
-rw-r--r--libc/sysdeps/linux/cris/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/csky/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/frv/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/frv/bits/stat.h4
-rw-r--r--libc/sysdeps/linux/h8300/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/hppa/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/i386/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/ia64/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/ia64/bits/stat.h4
-rw-r--r--libc/sysdeps/linux/kvx/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/lm32/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/m68k/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/m68k/bits/stat.h4
-rw-r--r--libc/sysdeps/linux/metag/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/microblaze/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/mips/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/mips/bits/stat.h8
-rw-r--r--libc/sysdeps/linux/nds32/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/nds32/bits/stat.h4
-rw-r--r--libc/sysdeps/linux/nios2/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/or1k/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/powerpc/bits/stat.h4
-rw-r--r--libc/sysdeps/linux/riscv32/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/riscv32/getcontext.S74
-rw-r--r--libc/sysdeps/linux/riscv32/setcontext.S112
-rw-r--r--libc/sysdeps/linux/riscv32/swapcontext.S122
-rw-r--r--libc/sysdeps/linux/riscv64/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/riscv64/getcontext.S74
-rw-r--r--libc/sysdeps/linux/riscv64/setcontext.S112
-rw-r--r--libc/sysdeps/linux/riscv64/swapcontext.S122
-rw-r--r--libc/sysdeps/linux/sh/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/sparc/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/sparc/bits/stat.h4
-rw-r--r--libc/sysdeps/linux/sparc64/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/sparc64/bits/stat.h4
-rw-r--r--libc/sysdeps/linux/tile/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/x86_64/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/x86_64/bits/stat.h4
-rw-r--r--libc/sysdeps/linux/xtensa/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/xtensa/bits/stat.h4
58 files changed, 217 insertions, 644 deletions
diff --git a/libc/sysdeps/linux/aarch64/bits/fcntl.h b/libc/sysdeps/linux/aarch64/bits/fcntl.h
index dbe929351..024344eec 100644
--- a/libc/sysdeps/linux/aarch64/bits/fcntl.h
+++ b/libc/sysdeps/linux/aarch64/bits/fcntl.h
@@ -289,3 +289,6 @@ extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
#endif /* use GNU */
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h
index 11e68214e..7d06c76b7 100644
--- a/libc/sysdeps/linux/alpha/bits/fcntl.h
+++ b/libc/sysdeps/linux/alpha/bits/fcntl.h
@@ -236,3 +236,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/alpha/bits/stat.h b/libc/sysdeps/linux/alpha/bits/stat.h
index 88bc6617d..f2dca250d 100644
--- a/libc/sysdeps/linux/alpha/bits/stat.h
+++ b/libc/sysdeps/linux/alpha/bits/stat.h
@@ -40,7 +40,7 @@
Use neat tidy anonymous unions and structures when possible. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
# if __GNUC_PREREQ(3,3)
# define __ST_TIME(X) \
__extension__ union { \
diff --git a/libc/sysdeps/linux/arc/bits/fcntl.h b/libc/sysdeps/linux/arc/bits/fcntl.h
index beb32e41e..b02849691 100755
--- a/libc/sysdeps/linux/arc/bits/fcntl.h
+++ b/libc/sysdeps/linux/arc/bits/fcntl.h
@@ -230,3 +230,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h
index 823660648..52dee4287 100644
--- a/libc/sysdeps/linux/arm/bits/fcntl.h
+++ b/libc/sysdeps/linux/arm/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/avr32/bits/fcntl.h b/libc/sysdeps/linux/avr32/bits/fcntl.h
index ec0a3b55d..9e41550be 100644
--- a/libc/sysdeps/linux/avr32/bits/fcntl.h
+++ b/libc/sysdeps/linux/avr32/bits/fcntl.h
@@ -218,3 +218,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
__END_DECLS
#endif
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h
index 0909ae6c4..67d2c5245 100644
--- a/libc/sysdeps/linux/bfin/bits/fcntl.h
+++ b/libc/sysdeps/linux/bfin/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/c6x/bits/fcntl.h b/libc/sysdeps/linux/c6x/bits/fcntl.h
index 14aea565e..00f3b34e0 100644
--- a/libc/sysdeps/linux/c6x/bits/fcntl.h
+++ b/libc/sysdeps/linux/c6x/bits/fcntl.h
@@ -237,3 +237,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index 848bc1e4a..e0b280c33 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -30,6 +30,7 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
inotify.c \
ioperm.c \
iopl.c \
+ memfd_create.c \
modify_ldt.c \
module.c \
name_to_handle_at.c \
@@ -39,6 +40,8 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
ppoll.c \
prctl.c \
prlimit.c \
+ process_vm_readv.c \
+ process_vm_writev.c \
readahead.c \
reboot.c \
remap_file_pages.c \
diff --git a/libc/sysdeps/linux/common/bits/fcntl-linux.h b/libc/sysdeps/linux/common/bits/fcntl-linux.h
new file mode 100644
index 000000000..d0236fd8b
--- /dev/null
+++ b/libc/sysdeps/linux/common/bits/fcntl-linux.h
@@ -0,0 +1,34 @@
+/* O_*, F_*, FD_* bit values for Linux.
+ Copyright (C) 2001-2024 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _FCNTL_H
+# error "Never use <bits/fcntl-linux.h> directly; include <fcntl.h> instead."
+#endif
+
+#ifdef __USE_GNU
+/* Types of seals. */
+# define F_SEAL_SEAL 0x0001 /* Prevent further seals from being set. */
+# define F_SEAL_SHRINK 0x0002 /* Prevent file from shrinking. */
+# define F_SEAL_GROW 0x0004 /* Prevent file from growing. */
+# define F_SEAL_WRITE 0x0008 /* Prevent writes. */
+# define F_SEAL_FUTURE_WRITE 0x0010 /* Prevent future writes while
+ mapped. */
+# define F_SEAL_EXEC 0x0020 /* Prevent chmod modifying exec bits. */
+
+# define F_ADD_SEALS 1033 /* Add seals to file. */
+# define F_GET_SEALS 1034 /* Get seals for file. */
+#endif
diff --git a/libc/sysdeps/linux/common/bits/mman-shared.h b/libc/sysdeps/linux/common/bits/mman-shared.h
index 98c9e1d3c..c40ae2d1e 100644
--- a/libc/sysdeps/linux/common/bits/mman-shared.h
+++ b/libc/sysdeps/linux/common/bits/mman-shared.h
@@ -40,11 +40,9 @@
__BEGIN_DECLS
-#if 0
/* Create a new memory file descriptor. NAME is a name for debugging.
FLAGS is a combination of the MFD_* constants. */
int memfd_create (const char *__name, unsigned int __flags) __THROW;
-#endif
/* Lock pages from ADDR (inclusive) to ADDR + LENGTH (exclusive) into
memory. FLAGS is a combination of the MLOCK_* flags above. */
diff --git a/libc/sysdeps/linux/common/bits/stat.h b/libc/sysdeps/linux/common/bits/stat.h
index 07c09f50a..fc76cc3e7 100644
--- a/libc/sysdeps/linux/common/bits/stat.h
+++ b/libc/sysdeps/linux/common/bits/stat.h
@@ -61,7 +61,7 @@ struct stat
#else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -107,7 +107,7 @@ struct stat64
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c
index 80d69318a..0fc99efae 100644
--- a/libc/sysdeps/linux/common/lseek.c
+++ b/libc/sysdeps/linux/common/lseek.c
@@ -40,6 +40,8 @@ off_t __NC(lseek)(int fd, off_t offset attribute_unused, int whence)
case SEEK_SET:
case SEEK_CUR:
case SEEK_END:
+ case SEEK_DATA:
+ case SEEK_HOLE:
break;
default:
__set_errno(EINVAL);
diff --git a/libc/sysdeps/linux/common/memfd_create.c b/libc/sysdeps/linux/common/memfd_create.c
new file mode 100644
index 000000000..7165f3278
--- /dev/null
+++ b/libc/sysdeps/linux/common/memfd_create.c
@@ -0,0 +1,13 @@
+/*
+ * memfd_create() for uClibc-ng
+ *
+ * Copyright (C) 2024 Waldemar Brodkorb <wbx@uclibc-ng.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+#include <sys/mman.h>
+#if defined(__NR_memfd_create)
+_syscall2(int, memfd_create, const char *, name, unsigned int, flags)
+#endif
diff --git a/libc/sysdeps/linux/common/process_vm_readv.c b/libc/sysdeps/linux/common/process_vm_readv.c
new file mode 100644
index 000000000..b69c1c97a
--- /dev/null
+++ b/libc/sysdeps/linux/common/process_vm_readv.c
@@ -0,0 +1,32 @@
+/* process_vm_readv - Linux specific syscall.
+ Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#ifdef __NR_process_vm_readv
+ssize_t
+process_vm_readv (pid_t pid, const struct iovec *local_iov,
+ unsigned long int liovcnt,
+ const struct iovec *remote_iov,
+ unsigned long int riovcnt, unsigned long int flags)
+{
+ return INLINE_SYSCALL (process_vm_readv, 6, pid, local_iov,
+ liovcnt, remote_iov, riovcnt, flags);
+}
+#endif
diff --git a/libc/sysdeps/linux/common/process_vm_writev.c b/libc/sysdeps/linux/common/process_vm_writev.c
new file mode 100644
index 000000000..e22817a8d
--- /dev/null
+++ b/libc/sysdeps/linux/common/process_vm_writev.c
@@ -0,0 +1,32 @@
+/* process_vm_writev - Linux specific syscall.
+ Copyright (C) 2020-2024 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <sys/uio.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#ifdef __NR_process_vm_writev
+ssize_t
+process_vm_writev (pid_t pid, const struct iovec *local_iov,
+ unsigned long int liovcnt,
+ const struct iovec *remote_iov,
+ unsigned long int riovcnt, unsigned long int flags)
+{
+ return INLINE_SYSCALL (process_vm_writev, 6, pid, local_iov,
+ liovcnt, remote_iov, riovcnt, flags);
+}
+#endif
diff --git a/libc/sysdeps/linux/common/sys/random.h b/libc/sysdeps/linux/common/sys/random.h
index 3d12744ad..3d24e439b 100644
--- a/libc/sysdeps/linux/common/sys/random.h
+++ b/libc/sysdeps/linux/common/sys/random.h
@@ -9,7 +9,7 @@
__BEGIN_DECLS
-#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
+#if defined __UCLIBC_LINUX_SPECIFIC__
# if 0 /*def __ASSUME_GETRANDOM_SYSCALL */
# include <linux/random.h>
# else
@@ -20,9 +20,11 @@ __BEGIN_DECLS
*
* GRND_NONBLOCK Don't block and return EAGAIN instead
* GRND_RANDOM Use the /dev/random pool instead of /dev/urandom
+ * GRND_INSECURE Write random data that may not be cryptographically secure.
*/
# define GRND_NONBLOCK 0x0001
# define GRND_RANDOM 0x0002
+# define GRND_INSECURE 0x0004
# endif
/* FIXME: aren't there a couple of __restrict and const missing ? */
extern int getrandom(void *__buf, size_t count, unsigned int flags)
diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h
index e9bc90ea9..e1d4ee1a6 100644
--- a/libc/sysdeps/linux/cris/bits/fcntl.h
+++ b/libc/sysdeps/linux/cris/bits/fcntl.h
@@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/csky/bits/fcntl.h b/libc/sysdeps/linux/csky/bits/fcntl.h
index b36f41569..25f4491ba 100644
--- a/libc/sysdeps/linux/csky/bits/fcntl.h
+++ b/libc/sysdeps/linux/csky/bits/fcntl.h
@@ -232,3 +232,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/frv/bits/fcntl.h b/libc/sysdeps/linux/frv/bits/fcntl.h
index 02c8ac310..81a1bcd99 100644
--- a/libc/sysdeps/linux/frv/bits/fcntl.h
+++ b/libc/sysdeps/linux/frv/bits/fcntl.h
@@ -226,3 +226,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/frv/bits/stat.h b/libc/sysdeps/linux/frv/bits/stat.h
index 381d207f2..18321c080 100644
--- a/libc/sysdeps/linux/frv/bits/stat.h
+++ b/libc/sysdeps/linux/frv/bits/stat.h
@@ -70,7 +70,7 @@ struct stat
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -117,7 +117,7 @@ struct stat64
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/libc/sysdeps/linux/h8300/bits/fcntl.h b/libc/sysdeps/linux/h8300/bits/fcntl.h
index 2062f7cda..7cbe04e15 100644
--- a/libc/sysdeps/linux/h8300/bits/fcntl.h
+++ b/libc/sysdeps/linux/h8300/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/hppa/bits/fcntl.h b/libc/sysdeps/linux/hppa/bits/fcntl.h
index 4ce76ce5f..bcd6618b2 100644
--- a/libc/sysdeps/linux/hppa/bits/fcntl.h
+++ b/libc/sysdeps/linux/hppa/bits/fcntl.h
@@ -234,3 +234,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/i386/bits/fcntl.h b/libc/sysdeps/linux/i386/bits/fcntl.h
index f3c08bbe5..5caf66114 100644
--- a/libc/sysdeps/linux/i386/bits/fcntl.h
+++ b/libc/sysdeps/linux/i386/bits/fcntl.h
@@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/ia64/bits/fcntl.h b/libc/sysdeps/linux/ia64/bits/fcntl.h
index a20f44ff7..53263c3d3 100644
--- a/libc/sysdeps/linux/ia64/bits/fcntl.h
+++ b/libc/sysdeps/linux/ia64/bits/fcntl.h
@@ -238,3 +238,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/ia64/bits/stat.h b/libc/sysdeps/linux/ia64/bits/stat.h
index 6723166e7..2b70b8cf8 100644
--- a/libc/sysdeps/linux/ia64/bits/stat.h
+++ b/libc/sysdeps/linux/ia64/bits/stat.h
@@ -38,7 +38,7 @@ struct stat
int pad0;
__dev_t st_rdev; /* Device number, if device. */
__off_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -77,7 +77,7 @@ struct stat64
int pad0;
__dev_t st_rdev; /* Device number, if device. */
__off_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/libc/sysdeps/linux/kvx/bits/fcntl.h b/libc/sysdeps/linux/kvx/bits/fcntl.h
index ea0c59d09..79cd3f14e 100644
--- a/libc/sysdeps/linux/kvx/bits/fcntl.h
+++ b/libc/sysdeps/linux/kvx/bits/fcntl.h
@@ -227,3 +227,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/lm32/bits/fcntl.h b/libc/sysdeps/linux/lm32/bits/fcntl.h
index 0bfea6e7a..049c7fd83 100644
--- a/libc/sysdeps/linux/lm32/bits/fcntl.h
+++ b/libc/sysdeps/linux/lm32/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h
index 5a56c8781..92c0964d9 100644
--- a/libc/sysdeps/linux/m68k/bits/fcntl.h
+++ b/libc/sysdeps/linux/m68k/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/m68k/bits/stat.h b/libc/sysdeps/linux/m68k/bits/stat.h
index 7b9c3d144..70da1b384 100644
--- a/libc/sysdeps/linux/m68k/bits/stat.h
+++ b/libc/sysdeps/linux/m68k/bits/stat.h
@@ -60,7 +60,7 @@ struct stat
#else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -106,7 +106,7 @@ struct stat64
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/libc/sysdeps/linux/metag/bits/fcntl.h b/libc/sysdeps/linux/metag/bits/fcntl.h
index bdd697348..471938b7d 100644
--- a/libc/sysdeps/linux/metag/bits/fcntl.h
+++ b/libc/sysdeps/linux/metag/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/microblaze/bits/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h
index 110927d95..8c9c2ceef 100644
--- a/libc/sysdeps/linux/microblaze/bits/fcntl.h
+++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/mips/bits/fcntl.h b/libc/sysdeps/linux/mips/bits/fcntl.h
index 33251c74d..a98b8c2e5 100644
--- a/libc/sysdeps/linux/mips/bits/fcntl.h
+++ b/libc/sysdeps/linux/mips/bits/fcntl.h
@@ -268,3 +268,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/mips/bits/stat.h b/libc/sysdeps/linux/mips/bits/stat.h
index 539fa33d2..81d2e4687 100644
--- a/libc/sysdeps/linux/mips/bits/stat.h
+++ b/libc/sysdeps/linux/mips/bits/stat.h
@@ -60,7 +60,7 @@ struct stat
long int st_pad2[2];
__off64_t st_size; /* Size of file, in bytes. */
#endif
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -103,7 +103,7 @@ struct stat {
unsigned int st_rdev; /* Device number, if device. */
int st_pad2[3];
__off_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -145,7 +145,7 @@ struct stat64
__dev_t st_rdev; /* Device number, if device. */
long int st_pad2[2];
__off64_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -184,7 +184,7 @@ struct stat64 {
unsigned int st_rdev; /* Device number, if device. */
int st_pad2[3];
__off_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/libc/sysdeps/linux/nds32/bits/fcntl.h b/libc/sysdeps/linux/nds32/bits/fcntl.h
index 2e6a95ec8..cfce8ab27 100644
--- a/libc/sysdeps/linux/nds32/bits/fcntl.h
+++ b/libc/sysdeps/linux/nds32/bits/fcntl.h
@@ -249,3 +249,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/nds32/bits/stat.h b/libc/sysdeps/linux/nds32/bits/stat.h
index c4e09e0f2..5272751f4 100644
--- a/libc/sysdeps/linux/nds32/bits/stat.h
+++ b/libc/sysdeps/linux/nds32/bits/stat.h
@@ -64,7 +64,7 @@ struct stat
#else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -110,7 +110,7 @@ struct stat64
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/libc/sysdeps/linux/nios2/bits/fcntl.h b/libc/sysdeps/linux/nios2/bits/fcntl.h
index 200a35443..0c11c3aba 100644
--- a/libc/sysdeps/linux/nios2/bits/fcntl.h
+++ b/libc/sysdeps/linux/nios2/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/or1k/bits/fcntl.h b/libc/sysdeps/linux/or1k/bits/fcntl.h
index c9599ef3a..78eed9d5f 100644
--- a/libc/sysdeps/linux/or1k/bits/fcntl.h
+++ b/libc/sysdeps/linux/or1k/bits/fcntl.h
@@ -244,3 +244,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h
index ef1beeca0..54e4894ec 100644
--- a/libc/sysdeps/linux/powerpc/bits/fcntl.h
+++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h
@@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/powerpc/bits/stat.h b/libc/sysdeps/linux/powerpc/bits/stat.h
index 7494586b5..ce2ebf896 100644
--- a/libc/sysdeps/linux/powerpc/bits/stat.h
+++ b/libc/sysdeps/linux/powerpc/bits/stat.h
@@ -59,7 +59,7 @@ struct stat
# else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
# endif
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -99,7 +99,7 @@ struct stat64
__off64_t st_size; /* Size of file, in bytes. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/libc/sysdeps/linux/riscv32/bits/fcntl.h b/libc/sysdeps/linux/riscv32/bits/fcntl.h
index a9d7c84e0..fdfb1805d 100644
--- a/libc/sysdeps/linux/riscv32/bits/fcntl.h
+++ b/libc/sysdeps/linux/riscv32/bits/fcntl.h
@@ -229,3 +229,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/riscv32/getcontext.S b/libc/sysdeps/linux/riscv32/getcontext.S
deleted file mode 100644
index 0b9e7c2d3..000000000
--- a/libc/sysdeps/linux/riscv32/getcontext.S
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Save current context.
- Copyright (C) 2009-2018 Free Software Foundation, Inc.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include "ucontext-macros.h"
-
-/* int getcontext (ucontext_t *ucp) */
-
- .text
-LEAF (getcontext)
- SAVE_INT_REG (ra, 0, a0)
- SAVE_INT_REG (ra, 1, a0)
- SAVE_INT_REG (sp, 2, a0)
- SAVE_INT_REG (s0, 8, a0)
- SAVE_INT_REG (s1, 9, a0)
- SAVE_INT_REG (x0, 10, a0) /* return 0 by overwriting a0. */
- SAVE_INT_REG (s2, 18, a0)
- SAVE_INT_REG (s3, 19, a0)
- SAVE_INT_REG (s4, 20, a0)
- SAVE_INT_REG (s5, 21, a0)
- SAVE_INT_REG (s6, 22, a0)
- SAVE_INT_REG (s7, 23, a0)
- SAVE_INT_REG (s8, 24, a0)
- SAVE_INT_REG (s9, 25, a0)
- SAVE_INT_REG (s10, 26, a0)
- SAVE_INT_REG (s11, 27, a0)
-
-#ifndef __riscv_float_abi_soft
- frsr a1
-
- SAVE_FP_REG (fs0, 8, a0)
- SAVE_FP_REG (fs1, 9, a0)
- SAVE_FP_REG (fs2, 18, a0)
- SAVE_FP_REG (fs3, 19, a0)
- SAVE_FP_REG (fs4, 20, a0)
- SAVE_FP_REG (fs5, 21, a0)
- SAVE_FP_REG (fs6, 22, a0)
- SAVE_FP_REG (fs7, 23, a0)
- SAVE_FP_REG (fs8, 24, a0)
- SAVE_FP_REG (fs9, 25, a0)
- SAVE_FP_REG (fs10, 26, a0)
- SAVE_FP_REG (fs11, 27, a0)
-
- sw a1, MCONTEXT_FSR(a0)
-#endif /* __riscv_float_abi_soft */
-
-/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
- li a3, _NSIG8
- add a2, a0, UCONTEXT_SIGMASK
- mv a1, zero
- li a0, SIG_BLOCK
-
- li a7, SYS_ify (rt_sigprocmask)
- scall
- bltz a0, 99f
-
- ret
-
-99: j __syscall_error
-
-PSEUDO_END (getcontext)
diff --git a/libc/sysdeps/linux/riscv32/setcontext.S b/libc/sysdeps/linux/riscv32/setcontext.S
deleted file mode 100644
index 15cc17bd8..000000000
--- a/libc/sysdeps/linux/riscv32/setcontext.S
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Set current context.
- Copyright (C) 2009-2018 Free Software Foundation, Inc.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include "ucontext-macros.h"
-
-/* int __setcontext (const ucontext_t *ucp)
-
- Restores the machine context in UCP and thereby resumes execution
- in that context.
-
- This implementation is intended to be used for *synchronous* context
- switches only. Therefore, it does not have to restore anything
- other than the PRESERVED state. */
-
- .text
-LEAF (setcontext)
-
- mv t0, a0 /* Save ucp into t0. */
-
-/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */
- li a3, _NSIG8
- mv a2, zero
- add a1, a0, UCONTEXT_SIGMASK
- li a0, SIG_SETMASK
-
- li a7, SYS_ify (rt_sigprocmask)
- scall
-
- bltz a0, 99f
-
- cfi_def_cfa (t0, 0)
-
-#ifndef __riscv_float_abi_soft
- lw t1, MCONTEXT_FSR(t0)
-
- RESTORE_FP_REG_CFI (fs0, 8, t0)
- RESTORE_FP_REG_CFI (fs1, 9, t0)
- RESTORE_FP_REG_CFI (fs2, 18, t0)
- RESTORE_FP_REG_CFI (fs3, 19, t0)
- RESTORE_FP_REG_CFI (fs4, 20, t0)
- RESTORE_FP_REG_CFI (fs5, 21, t0)
- RESTORE_FP_REG_CFI (fs6, 22, t0)
- RESTORE_FP_REG_CFI (fs7, 23, t0)
- RESTORE_FP_REG_CFI (fs8, 24, t0)
- RESTORE_FP_REG_CFI (fs9, 25, t0)
- RESTORE_FP_REG_CFI (fs10, 26, t0)
- RESTORE_FP_REG_CFI (fs11, 27, t0)
-
- fssr t1
-#endif /* __riscv_float_abi_soft */
-
- /* Note the contents of argument registers will be random
- unless makecontext() has been called. */
- RESTORE_INT_REG (t1, 0, t0)
- RESTORE_INT_REG_CFI (ra, 1, t0)
- RESTORE_INT_REG (sp, 2, t0)
- RESTORE_INT_REG_CFI (s0, 8, t0)
- RESTORE_INT_REG_CFI (s1, 9, t0)
- RESTORE_INT_REG (a0, 10, t0)
- RESTORE_INT_REG (a1, 11, t0)
- RESTORE_INT_REG (a2, 12, t0)
- RESTORE_INT_REG (a3, 13, t0)
- RESTORE_INT_REG (a4, 14, t0)
- RESTORE_INT_REG (a5, 15, t0)
- RESTORE_INT_REG (a6, 16, t0)
- RESTORE_INT_REG (a7, 17, t0)
- RESTORE_INT_REG_CFI (s2, 18, t0)
- RESTORE_INT_REG_CFI (s3, 19, t0)
- RESTORE_INT_REG_CFI (s4, 20, t0)
- RESTORE_INT_REG_CFI (s5, 21, t0)
- RESTORE_INT_REG_CFI (s6, 22, t0)
- RESTORE_INT_REG_CFI (s7, 23, t0)
- RESTORE_INT_REG_CFI (s8, 24, t0)
- RESTORE_INT_REG_CFI (s9, 25, t0)
- RESTORE_INT_REG_CFI (s10, 26, t0)
- RESTORE_INT_REG_CFI (s11, 27, t0)
-
- jr t1
-
-99: j __syscall_error
-
-PSEUDO_END (setcontext)
-
-LEAF (start_context)
-
- /* Terminate call stack by noting ra == 0. Happily, s0 == 0 here. */
- cfi_register (ra, s0)
-
- /* Call the function passed to makecontext. */
- jalr s1
-
- /* Invoke subsequent context if present, else exit(0). */
- mv a0, s2
- beqz s2, 1f
- jal setcontext
-1: j exit
-
-PSEUDO_END (start_context)
diff --git a/libc/sysdeps/linux/riscv32/swapcontext.S b/libc/sysdeps/linux/riscv32/swapcontext.S
deleted file mode 100644
index f5e12b2db..000000000
--- a/libc/sysdeps/linux/riscv32/swapcontext.S
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Save and set current context.
- Copyright (C) 2009-2018 Free Software Foundation, Inc.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include "ucontext-macros.h"
-
-/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
-
-LEAF (swapcontext)
- mv t0, a1 /* Save ucp into t0. */
-
- SAVE_INT_REG (ra, 0, a0)
- SAVE_INT_REG (ra, 1, a0)
- SAVE_INT_REG (sp, 2, a0)
- SAVE_INT_REG (s0, 8, a0)
- SAVE_INT_REG (s1, 9, a0)
- SAVE_INT_REG (x0, 10, a0) /* return 0 by overwriting a0. */
- SAVE_INT_REG (s2, 18, a0)
- SAVE_INT_REG (s3, 19, a0)
- SAVE_INT_REG (s4, 20, a0)
- SAVE_INT_REG (s5, 21, a0)
- SAVE_INT_REG (s6, 22, a0)
- SAVE_INT_REG (s7, 23, a0)
- SAVE_INT_REG (s8, 24, a0)
- SAVE_INT_REG (s9, 25, a0)
- SAVE_INT_REG (s10, 26, a0)
- SAVE_INT_REG (s11, 27, a0)
-
-#ifndef __riscv_float_abi_soft
- frsr a1
-
- SAVE_FP_REG (fs0, 8, a0)
- SAVE_FP_REG (fs1, 9, a0)
- SAVE_FP_REG (fs2, 18, a0)
- SAVE_FP_REG (fs3, 19, a0)
- SAVE_FP_REG (fs4, 20, a0)
- SAVE_FP_REG (fs5, 21, a0)
- SAVE_FP_REG (fs6, 22, a0)
- SAVE_FP_REG (fs7, 23, a0)
- SAVE_FP_REG (fs8, 24, a0)
- SAVE_FP_REG (fs9, 25, a0)
- SAVE_FP_REG (fs10, 26, a0)
- SAVE_FP_REG (fs11, 27, a0)
-
- sw a1, MCONTEXT_FSR(a0)
-#endif /* __riscv_float_abi_soft */
-
-/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, &oucp->uc_sigmask, _NSIG8) */
- li a3, _NSIG8
- add a2, a0, UCONTEXT_SIGMASK
- add a1, t0, UCONTEXT_SIGMASK
- li a0, SIG_SETMASK
-
- li a7, SYS_ify (rt_sigprocmask)
- scall
-
- bltz a0, 99f
-
-#ifndef __riscv_float_abi_soft
- lw t1, MCONTEXT_FSR(t0)
-
- RESTORE_FP_REG (fs0, 8, t0)
- RESTORE_FP_REG (fs1, 9, t0)
- RESTORE_FP_REG (fs2, 18, t0)
- RESTORE_FP_REG (fs3, 19, t0)
- RESTORE_FP_REG (fs4, 20, t0)
- RESTORE_FP_REG (fs5, 21, t0)
- RESTORE_FP_REG (fs6, 22, t0)
- RESTORE_FP_REG (fs7, 23, t0)
- RESTORE_FP_REG (fs8, 24, t0)
- RESTORE_FP_REG (fs9, 25, t0)
- RESTORE_FP_REG (fs10, 26, t0)
- RESTORE_FP_REG (fs11, 27, t0)
-
- fssr t1
-#endif /* __riscv_float_abi_soft */
-
- /* Note the contents of argument registers will be random
- unless makecontext() has been called. */
- RESTORE_INT_REG (t1, 0, t0)
- RESTORE_INT_REG (ra, 1, t0)
- RESTORE_INT_REG (sp, 2, t0)
- RESTORE_INT_REG (s0, 8, t0)
- RESTORE_INT_REG (s1, 9, t0)
- RESTORE_INT_REG (a0, 10, t0)
- RESTORE_INT_REG (a1, 11, t0)
- RESTORE_INT_REG (a2, 12, t0)
- RESTORE_INT_REG (a3, 13, t0)
- RESTORE_INT_REG (a4, 14, t0)
- RESTORE_INT_REG (a5, 15, t0)
- RESTORE_INT_REG (a6, 16, t0)
- RESTORE_INT_REG (a7, 17, t0)
- RESTORE_INT_REG (s2, 18, t0)
- RESTORE_INT_REG (s3, 19, t0)
- RESTORE_INT_REG (s4, 20, t0)
- RESTORE_INT_REG (s5, 21, t0)
- RESTORE_INT_REG (s6, 22, t0)
- RESTORE_INT_REG (s7, 23, t0)
- RESTORE_INT_REG (s8, 24, t0)
- RESTORE_INT_REG (s9, 25, t0)
- RESTORE_INT_REG (s10, 26, t0)
- RESTORE_INT_REG (s11, 27, t0)
-
- jr t1
-
-
-99: j __syscall_error
-
-PSEUDO_END (swapcontext)
diff --git a/libc/sysdeps/linux/riscv64/bits/fcntl.h b/libc/sysdeps/linux/riscv64/bits/fcntl.h
index a9d7c84e0..fdfb1805d 100644
--- a/libc/sysdeps/linux/riscv64/bits/fcntl.h
+++ b/libc/sysdeps/linux/riscv64/bits/fcntl.h
@@ -229,3 +229,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/riscv64/getcontext.S b/libc/sysdeps/linux/riscv64/getcontext.S
deleted file mode 100644
index 0b9e7c2d3..000000000
--- a/libc/sysdeps/linux/riscv64/getcontext.S
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Save current context.
- Copyright (C) 2009-2018 Free Software Foundation, Inc.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include "ucontext-macros.h"
-
-/* int getcontext (ucontext_t *ucp) */
-
- .text
-LEAF (getcontext)
- SAVE_INT_REG (ra, 0, a0)
- SAVE_INT_REG (ra, 1, a0)
- SAVE_INT_REG (sp, 2, a0)
- SAVE_INT_REG (s0, 8, a0)
- SAVE_INT_REG (s1, 9, a0)
- SAVE_INT_REG (x0, 10, a0) /* return 0 by overwriting a0. */
- SAVE_INT_REG (s2, 18, a0)
- SAVE_INT_REG (s3, 19, a0)
- SAVE_INT_REG (s4, 20, a0)
- SAVE_INT_REG (s5, 21, a0)
- SAVE_INT_REG (s6, 22, a0)
- SAVE_INT_REG (s7, 23, a0)
- SAVE_INT_REG (s8, 24, a0)
- SAVE_INT_REG (s9, 25, a0)
- SAVE_INT_REG (s10, 26, a0)
- SAVE_INT_REG (s11, 27, a0)
-
-#ifndef __riscv_float_abi_soft
- frsr a1
-
- SAVE_FP_REG (fs0, 8, a0)
- SAVE_FP_REG (fs1, 9, a0)
- SAVE_FP_REG (fs2, 18, a0)
- SAVE_FP_REG (fs3, 19, a0)
- SAVE_FP_REG (fs4, 20, a0)
- SAVE_FP_REG (fs5, 21, a0)
- SAVE_FP_REG (fs6, 22, a0)
- SAVE_FP_REG (fs7, 23, a0)
- SAVE_FP_REG (fs8, 24, a0)
- SAVE_FP_REG (fs9, 25, a0)
- SAVE_FP_REG (fs10, 26, a0)
- SAVE_FP_REG (fs11, 27, a0)
-
- sw a1, MCONTEXT_FSR(a0)
-#endif /* __riscv_float_abi_soft */
-
-/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
- li a3, _NSIG8
- add a2, a0, UCONTEXT_SIGMASK
- mv a1, zero
- li a0, SIG_BLOCK
-
- li a7, SYS_ify (rt_sigprocmask)
- scall
- bltz a0, 99f
-
- ret
-
-99: j __syscall_error
-
-PSEUDO_END (getcontext)
diff --git a/libc/sysdeps/linux/riscv64/setcontext.S b/libc/sysdeps/linux/riscv64/setcontext.S
deleted file mode 100644
index 15cc17bd8..000000000
--- a/libc/sysdeps/linux/riscv64/setcontext.S
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Set current context.
- Copyright (C) 2009-2018 Free Software Foundation, Inc.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include "ucontext-macros.h"
-
-/* int __setcontext (const ucontext_t *ucp)
-
- Restores the machine context in UCP and thereby resumes execution
- in that context.
-
- This implementation is intended to be used for *synchronous* context
- switches only. Therefore, it does not have to restore anything
- other than the PRESERVED state. */
-
- .text
-LEAF (setcontext)
-
- mv t0, a0 /* Save ucp into t0. */
-
-/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, NULL, _NSIG8) */
- li a3, _NSIG8
- mv a2, zero
- add a1, a0, UCONTEXT_SIGMASK
- li a0, SIG_SETMASK
-
- li a7, SYS_ify (rt_sigprocmask)
- scall
-
- bltz a0, 99f
-
- cfi_def_cfa (t0, 0)
-
-#ifndef __riscv_float_abi_soft
- lw t1, MCONTEXT_FSR(t0)
-
- RESTORE_FP_REG_CFI (fs0, 8, t0)
- RESTORE_FP_REG_CFI (fs1, 9, t0)
- RESTORE_FP_REG_CFI (fs2, 18, t0)
- RESTORE_FP_REG_CFI (fs3, 19, t0)
- RESTORE_FP_REG_CFI (fs4, 20, t0)
- RESTORE_FP_REG_CFI (fs5, 21, t0)
- RESTORE_FP_REG_CFI (fs6, 22, t0)
- RESTORE_FP_REG_CFI (fs7, 23, t0)
- RESTORE_FP_REG_CFI (fs8, 24, t0)
- RESTORE_FP_REG_CFI (fs9, 25, t0)
- RESTORE_FP_REG_CFI (fs10, 26, t0)
- RESTORE_FP_REG_CFI (fs11, 27, t0)
-
- fssr t1
-#endif /* __riscv_float_abi_soft */
-
- /* Note the contents of argument registers will be random
- unless makecontext() has been called. */
- RESTORE_INT_REG (t1, 0, t0)
- RESTORE_INT_REG_CFI (ra, 1, t0)
- RESTORE_INT_REG (sp, 2, t0)
- RESTORE_INT_REG_CFI (s0, 8, t0)
- RESTORE_INT_REG_CFI (s1, 9, t0)
- RESTORE_INT_REG (a0, 10, t0)
- RESTORE_INT_REG (a1, 11, t0)
- RESTORE_INT_REG (a2, 12, t0)
- RESTORE_INT_REG (a3, 13, t0)
- RESTORE_INT_REG (a4, 14, t0)
- RESTORE_INT_REG (a5, 15, t0)
- RESTORE_INT_REG (a6, 16, t0)
- RESTORE_INT_REG (a7, 17, t0)
- RESTORE_INT_REG_CFI (s2, 18, t0)
- RESTORE_INT_REG_CFI (s3, 19, t0)
- RESTORE_INT_REG_CFI (s4, 20, t0)
- RESTORE_INT_REG_CFI (s5, 21, t0)
- RESTORE_INT_REG_CFI (s6, 22, t0)
- RESTORE_INT_REG_CFI (s7, 23, t0)
- RESTORE_INT_REG_CFI (s8, 24, t0)
- RESTORE_INT_REG_CFI (s9, 25, t0)
- RESTORE_INT_REG_CFI (s10, 26, t0)
- RESTORE_INT_REG_CFI (s11, 27, t0)
-
- jr t1
-
-99: j __syscall_error
-
-PSEUDO_END (setcontext)
-
-LEAF (start_context)
-
- /* Terminate call stack by noting ra == 0. Happily, s0 == 0 here. */
- cfi_register (ra, s0)
-
- /* Call the function passed to makecontext. */
- jalr s1
-
- /* Invoke subsequent context if present, else exit(0). */
- mv a0, s2
- beqz s2, 1f
- jal setcontext
-1: j exit
-
-PSEUDO_END (start_context)
diff --git a/libc/sysdeps/linux/riscv64/swapcontext.S b/libc/sysdeps/linux/riscv64/swapcontext.S
deleted file mode 100644
index f5e12b2db..000000000
--- a/libc/sysdeps/linux/riscv64/swapcontext.S
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Save and set current context.
- Copyright (C) 2009-2018 Free Software Foundation, Inc.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include "ucontext-macros.h"
-
-/* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
-
-LEAF (swapcontext)
- mv t0, a1 /* Save ucp into t0. */
-
- SAVE_INT_REG (ra, 0, a0)
- SAVE_INT_REG (ra, 1, a0)
- SAVE_INT_REG (sp, 2, a0)
- SAVE_INT_REG (s0, 8, a0)
- SAVE_INT_REG (s1, 9, a0)
- SAVE_INT_REG (x0, 10, a0) /* return 0 by overwriting a0. */
- SAVE_INT_REG (s2, 18, a0)
- SAVE_INT_REG (s3, 19, a0)
- SAVE_INT_REG (s4, 20, a0)
- SAVE_INT_REG (s5, 21, a0)
- SAVE_INT_REG (s6, 22, a0)
- SAVE_INT_REG (s7, 23, a0)
- SAVE_INT_REG (s8, 24, a0)
- SAVE_INT_REG (s9, 25, a0)
- SAVE_INT_REG (s10, 26, a0)
- SAVE_INT_REG (s11, 27, a0)
-
-#ifndef __riscv_float_abi_soft
- frsr a1
-
- SAVE_FP_REG (fs0, 8, a0)
- SAVE_FP_REG (fs1, 9, a0)
- SAVE_FP_REG (fs2, 18, a0)
- SAVE_FP_REG (fs3, 19, a0)
- SAVE_FP_REG (fs4, 20, a0)
- SAVE_FP_REG (fs5, 21, a0)
- SAVE_FP_REG (fs6, 22, a0)
- SAVE_FP_REG (fs7, 23, a0)
- SAVE_FP_REG (fs8, 24, a0)
- SAVE_FP_REG (fs9, 25, a0)
- SAVE_FP_REG (fs10, 26, a0)
- SAVE_FP_REG (fs11, 27, a0)
-
- sw a1, MCONTEXT_FSR(a0)
-#endif /* __riscv_float_abi_soft */
-
-/* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, &oucp->uc_sigmask, _NSIG8) */
- li a3, _NSIG8
- add a2, a0, UCONTEXT_SIGMASK
- add a1, t0, UCONTEXT_SIGMASK
- li a0, SIG_SETMASK
-
- li a7, SYS_ify (rt_sigprocmask)
- scall
-
- bltz a0, 99f
-
-#ifndef __riscv_float_abi_soft
- lw t1, MCONTEXT_FSR(t0)
-
- RESTORE_FP_REG (fs0, 8, t0)
- RESTORE_FP_REG (fs1, 9, t0)
- RESTORE_FP_REG (fs2, 18, t0)
- RESTORE_FP_REG (fs3, 19, t0)
- RESTORE_FP_REG (fs4, 20, t0)
- RESTORE_FP_REG (fs5, 21, t0)
- RESTORE_FP_REG (fs6, 22, t0)
- RESTORE_FP_REG (fs7, 23, t0)
- RESTORE_FP_REG (fs8, 24, t0)
- RESTORE_FP_REG (fs9, 25, t0)
- RESTORE_FP_REG (fs10, 26, t0)
- RESTORE_FP_REG (fs11, 27, t0)
-
- fssr t1
-#endif /* __riscv_float_abi_soft */
-
- /* Note the contents of argument registers will be random
- unless makecontext() has been called. */
- RESTORE_INT_REG (t1, 0, t0)
- RESTORE_INT_REG (ra, 1, t0)
- RESTORE_INT_REG (sp, 2, t0)
- RESTORE_INT_REG (s0, 8, t0)
- RESTORE_INT_REG (s1, 9, t0)
- RESTORE_INT_REG (a0, 10, t0)
- RESTORE_INT_REG (a1, 11, t0)
- RESTORE_INT_REG (a2, 12, t0)
- RESTORE_INT_REG (a3, 13, t0)
- RESTORE_INT_REG (a4, 14, t0)
- RESTORE_INT_REG (a5, 15, t0)
- RESTORE_INT_REG (a6, 16, t0)
- RESTORE_INT_REG (a7, 17, t0)
- RESTORE_INT_REG (s2, 18, t0)
- RESTORE_INT_REG (s3, 19, t0)
- RESTORE_INT_REG (s4, 20, t0)
- RESTORE_INT_REG (s5, 21, t0)
- RESTORE_INT_REG (s6, 22, t0)
- RESTORE_INT_REG (s7, 23, t0)
- RESTORE_INT_REG (s8, 24, t0)
- RESTORE_INT_REG (s9, 25, t0)
- RESTORE_INT_REG (s10, 26, t0)
- RESTORE_INT_REG (s11, 27, t0)
-
- jr t1
-
-
-99: j __syscall_error
-
-PSEUDO_END (swapcontext)
diff --git a/libc/sysdeps/linux/sh/bits/fcntl.h b/libc/sysdeps/linux/sh/bits/fcntl.h
index 0d687f04f..4ae682425 100644
--- a/libc/sysdeps/linux/sh/bits/fcntl.h
+++ b/libc/sysdeps/linux/sh/bits/fcntl.h
@@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/sparc/bits/fcntl.h b/libc/sysdeps/linux/sparc/bits/fcntl.h
index 935495937..35224cdb3 100644
--- a/libc/sysdeps/linux/sparc/bits/fcntl.h
+++ b/libc/sysdeps/linux/sparc/bits/fcntl.h
@@ -252,3 +252,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/sparc/bits/stat.h b/libc/sysdeps/linux/sparc/bits/stat.h
index b88885fe2..0fbef8b3f 100644
--- a/libc/sysdeps/linux/sparc/bits/stat.h
+++ b/libc/sysdeps/linux/sparc/bits/stat.h
@@ -53,7 +53,7 @@ struct stat
#else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -93,7 +93,7 @@ struct stat64
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/libc/sysdeps/linux/sparc64/bits/fcntl.h b/libc/sysdeps/linux/sparc64/bits/fcntl.h
index 395c95baf..00e91a671 100644
--- a/libc/sysdeps/linux/sparc64/bits/fcntl.h
+++ b/libc/sysdeps/linux/sparc64/bits/fcntl.h
@@ -248,3 +248,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/sparc64/bits/stat.h b/libc/sysdeps/linux/sparc64/bits/stat.h
index 8516b159c..62b48b745 100644
--- a/libc/sysdeps/linux/sparc64/bits/stat.h
+++ b/libc/sysdeps/linux/sparc64/bits/stat.h
@@ -58,7 +58,7 @@ struct stat
#else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -101,7 +101,7 @@ struct stat64
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/libc/sysdeps/linux/tile/bits/fcntl.h b/libc/sysdeps/linux/tile/bits/fcntl.h
index 818da5c4a..28fda899d 100644
--- a/libc/sysdeps/linux/tile/bits/fcntl.h
+++ b/libc/sysdeps/linux/tile/bits/fcntl.h
@@ -229,3 +229,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h
index 3547a2046..821b2e3cc 100644
--- a/libc/sysdeps/linux/x86_64/bits/fcntl.h
+++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h
@@ -259,3 +259,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/x86_64/bits/stat.h b/libc/sysdeps/linux/x86_64/bits/stat.h
index a7412c8f9..a8c75feaa 100644
--- a/libc/sysdeps/linux/x86_64/bits/stat.h
+++ b/libc/sysdeps/linux/x86_64/bits/stat.h
@@ -77,7 +77,7 @@ struct stat
#else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -138,7 +138,7 @@ struct stat64
#endif
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/libc/sysdeps/linux/xtensa/bits/fcntl.h b/libc/sysdeps/linux/xtensa/bits/fcntl.h
index 5af9d2124..9bc5fa893 100644
--- a/libc/sysdeps/linux/xtensa/bits/fcntl.h
+++ b/libc/sysdeps/linux/xtensa/bits/fcntl.h
@@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/xtensa/bits/stat.h b/libc/sysdeps/linux/xtensa/bits/stat.h
index 045a017fd..43af825ec 100644
--- a/libc/sysdeps/linux/xtensa/bits/stat.h
+++ b/libc/sysdeps/linux/xtensa/bits/stat.h
@@ -54,7 +54,7 @@ struct stat
unsigned long __pad2;
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -94,7 +94,7 @@ struct stat64
unsigned long __pad2;
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the