]> git.ipfire.org Git - thirdparty/gcc.git/blob - libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc
Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856).
[thirdparty/gcc.git] / libsanitizer / sanitizer_common / sanitizer_syscall_generic.inc
1 //===-- sanitizer_syscall_generic.inc ---------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // Generic implementations of internal_syscall* and internal_iserror.
9 //
10 //===----------------------------------------------------------------------===//
11
12 // NetBSD uses libc calls directly
13 #if !SANITIZER_NETBSD
14
15 #if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_OPENBSD || SANITIZER_SOLARIS
16 # define SYSCALL(name) SYS_ ## name
17 #else
18 # define SYSCALL(name) __NR_ ## name
19 #endif
20
21 #if defined(__x86_64__) && (SANITIZER_FREEBSD || SANITIZER_MAC)
22 # define internal_syscall __syscall
23 # else
24 # define internal_syscall syscall
25 #endif
26
27 #endif
28
29 bool internal_iserror(uptr retval, int *rverrno) {
30 if (retval == (uptr)-1) {
31 if (rverrno)
32 *rverrno = errno;
33 return true;
34 } else {
35 return false;
36 }
37 }