Retro68/gcc/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc

38 lines
995 B
PHP
Raw Normal View History

2014-09-21 17:33:12 +00:00
//===-- sanitizer_syscall_generic.inc ---------------------------*- C++ -*-===//
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
2018-12-28 15:30:48 +00:00
// Generic implementations of internal_syscall* and internal_iserror.
2014-09-21 17:33:12 +00:00
//
//===----------------------------------------------------------------------===//
2019-06-02 15:48:37 +00:00
// NetBSD uses libc calls directly
#if !SANITIZER_NETBSD
#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_OPENBSD || SANITIZER_SOLARIS
2015-08-28 15:33:40 +00:00
# define SYSCALL(name) SYS_ ## name
#else
# define SYSCALL(name) __NR_ ## name
#endif
2019-06-02 15:48:37 +00:00
#if defined(__x86_64__) && (SANITIZER_FREEBSD || SANITIZER_MAC)
2015-08-28 15:33:40 +00:00
# define internal_syscall __syscall
# else
# define internal_syscall syscall
#endif
2014-09-21 17:33:12 +00:00
2019-06-02 15:48:37 +00:00
#endif
2014-09-21 17:33:12 +00:00
bool internal_iserror(uptr retval, int *rverrno) {
if (retval == (uptr)-1) {
if (rverrno)
*rverrno = errno;
return true;
} else {
return false;
}
}