]> granicus.if.org Git - strace/commitdiff
Implement decoding of preadv2 and pwritev2 syscalls
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 11 May 2016 00:42:10 +0000 (00:42 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 11 May 2016 00:58:06 +0000 (00:58 +0000)
* io.c: Include "xlat/rwf_flags.h".
(do_preadv, do_pwritev, SYS_FUNC(preadv2), SYS_FUNC(pwritev2)):
New functions.
(SYS_FUNC(preadv)): Use do_preadv.
(SYS_FUNC(pwritev)): Use do_pwritev.
* linux/32/syscallent.h (preadv2, pwritev2): New entries.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* syscall.c (dumpio): Handle SEN_preadv2 and SEN_pwritev2.
* xlat/rwf_flags.in: New file.
* NEWS: Mention parsers of new syscalls.

22 files changed:
NEWS
io.c
linux/32/syscallent.h
linux/64/syscallent.h
linux/arm/syscallent.h
linux/hppa/syscallent.h
linux/i386/syscallent.h
linux/ia64/syscallent.h
linux/m68k/syscallent.h
linux/mips/syscallent-n32.h
linux/mips/syscallent-n64.h
linux/mips/syscallent-o32.h
linux/powerpc/syscallent.h
linux/powerpc64/syscallent.h
linux/s390/syscallent.h
linux/s390x/syscallent.h
linux/sparc/syscallent.h
linux/sparc64/syscallent.h
linux/x32/syscallent.h
linux/x86_64/syscallent.h
syscall.c
xlat/rwf_flags.in [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 08e23093c64b4b734efb48f7f0c517f6b7d44d85..e12fb4592325229f569336293f371ab212a0c4ac 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,8 +10,9 @@ Noteworthy changes in release ?.?? (????-??-??)
   * Added decoding of bind, listen, and setsockopt direct syscalls on sparc.
   * Implemented caching of netlink conversations to reduce amount of time
     spent in decoding socket details in -yy mode.
-  * Implemented decoding of copy_file_range syscall.
-  * Implemented dumping of preadv, pwritev, and vmsplice syscalls.
+  * Implemented decoding of copy_file_range, preadv2, and pwritev2 syscalls.
+  * Implemented dumping of preadv, preadv2, pwritev, pwritev2, and vmsplice
+    syscalls.
   * Updated lists of ioctl commands from Linux 4.5.
 
 * Bug fixes
diff --git a/io.c b/io.c
index a52904cfc8074881eadbfa9f3d10a48ce9ef9199..3c4ef592f1d376c3f176ad8a8cbbf778040c7083 100644 (file)
--- a/io.c
+++ b/io.c
@@ -207,7 +207,10 @@ print_lld_from_low_high_val(struct tcb *tcp, int arg)
 #endif
 }
 
-SYS_FUNC(preadv)
+#include "xlat/rwf_flags.h"
+
+static int
+do_preadv(struct tcb *tcp, const int flags_arg)
 {
        if (entering(tcp)) {
                printfd(tcp, tcp->u_arg[0]);
@@ -217,21 +220,50 @@ SYS_FUNC(preadv)
                                tcp->u_rval);
                tprintf(", %lu, ", tcp->u_arg[2]);
                print_lld_from_low_high_val(tcp, 3);
+               if (flags_arg >= 0) {
+                       tprints(", ");
+                       printflags(rwf_flags, tcp->u_arg[flags_arg], "RWF_???");
+               }
        }
        return 0;
 }
 
-SYS_FUNC(pwritev)
+SYS_FUNC(preadv)
+{
+       return do_preadv(tcp, -1);
+}
+
+SYS_FUNC(preadv2)
+{
+       return do_preadv(tcp, 5);
+}
+
+static int
+do_pwritev(struct tcb *tcp, const int flags_arg)
 {
        printfd(tcp, tcp->u_arg[0]);
        tprints(", ");
        tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
        tprintf(", %lu, ", tcp->u_arg[2]);
        print_lld_from_low_high_val(tcp, 3);
+       if (flags_arg >= 0) {
+               tprints(", ");
+               printflags(rwf_flags, tcp->u_arg[flags_arg], "RWF_???");
+       }
 
        return RVAL_DECODED;
 }
 
+SYS_FUNC(pwritev)
+{
+       return do_pwritev(tcp, -1);
+}
+
+SYS_FUNC(pwritev2)
+{
+       return do_pwritev(tcp, 5);
+}
+
 #include "xlat/splice_flags.h"
 
 SYS_FUNC(tee)
