On 12/25/25 19:36, Jean-Christian CÎRSTEA wrote:
Previously, 64-bit file offsets (loff_t) were printed using `print_raw_param()`
function, which led to silent truncation of the upper part. This commit fixes
this issue by adding two helper functions:

1. print_file_offset32(): prints 32-bit file offsets (off_t)
2. print_file_offset64(): prints 64-bit file offsets (loff_t)

*NOTE*: checkpatch.pl gives the following errors:

```
ERROR: externs should be avoided in .c files
#30: FILE: linux-user/strace.c:88:
+UNUSED void print_file_offset32(abi_long offset, int);

ERROR: storage class should be at the beginning of the declaration
#31: FILE: linux-user/strace.c:89:
+UNUSED static void print_file_offset64(abi_long low, abi_long high, int);
```

The errors are may be removed if `UNUSED` and `static` are switched. Should this
patch fix this and swap all `UNUSED`s and `static`s?

I'd ignore the checkpatch warning for your patch.
If a switch is done (and wanted), please send it later in a seperate patch.
Signed-off-by: Jean-Christian CÎRSTEA <[email protected]>
---
  linux-user/strace.c | 38 ++++++++++++++++++++++++++++----------
  1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/linux-user/strace.c b/linux-user/strace.c
index 758c5d32b6..f790cab4da 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -85,6 +85,8 @@ UNUSED static void print_enums(const struct enums *, 
abi_long, int);
  UNUSED static void print_at_dirfd(abi_long, int);
  UNUSED static void print_file_mode(abi_long, int);
  UNUSED static void print_open_flags(abi_long, int);
+UNUSED void print_file_offset32(abi_long offset, int);

^ shouldn't it be static too?

+UNUSED static void print_file_offset64(abi_long low, abi_long high, int);

I think it's wrong to have "low" and "high" here.
This very much depends if this is on big-endian or little-endian machines.
See definition of target_offset64() in linux-user/user-internals.h.
There it's called word0 and word1, which is probably better.

Overall your patch seems ok.
Did you test it on little- and big-endian machines?

Helge

Reply via email to