OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <dirent.h> | 5 #include <dirent.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
11 #include <sys/time.h> | 11 #include <sys/time.h> |
(...skipping 13 matching lines...) Expand all Loading... | |
25 #include "base/file_util.h" | 25 #include "base/file_util.h" |
26 #include "base/logging.h" | 26 #include "base/logging.h" |
27 #include "base/memory/scoped_ptr.h" | 27 #include "base/memory/scoped_ptr.h" |
28 #include "base/process_util.h" | 28 #include "base/process_util.h" |
29 #include "base/stringprintf.h" | 29 #include "base/stringprintf.h" |
30 #include "base/synchronization/waitable_event.h" | 30 #include "base/synchronization/waitable_event.h" |
31 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 31 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
32 #include "base/threading/platform_thread.h" | 32 #include "base/threading/platform_thread.h" |
33 #include "base/threading/thread_restrictions.h" | 33 #include "base/threading/thread_restrictions.h" |
34 | 34 |
35 #if defined(OS_CHROMEOS) | |
36 #include <sys/ioctl.h> | |
37 #endif | |
38 | |
35 #if defined(OS_FREEBSD) | 39 #if defined(OS_FREEBSD) |
36 #include <sys/event.h> | 40 #include <sys/event.h> |
37 #include <sys/ucontext.h> | 41 #include <sys/ucontext.h> |
38 #endif | 42 #endif |
39 | 43 |
40 #if defined(OS_MACOSX) | 44 #if defined(OS_MACOSX) |
41 #include <crt_externs.h> | 45 #include <crt_externs.h> |
42 #include <sys/event.h> | 46 #include <sys/event.h> |
43 #else | 47 #else |
44 extern char** environ; | 48 extern char** environ; |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
670 // any hidden calls to malloc. | 674 // any hidden calls to malloc. |
671 void *malloc_thunk = | 675 void *malloc_thunk = |
672 reinterpret_cast<void*>(reinterpret_cast<intptr_t>(malloc) & ~4095); | 676 reinterpret_cast<void*>(reinterpret_cast<intptr_t>(malloc) & ~4095); |
673 mprotect(malloc_thunk, 4096, PROT_READ | PROT_WRITE | PROT_EXEC); | 677 mprotect(malloc_thunk, 4096, PROT_READ | PROT_WRITE | PROT_EXEC); |
674 memset(reinterpret_cast<void*>(malloc), 0xff, 8); | 678 memset(reinterpret_cast<void*>(malloc), 0xff, 8); |
675 #endif // 0 | 679 #endif // 0 |
676 | 680 |
677 // DANGER: no calls to malloc are allowed from now on: | 681 // DANGER: no calls to malloc are allowed from now on: |
678 // http://crbug.com/36678 | 682 // http://crbug.com/36678 |
679 | 683 |
684 #if defined(OS_CHROMEOS) | |
685 if (options.ctrl_terminal_fd >=0) { | |
Evan Martin
2012/01/20 19:03:03
space before 0
tbarzic
2012/01/20 20:42:05
Done.
| |
686 if (HANDLE_EINTR(setsid()) == -1 || | |
687 HANDLE_EINTR( | |
688 ioctl(options.ctrl_terminal_fd, TIOCSCTTY, NULL)) == -1) { | |
689 RAW_LOG(WARNING, "Unable to set controlling terminal"); | |
Evan Martin
2012/01/20 19:03:03
I wonder if it'd be more useful to specify what fa
tbarzic
2012/01/20 20:42:05
Good suggestion...
| |
690 } | |
691 } | |
692 #endif // defined(OS_CHROMEOS) | |
693 | |
680 if (options.fds_to_remap) { | 694 if (options.fds_to_remap) { |
681 for (file_handle_mapping_vector::const_iterator | 695 for (file_handle_mapping_vector::const_iterator |
682 it = options.fds_to_remap->begin(); | 696 it = options.fds_to_remap->begin(); |
683 it != options.fds_to_remap->end(); ++it) { | 697 it != options.fds_to_remap->end(); ++it) { |
684 fd_shuffle1.push_back(InjectionArc(it->first, it->second, false)); | 698 fd_shuffle1.push_back(InjectionArc(it->first, it->second, false)); |
685 fd_shuffle2.push_back(InjectionArc(it->first, it->second, false)); | 699 fd_shuffle2.push_back(InjectionArc(it->first, it->second, false)); |
686 } | 700 } |
687 } | 701 } |
688 | 702 |
689 #if defined(OS_MACOSX) | 703 #if defined(OS_MACOSX) |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1305 if (IsChildDead(process)) | 1319 if (IsChildDead(process)) |
1306 return; | 1320 return; |
1307 | 1321 |
1308 BackgroundReaper* reaper = new BackgroundReaper(process, 0); | 1322 BackgroundReaper* reaper = new BackgroundReaper(process, 0); |
1309 PlatformThread::CreateNonJoinable(0, reaper); | 1323 PlatformThread::CreateNonJoinable(0, reaper); |
1310 } | 1324 } |
1311 | 1325 |
1312 #endif // !defined(OS_MACOSX) | 1326 #endif // !defined(OS_MACOSX) |
1313 | 1327 |
1314 } // namespace base | 1328 } // namespace base |
OLD | NEW |