OLD | NEW |
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 #include <errno.h> | 5 #include <errno.h> |
6 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <pthread.h> | 7 #include <pthread.h> |
8 #include <sched.h> | 8 #include <sched.h> |
9 #include <signal.h> | 9 #include <signal.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 2117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 if (base::SysInfo::IsRunningOnChromeOS()) { | 2128 if (base::SysInfo::IsRunningOnChromeOS()) { |
2129 BPF_ASSERT_EQ(true, supports_multi_threaded); | 2129 BPF_ASSERT_EQ(true, supports_multi_threaded); |
2130 } | 2130 } |
2131 // else a Chrome OS build not running on a Chrome OS device e.g. Chrome bots. | 2131 // else a Chrome OS build not running on a Chrome OS device e.g. Chrome bots. |
2132 // In this case fall through. | 2132 // In this case fall through. |
2133 #endif | 2133 #endif |
2134 if (!supports_multi_threaded) { | 2134 if (!supports_multi_threaded) { |
2135 return; | 2135 return; |
2136 } | 2136 } |
2137 | 2137 |
2138 base::WaitableEvent event(true, false); | 2138 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, |
| 2139 base::WaitableEvent::InitialState::NOT_SIGNALED); |
2139 | 2140 |
2140 // Create a thread on which to invoke the blocked syscall. | 2141 // Create a thread on which to invoke the blocked syscall. |
2141 pthread_t thread; | 2142 pthread_t thread; |
2142 BPF_ASSERT_EQ( | 2143 BPF_ASSERT_EQ( |
2143 0, pthread_create(&thread, NULL, &TsyncApplyToTwoThreadsFunc, &event)); | 2144 0, pthread_create(&thread, NULL, &TsyncApplyToTwoThreadsFunc, &event)); |
2144 | 2145 |
2145 // Test that nanoseelp success. | 2146 // Test that nanoseelp success. |
2146 const struct timespec ts = {0, 0}; | 2147 const struct timespec ts = {0, 0}; |
2147 BPF_ASSERT_EQ(0, HANDLE_EINTR(syscall(__NR_nanosleep, &ts, NULL))); | 2148 BPF_ASSERT_EQ(0, HANDLE_EINTR(syscall(__NR_nanosleep, &ts, NULL))); |
2148 | 2149 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2255 BPF_ASSERT_EQ(ENOSYS, errno); | 2256 BPF_ASSERT_EQ(ENOSYS, errno); |
2256 | 2257 |
2257 BPF_ASSERT_EQ(-1, syscall(__NR_setgid, 300)); | 2258 BPF_ASSERT_EQ(-1, syscall(__NR_setgid, 300)); |
2258 BPF_ASSERT_EQ(EPERM, errno); | 2259 BPF_ASSERT_EQ(EPERM, errno); |
2259 } | 2260 } |
2260 | 2261 |
2261 } // namespace | 2262 } // namespace |
2262 | 2263 |
2263 } // namespace bpf_dsl | 2264 } // namespace bpf_dsl |
2264 } // namespace sandbox | 2265 } // namespace sandbox |
OLD | NEW |