From nobody Tue May 14 10:06:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=syrmia.com) ARC-Seal: i=2; a=rsa-sha256; t=1597164669; cv=pass; d=zohomail.com; s=zohoarc; b=PC7UOAeqIwE15TbYb1l1n2N0EIwumr0+4OfCjWNRmN07Um1hktH+SWuCWK9nW1kT8u18WH12BZ9wN5BSThj/AcLzoDHChnbs0UGEu5SEIEvzBprVi62gE8brH5xghRyoiWi96Ym9ZIcZrUu/IvWPEl/eOGB1MfxnX+hNV2Yb/dY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597164669; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6zd3h0nigB7ypzVhSlAKMUsFUbL7huBDdkZN7HGFuSc=; b=fduOHTVZQ4/emZpRHFiSpxwAVrtYWEDaYC6flXHLuSZwCKhPEWPniAoFQPQknQ6RQnXfipp5+vRgc0dH8XQFn3R7c5cK0Wy/JKQ1raEPvU+Ok22BnOcibfzpgqd6W+8rx4qbClEtXIuJK36T0csaXym19zVGPTLoKvkYBVF73DE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=syrmia.com) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597164669151254.69340824552376; Tue, 11 Aug 2020 09:51:09 -0700 (PDT) Received: from localhost ([::1]:36554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5XUN-0000cK-CS for importer@patchew.org; Tue, 11 Aug 2020 12:51:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5XPv-0003y7-Bv for qemu-devel@nongnu.org; Tue, 11 Aug 2020 12:46:28 -0400 Received: from mail-eopbgr50105.outbound.protection.outlook.com ([40.107.5.105]:15741 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5XPs-0002xQ-1D for qemu-devel@nongnu.org; Tue, 11 Aug 2020 12:46:27 -0400 Received: from VE1PR03MB5246.eurprd03.prod.outlook.com (2603:10a6:802:a1::22) by VI1PR03MB3662.eurprd03.prod.outlook.com (2603:10a6:803:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.22; Tue, 11 Aug 2020 16:46:08 +0000 Received: from VE1PR03MB5246.eurprd03.prod.outlook.com ([fe80::3568:5b4f:ab6b:e362]) by VE1PR03MB5246.eurprd03.prod.outlook.com ([fe80::3568:5b4f:ab6b:e362%6]) with mapi id 15.20.3261.024; Tue, 11 Aug 2020 16:46:07 +0000 Received: from localhost.localdomain (147.91.217.235) by LO3P123CA0008.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16 via Frontend Transport; Tue, 11 Aug 2020 16:46:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RGNDkPQ+OavKp+ts9vM2ASTg58ije9xVg5ikYCmtBrWDXvaZEMXxCKx6ehD22dpWYU5F/wTuJDUYB9D1loYiJ3JhTzTGVQP+4NJ+AmzJJAC55fSCGj1pL5OjCQETFjJYt1fDO+iASwBLUOcknHANNZHrH2Z6YZuh1hzMPCa4GmGaxClBjp/L6fbwYY3KtycrulyXDiLbM7uvToaEJGVyix7q38O3CGNA1oY+OdNvLmKUDqeJw4RQYFV7fiMS566SJ3qbHpx9loHaH+jR/1/Erk4qkr5XQ/oZLVzmE6D4rHbiiBsFuXBZ2HcbMV/20NX4AQ/K9le72JpFp3hvw68KcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6zd3h0nigB7ypzVhSlAKMUsFUbL7huBDdkZN7HGFuSc=; b=T1yFWBgwj/NltPBvTQjLBiCw0+7jj6d8muAPDFXcj+qf1msr7jnNkHezPu9FtlNQ4rs0MSsBDQgt4MD9Hv0UOqYwfnN6MaAU4FQqs6FzbnyN3P3hM9V50kzUFUKdgutIIgG4YC+I+OChmJWqmIAK8+LzaBMq0E5vZQvtEp3tABFq6V3wNRtOtoEjFufZ2OUX75YtG3+zVezGM27zX6CwYh+YuaGNl7WPCo92FZ2qIkT2Ce+1ZR50tAW9UWqwitSDbsE8s/n51yOHVVs2GzhUDBAqJ7eMP977ntmORAvQbN3Vb1gfJnB2c9Kh6CpUf6spo7sfcLIqF9tTiyirNtC/sA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6zd3h0nigB7ypzVhSlAKMUsFUbL7huBDdkZN7HGFuSc=; b=Pi2eDTC41v+HYkqUc10iuMGrVLWLeac9WVN2MICG75ZYD+Kw8wrVUUu4naXZqEC/MG178guBuL03DhvmOSQ6Nxi3Smf909C7FPIrzqZ+s5NA74Zg/Mp+k2UZACUyw4jSq3vIyI1rHQaqB++gTdFPVJ27BaEtgpDkc/4XLrjUThE= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=syrmia.com; From: Filip Bozuta To: qemu-devel@nongnu.org Subject: [PATCH v4 1/5] linux-user: Make cpu_env accessible in strace.c Date: Tue, 11 Aug 2020 18:45:49 +0200 Message-Id: <20200811164553.27713-2-Filip.Bozuta@syrmia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200811164553.27713-1-Filip.Bozuta@syrmia.com> References: <20200811164553.27713-1-Filip.Bozuta@syrmia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO3P123CA0008.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::13) To VE1PR03MB5246.eurprd03.prod.outlook.com (2603:10a6:802:a1::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [147.91.217.235] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 084e9ec0-b727-4e1a-b5e5-08d83e160b42 X-MS-TrafficTypeDiagnostic: VI1PR03MB3662: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R3mYwogPFqloGQDy51N7wD8uYYnGgVsekuMZwOKeLBk7bw+o50/SQX8IDTbflTgA1lnpE1xVuhDJNLkmYk2InA86GkkmX/N48LsWCcev6jeFNVk25JD5O0pnL5137TbLLN0Ap/6nZwop43OvGMuRoVPWbZtkGLztD7Qq/9UC24t4NHaVDOAXyxxrs+c3CwXSYzX8LICKuIlBV3YB3piXTwW7DshtLHuW+EhAOh9Hh2RtxqzX7BAbNbtp/3coxSC1Ngc4J2/3TW7HmZ9WCf5aDgOPPSPgBKuAHBgBcNDMBXJ5wwDUlNfwCbFuBAnRkDs7SRoQ66RCkSJzPI3a/u5Qo4GYSfu2TNShdHt2yLjc8ZBP65YsubcdXyug7u1KX+pl3cb6l/F5RyOCPpK22W9dd2mcCmcoBdrSD0Je1o6nDqI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR03MB5246.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(346002)(376002)(396003)(366004)(39830400003)(136003)(956004)(2906002)(508600001)(6512007)(186003)(52116002)(16526019)(66556008)(66946007)(26005)(83380400001)(6666004)(1076003)(30864003)(66476007)(6506007)(86362001)(54906003)(8936002)(4326008)(107886003)(36756003)(316002)(6916009)(5660300002)(8676002)(6486002)(69590400007)(2616005)(21314003)(579004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: wbAlg5m/FrUsXrRSjetvm1/3xhTXnQNnDqxcjiHMYGJirWMSffMZYFWc1bVTVLP4xTlRWQM5Ge6G4NipjVM4yThYg3Am6CpxpQL6CAVmZEWg63iVAq+ieAbVQx7+1iaeYNkq31mlV0BOwgADOUdnlRmDTk8weYhGiTiLPeBkbL7BTFiugxPBdcBwUZUSVnD1PTNS1OOaBv7rAU4vpPd0zppPb/36IF8XYXORGwl76reM4UcTzQ63RYOWTdOAHThVL/J3ZbDzUvAFsydga5r5rYeSsIzpa7h5tKIGKvTWxWAis2Tc3PtI+Ju9dddpa3mDCNQbMLB24tNwvZF6EB9kyAxqj4zNnx5V8BQZ9i+VgkzTsAV2CTTSOXMglrAOeVQg4b/WceptEBMIpA2N0x8xEQuNJlK4XqLMlGo1TYe6mODf6A5ojFdp01ctHdu/tKSCKrJzudFNYCspM/q+7I/4L8V6WFEh5ddgOcHBEmSYzLWkEzI4hTfTxOqvTdo7F+3DFAfPNg1IXkglvVqvXbcbVOYCqeh4PwMzpjUAw85xu++7DxprO6JVdPIF53jr2Fo99OS7Ghiy/gWUbgpiXOadegaRXGXs2lSlE/oNyJzzdh5/aHQP50W0vYdKqS6UfIWt2qRtFjE72TA+Ii75cUsDTw== X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 084e9ec0-b727-4e1a-b5e5-08d83e160b42 X-MS-Exchange-CrossTenant-AuthSource: VE1PR03MB5246.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2020 16:46:07.8245 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CWQNBQqatIkTestvvts5f3THn+fNNs4/D/5qnka09I1O3r93e2C47hNCa6TP6RuCq23YlY5V0SRX7NxuDoHl+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB3662 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.5.105; envelope-from=Filip.Bozuta@syrmia.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 12:46:08 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Filip Bozuta Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @syrmia.com) Content-Type: text/plain; charset="utf-8" Variable "cpu_env" is used in file "syscall.c" to store the information about the cpu environment. This variable is used because values of some syscalls can vary between cpu architectures. This patch makes the "cpu_env" accessible in "strace.c" so it can enable aproppriate "-strace" argument printing for these syscalls. This will be a useful addition for future "-strace" implementation in QEMU. Implementation notes: Functions "print_syscall()" and "print_syscall_ret()" which are stated and defined in "qemu.h" and "strace.c" respectively are used to print syscall arguments before and after syscall execution. These functions were changed with addition of a new argument "void *cpu_env". Strucute "struct syscallname" in "strace.c" is used to store the information about syscalls. Fields "call" and "result" represent pointers to functions which are used to print syscall arguments before and after execution. These fields were also changed with addition of a new "void *" argumetn. Also, all defined "print_*" and "print_syscall_ret*" functions in "strace.c" were changed to have the new "void *cpu_env". This was done to not cause build errors (even though none of these functions use this argument). Signed-off-by: Filip Bozuta Reviewed-by: Laurent Vivier --- linux-user/qemu.h | 4 +- linux-user/strace.c | 479 ++++++++++++++++++++++--------------------- linux-user/syscall.c | 5 +- 3 files changed, 247 insertions(+), 241 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 5c964389c1..63ddfe86fd 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -400,10 +400,10 @@ extern long safe_syscall_base(int *pending, long numb= er, ...); int host_to_target_waitstatus(int status); =20 /* strace.c */ -void print_syscall(int num, +void print_syscall(void *cpu_env, int num, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6); -void print_syscall_ret(int num, abi_long ret, +void print_syscall_ret(void *cpu_env, int num, abi_long ret, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6); /** diff --git a/linux-user/strace.c b/linux-user/strace.c index 13981341b3..f0624b6206 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -16,10 +16,10 @@ struct syscallname { int nr; const char *name; const char *format; - void (*call)(const struct syscallname *, + void (*call)(void *, const struct syscallname *, abi_long, abi_long, abi_long, abi_long, abi_long, abi_long); - void (*result)(const struct syscallname *, abi_long, + void (*result)(void *, const struct syscallname *, abi_long, abi_long, abi_long, abi_long, abi_long, abi_long, abi_long); }; @@ -634,7 +634,7 @@ print_clockid(int clockid, int last) /* select */ #ifdef TARGET_NR__newselect static void -print_newselect(const struct syscallname *name, +print_newselect(void *cpu_env, const struct syscallname *name, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6) { @@ -652,7 +652,7 @@ print_newselect(const struct syscallname *name, =20 #ifdef TARGET_NR_semctl static void -print_semctl(const struct syscallname *name, +print_semctl(void *cpu_env, const struct syscallname *name, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6) { @@ -664,7 +664,7 @@ print_semctl(const struct syscallname *name, #endif =20 static void -print_execve(const struct syscallname *name, +print_execve(void *cpu_env, const struct syscallname *name, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6) { @@ -697,7 +697,7 @@ print_execve(const struct syscallname *name, =20 #ifdef TARGET_NR_ipc static void -print_ipc(const struct syscallname *name, +print_ipc(void *cpu_env, const struct syscallname *name, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6) { @@ -741,9 +741,10 @@ print_syscall_err(abi_long ret) } =20 static void -print_syscall_ret_addr(const struct syscallname *name, abi_long ret, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_syscall_ret_addr(void *cpu_env, const struct syscallname *name, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5) { if (!print_syscall_err(ret)) { qemu_log("0x" TARGET_ABI_FMT_lx, ret); @@ -761,9 +762,10 @@ print_syscall_ret_raw(struct syscallname *name, abi_lo= ng ret) =20 #ifdef TARGET_NR__newselect static void -print_syscall_ret_newselect(const struct syscallname *name, abi_long ret, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_syscall_ret_newselect(void *cpu_env, const struct syscallname *name, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5) { if (!print_syscall_err(ret)) { qemu_log(" =3D 0x" TARGET_ABI_FMT_lx " (", ret); @@ -790,9 +792,10 @@ print_syscall_ret_newselect(const struct syscallname *= name, abi_long ret, #define TARGET_TIME_ERROR 5 /* clock not synchronized */ #ifdef TARGET_NR_adjtimex static void -print_syscall_ret_adjtimex(const struct syscallname *name, abi_long ret, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_syscall_ret_adjtimex(void *cpu_env, const struct syscallname *name, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5) { if (!print_syscall_err(ret)) { qemu_log(TARGET_ABI_FMT_ld, ret); @@ -825,9 +828,10 @@ print_syscall_ret_adjtimex(const struct syscallname *n= ame, abi_long ret, #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \ || defined(TARGGET_NR_flistxattr) static void -print_syscall_ret_listxattr(const struct syscallname *name, abi_long ret, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_syscall_ret_listxattr(void *cpu_env, const struct syscallname *name, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5) { if (!print_syscall_err(ret)) { qemu_log(TARGET_ABI_FMT_ld, ret); @@ -856,9 +860,10 @@ print_syscall_ret_listxattr(const struct syscallname *= name, abi_long ret, =20 #ifdef TARGET_NR_ioctl static void -print_syscall_ret_ioctl(const struct syscallname *name, abi_long ret, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_syscall_ret_ioctl(void *cpu_env, const struct syscallname *name, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5) { if (!print_syscall_err(ret)) { qemu_log(TARGET_ABI_FMT_ld, ret); @@ -1420,9 +1425,9 @@ print_timezone(abi_ulong tz_addr, int last) =20 #ifdef TARGET_NR_accept static void -print_accept(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_accept(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -1434,9 +1439,9 @@ print_accept(const struct syscallname *name, =20 #ifdef TARGET_NR_access static void -print_access(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_access(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -1447,9 +1452,9 @@ print_access(const struct syscallname *name, =20 #ifdef TARGET_NR_acct static void -print_acct(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_acct(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 1); @@ -1459,9 +1464,9 @@ print_acct(const struct syscallname *name, =20 #ifdef TARGET_NR_brk static void -print_brk(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_brk(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_pointer(arg0, 1); @@ -1471,9 +1476,9 @@ print_brk(const struct syscallname *name, =20 #ifdef TARGET_NR_chdir static void -print_chdir(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_chdir(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 1); @@ -1483,9 +1488,9 @@ print_chdir(const struct syscallname *name, =20 #ifdef TARGET_NR_chroot static void -print_chroot(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_chroot(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 1); @@ -1495,9 +1500,9 @@ print_chroot(const struct syscallname *name, =20 #ifdef TARGET_NR_chmod static void -print_chmod(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_chmod(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -1508,9 +1513,9 @@ print_chmod(const struct syscallname *name, =20 #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown) static void -print_chown(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_chown(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -1523,9 +1528,9 @@ print_chown(const struct syscallname *name, =20 #ifdef TARGET_NR_clock_adjtime static void -print_clock_adjtime(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_clock_adjtime(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_clockid(arg0, 0); @@ -1547,9 +1552,9 @@ static void do_print_clone(unsigned int flags, abi_ul= ong newsp, } =20 static void -print_clone(const struct syscallname *name, - abi_long arg1, abi_long arg2, abi_long arg3, - abi_long arg4, abi_long arg5, abi_long arg6) +print_clone(void *cpu_env, const struct syscallname *name, + abi_long arg1, abi_long arg2, abi_long arg3, + abi_long arg4, abi_long arg5, abi_long arg6) { print_syscall_prologue(name); #if defined(TARGET_MICROBLAZE) @@ -1567,9 +1572,9 @@ print_clone(const struct syscallname *name, =20 #ifdef TARGET_NR_creat static void -print_creat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_creat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -1580,9 +1585,9 @@ print_creat(const struct syscallname *name, =20 #ifdef TARGET_NR_execv static void -print_execv(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_execv(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -1593,9 +1598,9 @@ print_execv(const struct syscallname *name, =20 #ifdef TARGET_NR_faccessat static void -print_faccessat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_faccessat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -1608,9 +1613,9 @@ print_faccessat(const struct syscallname *name, =20 #ifdef TARGET_NR_fallocate static void -print_fallocate(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_fallocate(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -1628,9 +1633,9 @@ print_fallocate(const struct syscallname *name, =20 #ifdef TARGET_NR_fchmodat static void -print_fchmodat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_fchmodat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -1643,9 +1648,9 @@ print_fchmodat(const struct syscallname *name, =20 #ifdef TARGET_NR_fchownat static void -print_fchownat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_fchownat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -1659,9 +1664,9 @@ print_fchownat(const struct syscallname *name, =20 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64) static void -print_fcntl(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_fcntl(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -1758,9 +1763,9 @@ print_fcntl(const struct syscallname *name, =20 #ifdef TARGET_NR_fgetxattr static void -print_fgetxattr(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_fgetxattr(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -1773,9 +1778,9 @@ print_fgetxattr(const struct syscallname *name, =20 #ifdef TARGET_NR_flistxattr static void -print_flistxattr(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_flistxattr(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -1787,9 +1792,9 @@ print_flistxattr(const struct syscallname *name, =20 #if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr) static void -print_getxattr(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_getxattr(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -1803,9 +1808,9 @@ print_getxattr(const struct syscallname *name, =20 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) static void -print_listxattr(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_listxattr(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -1818,9 +1823,9 @@ print_listxattr(const struct syscallname *name, =20 #if defined(TARGET_NR_fremovexattr) static void -print_fremovexattr(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_fremovexattr(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -1831,9 +1836,9 @@ print_fremovexattr(const struct syscallname *name, =20 #if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr) static void -print_removexattr(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_removexattr(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -1845,9 +1850,9 @@ print_removexattr(const struct syscallname *name, =20 #ifdef TARGET_NR_futimesat static void -print_futimesat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_futimesat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -1860,9 +1865,9 @@ print_futimesat(const struct syscallname *name, =20 #ifdef TARGET_NR_settimeofday static void -print_settimeofday(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_settimeofday(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_timeval(arg0, 0); @@ -1873,9 +1878,9 @@ print_settimeofday(const struct syscallname *name, =20 #ifdef TARGET_NR_link static void -print_link(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_link(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -1886,9 +1891,9 @@ print_link(const struct syscallname *name, =20 #ifdef TARGET_NR_linkat static void -print_linkat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_linkat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -1902,9 +1907,9 @@ print_linkat(const struct syscallname *name, =20 #ifdef TARGET_NR__llseek static void -print__llseek(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print__llseek(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { const char *whence =3D "UNKNOWN"; print_syscall_prologue(name); @@ -1924,9 +1929,9 @@ print__llseek(const struct syscallname *name, =20 #ifdef TARGET_NR_lseek static void -print_lseek(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_lseek(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -1955,7 +1960,7 @@ print_lseek(const struct syscallname *name, =20 #if defined(TARGET_NR_socket) static void -print_socket(const struct syscallname *name, +print_socket(void *cpu_env, const struct syscallname *name, abi_long arg0, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5) { @@ -2304,7 +2309,7 @@ static struct { }; =20 static void -print_socketcall(const struct syscallname *name, +print_socketcall(void *cpu_env, const struct syscallname *name, abi_long arg0, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5) { @@ -2325,7 +2330,7 @@ print_socketcall(const struct syscallname *name, =20 #if defined(TARGET_NR_bind) static void -print_bind(const struct syscallname *name, +print_bind(void *cpu_env, const struct syscallname *name, abi_long arg0, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5) { @@ -2339,9 +2344,9 @@ print_bind(const struct syscallname *name, #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \ defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) static void -print_stat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_stat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2355,9 +2360,9 @@ print_stat(const struct syscallname *name, =20 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64) static void -print_fstat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_fstat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -2369,9 +2374,9 @@ print_fstat(const struct syscallname *name, =20 #ifdef TARGET_NR_mkdir static void -print_mkdir(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_mkdir(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2382,9 +2387,9 @@ print_mkdir(const struct syscallname *name, =20 #ifdef TARGET_NR_mkdirat static void -print_mkdirat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_mkdirat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -2396,9 +2401,9 @@ print_mkdirat(const struct syscallname *name, =20 #ifdef TARGET_NR_rmdir static void -print_rmdir(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_rmdir(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2408,9 +2413,9 @@ print_rmdir(const struct syscallname *name, =20 #ifdef TARGET_NR_rt_sigaction static void -print_rt_sigaction(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_rt_sigaction(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_signal(arg0, 0); @@ -2422,9 +2427,9 @@ print_rt_sigaction(const struct syscallname *name, =20 #ifdef TARGET_NR_rt_sigprocmask static void -print_rt_sigprocmask(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_rt_sigprocmask(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { const char *how =3D "UNKNOWN"; print_syscall_prologue(name); @@ -2442,9 +2447,9 @@ print_rt_sigprocmask(const struct syscallname *name, =20 #ifdef TARGET_NR_rt_sigqueueinfo static void -print_rt_sigqueueinfo(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_rt_sigqueueinfo(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { void *p; target_siginfo_t uinfo; @@ -2467,9 +2472,9 @@ print_rt_sigqueueinfo(const struct syscallname *name, =20 #ifdef TARGET_NR_rt_tgsigqueueinfo static void -print_rt_tgsigqueueinfo(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_rt_tgsigqueueinfo(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { void *p; target_siginfo_t uinfo; @@ -2551,9 +2556,9 @@ print_syslog_action(abi_ulong arg, int last) } =20 static void -print_syslog(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_syslog(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_syslog_action(arg0, 0); @@ -2565,9 +2570,9 @@ print_syslog(const struct syscallname *name, =20 #ifdef TARGET_NR_mknod static void -print_mknod(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_mknod(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { int hasdev =3D (arg1 & (S_IFCHR|S_IFBLK)); =20 @@ -2584,9 +2589,9 @@ print_mknod(const struct syscallname *name, =20 #ifdef TARGET_NR_mknodat static void -print_mknodat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_mknodat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { int hasdev =3D (arg2 & (S_IFCHR|S_IFBLK)); =20 @@ -2604,9 +2609,9 @@ print_mknodat(const struct syscallname *name, =20 #ifdef TARGET_NR_mq_open static void -print_mq_open(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_mq_open(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { int is_creat =3D (arg1 & TARGET_O_CREAT); =20 @@ -2623,9 +2628,9 @@ print_mq_open(const struct syscallname *name, =20 #ifdef TARGET_NR_open static void -print_open(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_open(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { int is_creat =3D (arg1 & TARGET_O_CREAT); =20 @@ -2640,9 +2645,9 @@ print_open(const struct syscallname *name, =20 #ifdef TARGET_NR_openat static void -print_openat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_openat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { int is_creat =3D (arg2 & TARGET_O_CREAT); =20 @@ -2658,9 +2663,9 @@ print_openat(const struct syscallname *name, =20 #ifdef TARGET_NR_mq_unlink static void -print_mq_unlink(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_mq_unlink(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 1); @@ -2670,9 +2675,9 @@ print_mq_unlink(const struct syscallname *name, =20 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat) static void -print_fstatat64(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_fstatat64(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -2686,9 +2691,9 @@ print_fstatat64(const struct syscallname *name, =20 #ifdef TARGET_NR_readlink static void -print_readlink(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_readlink(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2700,9 +2705,9 @@ print_readlink(const struct syscallname *name, =20 #ifdef TARGET_NR_readlinkat static void -print_readlinkat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_readlinkat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -2715,9 +2720,9 @@ print_readlinkat(const struct syscallname *name, =20 #ifdef TARGET_NR_rename static void -print_rename(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_rename(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2728,9 +2733,9 @@ print_rename(const struct syscallname *name, =20 #ifdef TARGET_NR_renameat static void -print_renameat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_renameat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -2743,9 +2748,9 @@ print_renameat(const struct syscallname *name, =20 #ifdef TARGET_NR_statfs static void -print_statfs(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_statfs(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2756,9 +2761,9 @@ print_statfs(const struct syscallname *name, =20 #ifdef TARGET_NR_statfs64 static void -print_statfs64(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_statfs64(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2769,9 +2774,9 @@ print_statfs64(const struct syscallname *name, =20 #ifdef TARGET_NR_symlink static void -print_symlink(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_symlink(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2782,9 +2787,9 @@ print_symlink(const struct syscallname *name, =20 #ifdef TARGET_NR_symlinkat static void -print_symlinkat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_symlinkat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2796,9 +2801,9 @@ print_symlinkat(const struct syscallname *name, =20 #ifdef TARGET_NR_mount static void -print_mount(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_mount(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2812,9 +2817,9 @@ print_mount(const struct syscallname *name, =20 #ifdef TARGET_NR_umount static void -print_umount(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_umount(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 1); @@ -2824,9 +2829,9 @@ print_umount(const struct syscallname *name, =20 #ifdef TARGET_NR_umount2 static void -print_umount2(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_umount2(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2837,9 +2842,9 @@ print_umount2(const struct syscallname *name, =20 #ifdef TARGET_NR_unlink static void -print_unlink(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_unlink(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 1); @@ -2849,9 +2854,9 @@ print_unlink(const struct syscallname *name, =20 #ifdef TARGET_NR_unlinkat static void -print_unlinkat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_unlinkat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -2863,9 +2868,9 @@ print_unlinkat(const struct syscallname *name, =20 #ifdef TARGET_NR_utime static void -print_utime(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_utime(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2876,9 +2881,9 @@ print_utime(const struct syscallname *name, =20 #ifdef TARGET_NR_utimes static void -print_utimes(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_utimes(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_string(arg0, 0); @@ -2889,9 +2894,9 @@ print_utimes(const struct syscallname *name, =20 #ifdef TARGET_NR_utimensat static void -print_utimensat(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_utimensat(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_at_dirfd(arg0, 0); @@ -2904,9 +2909,9 @@ print_utimensat(const struct syscallname *name, =20 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2) static void -print_mmap(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_mmap(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_pointer(arg0, 0); @@ -2922,9 +2927,9 @@ print_mmap(const struct syscallname *name, =20 #ifdef TARGET_NR_mprotect static void -print_mprotect(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_mprotect(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_pointer(arg0, 0); @@ -2936,9 +2941,9 @@ print_mprotect(const struct syscallname *name, =20 #ifdef TARGET_NR_munmap static void -print_munmap(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_munmap(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_pointer(arg0, 0); @@ -2989,9 +2994,9 @@ if( cmd =3D=3D val ) { \ } =20 static void -print_futex(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_futex(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_pointer(arg0, 0); @@ -3006,9 +3011,9 @@ print_futex(const struct syscallname *name, =20 #ifdef TARGET_NR_kill static void -print_kill(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_kill(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -3019,9 +3024,9 @@ print_kill(const struct syscallname *name, =20 #ifdef TARGET_NR_tkill static void -print_tkill(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_tkill(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -3032,9 +3037,9 @@ print_tkill(const struct syscallname *name, =20 #ifdef TARGET_NR_tgkill static void -print_tgkill(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) +print_tgkill(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); print_raw_param("%d", arg0, 0); @@ -3046,7 +3051,7 @@ print_tgkill(const struct syscallname *name, =20 #ifdef TARGET_NR_statx static void -print_statx(const struct syscallname *name, +print_statx(void *cpu_env, const struct syscallname *name, abi_long arg0, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5) { @@ -3062,7 +3067,7 @@ print_statx(const struct syscallname *name, =20 #ifdef TARGET_NR_ioctl static void -print_ioctl(const struct syscallname *name, +print_ioctl(void *cpu_env, const struct syscallname *name, abi_long arg0, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5) { @@ -3147,7 +3152,7 @@ static int nsyscalls =3D ARRAY_SIZE(scnames); * The public interface to this module. */ void -print_syscall(int num, +print_syscall(void *cpu_env, int num, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6) { @@ -3160,7 +3165,7 @@ print_syscall(int num, if( scnames[i].nr =3D=3D num ) { if( scnames[i].call !=3D NULL ) { scnames[i].call( - &scnames[i], arg1, arg2, arg3, arg4, arg5, arg6); + cpu_env, &scnames[i], arg1, arg2, arg3, arg4, arg5, ar= g6); } else { /* XXX: this format system is broken because it uses host types and host pointers for strings */ @@ -3176,7 +3181,7 @@ print_syscall(int num, =20 =20 void -print_syscall_ret(int num, abi_long ret, +print_syscall_ret(void *cpu_env, int num, abi_long ret, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6) { @@ -3185,7 +3190,7 @@ print_syscall_ret(int num, abi_long ret, for(i=3D0;i Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159716445999530.867507548173535; Tue, 11 Aug 2020 09:47:39 -0700 (PDT) Received: from localhost ([::1]:55208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5XR4-00056O-LN for importer@patchew.org; Tue, 11 Aug 2020 12:47:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5XPj-0003ni-Ac for qemu-devel@nongnu.org; Tue, 11 Aug 2020 12:46:15 -0400 Received: from mail-eopbgr50105.outbound.protection.outlook.com ([40.107.5.105]:15741 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5XPh-0002xQ-Ff for qemu-devel@nongnu.org; Tue, 11 Aug 2020 12:46:15 -0400 Received: from VE1PR03MB5246.eurprd03.prod.outlook.com (2603:10a6:802:a1::22) by VI1PR03MB3662.eurprd03.prod.outlook.com (2603:10a6:803:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.22; Tue, 11 Aug 2020 16:46:08 +0000 Received: from VE1PR03MB5246.eurprd03.prod.outlook.com ([fe80::3568:5b4f:ab6b:e362]) by VE1PR03MB5246.eurprd03.prod.outlook.com ([fe80::3568:5b4f:ab6b:e362%6]) with mapi id 15.20.3261.024; Tue, 11 Aug 2020 16:46:08 +0000 Received: from localhost.localdomain (147.91.217.235) by LO3P123CA0008.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16 via Frontend Transport; Tue, 11 Aug 2020 16:46:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fMO3eAVm7UF7H6b2KDFkXCqUXahwTkSn2q+n71qXVtOEsbqe79UtI8+hcxksK8wLp4kLlH9vcftAX0FXKmPLw2eNNgVZuecgbSTkR1FC/03At+p1fDQ6V+OE7qSFvwdjF4YVf1VSBnfNvFTYPRX0l06g4SZLhIFPEshwfdvvWlpoaRhkIsB9Qjc+s2Nxtco4Pe+wAE7xdp62QzgK+q6VHvciQRLOP6EiYNC43whdHI3IVvTJEXbYIMXjHvQC0WIOdo59kKgFbUJn386t6Xp27xe6xmVDDDstWTc/P/yYIOODKDgeD8rtPA5QuW0D0mmBbrNcCHeTJUiMSVE9Jf5RFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pVAJorsml/0OXlxkEkuRvBk/Ii5+nXBGPfsPBLt1KRQ=; b=mDQoLpdpYIedWAG0x/VHhlIUPPMIg/wYJLx2aFNj4yQjJKSG+7HwZwibMqiWAYrakcYqtB6mu/JIdCQ2GivLaINDKh5RX/J2YTf/EjhybT7xbMqJBgzSycIdsnm6gDt4lhd8DjA6DC5dlx1XAbbce23uvGRviaoFHxal0fChcSTm8A6yxWP/gIPnsGFm1OOaowwhK6eA+4Kn52k2mIXCWwr9z9jigBRU7xVWmOxY6h/legjoGKAOWt486PuDspN9LOiyGRm5VDzvahKbpafP/OALmbsxhuX/u2PxDM1W0etCP37Nqs+xRR5c18NBNjd7+qbtkLjvWRYtpna+o0nrjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pVAJorsml/0OXlxkEkuRvBk/Ii5+nXBGPfsPBLt1KRQ=; b=xL2+5TS8bZMrJW8DrzfoD5y6MTbIy2b0/DzaqP8oEjTgWgFeUQfvhayQh8zgHVjof5BoGoyYw209U5K8+Vyj31ZFl/ieaR070xVpoa4vbcGpkG+Q6gFg1Mk3GZeliM7Iv33y9xF26Enh5XHfDHbel+taipu2+sUYGuanIfKQks0= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=syrmia.com; From: Filip Bozuta To: qemu-devel@nongnu.org Subject: [PATCH v4 2/5] linux-user: Add strace support for printing arguments of truncate()/ftruncate() and getsid() Date: Tue, 11 Aug 2020 18:45:50 +0200 Message-Id: <20200811164553.27713-3-Filip.Bozuta@syrmia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200811164553.27713-1-Filip.Bozuta@syrmia.com> References: <20200811164553.27713-1-Filip.Bozuta@syrmia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO3P123CA0008.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::13) To VE1PR03MB5246.eurprd03.prod.outlook.com (2603:10a6:802:a1::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [147.91.217.235] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c079c073-1bc7-4214-acca-08d83e160bfd X-MS-TrafficTypeDiagnostic: VI1PR03MB3662: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ltm1l0jKi1v6h+kgXBVndvnPYumMnG7JzSaaqka4Uw0yXISufSyeVMAzeOgI9sSZbj3CFs5RjXSnNRFNkOWVcAo6ke9cWrT+BMEJP6hnCIRSrAhF1yfYz+4G35Y+aPfap/VaRoD5vCAcO5ZrY4yUvi04ShyLgTt1R4RzaalQdQDLygslmBRyLW5D9J0Oo6wGIIpUOe7GFDN5c665Thltbq4IPlwbzy4MDNupGM7q8fOzm1d1a/cW2NtYvek+liTPASqt1FNEefJOrzg+FxRxBNAs64mcg9r1r6F2HLwfByWh8SVGYsavMdjL9tnG/cmj3xa7VLjCF6U5+IzuDvhdfU6AJRx39z9uQXAj4vCxiukdQJ0HeQozdlvDDI1fv01f9GGicVXbFtODV94LDbjbVJoyyZftHpX0yNzs57qfCL6AMReCROFSV3dxZnrhRznwCjjUm/O/bTmWLbL5Ncp/xw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR03MB5246.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(346002)(376002)(396003)(366004)(39830400003)(136003)(956004)(2906002)(508600001)(6512007)(186003)(52116002)(16526019)(66556008)(66946007)(26005)(83380400001)(6666004)(1076003)(66476007)(6506007)(86362001)(54906003)(8936002)(4326008)(107886003)(966005)(36756003)(316002)(6916009)(5660300002)(8676002)(6486002)(69590400007)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 5a+QNlZm+RGKW1lGmuDo2etAo2NLmq3pcYOZ/mdQtXhqBPqgFTZ4JpuCrdB3eXK9wb/oTQ0hYsqcXqVtYPz/ot5qW4Rz4tZI8I5iUw6i6R8WAvjsaTepJmokH+Cgcqi8/RH3C0cB/FbzuIHRKtTl/q00tLd+aNVZZaBCOALdfXf++aXE0f/jUwlrtZNHRRAf8InNRoQm69+4yzChYb3RnJIDHbDtOIiIpHTPauetoSppF9IAATb9cnq/Xj/sCQA9S0lU84ArnMMzhKZFP1Xiqmu/AGtwoEHGfYuFlN37Hdn7faXFS1ImDnM3bLaOVzCQOG9TOjmllCgWSHF2/UYxJq6T5Kd/QD++/8i8kXIU23a+rWdgWm7fltjOvDpVZnz87VgUXF+k+xnZkr4KFpqcKopCL9HV16dwT298E03KqcrraQyUg4jzkK4zrqswB7o+8CAVdRJ/vDBWoCFviy+jtpAaJMv9oxAOZVN/jremHj7LafMeMfeo+guWB0CU4K7fNR0CViqeCqAJPc0pgohz/Lm2werB+3qLYrrYHMWFBGVziO6O6NLnfRLhANU5rnVUinAfA5EzChwpq9Dv2o53hzy4D01/DGdLzSzdxDGh4B3OZyR1oPMS2a1TLujzAKmHbAxC+0A/q1PLjAcKwLLSww== X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c079c073-1bc7-4214-acca-08d83e160bfd X-MS-Exchange-CrossTenant-AuthSource: VE1PR03MB5246.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2020 16:46:08.6490 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1nCsfyiLTb8jPxsaY2+kWWFtbXHFR9VU1tB05fHhqNMFgz7EMTx7P9dEorhpVnt3QEpcbWUQLFvM20XKBrIqyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB3662 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.5.105; envelope-from=Filip.Bozuta@syrmia.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 12:46:08 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Filip Bozuta Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @syrmia.com) Content-Type: text/plain; charset="utf-8" This patch implements strace argument printing functionality for following = syscalls: * truncate, ftruncate - truncate a file to a specified length int truncate/truncate64(const char *path, off_t length) int ftruncate/ftruncate64(int fd, off_t length) man page: https://man7.org/linux/man-pages/man2/truncate.2.html * getsid - get session ID pid_t getsid(pid_t pid) man page: https://man7.org/linux/man-pages/man2/getsid.2.html Implementation notes: Syscalls truncate/truncate64 take string argument types and thus a separate print function "print_truncate/print_truncate64" is stated in file "strace.list". This function is defined and implemented in "strace= .c" by using an existing function used to print string arguments: "print_st= ring()". For syscall ftruncate64, a separate printing function was also stated in "strace.c" as it requires a special kind of handling. The other syscalls have only primitive argument types, so the rest of t= he implementation was handled by stating an appropriate printing format in= file "strace.list". Function "regpairs_aligned()" was cut & pasted from "syscall.c" to "qem= u.h" as it is used by functions "print_truncate64()" and "print_ftruncate64(= )" to print the offset arguments of "truncate64()" and "ftruncate64()". Signed-off-by: Filip Bozuta Reviewed-by: Laurent Vivier --- linux-user/qemu.h | 35 +++++++++++++++++++++++++++++++ linux-user/strace.c | 47 ++++++++++++++++++++++++++++++++++++++++++ linux-user/strace.list | 10 ++++----- linux-user/syscall.c | 32 ---------------------------- 4 files changed, 87 insertions(+), 37 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 63ddfe86fd..f431805e57 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -706,6 +706,41 @@ static inline uint64_t target_offset64(uint64_t word0,= uint64_t word1) } #endif /* TARGET_ABI_BITS !=3D 32 */ =20 + +/* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers= */ +#ifdef TARGET_ARM +static inline int regpairs_aligned(void *cpu_env, int num) +{ + return ((((CPUARMState *)cpu_env)->eabi) =3D=3D 1) ; +} +#elif defined(TARGET_MIPS) && (TARGET_ABI_BITS =3D=3D 32) +static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } +#elif defined(TARGET_PPC) && !defined(TARGET_PPC64) +/* + * SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pa= irs + * of registers which translates to the same as ARM/MIPS, because we start= with + * r3 as arg1 + */ +static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } +#elif defined(TARGET_SH4) +/* SH4 doesn't align register pairs, except for p{read,write}64 */ +static inline int regpairs_aligned(void *cpu_env, int num) +{ + switch (num) { + case TARGET_NR_pread64: + case TARGET_NR_pwrite64: + return 1; + + default: + return 0; + } +} +#elif defined(TARGET_XTENSA) +static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } +#else +static inline int regpairs_aligned(void *cpu_env, int num) { return 0; } +#endif + /** * preexit_cleanup: housekeeping before the guest exits * diff --git a/linux-user/strace.c b/linux-user/strace.c index f0624b6206..7dc239b9f1 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1958,6 +1958,53 @@ print_lseek(void *cpu_env, const struct syscallname = *name, } #endif =20 +#ifdef TARGET_NR_truncate +static void +print_truncate(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_string(arg0, 0); + print_raw_param(TARGET_ABI_FMT_ld, arg1, 1); + print_syscall_epilogue(name); +} +#endif + +#ifdef TARGET_NR_truncate64 +static void +print_truncate64(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_string(arg0, 0); + if (regpairs_aligned(cpu_env, TARGET_NR_truncate64)) { + arg1 =3D arg2; + arg2 =3D arg3; + } + print_raw_param("%" PRIu64, target_offset64(arg1, arg2), 1); + print_syscall_epilogue(name); +} +#endif + +#ifdef TARGET_NR_ftruncate64 +static void +print_ftruncate64(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_raw_param("%d", arg0, 0); + if (regpairs_aligned(cpu_env, TARGET_NR_ftruncate64)) { + arg1 =3D arg2; + arg2 =3D arg3; + } + print_raw_param("%" PRIu64, target_offset64(arg1, arg2), 1); + print_syscall_epilogue(name); +} +#endif + #if defined(TARGET_NR_socket) static void print_socket(void *cpu_env, const struct syscallname *name, diff --git a/linux-user/strace.list b/linux-user/strace.list index a04706a524..8e5303d035 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -258,10 +258,10 @@ { TARGET_NR_ftime, "ftime" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_ftruncate -{ TARGET_NR_ftruncate, "ftruncate" , NULL, NULL, NULL }, +{ TARGET_NR_ftruncate, "ftruncate" , "%s(%d," TARGET_ABI_FMT_ld ")", NULL,= NULL }, #endif #ifdef TARGET_NR_ftruncate64 -{ TARGET_NR_ftruncate64, "ftruncate64" , NULL, NULL, NULL }, +{ TARGET_NR_ftruncate64, "ftruncate64" , NULL, print_ftruncate64, NULL }, #endif #ifdef TARGET_NR_futex { TARGET_NR_futex, "futex" , NULL, print_futex, NULL }, @@ -372,7 +372,7 @@ { TARGET_NR_getrusage, "getrusage" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_getsid -{ TARGET_NR_getsid, "getsid" , NULL, NULL, NULL }, +{ TARGET_NR_getsid, "getsid" , "%s(%d)", NULL, NULL }, #endif #ifdef TARGET_NR_getsockname { TARGET_NR_getsockname, "getsockname" , NULL, NULL, NULL }, @@ -1535,10 +1535,10 @@ { TARGET_NR_tkill, "tkill" , NULL, print_tkill, NULL }, #endif #ifdef TARGET_NR_truncate -{ TARGET_NR_truncate, "truncate" , NULL, NULL, NULL }, +{ TARGET_NR_truncate, "truncate" , NULL, print_truncate, NULL }, #endif #ifdef TARGET_NR_truncate64 -{ TARGET_NR_truncate64, "truncate64" , NULL, NULL, NULL }, +{ TARGET_NR_truncate64, "truncate64" , NULL, print_truncate64, NULL }, #endif #ifdef TARGET_NR_tuxcall { TARGET_NR_tuxcall, "tuxcall" , NULL, NULL, NULL }, diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cc76ac61ba..1517096a9b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -501,38 +501,6 @@ static inline int next_free_host_timer(void) } #endif =20 -/* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers= */ -#ifdef TARGET_ARM -static inline int regpairs_aligned(void *cpu_env, int num) -{ - return ((((CPUARMState *)cpu_env)->eabi) =3D=3D 1) ; -} -#elif defined(TARGET_MIPS) && (TARGET_ABI_BITS =3D=3D 32) -static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } -#elif defined(TARGET_PPC) && !defined(TARGET_PPC64) -/* SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pa= irs - * of registers which translates to the same as ARM/MIPS, because we start= with - * r3 as arg1 */ -static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } -#elif defined(TARGET_SH4) -/* SH4 doesn't align register pairs, except for p{read,write}64 */ -static inline int regpairs_aligned(void *cpu_env, int num) -{ - switch (num) { - case TARGET_NR_pread64: - case TARGET_NR_pwrite64: - return 1; - - default: - return 0; - } -} -#elif defined(TARGET_XTENSA) -static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } -#else -static inline int regpairs_aligned(void *cpu_env, int num) { return 0; } -#endif - #define ERRNO_TABLE_SIZE 1200 =20 /* target_to_host_errno_table[] is initialized from --=20 2.25.1 From nobody Tue May 14 10:06:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=syrmia.com) ARC-Seal: i=2; a=rsa-sha256; t=1597164560; cv=pass; d=zohomail.com; s=zohoarc; b=Hg0Mt18KzQLuMg7rbV4H+fGuJ8NgcfyPNbqpiKightplAlijW4frgzyi4UzzL/CfJnevp6is+NmqdzkOY8jYk+NuAR/GJq4WoqVN+tLyfaR28UcNgHqJOqOVYcw5OaITXorjx25876uPgmAN7gexngUJSA69jNmRxHVz1UKfSrg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597164560; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gfBRNnPfhhFG5rLrehU8qCTuG7mo1D2I+kvG1h0VIfI=; b=bXjugxFx/Xjc5pO3r0kqpwK+4hKJU4hIuIpJ0P0eIqdUUnnpwq6zv6rN82j5iDSDv8US8n5T8osO2iVcn5avOmOJFz1xdQ2BplmXA1bgW8Ak0+Me2+gO2pXWEJtHscMkzOX8z4Rl6txQPPwniTKC3XLcQNwd8/SBlnVbO9J3mhw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=syrmia.com) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597164560281836.4753677442313; Tue, 11 Aug 2020 09:49:20 -0700 (PDT) Received: from localhost ([::1]:60472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5XSg-0007FH-Ua for importer@patchew.org; Tue, 11 Aug 2020 12:49:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5XPl-0003qt-UR for qemu-devel@nongnu.org; Tue, 11 Aug 2020 12:46:17 -0400 Received: from mail-eopbgr50105.outbound.protection.outlook.com ([40.107.5.105]:15741 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5XPj-0002xQ-JA for qemu-devel@nongnu.org; Tue, 11 Aug 2020 12:46:17 -0400 Received: from VE1PR03MB5246.eurprd03.prod.outlook.com (2603:10a6:802:a1::22) by VI1PR03MB3662.eurprd03.prod.outlook.com (2603:10a6:803:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.22; Tue, 11 Aug 2020 16:46:09 +0000 Received: from VE1PR03MB5246.eurprd03.prod.outlook.com ([fe80::3568:5b4f:ab6b:e362]) by VE1PR03MB5246.eurprd03.prod.outlook.com ([fe80::3568:5b4f:ab6b:e362%6]) with mapi id 15.20.3261.024; Tue, 11 Aug 2020 16:46:09 +0000 Received: from localhost.localdomain (147.91.217.235) by LO3P123CA0008.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16 via Frontend Transport; Tue, 11 Aug 2020 16:46:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g+AlJdXZJRVL3UkqqO2h0eQY39kqJN0rDqGOjjTCtsy5OacGOUIYX7XmB+FpmD2pPixnaxQi4GAvcjKi/09vsLVspzddwX/PzIlCtSrtO0iiD+P9KWCHxZ61WYVUrWogjSo48ndOrSmrlfKrPBueSuud7LjRZ3qgKd4p5NWogcBz/kbMyHLXT+3AdNF6yND8bLcZWyV0qZJ71FoepY9ozEitZW4GvZL1KkjJS0w1BcVZnT01cwqENkx1KJR8VpPljRyGfnL0lZ4xd/vCf9cHIDBSRLDZs2xryHobPyj2+C1pq8a4pAfymrhTpW7kA7lLdFnjBCGIfr2x7BkRiI2iGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gfBRNnPfhhFG5rLrehU8qCTuG7mo1D2I+kvG1h0VIfI=; b=YDOgiQFdCAUjpnmmIAEv92gH+hva8yzEHjGhz1KBH09GXA02BYOspEP9RSkyS91hI52AJENPvEDSYepdnEK6W3TI2Mj26ikB+Sq8n5uv8WR31DZaRlai96KC01zZ1cF6+zWU6SW7s615bELh9UhUNL3X9zSDjVzpSKjsIhIqkIkQBUFpBmb0Y8I3/efcjKnbvFzVZG/x965fxgz5mJZ5971rJX479CBpS/m6ru4k1CznY2wAACf/JMqpwmS0CKA4xTughWaNP9JmhtsgXR6BeVcwfULJknySv8DZ/QN/LLRSR1AHohrFi3SYDmFfroUaiC+Yk2lISm9GJGJrlW0G2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gfBRNnPfhhFG5rLrehU8qCTuG7mo1D2I+kvG1h0VIfI=; b=QA22Cb6hRgXaNUeoLuugCQH/X1xCy+/c0K1uDxBiZZzlZPAia9x2SOXHLrpcjHuASp39QM6AqzsfbrO4lvGvcLWxZFwpd1ERUQGqbwduaeGEPhHxzo91xuzL8ipl5AygIz1uPyYduERi8/0vwbQN2EOUidO6E2K23/cTv+KvOx0= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=syrmia.com; From: Filip Bozuta To: qemu-devel@nongnu.org Subject: [PATCH v4 3/5] linux-user: Add strace support for printing arguments of syscalls used to lock and unlock memory Date: Tue, 11 Aug 2020 18:45:51 +0200 Message-Id: <20200811164553.27713-4-Filip.Bozuta@syrmia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200811164553.27713-1-Filip.Bozuta@syrmia.com> References: <20200811164553.27713-1-Filip.Bozuta@syrmia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO3P123CA0008.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::13) To VE1PR03MB5246.eurprd03.prod.outlook.com (2603:10a6:802:a1::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [147.91.217.235] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 26810fa0-9fbe-4758-bdf4-08d83e160c78 X-MS-TrafficTypeDiagnostic: VI1PR03MB3662: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bl41HcSzq62wogOMrC9iXntbE38cO2Yk+4Hy1EoREBuNqT7dpKidMn9LQWtGBOsBP9/dMbllOli2scWppUCqvZ0m3lyfYM1zWxHGs54sH7otifIl1gbipiLIZNhepQorqUCSRG+8coryx41uHSCBnFkvUZBBrJ9v3gZoyzpQG2/Ft/jtJzBadp9dEC4AkmNq7xrZFIvPSUhooS76KTJCIPVVDz/YXw54q7ANy4wko6qqS6ZhWEWQkgVH9sP3cQeFtwTZDE/fGeKzk/NMhv6ynT5qUE5ES9dleMbbiwH+3FBvkPgIOohvGfEH36sib+XmgKkms+/t8C0sWFqK1vimUi6fTJobDZz/DYFJWod+T+JM7sh5jnYuO0WGZS5gX/mHQ6CWnjQzkFinXx6cmuqHU6nj+OaWlZX5LlUGVXZAnrWcJiyRYvN84pDIjRTUJ/d7OAReEFa7p17bCrMdDEfLXRzxeEU/J7kaZG6Kuw9PJX4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR03MB5246.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(346002)(376002)(396003)(366004)(39830400003)(136003)(956004)(2906002)(508600001)(6512007)(186003)(52116002)(16526019)(66556008)(66946007)(26005)(83380400001)(6666004)(1076003)(30864003)(66476007)(6506007)(86362001)(54906003)(8936002)(4326008)(107886003)(966005)(36756003)(316002)(6916009)(5660300002)(8676002)(6486002)(69590400007)(2616005)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: q0/z7gGJX41oiqAZeC7pTCZpbJAxiNYz7DDB0s9rsEp88W1B+8ikC9bVI5X3V+Xe3v9OGW3A8JQ+uMYS/IWMd3+AM+dM3UHg20U6oUHbI8fw60U9lcWyx63wHCnYY+nMIbOoQT44qtQ3gCvXMI3Bc44Nzo5OesSX6XmiEPsTaZhOEHBmf2TghkpYHtVcjP1ILkPzfXnKFFLHki7jYP4wfszPWKwfdlyuyr4G71RO4dxkgotO2/Xz0yd99E2wFuMlojDN+PRPyYEuhvRjMP45DJYhSNX+1djHETChnDAYp83OpA8yHLPxcG3AcRnM/WRNwmDhjRudMUFDzL9PAF9/A2nfOHtF2poybqG8e+JRkPf5MYxsn6sqRjZdd+Y48a2lv81teZhMHR46bjbq9u54KNl3CP8oCkNbwqf1mZSKqCDUMJ/0NoCtsg45hec25nOj99iAqGQFrWvgOUwMMieeBjUMAf/KNvvXleqOAyxKuEXPlYTSMGNir9FqXejU9fQi9IFyE9xNCnEKwYeRRCwmMPVRJ9ECMAsDjgLVPu12oqkW+YXgqDlYnqQl6FPhrEFXUiCthzj5SwyEz42YgNaHrlzPBlHJ9n3mueKWOuVF9V8psRYwKGZ7TnvqG0SPpmVke4cFB1UWeHv+Gw9ZweGUlQ== X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26810fa0-9fbe-4758-bdf4-08d83e160c78 X-MS-Exchange-CrossTenant-AuthSource: VE1PR03MB5246.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2020 16:46:09.6165 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ImfBCjeDiRVsGjHOBKKI7o9K0iwJe8g2U67Du0EdE1UmLPXkkn82EwD3qujG9Pqgwoc5QC/NZcGZw1RYhmkSGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB3662 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.5.105; envelope-from=Filip.Bozuta@syrmia.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 12:46:08 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Filip Bozuta Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @syrmia.com) Content-Type: text/plain; charset="utf-8" This patch implements strace argument printing functionality for following = syscalls: * mlock, munlock, mlockall, munlockall - lock and unlock memory int mlock(const void *addr, size_t len) int munlock(const void *addr, size_t len) int mlockall(int flags) int munlockall(void) man page: https://man7.org/linux/man-pages/man2/mlock.2.html Implementation notes: Syscall mlockall() takes an argument that is composed of predefined val= ues which represent flags that determine the type of locking operation that= is to be performed. For that reason, a printing function "print_mlockall" = was stated in file "strace.list". This printing function uses an already ex= isting function "print_flags()" to print the "flags" argument. These flags ar= e stated inside an array "mlockall_flags" that contains values of type "struct f= lags". These values are instantiated using an existing macro "FLAG_TARGET()" t= hat crates aproppriate target flag values based on those defined in files '/target_syscall.h'. These target flag values were changed from "TARGET_MLOCKALL_MCL*" to "TARGET_MCL_*" so that they can be aproppriat= ely set and recognised in "strace.c" with "FLAG_TARGET()". Value for "MCL_ONFAU= LT" was added in this patch. This value was also added in "syscall.c" in fu= nction "target_to_host_mlockall_arg()". Because this flag value was added in k= ernel version 4.4, it is enwrapped in an #ifdef directive (both in "syscall.c= " and in "strace.c") as to support older kernel versions. The other syscalls have only primitive argument types, so the rest of the implementation was handled by stating an appropriate printing format in file "strace.list". Syscall mlock2() is not implemen= ted in "syscall.c" and thus it's argument printing is not implemented in this = patch. Signed-off-by: Filip Bozuta Reviewed-by: Laurent Vivier --- linux-user/aarch64/target_syscall.h | 5 +++-- linux-user/alpha/target_syscall.h | 5 +++-- linux-user/arm/target_syscall.h | 6 ++++-- linux-user/cris/target_syscall.h | 5 +++-- linux-user/hppa/target_syscall.h | 5 +++-- linux-user/i386/target_syscall.h | 5 +++-- linux-user/m68k/target_syscall.h | 6 +++--- linux-user/microblaze/target_syscall.h | 5 +++-- linux-user/mips/target_syscall.h | 5 +++-- linux-user/mips64/target_syscall.h | 5 +++-- linux-user/nios2/target_syscall.h | 5 +++-- linux-user/openrisc/target_syscall.h | 5 +++-- linux-user/ppc/target_syscall.h | 5 +++-- linux-user/riscv/target_syscall.h | 5 +++-- linux-user/s390x/target_syscall.h | 5 +++-- linux-user/sh4/target_syscall.h | 5 +++-- linux-user/sparc/target_syscall.h | 5 +++-- linux-user/sparc64/target_syscall.h | 5 +++-- linux-user/strace.c | 21 +++++++++++++++++++++ linux-user/strace.list | 8 ++++---- linux-user/syscall.c | 10 ++++++++-- linux-user/tilegx/target_syscall.h | 5 +++-- linux-user/x86_64/target_syscall.h | 5 +++-- linux-user/xtensa/target_syscall.h | 5 +++-- 24 files changed, 97 insertions(+), 49 deletions(-) diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/targe= t_syscall.h index 995e475c73..3194e6b009 100644 --- a/linux-user/aarch64/target_syscall.h +++ b/linux-user/aarch64/target_syscall.h @@ -16,8 +16,9 @@ struct target_pt_regs { #define UNAME_MINIMUM_RELEASE "3.8.0" #define TARGET_CLONE_BACKWARDS #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #define TARGET_PR_SVE_SET_VL 50 #define TARGET_PR_SVE_GET_VL 51 diff --git a/linux-user/alpha/target_syscall.h b/linux-user/alpha/target_sy= scall.h index 3426cc5b4e..fd389422e3 100644 --- a/linux-user/alpha/target_syscall.h +++ b/linux-user/alpha/target_syscall.h @@ -258,7 +258,8 @@ struct target_pt_regs { #define TARGET_UAC_NOFIX 2 #define TARGET_UAC_SIGBUS 4 #define TARGET_MINSIGSTKSZ 4096 -#define TARGET_MLOCKALL_MCL_CURRENT 0x2000 -#define TARGET_MLOCKALL_MCL_FUTURE 0x4000 +#define TARGET_MCL_CURRENT 0x2000 +#define TARGET_MCL_FUTURE 0x4000 +#define TARGET_MCL_ONFAULT 0x8000 =20 #endif /* ALPHA_TARGET_SYSCALL_H */ diff --git a/linux-user/arm/target_syscall.h b/linux-user/arm/target_syscal= l.h index f85cbdaf56..e870ed7a54 100644 --- a/linux-user/arm/target_syscall.h +++ b/linux-user/arm/target_syscall.h @@ -28,8 +28,10 @@ struct target_pt_regs { #define TARGET_CLONE_BACKWARDS =20 #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 + #define TARGET_WANT_OLD_SYS_SELECT =20 #define TARGET_FORCE_SHMLBA diff --git a/linux-user/cris/target_syscall.h b/linux-user/cris/target_sysc= all.h index 29d69009ff..d109a6b42a 100644 --- a/linux-user/cris/target_syscall.h +++ b/linux-user/cris/target_syscall.h @@ -40,7 +40,8 @@ struct target_pt_regs { =20 #define TARGET_CLONE_BACKWARDS2 #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #endif diff --git a/linux-user/hppa/target_syscall.h b/linux-user/hppa/target_sysc= all.h index e2f366839d..f34e05edb5 100644 --- a/linux-user/hppa/target_syscall.h +++ b/linux-user/hppa/target_syscall.h @@ -23,8 +23,9 @@ struct target_pt_regs { #define UNAME_MINIMUM_RELEASE "2.6.32" #define TARGET_CLONE_BACKWARDS #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #undef TARGET_ENOMSG #define TARGET_ENOMSG 35 diff --git a/linux-user/i386/target_syscall.h b/linux-user/i386/target_sysc= all.h index 2854758134..ed356b3908 100644 --- a/linux-user/i386/target_syscall.h +++ b/linux-user/i386/target_syscall.h @@ -151,8 +151,9 @@ struct target_vm86plus_struct { =20 #define TARGET_CLONE_BACKWARDS #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 #define TARGET_WANT_OLD_SYS_SELECT =20 #endif /* I386_TARGET_SYSCALL_H */ diff --git a/linux-user/m68k/target_syscall.h b/linux-user/m68k/target_sysc= all.h index c0366b1c62..23359a6299 100644 --- a/linux-user/m68k/target_syscall.h +++ b/linux-user/m68k/target_syscall.h @@ -21,9 +21,9 @@ struct target_pt_regs { #define UNAME_MINIMUM_RELEASE "2.6.32" =20 #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 - +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 #define TARGET_WANT_OLD_SYS_SELECT =20 #endif /* M68K_TARGET_SYSCALL_H */ diff --git a/linux-user/microblaze/target_syscall.h b/linux-user/microblaze= /target_syscall.h index 4141cbaa5e..7f653db34f 100644 --- a/linux-user/microblaze/target_syscall.h +++ b/linux-user/microblaze/target_syscall.h @@ -50,8 +50,9 @@ struct target_pt_regs { =20 #define TARGET_CLONE_BACKWARDS #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #define TARGET_WANT_NI_OLD_SELECT =20 diff --git a/linux-user/mips/target_syscall.h b/linux-user/mips/target_sysc= all.h index d5509a34a7..dd6fd7af8e 100644 --- a/linux-user/mips/target_syscall.h +++ b/linux-user/mips/target_syscall.h @@ -234,8 +234,9 @@ struct target_pt_regs { =20 #define TARGET_CLONE_BACKWARDS #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #define TARGET_FORCE_SHMLBA =20 diff --git a/linux-user/mips64/target_syscall.h b/linux-user/mips64/target_= syscall.h index 8ccc46822c..8594955eec 100644 --- a/linux-user/mips64/target_syscall.h +++ b/linux-user/mips64/target_syscall.h @@ -231,8 +231,9 @@ struct target_pt_regs { =20 #define TARGET_CLONE_BACKWARDS #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #define TARGET_FORCE_SHMLBA =20 diff --git a/linux-user/nios2/target_syscall.h b/linux-user/nios2/target_sy= scall.h index f3b2a500f4..78006c24d4 100644 --- a/linux-user/nios2/target_syscall.h +++ b/linux-user/nios2/target_syscall.h @@ -31,7 +31,8 @@ struct target_pt_regs { }; =20 #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #endif /* NIOS2_TARGET_SYSCALL_H */ diff --git a/linux-user/openrisc/target_syscall.h b/linux-user/openrisc/tar= get_syscall.h index d586d2a018..ef0d89a551 100644 --- a/linux-user/openrisc/target_syscall.h +++ b/linux-user/openrisc/target_syscall.h @@ -16,8 +16,9 @@ struct target_pt_regs { #define UNAME_MINIMUM_RELEASE "2.6.32" =20 #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #define MMAP_SHIFT TARGET_PAGE_BITS =20 diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscal= l.h index afc0570410..c461f878f2 100644 --- a/linux-user/ppc/target_syscall.h +++ b/linux-user/ppc/target_syscall.h @@ -72,8 +72,9 @@ struct target_revectored_struct { #define TARGET_CLONE_BACKWARDS =20 #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 0x2000 -#define TARGET_MLOCKALL_MCL_FUTURE 0x4000 +#define TARGET_MCL_CURRENT 0x2000 +#define TARGET_MCL_FUTURE 0x4000 +#define TARGET_MCL_ONFAULT 0x8000 #define TARGET_WANT_NI_OLD_SELECT =20 #endif /* PPC_TARGET_SYSCALL_H */ diff --git a/linux-user/riscv/target_syscall.h b/linux-user/riscv/target_sy= scall.h index a88e821f73..dc597c8972 100644 --- a/linux-user/riscv/target_syscall.h +++ b/linux-user/riscv/target_syscall.h @@ -51,8 +51,9 @@ struct target_pt_regs { #define UNAME_MINIMUM_RELEASE "4.15.0" =20 #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 /* clone(flags, newsp, ptidptr, tls, ctidptr) for RISC-V */ /* This comes from linux/kernel/fork.c, CONFIG_CLONE_BACKWARDS */ diff --git a/linux-user/s390x/target_syscall.h b/linux-user/s390x/target_sy= scall.h index 8d4f609eaa..94f84178db 100644 --- a/linux-user/s390x/target_syscall.h +++ b/linux-user/s390x/target_syscall.h @@ -28,7 +28,8 @@ struct target_pt_regs { =20 #define TARGET_CLONE_BACKWARDS2 #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #endif /* S390X_TARGET_SYSCALL_H */ diff --git a/linux-user/sh4/target_syscall.h b/linux-user/sh4/target_syscal= l.h index 2b5f75be13..c1437adafe 100644 --- a/linux-user/sh4/target_syscall.h +++ b/linux-user/sh4/target_syscall.h @@ -16,8 +16,9 @@ struct target_pt_regs { #define UNAME_MINIMUM_RELEASE "2.6.32" =20 #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #define TARGET_FORCE_SHMLBA =20 diff --git a/linux-user/sparc/target_syscall.h b/linux-user/sparc/target_sy= scall.h index b9160a771b..d8ea04ea83 100644 --- a/linux-user/sparc/target_syscall.h +++ b/linux-user/sparc/target_syscall.h @@ -21,8 +21,9 @@ struct target_pt_regs { */ #define TARGET_CLONE_BACKWARDS #define TARGET_MINSIGSTKSZ 4096 -#define TARGET_MLOCKALL_MCL_CURRENT 0x2000 -#define TARGET_MLOCKALL_MCL_FUTURE 0x4000 +#define TARGET_MCL_CURRENT 0x2000 +#define TARGET_MCL_FUTURE 0x4000 +#define TARGET_MCL_ONFAULT 0x8000 =20 /* For SPARC SHMLBA is determined at runtime in the kernel, and * libc has to runtime-detect it using the hwcaps (see glibc diff --git a/linux-user/sparc64/target_syscall.h b/linux-user/sparc64/targe= t_syscall.h index 3073a23e03..696a68b1ed 100644 --- a/linux-user/sparc64/target_syscall.h +++ b/linux-user/sparc64/target_syscall.h @@ -22,8 +22,9 @@ struct target_pt_regs { */ #define TARGET_CLONE_BACKWARDS #define TARGET_MINSIGSTKSZ 4096 -#define TARGET_MLOCKALL_MCL_CURRENT 0x2000 -#define TARGET_MLOCKALL_MCL_FUTURE 0x4000 +#define TARGET_MCL_CURRENT 0x2000 +#define TARGET_MCL_FUTURE 0x4000 +#define TARGET_MCL_ONFAULT 0x8000 =20 #define TARGET_FORCE_SHMLBA =20 diff --git a/linux-user/strace.c b/linux-user/strace.c index 7dc239b9f1..40f863c6e2 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1194,6 +1194,15 @@ UNUSED static struct flags falloc_flags[] =3D { #endif }; =20 +UNUSED static struct flags mlockall_flags[] =3D { + FLAG_TARGET(MCL_CURRENT), + FLAG_TARGET(MCL_FUTURE), +#ifdef MCL_ONFAULT + FLAG_TARGET(MCL_ONFAULT), +#endif + FLAG_END, +}; + /* * print_xxx utility functions. These are used to print syscall * parameters in certain format. All of these have parameter @@ -2005,6 +2014,18 @@ print_ftruncate64(void *cpu_env, const struct syscal= lname *name, } #endif =20 +#ifdef TARGET_NR_mlockall +static void +print_mlockall(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_flags(mlockall_flags, arg0, 1); + print_syscall_epilogue(name); +} +#endif + #if defined(TARGET_NR_socket) static void print_socket(void *cpu_env, const struct syscallname *name, diff --git a/linux-user/strace.list b/linux-user/strace.list index 8e5303d035..d0ea7f3464 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -568,13 +568,13 @@ { TARGET_NR_mknodat, "mknodat" , NULL, print_mknodat, NULL }, #endif #ifdef TARGET_NR_mlock -{ TARGET_NR_mlock, "mlock" , NULL, NULL, NULL }, +{ TARGET_NR_mlock, "mlock" , "%s(%p," TARGET_FMT_lu ")", NULL, NULL }, #endif #ifdef TARGET_NR_mlock2 { TARGET_NR_mlock2, "mlock2" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_mlockall -{ TARGET_NR_mlockall, "mlockall" , NULL, NULL, NULL }, +{ TARGET_NR_mlockall, "mlockall" , NULL, print_mlockall, NULL }, #endif #ifdef TARGET_NR_mmap { TARGET_NR_mmap, "mmap" , NULL, print_mmap, print_syscall_ret_addr }, @@ -637,10 +637,10 @@ { TARGET_NR_multiplexer, "multiplexer" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_munlock -{ TARGET_NR_munlock, "munlock" , NULL, NULL, NULL }, +{ TARGET_NR_munlock, "munlock" , "%s(%p," TARGET_FMT_lu ")", NULL, NULL }, #endif #ifdef TARGET_NR_munlockall -{ TARGET_NR_munlockall, "munlockall" , NULL, NULL, NULL }, +{ TARGET_NR_munlockall, "munlockall" , "%s()", NULL, NULL }, #endif #ifdef TARGET_NR_munmap { TARGET_NR_munmap, "munmap" , NULL, print_munmap, NULL }, diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1517096a9b..24d915f0ff 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6906,12 +6906,18 @@ static inline int target_to_host_mlockall_arg(int a= rg) { int result =3D 0; =20 - if (arg & TARGET_MLOCKALL_MCL_CURRENT) { + if (arg & TARGET_MCL_CURRENT) { result |=3D MCL_CURRENT; } - if (arg & TARGET_MLOCKALL_MCL_FUTURE) { + if (arg & TARGET_MCL_FUTURE) { result |=3D MCL_FUTURE; } +#ifdef MCL_ONFAULT + if (arg & TARGET_MCL_ONFAULT) { + result |=3D MCL_ONFAULT; + } +#endif + return result; } #endif diff --git a/linux-user/tilegx/target_syscall.h b/linux-user/tilegx/target_= syscall.h index d731acdafa..8e9db734b8 100644 --- a/linux-user/tilegx/target_syscall.h +++ b/linux-user/tilegx/target_syscall.h @@ -34,8 +34,9 @@ struct target_pt_regs { tilegx_reg_t pad[2]; }; =20 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 /* For faultnum */ #define TARGET_INT_SWINT_1 14 diff --git a/linux-user/x86_64/target_syscall.h b/linux-user/x86_64/target_= syscall.h index 5e221e1d9d..3ecccb72be 100644 --- a/linux-user/x86_64/target_syscall.h +++ b/linux-user/x86_64/target_syscall.h @@ -101,7 +101,8 @@ struct target_msqid64_ds { #define TARGET_ARCH_GET_FS 0x1003 #define TARGET_ARCH_GET_GS 0x1004 #define TARGET_MINSIGSTKSZ 2048 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #endif /* X86_64_TARGET_SYSCALL_H */ diff --git a/linux-user/xtensa/target_syscall.h b/linux-user/xtensa/target_= syscall.h index 3866dad849..afc86a153f 100644 --- a/linux-user/xtensa/target_syscall.h +++ b/linux-user/xtensa/target_syscall.h @@ -43,7 +43,8 @@ struct target_pt_regs { xtensa_reg_t areg[16]; }; =20 -#define TARGET_MLOCKALL_MCL_CURRENT 1 -#define TARGET_MLOCKALL_MCL_FUTURE 2 +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 =20 #endif --=20 2.25.1 From nobody Tue May 14 10:06:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=syrmia.com) ARC-Seal: i=2; a=rsa-sha256; t=1597164496; cv=pass; d=zohomail.com; s=zohoarc; b=TjQqUL7n8DLQjD1Ocxxm8STntdzoSZbNPWThwG6tXLWIA3Dsue0xqj4lGvxJMFXJ9CdQ9gyXGQ1lJKRd1QRlyoTkyANmEbxLnf+B/koaRqt1j36YLxuGnKv3OYd2OcfehlMgFHsXui+Fj+uFy54fL816eAsdjQdhjJJVsqIA714= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597164496; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BxnDcxcgDKTF50IjaTRehSOoEG4aKIRSkscz2UcvKHE=; b=a5Q+8bZtIqf3HJ+Nx1e2pQknUEQLRZ/ZLPRUf2GMN/E4SbKCTx6rJkCci1yac8ZkgM3GkxfDJ3gQzPQGjHvtausVZc4R/+SGfmYo1jeBMX5OnejWbfMcso34sjUd0LE08si7ZVbmEnUWYeHNnXdv3Rb8Rr/LuyCav0ZVlbrLY2E= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=syrmia.com) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597164496288393.23489775661324; Tue, 11 Aug 2020 09:48:16 -0700 (PDT) Received: from localhost ([::1]:57364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5XRf-0005z9-3y for importer@patchew.org; Tue, 11 Aug 2020 12:48:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5XPo-0003sz-Mu for qemu-devel@nongnu.org; Tue, 11 Aug 2020 12:46:20 -0400 Received: from mail-eopbgr50105.outbound.protection.outlook.com ([40.107.5.105]:15741 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5XPm-0002xQ-Qj for qemu-devel@nongnu.org; Tue, 11 Aug 2020 12:46:20 -0400 Received: from VE1PR03MB5246.eurprd03.prod.outlook.com (2603:10a6:802:a1::22) by VI1PR03MB3662.eurprd03.prod.outlook.com (2603:10a6:803:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.22; Tue, 11 Aug 2020 16:46:10 +0000 Received: from VE1PR03MB5246.eurprd03.prod.outlook.com ([fe80::3568:5b4f:ab6b:e362]) by VE1PR03MB5246.eurprd03.prod.outlook.com ([fe80::3568:5b4f:ab6b:e362%6]) with mapi id 15.20.3261.024; Tue, 11 Aug 2020 16:46:10 +0000 Received: from localhost.localdomain (147.91.217.235) by LO3P123CA0008.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16 via Frontend Transport; Tue, 11 Aug 2020 16:46:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bNeJS3Z6y70VVThCRSnEGqpoNHZlEPujMbYlJBC39ATVBDX+i56tEL8mEV8+pQUK7/QEE15yPLLmhN8niI6YpnPPjV3ODhIiMRekmquttK6jmFm//SE5512UsBR95/9ka9bTfb94Yd+QmAlemyp4JEhluEtE7An2wzlsfajrQkZOiLhrxW3YRXI46smU9T8kMR2noI8VT0vUPiWfts+gWIOsj5sAO/IoujhwTZmTPE0xTo5juNwtp+gzuEL12PWCdL87P6batZMVXYC8rfwigO5tZ8SMWRM7DKhQ+YLdDK9TBXpRpcDVE8e6tLkCBqsk0yDgXRj0bSGqyq/qdh/WvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BxnDcxcgDKTF50IjaTRehSOoEG4aKIRSkscz2UcvKHE=; b=c0hNp9sBDNiVgi27KEjp5KkILZ2a6zipT8Smw9XfsI5YTPqwz7Hsh/+uSNVWEukXq2b47Fo3IXwI5w6dm3+lVwBkPmKpNsm9swJjgb+X8nmZK19wOBHj9W859S4SXr+5Z+fBdyBMiEtYXHJrQvg2Z47onJF+/+wKXmGJ967oD3uQj2zhbSJcPwdW8EwIE+KARasjPr/HwgPEYY6dxyVdKcS3rRRKi8i8YPvyBumNDnxn+UFfjgBK8EaSyr4Jn4wsIvcji56NI24mGchNWRyhQb97vzsjxwwJ1GZ1WHXD8rdHyAbK/FM1hDnvqjVyAGTBIVie94BpKV/O+a4epxSOSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BxnDcxcgDKTF50IjaTRehSOoEG4aKIRSkscz2UcvKHE=; b=w6twi2Jby0AbQgQ1OdzjDzHjIOljP2Bu/frCOF+7pbcroh8BHUB6FHzOXFH9THY6JIG8EXrXD/4HHi/gUqy2+i5sX/dc0XFbXGAonFTXMBNIXNzomZu6LO30L6DeAiL0dE3iKsM/A447BjubHJHS6kV/OUUA5CraJ3aZipKBc5c= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=syrmia.com; From: Filip Bozuta To: qemu-devel@nongnu.org Subject: [PATCH v4 4/5] linux-user: Add an api to print enumareted argument values with strace Date: Tue, 11 Aug 2020 18:45:52 +0200 Message-Id: <20200811164553.27713-5-Filip.Bozuta@syrmia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200811164553.27713-1-Filip.Bozuta@syrmia.com> References: <20200811164553.27713-1-Filip.Bozuta@syrmia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO3P123CA0008.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::13) To VE1PR03MB5246.eurprd03.prod.outlook.com (2603:10a6:802:a1::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [147.91.217.235] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 88d53055-376b-463e-eb4d-08d83e160d12 X-MS-TrafficTypeDiagnostic: VI1PR03MB3662: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1122; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d5saxNUi6q36ME97BOLl0gIm4JxVQQKdsfjFBKQ0fr/rRrVCW56l7aETvkA54UjtTKeEuJUaHcDn3fyGKKhetgcUy0d8ReNWoW1DZAlRqhgWYGWd7JBjiw/PullOEv7lfqKgoghpw2wFo29neY8iuKFnYKyAXjcsmQcphJllSc3+EfpOUxjkRwku6tSy0fXy77NzAkfaVx9gt7SFNL+JfLsrT8aZHzokT7259Dl3eGuf/Y0whpAY++fIQRZ5sKH4/V5jPYpffPNQ/kWaQoQ+2LTP/jw+GEWV2kgnsIcolS3lkZ4LNbUhT+VttmdaSi8LM0VQRXXek+AzJAuhg4qQ/CqXn9bBegbJHEpG2c3P/nK2t8tn1m9pMdLeg1wHQXa5 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR03MB5246.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(346002)(376002)(396003)(366004)(39830400003)(136003)(956004)(2906002)(508600001)(6512007)(186003)(52116002)(16526019)(66556008)(66946007)(26005)(6666004)(1076003)(66476007)(6506007)(86362001)(54906003)(8936002)(4326008)(107886003)(36756003)(316002)(6916009)(5660300002)(8676002)(6486002)(69590400007)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: mupOmZPT2XxVNb90ehTJXHk5IVtRqHE1rhKKYzQ//qOAhr44W6Faf9Po6wNuCgomsdfaNPGzuDkUd7XKJAN4KY8mbe9bh299dXTfrj6wSal9N8CZw38Au6RgHKmBadKzd+5/7VQ71eu1Suz9p8rCehlC6vytV0A2+PoCXjteWq5GbPjicnPhNKxxTy7Xb6tK+IqVm2YmQvzHNSDkDd5xHXRjhHKJz0Y/TMLa5VHCURzJHUlFr+Kwu5jmbP/aOvFKi1TWhI51wQ3rsDpQlsZ1VAPSxI0/SoCHMn8KtQtAeR66nhTG+VCDcNgxS0LCJF4Ewd8UBOQUiNaMNIV0GVY9B+U8SaGsiR1KAQ72ExQKCQzD/ZA1933GL+Li3N57VEOPbulKjbHxw950OJTnBKS/7p+1/qovtcd2Cc1QeSRtv4to1lsJcflWYBAWE5sd75fKvkOy/heD0dWUDUr+udiU1QEP/6dSb9jZ9PKmBQxQ7GoGiY5wa4ubxlcO/beKpKp+tgnRGr1u69Z0lGhayE+qpJgc7JNm9UKvRjuci9eBK0cP3JDtrg/cTZXHeJGOGe9r1Q/lIj3kPKmVY1gH9YFKffID2XI7k9tL/0Dyf2zvnIyoTHqDh4OWl2Wr6ZGLrwOyiqX94JOdBM/h4Iq9CcQTPA== X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88d53055-376b-463e-eb4d-08d83e160d12 X-MS-Exchange-CrossTenant-AuthSource: VE1PR03MB5246.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2020 16:46:10.5209 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8kWwJTEt8lcBwLDTNT/OcGgn1PlZVeJMv8NB2ZCN/4drQUlm7jmFFljfXQTXxDCpFMXupR+/uXWSykrQZOAJHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB3662 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.5.105; envelope-from=Filip.Bozuta@syrmia.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 12:46:08 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Filip Bozuta Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @syrmia.com) Content-Type: text/plain; charset="utf-8" This patch introduces a type 'struct enums' and function 'print_enums()' that can be used to print enumerated argument values of some syscalls in strace. This can be used in future strace implementations. Also, macros 'ENUM_GENERIC()', 'ENUM_TARGET()' and 'ENUM_END', are introduced to enable automatic generation of aproppriate enumarated values and their repsective string representations (these macros are exactly the same as 'FLAG_GENERIC()', 'FLAG_TARGET()' and 'FLAG_END'). Future patches are planned to modify all existing print functions in 'strace.c' that print arguments of syscalls with enumerated values to use this new api. Signed-off-by: Filip Bozuta Reviewed-by: Laurent Vivier --- linux-user/strace.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/linux-user/strace.c b/linux-user/strace.c index 40f863c6e2..def92c4d73 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -52,9 +52,23 @@ struct flags { /* end of flags array */ #define FLAG_END { 0, NULL } =20 +/* Structure used to translate enumerated values into strings */ +struct enums { + abi_long e_value; /* enum value */ + const char *e_string; /* stringified enum */ +}; + +/* common enums for all architectures */ +#define ENUM_GENERIC(name) { name, #name } +/* target specific enums */ +#define ENUM_TARGET(name) { TARGET_ ## name, #name } +/* end of enums array */ +#define ENUM_END { 0, NULL } + UNUSED static const char *get_comma(int); UNUSED static void print_pointer(abi_long, int); UNUSED static void print_flags(const struct flags *, abi_long, int); +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); @@ -1248,6 +1262,23 @@ print_flags(const struct flags *f, abi_long flags, i= nt last) } } =20 +static void +print_enums(const struct enums *e, abi_long enum_arg, int last) +{ + for (; e->e_string !=3D NULL; e++) { + if (e->e_value =3D=3D enum_arg) { + qemu_log("%s", e->e_string); + break; + } + } + + if (e->e_string =3D=3D NULL) { + qemu_log("%#x", (unsigned int)enum_arg); + } + + qemu_log("%s", get_comma(last)); +} + static void print_at_dirfd(abi_long dirfd, int last) { --=20 2.25.1 From nobody Tue May 14 10:06:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=syrmia.com) ARC-Seal: i=2; a=rsa-sha256; t=1597164585; cv=pass; d=zohomail.com; s=zohoarc; b=H7/nW/NIujZyMgT6c82cJ9q2kE+JvRzC7tHMxbjCzO3wn53oDWlXjfL8c0YEnXJnZI7pu/R5Sf0ZFHi8W9wjMNFEYqNvXU3Ly3KW50l5T1qDHBjhU62x11B9YhN7+6c0vXz8t1CnfJizKgR16Ge6UCHi0F8r8Ym+KBoRNkesgww= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597164585; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XjRC3S9Kmlf4JTMv2f9aEWiXVlcZppDcI/jFL8vqtJ4=; b=BqgzXlzvqO7yJO1EphYNqKpHZB2Fmu7E0WM3QZpNMGABOPLQppnttesdzF7mEsLpDTPpBWPwQcoIJgfqSAOiitUsKZBTvs6VEx2ZgSRCKPNZ3kE4YM8rnyzs0yt8LHwnKb2t5CH/JHHTVO/Hfh0wD86thepoCSPpRzgJFtddUnI= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=syrmia.com) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597164585328818.584558842513; Tue, 11 Aug 2020 09:49:45 -0700 (PDT) Received: from localhost ([::1]:33822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5XT6-0007sE-65 for importer@patchew.org; Tue, 11 Aug 2020 12:49:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5XPr-0003vH-Au for qemu-devel@nongnu.org; Tue, 11 Aug 2020 12:46:24 -0400 Received: from mail-eopbgr50105.outbound.protection.outlook.com ([40.107.5.105]:15741 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5XPp-0002xQ-14 for qemu-devel@nongnu.org; Tue, 11 Aug 2020 12:46:23 -0400 Received: from VE1PR03MB5246.eurprd03.prod.outlook.com (2603:10a6:802:a1::22) by VI1PR03MB3662.eurprd03.prod.outlook.com (2603:10a6:803:3a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.22; Tue, 11 Aug 2020 16:46:11 +0000 Received: from VE1PR03MB5246.eurprd03.prod.outlook.com ([fe80::3568:5b4f:ab6b:e362]) by VE1PR03MB5246.eurprd03.prod.outlook.com ([fe80::3568:5b4f:ab6b:e362%6]) with mapi id 15.20.3261.024; Tue, 11 Aug 2020 16:46:11 +0000 Received: from localhost.localdomain (147.91.217.235) by LO3P123CA0008.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16 via Frontend Transport; Tue, 11 Aug 2020 16:46:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SaOqt1tD9uHg8AibmfM2yKZa4wkECrvgr2TaX8W0IKp3YbllcOjjZRXh6b1lTzUzxzwQXnRKgp7w7I+I0NXnVKHq3+VcyVvTWThNce9JfoFS2EDIq8vuJrDsUwMbo6gAX/Xgg1ZwaAbaw+ngdlGlwN8GlAqfsgSXDW9/UCrTOplztGnvxzzFsKgevVh3thbd9ULyk2cjjHpHmhXQmVdnbgnvI/DTfHwZQcor45UFCgPJEpD84GDA1pvvxhnmzvVUYOehoVOLCo2NeFOnR+ziivnLfIQviJPVO0xORZTEjfCh29ISD4nDPug/cTQjjsgsuSvbWnQLQjoCuTbGCfCkPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XjRC3S9Kmlf4JTMv2f9aEWiXVlcZppDcI/jFL8vqtJ4=; b=k8jdZxRT1+HGbNZBXcerMwVnTJvshmLP9oIKfP40FmU+7hyKutetiCHZuukj+BLZOAzWe1lIXFRoJohslu4kifMzZ23RKa/CCDkrIWr20h+xl4mim5GdPw8eBeiRqbkiyLFzScttAz5XayfhPUxd7w4mDaZ6Xyze3Lf0P5CJONs0nC/ZWF0O2M1so9v7bTbrmbMJnqZC8+i3tiPEdRZ9MSU8sZ1u+E6E2flXzFbVqjMjz1FGiXBYHBEKqEcmlZK8/VTSZdumd+iVZva/sl/4ep9CRbaPJTItLYXRy69D+5bmafXs8KTpWXjwc8IfopRJabR60hx6h8yYgzv4EwoHJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XjRC3S9Kmlf4JTMv2f9aEWiXVlcZppDcI/jFL8vqtJ4=; b=lVwwZujlH0wdmcsURghz5lhKxcQZMz7II8zXiPzUYB4fTjgSrak4UjZbJHv4HiFYKYneDxkq80AmcCQtUNT9IWS2cLdmLuC2O5sTVoEjpGa2HCt2Q5stnDmc/xT20mkG/7HYxL/jkpXRwm3nomZsD/CR66GJGAkUDMVwr3OhIxI= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=syrmia.com; From: Filip Bozuta To: qemu-devel@nongnu.org Subject: [PATCH v4 5/5] linux-user: Add strace support for printing arguments of some clock and time functions Date: Tue, 11 Aug 2020 18:45:53 +0200 Message-Id: <20200811164553.27713-6-Filip.Bozuta@syrmia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200811164553.27713-1-Filip.Bozuta@syrmia.com> References: <20200811164553.27713-1-Filip.Bozuta@syrmia.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO3P123CA0008.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::13) To VE1PR03MB5246.eurprd03.prod.outlook.com (2603:10a6:802:a1::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [147.91.217.235] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3301244b-9be1-4d61-92d7-08d83e160da2 X-MS-TrafficTypeDiagnostic: VI1PR03MB3662: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1i2izDchf7VtdWJ8eFZHi0lkvTNoz3vgeNMKLwPZJ9qdDreWbMWcSMk0g0qFTAhv9ZfxrsfpIGeVPopNZAoV7L/EJZzl1dsdqgKg8H0CTs9ZJ15+FvB56/j0sm5j2d6cRSEav7OJfR34DhMvnmGvGZq9TqDIYq3vNA9nqVTUc5OHKr/fOCVfsyHTUjlabuBZizun+wCW/M3vgF02T+kPhURDilrGOWupGzrj1hOqQRQQQNnoEAh2a8oxfn5XmKhDa+L0vMa77Tg9XN8SVWvJWeNK3ReSMuQVJvXDHi4MdbYR08zR3d3B/CPlWHgL/qyfFNRkjrlJzwCgj+NC9eftCe5PKTpnry4f119i8kKmK64GR+wZz2q4s6UW7N16uljnWeV/A8lAbLO2a9uSXM+qHriC+hds8H5AZLs/7o41GNj+2lNDCK1xvFYMz5/bM2PJw3gECG+VxAlJmF0AF3nfckWnTgWvapqqkNiBOWJGGWw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR03MB5246.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(346002)(376002)(396003)(366004)(39830400003)(136003)(956004)(2906002)(508600001)(6512007)(186003)(52116002)(16526019)(66556008)(66946007)(26005)(83380400001)(6666004)(1076003)(30864003)(66476007)(6506007)(86362001)(54906003)(8936002)(4326008)(107886003)(966005)(36756003)(316002)(6916009)(5660300002)(8676002)(6486002)(69590400007)(2616005)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: WlEVifvdEmrI3Ae04wqBGnRPBrxuIxGh+kwy1qLJaOrgANpiQgOtG/dHVD9slAmZprEZTI7mJfATi2soMWlmkaGe7HSgCJspy0jOrZHHgiOdUgd8CnIuhjlB0okXW9P4FfFr2Nv7RgNkvOBsWS2DGy9yhda11sz/m2bAV2y9HitAnZo5lZjCd7IaCq2KJDXKgNeoIghGRV5bXxGJCnoMOLBWzW7Edff+KLEL0hxP1ThvB+zMzJPwxSBG82w7BTxkBsrx5xXU41ByBCZ2QxzFlcNRF1cCCR3MYqq9WDhv9nPEYPgEhXt8K8VYwo9U/vU4E0K7opt+M9xRtJqS6zF6Mx7c9S53iTuOsZdd9Dk4Wq7+SMXUsmi8QBSEsCtwurInTuQ0pfB9b2mPYOS4imB8xPqyoPUrhF6OXHn3JtcHYGon9OTo3kJsAboYIeF6eoTOK6kLg9ny5NK4aM/b9L0RQ5gP0loBem56K8DNnNwlHdHNFwYN8QGrrDKx6YczClKngjXt5diHxzoqJe7tc+qXPGmGCyCbAuOqeJxjIKKFGTpvK54eyJ1qJxoAjF94S/Pu4dIPCe3gwkyU3L3uPbwuAJApHRmBXvpnpiZgwpTIQtIKVjSXFBwyen+jqwtA44Y67j6jS/O9nxznGyHA2CUBpA== X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3301244b-9be1-4d61-92d7-08d83e160da2 X-MS-Exchange-CrossTenant-AuthSource: VE1PR03MB5246.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2020 16:46:11.4874 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uZwq7bVe0vzwr1VNJZOyD/WyldrZ0Ia7igjgAJnj43AABVy5VpEPno93x/ENobcAYakz1ONl9lqW9FEgXE5N/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB3662 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.5.105; envelope-from=Filip.Bozuta@syrmia.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/11 12:46:08 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Filip Bozuta Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @syrmia.com) Content-Type: text/plain; charset="utf-8" This patch implements strace argument printing functionality for following = syscalls: * clock_getres, clock_gettime, clock_settime - clock and time functions int clock_getres(clockid_t clockid, struct timespec *res) int clock_gettime(clockid_t clockid, struct timespec *tp) int clock_settime(clockid_t clockid, const struct timespec *tp) man page: https://man7.org/linux/man-pages/man2/clock_getres.2.html * gettimeofday - get time int gettimeofday(struct timeval *tv, struct timezone *tz) man page: https://man7.org/linux/man-pages/man2/gettimeofday.2.html * getitimer, setitimer - get or set value of an interval timer int getitimer(int which, struct itimerval *curr_value) int setitimer(int which, const struct itimerval *new_value, struct itimerval *old_value) man page: https://man7.org/linux/man-pages/man2/getitimer.2.html Implementation notes: All of the syscalls have some structue types as argument types and thus a separate printing function was stated in file "strace.list" for each of them. All of these functions use existing functions for their appropriate structure types ("print_timeval()" and "print_timezone()"). Functions "print_timespec()" and "print_itimerval()" were added in this patch so that they can be used to print types "struct timespec" and "struct itimerval" used by some of the syscalls. Function "print_itimer= val()" uses the existing function "print_timeval()" to print fields of the structure "struct itimerval" that are of type "struct timeval". Function "print_enums()", which was introduced in the previous patch, i= s used to print the interval timer type which is the first argument of "getiti= mer()" and "setitimer()". Also, this function is used to print the clock id wh= ich is the first argument of "clock_getres()" and "clock_gettime()". For th= at reason, the existing function "print_clockid()" was removed in this pat= ch. Existing function "print_clock_adjtime()" was also changed for this rea= son to use "print_enums()". The existing function "print_timeval()" was changed a little so that it prints the field names beside the values. Syscalls "clock_getres()" and "clock_gettime()" have the same number and types of arguments and thus their print functions "print_clock_getr= es" and "print_clock_gettime" share a common definition in file "strace.c". Signed-off-by: Filip Bozuta Reviewed-by: Laurent Vivier --- linux-user/strace.c | 287 +++++++++++++++++++++++++++++++---------- linux-user/strace.list | 17 ++- 2 files changed, 232 insertions(+), 72 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index def92c4d73..1a5c4c820a 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -78,7 +78,9 @@ UNUSED static void print_string(abi_long, int); UNUSED static void print_buf(abi_long addr, abi_long len, int last); UNUSED static void print_raw_param(const char *, abi_long, int); UNUSED static void print_timeval(abi_ulong, int); +UNUSED static void print_timespec(abi_ulong, int); UNUSED static void print_timezone(abi_ulong, int); +UNUSED static void print_itimerval(abi_ulong, int); UNUSED static void print_number(abi_long, int); UNUSED static void print_signal(abi_ulong, int); UNUSED static void print_sockaddr(abi_ulong, abi_long, int); @@ -578,69 +580,6 @@ print_fdset(int n, abi_ulong target_fds_addr) } #endif =20 -#ifdef TARGET_NR_clock_adjtime -/* IDs of the various system clocks */ -#define TARGET_CLOCK_REALTIME 0 -#define TARGET_CLOCK_MONOTONIC 1 -#define TARGET_CLOCK_PROCESS_CPUTIME_ID 2 -#define TARGET_CLOCK_THREAD_CPUTIME_ID 3 -#define TARGET_CLOCK_MONOTONIC_RAW 4 -#define TARGET_CLOCK_REALTIME_COARSE 5 -#define TARGET_CLOCK_MONOTONIC_COARSE 6 -#define TARGET_CLOCK_BOOTTIME 7 -#define TARGET_CLOCK_REALTIME_ALARM 8 -#define TARGET_CLOCK_BOOTTIME_ALARM 9 -#define TARGET_CLOCK_SGI_CYCLE 10 -#define TARGET_CLOCK_TAI 11 - -static void -print_clockid(int clockid, int last) -{ - switch (clockid) { - case TARGET_CLOCK_REALTIME: - qemu_log("CLOCK_REALTIME"); - break; - case TARGET_CLOCK_MONOTONIC: - qemu_log("CLOCK_MONOTONIC"); - break; - case TARGET_CLOCK_PROCESS_CPUTIME_ID: - qemu_log("CLOCK_PROCESS_CPUTIME_ID"); - break; - case TARGET_CLOCK_THREAD_CPUTIME_ID: - qemu_log("CLOCK_THREAD_CPUTIME_ID"); - break; - case TARGET_CLOCK_MONOTONIC_RAW: - qemu_log("CLOCK_MONOTONIC_RAW"); - break; - case TARGET_CLOCK_REALTIME_COARSE: - qemu_log("CLOCK_REALTIME_COARSE"); - break; - case TARGET_CLOCK_MONOTONIC_COARSE: - qemu_log("CLOCK_MONOTONIC_COARSE"); - break; - case TARGET_CLOCK_BOOTTIME: - qemu_log("CLOCK_BOOTTIME"); - break; - case TARGET_CLOCK_REALTIME_ALARM: - qemu_log("CLOCK_REALTIME_ALARM"); - break; - case TARGET_CLOCK_BOOTTIME_ALARM: - qemu_log("CLOCK_BOOTTIME_ALARM"); - break; - case TARGET_CLOCK_SGI_CYCLE: - qemu_log("CLOCK_SGI_CYCLE"); - break; - case TARGET_CLOCK_TAI: - qemu_log("CLOCK_TAI"); - break; - default: - qemu_log("%d", clockid); - break; - } - qemu_log("%s", get_comma(last)); -} -#endif - /* * Sysycall specific output functions */ @@ -839,6 +778,81 @@ print_syscall_ret_adjtimex(void *cpu_env, const struct= syscallname *name, } #endif =20 +#if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres) +static void +print_syscall_ret_clock_gettime(void *cpu_env, const struct syscallname *n= ame, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg= 4, + abi_long arg5) +{ + if (!print_syscall_err(ret)) { + qemu_log(TARGET_ABI_FMT_ld, ret); + qemu_log(" ("); + print_timespec(arg1, 1); + qemu_log(")"); + } + + qemu_log("\n"); +} +#define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime +#endif + +#ifdef TARGET_NR_gettimeofday +static void +print_syscall_ret_gettimeofday(void *cpu_env, const struct syscallname *na= me, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5) +{ + if (!print_syscall_err(ret)) { + qemu_log(TARGET_ABI_FMT_ld, ret); + qemu_log(" ("); + print_timeval(arg0, 0); + print_timezone(arg1, 1); + qemu_log(")"); + } + + qemu_log("\n"); +} +#endif + +#ifdef TARGET_NR_getitimer +static void +print_syscall_ret_getitimer(void *cpu_env, const struct syscallname *name, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5) +{ + if (!print_syscall_err(ret)) { + qemu_log(TARGET_ABI_FMT_ld, ret); + qemu_log(" ("); + print_itimerval(arg1, 1); + qemu_log(")"); + } + + qemu_log("\n"); +} +#endif + + +#ifdef TARGET_NR_getitimer +static void +print_syscall_ret_setitimer(void *cpu_env, const struct syscallname *name, + abi_long ret, abi_long arg0, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5) +{ + if (!print_syscall_err(ret)) { + qemu_log(TARGET_ABI_FMT_ld, ret); + qemu_log(" (old_value =3D "); + print_itimerval(arg2, 1); + qemu_log(")"); + } + + qemu_log("\n"); +} +#endif + #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \ || defined(TARGGET_NR_flistxattr) static void @@ -1217,6 +1231,43 @@ UNUSED static struct flags mlockall_flags[] =3D { FLAG_END, }; =20 +/* IDs of the various system clocks */ +#define TARGET_CLOCK_REALTIME 0 +#define TARGET_CLOCK_MONOTONIC 1 +#define TARGET_CLOCK_PROCESS_CPUTIME_ID 2 +#define TARGET_CLOCK_THREAD_CPUTIME_ID 3 +#define TARGET_CLOCK_MONOTONIC_RAW 4 +#define TARGET_CLOCK_REALTIME_COARSE 5 +#define TARGET_CLOCK_MONOTONIC_COARSE 6 +#define TARGET_CLOCK_BOOTTIME 7 +#define TARGET_CLOCK_REALTIME_ALARM 8 +#define TARGET_CLOCK_BOOTTIME_ALARM 9 +#define TARGET_CLOCK_SGI_CYCLE 10 +#define TARGET_CLOCK_TAI 11 + +UNUSED static struct enums clockids[] =3D { + ENUM_TARGET(CLOCK_REALTIME), + ENUM_TARGET(CLOCK_MONOTONIC), + ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID), + ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID), + ENUM_TARGET(CLOCK_MONOTONIC_RAW), + ENUM_TARGET(CLOCK_REALTIME_COARSE), + ENUM_TARGET(CLOCK_MONOTONIC_COARSE), + ENUM_TARGET(CLOCK_BOOTTIME), + ENUM_TARGET(CLOCK_REALTIME_ALARM), + ENUM_TARGET(CLOCK_BOOTTIME_ALARM), + ENUM_TARGET(CLOCK_SGI_CYCLE), + ENUM_TARGET(CLOCK_TAI), + ENUM_END, +}; + +UNUSED static struct enums itimer_types[] =3D { + ENUM_GENERIC(ITIMER_REAL), + ENUM_GENERIC(ITIMER_VIRTUAL), + ENUM_GENERIC(ITIMER_PROF), + ENUM_END, +}; + /* * print_xxx utility functions. These are used to print syscall * parameters in certain format. All of these have parameter @@ -1435,13 +1486,34 @@ print_timeval(abi_ulong tv_addr, int last) print_pointer(tv_addr, last); return; } - qemu_log("{" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "}%s", - tswapal(tv->tv_sec), tswapal(tv->tv_usec), get_comma(last)); + qemu_log("{tv_sec =3D " TARGET_ABI_FMT_ld + ",tv_usec =3D " TARGET_ABI_FMT_ld "}%s", + tswapal(tv->tv_sec), tswapal(tv->tv_usec), get_comma(last= )); unlock_user(tv, tv_addr, 0); } else qemu_log("NULL%s", get_comma(last)); } =20 +static void +print_timespec(abi_ulong ts_addr, int last) +{ + if (ts_addr) { + struct target_timespec *ts; + + ts =3D lock_user(VERIFY_READ, ts_addr, sizeof(*ts), 1); + if (!ts) { + print_pointer(ts_addr, last); + return; + } + qemu_log("{tv_sec =3D " TARGET_ABI_FMT_ld + ",tv_nsec =3D " TARGET_ABI_FMT_ld "}%s", + tswapal(ts->tv_sec), tswapal(ts->tv_nsec), get_comma(last= )); + unlock_user(ts, ts_addr, 0); + } else { + qemu_log("NULL%s", get_comma(last)); + } +} + static void print_timezone(abi_ulong tz_addr, int last) { @@ -1461,6 +1533,22 @@ print_timezone(abi_ulong tz_addr, int last) } } =20 +static void +print_itimerval(abi_ulong it_addr, int last) +{ + if (it_addr) { + qemu_log("{it_interval=3D"); + print_timeval(it_addr + + offsetof(struct target_itimerval, it_interval), 0); + qemu_log("it_value=3D"); + print_timeval(it_addr + + offsetof(struct target_itimerval, it_value), 0); + qemu_log("}%s", get_comma(last)); + } else { + qemu_log("NULL%s", get_comma(last)); + } +} + #undef UNUSED =20 #ifdef TARGET_NR_accept @@ -1573,7 +1661,7 @@ print_clock_adjtime(void *cpu_env, const struct sysca= llname *name, abi_long arg3, abi_long arg4, abi_long arg5) { print_syscall_prologue(name); - print_clockid(arg0, 0); + print_enums(clockids, arg0, 0); print_pointer(arg1, 1); print_syscall_epilogue(name); } @@ -1903,6 +1991,19 @@ print_futimesat(void *cpu_env, const struct syscalln= ame *name, } #endif =20 +#ifdef TARGET_NR_gettimeofday +static void +print_gettimeofday(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_pointer(arg0, 0); + print_pointer(arg1, 1); + print_syscall_epilogue(name); +} +#endif + #ifdef TARGET_NR_settimeofday static void print_settimeofday(void *cpu_env, const struct syscallname *name, @@ -1916,6 +2017,60 @@ print_settimeofday(void *cpu_env, const struct sysca= llname *name, } #endif =20 +#if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres) +static void +print_clock_gettime(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_enums(clockids, arg0, 0); + print_pointer(arg1, 1); + print_syscall_epilogue(name); +} +#define print_clock_getres print_clock_gettime +#endif + +#ifdef TARGET_NR_clock_settime +static void +print_clock_settime(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_enums(clockids, arg0, 0); + print_timespec(arg1, 1); + print_syscall_epilogue(name); +} +#endif + +#ifdef TARGET_NR_getitimer +static void +print_getitimer(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_enums(itimer_types, arg0, 0); + print_pointer(arg1, 1); + print_syscall_epilogue(name); +} +#endif + +#ifdef TARGET_NR_setitimer +static void +print_setitimer(void *cpu_env, const struct syscallname *name, + abi_long arg0, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + print_syscall_prologue(name); + print_enums(itimer_types, arg0, 0); + print_itimerval(arg1, 0); + print_pointer(arg2, 1); + print_syscall_epilogue(name); +} +#endif + #ifdef TARGET_NR_link static void print_link(void *cpu_env, const struct syscallname *name, diff --git a/linux-user/strace.list b/linux-user/strace.list index d0ea7f3464..084048ab96 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -83,16 +83,18 @@ { TARGET_NR_clock_adjtime, "clock_adjtime" , NULL, print_clock_adjtime, NU= LL }, #endif #ifdef TARGET_NR_clock_getres -{ TARGET_NR_clock_getres, "clock_getres" , NULL, NULL, NULL }, +{ TARGET_NR_clock_getres, "clock_getres" , NULL, print_clock_getres, + print_syscall_ret_clock_getres }, #endif #ifdef TARGET_NR_clock_gettime -{ TARGET_NR_clock_gettime, "clock_gettime" , NULL, NULL, NULL }, +{ TARGET_NR_clock_gettime, "clock_gettime" , NULL, print_clock_gettime, + print_syscall_ret_clock_gettime }, #endif #ifdef TARGET_NR_clock_nanosleep { TARGET_NR_clock_nanosleep, "clock_nanosleep" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_clock_settime -{ TARGET_NR_clock_settime, "clock_settime" , NULL, NULL, NULL }, +{ TARGET_NR_clock_settime, "clock_settime" , NULL, print_clock_settime, NU= LL }, #endif #ifdef TARGET_NR_clone { TARGET_NR_clone, "clone" , NULL, print_clone, NULL }, @@ -315,7 +317,8 @@ { TARGET_NR_gethostname, "gethostname" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_getitimer -{ TARGET_NR_getitimer, "getitimer" , NULL, NULL, NULL }, +{ TARGET_NR_getitimer, "getitimer" , NULL, print_getitimer, + print_syscall_ret_getitimer }, #endif #ifdef TARGET_NR_get_kernel_syms { TARGET_NR_get_kernel_syms, "get_kernel_syms" , NULL, NULL, NULL }, @@ -388,7 +391,8 @@ { TARGET_NR_gettid, "gettid" , "%s()", NULL, NULL }, #endif #ifdef TARGET_NR_gettimeofday -{ TARGET_NR_gettimeofday, "gettimeofday" , NULL, NULL, NULL }, +{ TARGET_NR_gettimeofday, "gettimeofday" , NULL, print_gettimeofday, + print_syscall_ret_gettimeofday }, #endif #ifdef TARGET_NR_getuid { TARGET_NR_getuid, "getuid" , "%s()", NULL, NULL }, @@ -1291,7 +1295,8 @@ { TARGET_NR_sethostname, "sethostname" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_setitimer -{ TARGET_NR_setitimer, "setitimer" , NULL, NULL, NULL }, +{ TARGET_NR_setitimer, "setitimer" , NULL, print_setitimer, + print_syscall_ret_setitimer }, #endif #ifdef TARGET_NR_set_mempolicy { TARGET_NR_set_mempolicy, "set_mempolicy" , NULL, NULL, NULL }, --=20 2.25.1