1 /*
2 * Copyright (c) 2015-2021 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8 #include "negated_errno.h"
9
10 #ifndef ARCH_REGSET
11 # define ARCH_REGSET s390_regset
12 #endif
13
14 static void
15 arch_get_error(struct tcb *tcp, const bool check_errno)
16 {
17 if (check_errno && is_negated_errno(ARCH_REGSET.gprs[2])) {
18 tcp->u_rval = -1;
19 tcp->u_error = -ARCH_REGSET.gprs[2];
20 } else {
21 tcp->u_rval = ARCH_REGSET.gprs[2];
22 }
23 }