Skip to contentSkip to conversation

Enable strace for TARGET_NR_llseek

PATCH In review Taylor Simpson 2 participants 2 messages Mar 16, 2020 – Mar 17, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Enable strace for TARGET_NR_llseek

linux-user/syscall.c handles the case where TARGET_NR_llseek (one underscore) is defined and TARGET_NR__llseek (two underscores)

    /* Newer kernel ports have llseek() instead of _llseek() */
    #if defined(TARGET_NR_llseek) && !defined(TARGET_NR__llseek)
    #define TARGET_NR__llseek TARGET_NR_llseek
    #endif

Unfortunately, strace will print "Unknown syscall" in this case. This patch fixes that problem.

---
 linux-user/strace.c    | 2 +-
 linux-user/strace.list | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
linux-user/strace.c +1 -1
index 4f7130b..4bcc00b 100644
@@ -1667,7 +1667,7 @@ print_linkat(const struct syscallname *name,
 }
 #endif
 
-#ifdef TARGET_NR__llseek
+#ifdef defined(TARGET_NR__llseek) || defined(TARGET_NR_llseek)
 static void
 print__llseek(const struct syscallname *name,
     abi_long arg0, abi_long arg1, abi_long arg2,
linux-user/strace.list +3 -0
index d49a1e9..5a01e95 100644
@@ -503,6 +503,9 @@
 #ifdef TARGET_NR__llseek
 { TARGET_NR__llseek, "_llseek" , NULL, print__llseek, NULL },
 #endif
+#ifdef TARGET_NR_llseek
+{ TARGET_NR_llseek, "_llseek" , NULL, print__llseek, NULL },
+#endif
 #ifdef TARGET_NR_lock
 { TARGET_NR_lock, "lock" , NULL, NULL, NULL },
 #endif
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 35 lines · Taylor Simpson

linux-user/syscall.c handles the case where TARGET_NR_llseek (one underscore) is defined and TARGET_NR__llseek (two underscores)

     /* Newer kernel ports have llseek() instead of _llseek() */
     #if defined(TARGET_NR_llseek) && !defined(TARGET_NR__llseek)
     #define TARGET_NR__llseek TARGET_NR_llseek
     #endif

Unfortunately, strace will print "Unknown syscall" in this case. This patch fixes that problem.

---
  linux-user/strace.c    | 2 +-
  linux-user/strace.list | 3 +++
  2 files changed, 4 insertions(+), 1 deletion(-)
linux-user/strace.c +1 -1
index 4f7130b..4bcc00b 100644
@@ -1667,7 +1667,7 @@ print_linkat(const struct syscallname *name,
  }
  #endif
 
-#ifdef TARGET_NR__llseek
+#ifdef defined(TARGET_NR__llseek) || defined(TARGET_NR_llseek)
  static void
  print__llseek(const struct syscallname *name,
      abi_long arg0, abi_long arg1, abi_long arg2,
linux-user/strace.list +0 -0
index d49a1e9..5a01e95 100644

linux-user/strace.list line 511

Quoted 9 lines
linux-user/strace.list +3 -0
@@ -503,6 +503,9 @@
  #ifdef TARGET_NR__llseek
  { TARGET_NR__llseek, "_llseek" , NULL, print__llseek, NULL },
  #endif
+#ifdef TARGET_NR_llseek
+{ TARGET_NR_llseek, "_llseek" , NULL, print__llseek, NULL },
+#endif
  #ifdef TARGET_NR_lock
  { TARGET_NR_lock, "lock" , NULL, NULL, NULL },
  #endif