[28/30] Linux: Make generic fcntl.h the default one
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
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.
---
sysdeps/unix/sysv/linux/bits/fcntl.h | 56 +++++++++++++++++++-
sysdeps/unix/sysv/linux/generic/bits/fcntl.h | 55 -------------------
2 files changed, 54 insertions(+), 57 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/generic/bits/fcntl.h
Comments
On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> 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.
LGTM.
No regressions on x86_64 and i686.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
> ---
> sysdeps/unix/sysv/linux/bits/fcntl.h | 56 +++++++++++++++++++-
> sysdeps/unix/sysv/linux/generic/bits/fcntl.h | 55 -------------------
> 2 files changed, 54 insertions(+), 57 deletions(-)
> delete mode 100644 sysdeps/unix/sysv/linux/generic/bits/fcntl.h
>
> 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>
OK. Move generic to linux. Flattens the structure and one less file to maintain.
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/fcntl.h b/sysdeps/unix/sysv/linux/generic/bits/fcntl.h
> deleted file mode 100644
> index 112ee96df5..0000000000
> --- a/sysdeps/unix/sysv/linux/generic/bits/fcntl.h
> +++ /dev/null
> @@ -1,55 +0,0 @@
> -/* 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>
@@ -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>
deleted file mode 100644
@@ -1,55 +0,0 @@
-/* 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>