qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stat64 wrong on sparc64 user


From: Thomas Huth
Subject: Re: stat64 wrong on sparc64 user
Date: Tue, 28 Mar 2023 14:41:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0

On 28/03/2023 14.22, Luca Bonissi wrote:
On 28/03/23 13:55, Thomas Huth wrote:
On 28/03/2023 13.48, Luca Bonissi wrote:
--- qemu-20230327/linux-user/syscall_defs.h    2023-03-27 15:41:42.000000000 +0200 +++ qemu-20230327/linux-user/syscall_defs.h.new    2023-03-27 21:43:25.615115126 +0200
@@ -1450,7 +1450,7 @@ struct target_stat {
      unsigned int    st_dev;
      abi_ulong    st_ino;
      unsigned int    st_mode;
-    unsigned int    st_nlink;
+    short int    st_nlink;
      unsigned int    st_uid;

That looks wrong at a first glance. IIRC Sparc is a very strictly aligned architecture, so if the previous field "st_mode" was aligned to a 4-byte boundary, the "st_uid" field now would not be aligned anymore... are you sure about this change? Maybe it needs a padding field now?

The padding is automatic (either on Sparc or x86-64): short will be aligned to 2-byte boundary, int will be aligned to 4-byte boundary, long will be aligned to 8-byte boundary.

Ah, right, I blindly assumed that we were using __attribute__((packed)) here for such structs... but that does not seem to be the case, so never mind.

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]