annotate libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 //===-- sanitizer_syscall_generic.inc ---------------------------*- C++ -*-===//
kono
parents:
diff changeset
2 //
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
111
kono
parents:
diff changeset
6 //
kono
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
kono
parents:
diff changeset
8 //
kono
parents:
diff changeset
9 // Generic implementations of internal_syscall* and internal_iserror.
kono
parents:
diff changeset
10 //
kono
parents:
diff changeset
11 //===----------------------------------------------------------------------===//
kono
parents:
diff changeset
12
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
13 // NetBSD uses libc calls directly
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
14 #if !SANITIZER_NETBSD
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
15
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
16 #if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_OPENBSD || SANITIZER_SOLARIS
111
kono
parents:
diff changeset
17 # define SYSCALL(name) SYS_ ## name
kono
parents:
diff changeset
18 #else
kono
parents:
diff changeset
19 # define SYSCALL(name) __NR_ ## name
kono
parents:
diff changeset
20 #endif
kono
parents:
diff changeset
21
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
22 #if defined(__x86_64__) && (SANITIZER_FREEBSD || SANITIZER_MAC)
111
kono
parents:
diff changeset
23 # define internal_syscall __syscall
kono
parents:
diff changeset
24 # else
kono
parents:
diff changeset
25 # define internal_syscall syscall
kono
parents:
diff changeset
26 #endif
kono
parents:
diff changeset
27
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
28 #endif
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
29
111
kono
parents:
diff changeset
30 bool internal_iserror(uptr retval, int *rverrno) {
kono
parents:
diff changeset
31 if (retval == (uptr)-1) {
kono
parents:
diff changeset
32 if (rverrno)
kono
parents:
diff changeset
33 *rverrno = errno;
kono
parents:
diff changeset
34 return true;
kono
parents:
diff changeset
35 } else {
kono
parents:
diff changeset
36 return false;
kono
parents:
diff changeset
37 }
kono
parents:
diff changeset
38 }