Mercurial > hg > CbC > CbC_gcc
comparison libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 04ced10e8804 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 //===-- sanitizer_syscall_generic.inc ---------------------------*- C++ -*-===// | 1 //===-- sanitizer_syscall_generic.inc ---------------------------*- C++ -*-===// |
2 // | 2 // |
3 // This file is distributed under the University of Illinois Open Source | 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 // License. See LICENSE.TXT for details. | 4 // See https://llvm.org/LICENSE.txt for license information. |
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
5 // | 6 // |
6 //===----------------------------------------------------------------------===// | 7 //===----------------------------------------------------------------------===// |
7 // | 8 // |
8 // Generic implementations of internal_syscall* and internal_iserror. | 9 // Generic implementations of internal_syscall* and internal_iserror. |
9 // | 10 // |
10 //===----------------------------------------------------------------------===// | 11 //===----------------------------------------------------------------------===// |
11 | 12 |
12 #if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD | 13 // NetBSD uses libc calls directly |
14 #if !SANITIZER_NETBSD | |
15 | |
16 #if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_OPENBSD || SANITIZER_SOLARIS | |
13 # define SYSCALL(name) SYS_ ## name | 17 # define SYSCALL(name) SYS_ ## name |
14 #else | 18 #else |
15 # define SYSCALL(name) __NR_ ## name | 19 # define SYSCALL(name) __NR_ ## name |
16 #endif | 20 #endif |
17 | 21 |
18 #if SANITIZER_NETBSD | 22 #if defined(__x86_64__) && (SANITIZER_FREEBSD || SANITIZER_MAC) |
19 // We use 3 kinds of internal_syscall's for different types of retval in order | |
20 // to address differences in calling conventions (e.g. registers to place the | |
21 // return value in). | |
22 // - internal_syscall for 32-bit length (int, pid_t) | |
23 // - internal_syscall64 for 64-bit length (off_t) | |
24 // - internal_syscall_ptr for pointer and (s)size_t | |
25 # define internal_syscall syscall | |
26 # define internal_syscall64 __syscall | |
27 // Handle syscall renames manually | |
28 # define SYS_stat SYS___stat50 | |
29 # define SYS_lstat SYS___lstat50 | |
30 # define SYS_fstat SYS___fstat50 | |
31 # define SYS_gettimeofday SYS___gettimeofday50 | |
32 # define SYS_wait4 SYS___wait450 | |
33 # define SYS_getdents SYS___getdents30 | |
34 # define SYS_sigaltstack SYS___sigaltstack14 | |
35 # define SYS_sigprocmask SYS___sigprocmask14 | |
36 # define SYS_nanosleep SYS___nanosleep50 | |
37 # if SANITIZER_WORDSIZE == 64 | |
38 # define internal_syscall_ptr __syscall | |
39 # else | |
40 # define internal_syscall_ptr syscall | |
41 # endif | |
42 #elif defined(__x86_64__) && (SANITIZER_FREEBSD || SANITIZER_MAC) | |
43 # define internal_syscall __syscall | 23 # define internal_syscall __syscall |
44 # else | 24 # else |
45 # define internal_syscall syscall | 25 # define internal_syscall syscall |
26 #endif | |
27 | |
46 #endif | 28 #endif |
47 | 29 |
48 bool internal_iserror(uptr retval, int *rverrno) { | 30 bool internal_iserror(uptr retval, int *rverrno) { |
49 if (retval == (uptr)-1) { | 31 if (retval == (uptr)-1) { |
50 if (rverrno) | 32 if (rverrno) |