index 03874ac81cfc8bf98d5a55630ffea7e36a9d33c6..9c864855827ce43677d15fae3167ed09070ae0d9 100644 (file)
 [283] = { 2,   0,              SEN(membarrier),                "membarrier",           },
 [284] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [285] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[286] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[287] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
 
 #undef sys_ARCH_mmap
 #undef ARCH_WANT_SYNC_FILE_RANGE2
index fc78605fa5abb9b0aa6261371cc1b2984e8e153b..55c011cf280bc6980cf530d03553146f3ed80f63 100644 (file)
 [283] = { 2,   0,              SEN(membarrier),                "membarrier",           },
 [284] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [285] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[286] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[287] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
index 526055184e17c7e5446ee6136054fea095d12bf8..18910e4ba9a126ca2a0a592993ece1ec320dfca4 100644 (file)
 [389] = { 2,   0,              SEN(membarrier),                "membarrier",           },
 [390] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [391] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[392] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[393] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
 
 #ifdef __ARM_EABI__
 # define ARM_FIRST_SHUFFLED_SYSCALL 400
index a22e73e716bc8f54ea9bc1a6fcadfc31fc11c79b..49280479f3d4e599a996164d7020f70b1879c4fb 100644 (file)
 [344] = { 1,   TD,             SEN(userfaultfd),               "userfaultfd",          },
 [345] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [346] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[347] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[348] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
index 1bba2e7303a5ef8dbeb6110622e11c1d7971658d..d6175fae5460b74e58c960ca55dd73464b0c3e88 100644 (file)
 [375] = { 2,   0,              SEN(membarrier),                "membarrier",           },
 [376] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [377] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[378] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[379] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
 
 #define SYS_socket_subcall     400
 #include "subcall.h"
index 911e21f329dde389e8cc7f101149197df6bdc5e6..713cab89484938b357a5484cb323e556dbde7578 100644 (file)
 [1345] = { 5,  0,              SEN(kcmp),                      "kcmp"                  },
 [1346] = { 3,  TM,             SEN(mlock2),                    "mlock2"                },
 [1347] = { 6,  TD,             SEN(copy_file_range),           "copy_file_range"       },
+[1348] = { 6,  TD,             SEN(preadv2),                   "preadv2"               },
+[1349] = { 6,  TD,             SEN(pwritev2),                  "pwritev2"              },
index a7652e3338b6c896bdbf361bea95709ba0936c1e..0f4895c5d216d2a05685181786247dfc761cb68e 100644 (file)
 [374] = { 2,   0,              SEN(membarrier),                "membarrier",           },
 [375] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [376] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[377] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[378] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
 
 #define SYS_socket_subcall     400
 #include "subcall.h"
index 9084fda719600fe3a4b8b20f40be8649281b3b5b..398b12c9027543f307e696d64190dcf77e35b4bb 100644 (file)
 [6322] = { 2,  0,              SEN(membarrier),                "membarrier",           },
 [6323] = { 3,  TM,             SEN(mlock2),                    "mlock2"                },
 [6324] = { 6,  TD,             SEN(copy_file_range),           "copy_file_range"       },
+[6325] = { 6,  TD,             SEN(preadv2),                   "preadv2"               },
+[6326] = { 6,  TD,             SEN(pwritev2),                  "pwritev2"              },
 
 # define SYS_socket_subcall      6400
 # include "subcall.h"
index c1ecddd66b69774b5c624356edb659db9bcdd4db..7321f0e7ab212b38f801ce3a2dce6e13795786b6 100644 (file)
 [5318] = { 2,  0,              SEN(membarrier),                "membarrier",           },
 [5319] = { 3,  TM,             SEN(mlock2),                    "mlock2"                },
 [5320] = { 6,  TD,             SEN(copy_file_range),           "copy_file_range"       },
+[5321] = { 6,  TD,             SEN(preadv2),                   "preadv2"               },
+[5322] = { 6,  TD,             SEN(pwritev2),                  "pwritev2"              },
 
 # define SYS_socket_subcall      5400
 # include "subcall.h"
index f65be7022f74f4dc04838c5bdbc8d138f8b49712..cb8afb963e235ea7baecbbc986cf59d65076dee1 100644 (file)
 [4358] = { 2,  0,              SEN(membarrier),                "membarrier",           },
 [4359] = { 3,  TM,             SEN(mlock2),                    "mlock2"                },
 [4360] = { 6,  TD,             SEN(copy_file_range),           "copy_file_range"       },
