Daily bump.
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_syscall_generic.inc
blob7667b753a8b189b0f2bf243616f31f372f333864
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 //===----------------------------------------------------------------------===//
12 #if SANITIZER_FREEBSD
13 # define SYSCALL(name) SYS_ ## name
14 #else
15 # define SYSCALL(name) __NR_ ## name
16 #endif
18 #if SANITIZER_FREEBSD && defined(__x86_64__)
19 # define internal_syscall __syscall
20 # else
21 # define internal_syscall syscall
22 #endif
24 bool internal_iserror(uptr retval, int *rverrno) {
25   if (retval == (uptr)-1) {
26     if (rverrno)
27       *rverrno = errno;
28     return true;
29   } else {
30     return false;
31   }