Force use of SYS_open on aarch64 as well
authorPetr Machata <pmachata@apm-mustang-ev2-02.ml3.eng.bos.redhat.com>
Fri, 31 Jan 2014 00:42:16 +0000 (19:42 -0500)
committerChanho Park <chanho61.park@samsung.com>
Fri, 22 Aug 2014 11:38:24 +0000 (20:38 +0900)
- That system call is not implemented on aarch64, but we don't
  care, we are only calling it to see if the parameters get decoded
  properly.  So call using the "syscall" wrapper, and hard-code
  SYS_open value on aarch64, where glibc doesn't define it.

testsuite/ltrace.main/system_call_params.exp

index 787e342..2ccf840 100644 (file)
@@ -1,5 +1,5 @@
 # This file is part of ltrace.
-# Copyright (C) 2013 Petr Machata, Red Hat Inc.
+# Copyright (C) 2013, 2014 Petr Machata, Red Hat Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
 # 02110-1301 USA
 
 set bin [ltraceCompile {} [ltraceSource c {
+    #define _GNU_SOURCE
     #include <sys/types.h>
     #include <sys/stat.h>
     #include <fcntl.h>
+    #include <unistd.h>
+    #include <sys/syscall.h>   /* For SYS_xxx definitions */
+
+    #ifndef SYS_open
+    # if defined(__aarch64__)
+    #  /* Linux doesn't actually implement SYS_open on AArch64, but for merely
+    #   * recording the syscall, it's fine.  */
+    #  define SYS_open 1024
+    # else
+    #  error SYS_open not available.
+    # endif
+    #endif
+
     int main(void) {
-       open("/some/path", O_RDONLY);
+       syscall(SYS_open, "/some/path", O_RDONLY);
        write(1, "something", 10);
        mount("source", "target", "filesystemtype", 0, 0);
     }