diff mbox

[RFC5,v6,00/21] ILP32 for ARM64

Message ID mvmoaa8dwre.fsf@hawking.suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Andreas Schwab March 21, 2016, 9:07 a.m. UTC
This patch may fix a few LTP tests.

Andreas.

Comments

Arnd Bergmann March 21, 2016, 9:43 a.m. UTC | #1
On Monday 21 March 2016 10:07:49 Andreas Schwab wrote:
> This patch may fix a few LTP tests.
> 

Thanks for analyzing.

> diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
> index 3631903..d1010db 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
> @@ -25,18 +25,29 @@
>  #define __O_NOFOLLOW	0100000
>  #define __O_DIRECT	0200000
>  
> -#define __O_LARGEFILE	0
> +#ifdef __ILP32__
> +# define __O_LARGEFILE	0400000
> +#else
> +# define __O_LARGEFILE	0
> +#endif
>  

I guess this means I screwed up when I said I'd merged the kernel patch
that Yury did to fix it, sorry about that.

We need the patch to make all new architecture in the kernel default to
O_LARGEFILE, and not do this in user space. I'd suggest now to keep the
patches as part of the ILP32 series after all, to make sure they are
merged at the point when they are needed.

> +#ifndef __ILP32__
>  # define F_GETLK64	5
>  # define F_SETLK64	6
>  # define F_SETLKW64	7
> +#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.  */
>    };

This looks like there is another bug as well, but I think this is in
libc, not in the kernel. I'm sure we had discussed this at some point
but I forgot what the outcome was. Defining 'struct flock' to have a
32-bit l_start and l_len member cannot be right if the kernel only
supports 64-bit offsets.

My guess is that the libc should either not define __off_t at all for
ILP32, and always use __off64_t in struct flock, or __off_t should
be defined as __kernel_loff_t a.k.a. long long so the #ifdef can be
avoided.

What exactly do you need to define F_GETLK64 for on LP64?

	Arnd
Andreas Schwab March 21, 2016, 10:52 a.m. UTC | #2
Arnd Bergmann <arnd@arndb.de> writes:

> What exactly do you need to define F_GETLK64 for on LP64?

To override the generic definitions.

Andreas.
Arnd Bergmann March 21, 2016, 5:02 p.m. UTC | #3
On Monday 21 March 2016 11:52:54 Andreas Schwab wrote:
> Arnd Bergmann <arnd@arndb.de> writes:
> 
> > What exactly do you need to define F_GETLK64 for on LP64?
> 
> To override the generic definitions.


Ok, got it. I misread that part as adding definitions for LP64, but it
is correctly removing the definitions for ILP32.

	Arnd
Yury Norov March 21, 2016, 6:40 p.m. UTC | #4
On Mon, Mar 21, 2016 at 10:07:49AM +0100, Andreas Schwab wrote:
> This patch may fix a few LTP tests.
> 
> Andreas.
> 
> diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
> index 3631903..d1010db 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
> @@ -25,18 +25,29 @@
>  #define __O_NOFOLLOW	0100000
>  #define __O_DIRECT	0200000
>  
> -#define __O_LARGEFILE	0
> +#ifdef __ILP32__
> +# define __O_LARGEFILE	0400000
> +#else
> +# define __O_LARGEFILE	0
> +#endif
>  
> +#ifndef __ILP32__
>  # define F_GETLK64	5
>  # define F_SETLK64	6
>  # define F_SETLKW64	7
> +#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.  */
>    };
>  
> -- 
> 2.7.3
> 
> -- 
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

Hi Andreas,

Thank you for your patch. It seems like it fixed a couple of tests.
I applied it to the library branch. Current list of fails is like this:
float_bessel                   FAIL       137
float_exp_log                  FAIL       137
float_iperb                    FAIL       137
float_power                    FAIL       137
float_trigo                    FAIL       137
pipeio_3                       FAIL       5
abort01                        FAIL       2
clone02                        FAIL       4
kill10                         FAIL       2
kill11                         FAIL       2
mmap16                         FAIL       6
nftw01                         FAIL       1
nftw6401                       FAIL       1
open12                         FAIL       2
pathconf01                     FAIL       1
profil01                       FAIL       1
rename11                       FAIL       2
rmdir02                        FAIL       2
umount2_01                     FAIL       2
umount2_02                     FAIL       2
umount2_03                     FAIL       2
utime06                        FAIL       2
mtest06                        FAIL       11

Yury.
diff mbox

Patch

diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
index 3631903..d1010db 100644
--- a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h
@@ -25,18 +25,29 @@ 
 #define __O_NOFOLLOW	0100000
 #define __O_DIRECT	0200000
 
-#define __O_LARGEFILE	0
+#ifdef __ILP32__
+# define __O_LARGEFILE	0400000
+#else
+# define __O_LARGEFILE	0
+#endif
 
+#ifndef __ILP32__
 # define F_GETLK64	5
 # define F_SETLK64	6
 # define F_SETLKW64	7
+#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.  */
   };