aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/bits/fcntl.h
diff options
context:
space:
mode:
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>2022-10-19 19:14:31 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-12-07 14:40:52 -0300
commit9d53dc48e885da95b60a12c1cbbce8d3ca5d7598 (patch)
tree2c36e000d33d050132f7aec9b13c6547944ef206 /sysdeps/unix/sysv/linux/bits/fcntl.h
parentfea7abbc23d47e5d4f4077dcee0aa35a8ce66800 (diff)
downloadglibc-9d53dc48e885da95b60a12c1cbbce8d3ca5d7598.tar
glibc-9d53dc48e885da95b60a12c1cbbce8d3ca5d7598.tar.gz
glibc-9d53dc48e885da95b60a12c1cbbce8d3ca5d7598.tar.bz2
glibc-9d53dc48e885da95b60a12c1cbbce8d3ca5d7598.zip
Linux: Make generic fcntl.h the default one
It is currently used for csky, arc, nios2, and or1k. Newer 64 bit architecture, like riscv32 and loongarch, reimplement it to override F_GETLK64/F_SETLK64/F_SETLKW64. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps/unix/sysv/linux/bits/fcntl.h')
-rw-r--r--sysdeps/unix/sysv/linux/bits/fcntl.h56
1 files changed, 54 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/bits/fcntl.h b/sysdeps/unix/sysv/linux/bits/fcntl.h
index be40350e82..112ee96df5 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl.h
@@ -1,3 +1,55 @@
-/* bits/fcntl.h is architecture specific. */
-#error "This file must be supplied by every Linux architecture."
+/* O_*, F_*, FD_* bit values for the generic Linux ABI.
+ Copyright (C) 2011-2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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.h> directly; include <fcntl.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __O_LARGEFILE 0
+#endif
+
+struct flock
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+#ifndef __USE_FILE_OFFSET64
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+#else
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#endif
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+#endif
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>