+[4361] = { 6,  TD,             SEN(preadv2),                   "preadv2"               },
+[4362] = { 6,  TD,             SEN(pwritev2),                  "pwritev2"              },
 
 # define SYS_socket_subcall      4400
 # include "subcall.h"
index d4c9402ce6f627d68d231a6a199fe594a9ab0a8d..b6dfb850a47849ae20bcdc39ed62ddb5ba6ed8d7 100644 (file)
 [377] = { 3,   TI,             SEN(shmctl),                    "shmctl"                },
 [378] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [379] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[380] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[381] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
 
 #define SYS_socket_subcall     400
 #include "subcall.h"
index 1239a6f2ae40bfb97ab87d9dc2481ab49a6f3b12..e0c18af4bfcec906be14dde20c70b9e24b3d367f 100644 (file)
 [377] = { 3,   TI,             SEN(shmctl),                    "shmctl"                },
 [378] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [379] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[380] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[381] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
 
 #define SYS_socket_subcall     400
 #include "subcall.h"
index 92b5c9c68ce89c90c3dc5572fd2a97a5132748c2..af300e977ccd902f8ac19d71a98ecf2cf26855cd 100644 (file)
 [373] = { 2,   TN,             SEN(shutdown),                  "shutdown"              },
 [374] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [375] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[376] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[377] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
 
 #define SYS_socket_subcall     400
 #include "subcall.h"
index fcbe69dd5dab822004ed09f1b85cef7ba2f44964..f41f2eb8fc7d51c18e729756bfe690b28552f012 100644 (file)
 [373] = { 2,   TN,             SEN(shutdown),                  "shutdown"              },
 [374] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [375] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[376] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[377] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
 
 #define SYS_socket_subcall     400
 #include "subcall.h"
index 89b22247e4f7283e8daf84fe5bcf7a74d91eb365..ec86f7e7292fd4fe480fd262a55f97c0169035b8 100644 (file)
 [355] = { 5,   TN,             SEN(setsockopt),                "setsockopt"            },
 [356] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [357] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[358] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[359] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
 
 #define SYS_socket_subcall     400
 #include "subcall.h"
index 23de9c9b7ebad2ebefafe31ad5bab48c75c8878f..8bf5c3a487f4d47d5bc3cc89858b5cd400a20f10 100644 (file)
 [355] = { 5,   TN,             SEN(setsockopt),                "setsockopt"            },
 [356] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [357] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[358] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[359] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
 
 #define SYS_socket_subcall     400
 #include "subcall.h"
index 5ef4a667259672d2267d54a316c10df65c1c6f4b..965a5dcc5de37096e3737f5f196685a109d06a3f 100644 (file)
 [324] = { 2,   0,              SEN(membarrier),                "membarrier",           },
 [325] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [326] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[327] = { 6,   TD,             SEN(printargs),                 "64:preadv2"            },
+[328] = { 6,   TD,             SEN(printargs),                 "64:pwritev2"           },
 [327 ... 511] = { },
 /*
  * x32-specific system call numbers start at 512 to avoid cache impact
index 52d73bf0ee90d765560c1088cc4569ef81405f24..265d55f08846c51bb596e8f93ebce7e3f8269f0c 100644 (file)
 [324] = { 2,   0,              SEN(membarrier),                "membarrier",           },
 [325] = { 3,   TM,             SEN(mlock2),                    "mlock2"                },
 [326] = { 6,   TD,             SEN(copy_file_range),           "copy_file_range"       },
+[327] = { 6,   TD,             SEN(preadv2),                   "preadv2"               },
+[328] = { 6,   TD,             SEN(pwritev2),                  "pwritev2"              },
index 6c5119f37a08956101a5d34575510577bb513a10..d71ead340e80fcdd1a0854a72beb085a0995c595 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -686,6 +686,7 @@ dumpio(struct tcb *tcp)
                        return;
                case SEN_readv:
                case SEN_preadv:
+               case SEN_preadv2:
                        dumpiov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1],
                                     tcp->u_rval);
                        return;
@@ -707,6 +708,7 @@ dumpio(struct tcb *tcp)
                        break;
                case SEN_writev:
                case SEN_pwritev:
+               case SEN_pwritev2:
                case SEN_vmsplice:
                        dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
                        break;
diff --git a/xlat/rwf_flags.in b/xlat/rwf_flags.in
new file mode 100644 (file)
index 0000000..2f97916
--- /dev/null
@@ -0,0 +1 @@
+RWF_HIPRI 1