File: get_error.c

package info (click to toggle)
strace 4.15-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 22,752 kB
  • ctags: 9,462
  • sloc: ansic: 62,976; sh: 7,256; makefile: 3,551; perl: 352; awk: 343; lisp: 44; sed: 6
file content (27 lines) | stat: -rw-r--r-- 549 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
static void
get_error(struct tcb *tcp, const bool check_errno)
{
	/*
	 * In X32, return value is 64-bit (llseek uses one).
	 * Using merely "long rax" would not work.
	 */
	long long rax;

	if (x86_io.iov_len == sizeof(i386_regs)) {
		/* Sign extend from 32 bits */
		rax = (int32_t) i386_regs.eax;
	} else {
		rax = x86_64_regs.rax;
	}

	if (check_errno && is_negated_errno(rax)) {
		tcp->u_rval = -1;
		tcp->u_error = -rax;
	} else {
		tcp->u_rval = rax;
#ifdef X32
		/* tcp->u_rval contains a truncated value */
		tcp->u_lrval = rax;
#endif
	}
}