xref: /aosp_15_r20/external/strace/linux/i386/get_error.c (revision cf84ac9a129d8ea9952db616b4e9b904c4bdde56)
1*cf84ac9aSAndroid Build Coastguard Worker #include "negated_errno.h"
2*cf84ac9aSAndroid Build Coastguard Worker 
3*cf84ac9aSAndroid Build Coastguard Worker static void
get_error(struct tcb * tcp,const bool check_errno)4*cf84ac9aSAndroid Build Coastguard Worker get_error(struct tcb *tcp, const bool check_errno)
5*cf84ac9aSAndroid Build Coastguard Worker {
6*cf84ac9aSAndroid Build Coastguard Worker 	if (check_errno && is_negated_errno(i386_regs.eax)) {
7*cf84ac9aSAndroid Build Coastguard Worker 		tcp->u_rval = -1;
8*cf84ac9aSAndroid Build Coastguard Worker 		tcp->u_error = -i386_regs.eax;
9*cf84ac9aSAndroid Build Coastguard Worker 	} else {
10*cf84ac9aSAndroid Build Coastguard Worker 		tcp->u_rval = i386_regs.eax;
11*cf84ac9aSAndroid Build Coastguard Worker 	}
12*cf84ac9aSAndroid Build Coastguard Worker }
13