Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: sandbox/linux/system_headers/linux_signal.h

Issue 1176413003: Build ForkWithFlags and part of NamespaceSandbox under nonsfi newlib. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sandbox/linux/services/namespace_sandbox.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ 5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_
6 #define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ 6 #define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_
7 7
8 // NOTE: On some toolchains, signal related ABI is incompatible with Linux's 8 // NOTE: On some toolchains, signal related ABI is incompatible with Linux's
9 // (not undefined, but defined different values and in different memory 9 // (not undefined, but defined different values and in different memory
10 // layouts). So, fill the gap here. 10 // layouts). So, fill the gap here.
11 #define LINUX_SIGHUP 1
12 #define LINUX_SIGINT 2
13 #define LINUX_SIGQUIT 3
14 #define LINUX_SIGABRT 6
15 #define LINUX_SIGBUS 7
16 #define LINUX_SIGUSR1 10
17 #define LINUX_SIGSEGV 11
18 #define LINUX_SIGUSR2 12
19 #define LINUX_SIGPIPE 13
20 #define LINUX_SIGTERM 15
21 #define LINUX_SIGCHLD 17
22 #define LINUX_SIGSYS 31
23
24 #define LINUX_SIG_BLOCK 0
25 #define LINUX_SIG_UNBLOCK 1
26
27 #define LINUX_SA_SIGINFO 4
28 #define LINUX_SA_NODEFER 0x40000000
29 #define LINUX_SA_RESTART 0x10000000
30
31 #define LINUX_SIG_DFL 0
11 32
12 #if defined(__native_client_nonsfi__) 33 #if defined(__native_client_nonsfi__)
13 #if !defined(__i386__) && !defined(__arm__) 34 #if !defined(__i386__) && !defined(__arm__)
14 #error "Unsupported platform" 35 #error "Unsupported platform"
15 #endif 36 #endif
16 37
17 #include <signal.h> 38 #include <signal.h>
18 39
19 #define LINUX_SIGBUS 7 // 10 in PNaCl toolchain.
20 #define LINUX_SIGSEGV 11 // 11 in PNaCl toolchain. Defined for consistency.
21 #define LINUX_SIGCHLD 17 // 20 in PNaCl toolchain.
22 #define LINUX_SIGSYS 31 // 12 in PNaCl toolchain.
23
24 #define LINUX_SIG_BLOCK 0 // 1 in PNaCl toolchain.
25 #define LINUX_SIG_UNBLOCK 1 // 2 in PNaCl toolchain.
26
27 #define LINUX_SA_SIGINFO 4 // 2 in PNaCl toolchain.
28 #define LINUX_SA_NODEFER 0x40000000 // Undefined in PNaCl toolchain.
29 #define LINUX_SA_RESTART 0x10000000 // Undefined in PNaCl toolchain.
30
31 #define LINUX_SIG_DFL 0 // In PNaCl toolchain, unneeded cast is applied.
32
33 struct LinuxSigInfo { 40 struct LinuxSigInfo {
34 int si_signo; 41 int si_signo;
35 int si_errno; 42 int si_errno;
36 int si_code; 43 int si_code;
37 44
38 // Extra data is followed by the |si_code|. The length depends on the 45 // Extra data is followed by the |si_code|. The length depends on the
39 // signal number. 46 // signal number.
40 char _sifields[1]; 47 char _sifields[1];
41 }; 48 };
42 49
43 #include "sandbox/linux/system_headers/linux_ucontext.h" 50 #include "sandbox/linux/system_headers/linux_ucontext.h"
44 51
45 #else // !defined(__native_client_nonsfi__) 52 #else // !defined(__native_client_nonsfi__)
46 53
47 // Just alias the toolchain's value.
48 #include <signal.h> 54 #include <signal.h>
49 55
50 #define LINUX_SIGBUS SIGBUS 56 static_assert(LINUX_SIGHUP == SIGHUP, "LINUX_SIGHUP == SIGHUP");
51 #define LINUX_SIGSEGV SIGSEGV 57 static_assert(LINUX_SIGINT == SIGINT, "LINUX_SIGINT == SIGINT");
52 #define LINUX_SIGCHLD SIGCHLD 58 static_assert(LINUX_SIGQUIT == SIGQUIT, "LINUX_SIGQUIT == SIGQUIT");
53 #define LINUX_SIGSYS SIGSYS 59 static_assert(LINUX_SIGABRT == SIGABRT, "LINUX_SIGABRT == SIGABRT");
54 60 static_assert(LINUX_SIGBUS == SIGBUS, "LINUX_SIGBUS == SIGBUS");
55 #define LINUX_SIG_BLOCK SIG_BLOCK 61 static_assert(LINUX_SIGUSR1 == SIGUSR1, "LINUX_SIGUSR1 == SIGUSR1");
56 #define LINUX_SIG_UNBLOCK SIG_UNBLOCK 62 static_assert(LINUX_SIGSEGV == SIGSEGV, "LINUX_SIGSEGV == SIGSEGV");
57 63 static_assert(LINUX_SIGUSR2 == SIGUSR2, "LINUX_SIGUSR2 == SIGUSR2");
58 #define LINUX_SA_SIGINFO SA_SIGINFO 64 static_assert(LINUX_SIGPIPE == SIGPIPE, "LINUX_SIGPIPE == SIGPIPE");
59 #define LINUX_SA_NODEFER SA_NODEFER 65 static_assert(LINUX_SIGTERM == SIGTERM, "LINUX_SIGTERM == SIGTERM");
60 #define LINUX_SA_RESTART SA_RESTART 66 static_assert(LINUX_SIGCHLD == SIGCHLD, "LINUX_SIGCHLD == SIGCHLD");
61 67 static_assert(LINUX_SIGSYS == SIGSYS, "LINUX_SIGSYS == SIGSYS");
62 #define LINUX_SIG_DFL SIG_DFL 68 static_assert(LINUX_SIG_BLOCK == SIG_BLOCK, "LINUX_SIG_BLOCK == SIG_BLOCK");
69 static_assert(LINUX_SIG_UNBLOCK == SIG_UNBLOCK,
70 "LINUX_SIG_UNBLOCK == SIG_UNBLOCK");
71 static_assert(LINUX_SA_SIGINFO == SA_SIGINFO, "LINUX_SA_SIGINFO == SA_SIGINFO");
72 static_assert(LINUX_SA_NODEFER == SA_NODEFER, "LINUX_SA_NODEFER == SA_NODEFER");
73 static_assert(LINUX_SA_RESTART == SA_RESTART, "LINUX_SA_RESTART == SA_RESTART");
74 static_assert(LINUX_SIG_DFL == SIG_DFL, "LINUX_SIG_DFL == SIG_DFL");
63 75
64 typedef siginfo_t LinuxSigInfo; 76 typedef siginfo_t LinuxSigInfo;
65 77
66 #if defined(__ANDROID__) 78 #if defined(__ANDROID__)
67 // Android's signal.h doesn't define ucontext etc. 79 // Android's signal.h doesn't define ucontext etc.
68 #include "sandbox/linux/system_headers/linux_ucontext.h" 80 #include "sandbox/linux/system_headers/linux_ucontext.h"
69 #endif // defined(__ANDROID__) 81 #endif // defined(__ANDROID__)
70 82
71 #endif // !defined(__native_client_nonsfi__) 83 #endif // !defined(__native_client_nonsfi__)
72 84
73 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ 85 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_
OLDNEW
« no previous file with comments | « sandbox/linux/services/namespace_sandbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698