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

Side by Side Diff: runtime/bin/process_linux.cc

Issue 251403004: Mark pipe as close-on-exec. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/process_android.cc ('k') | runtime/bin/process_macos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include "bin/process.h" 8 #include "bin/process.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 intptr_t Process::SetSignalHandler(intptr_t signal) { 664 intptr_t Process::SetSignalHandler(intptr_t signal) {
665 bool found = false; 665 bool found = false;
666 for (int i = 0; i < kSignalsCount; i++) { 666 for (int i = 0; i < kSignalsCount; i++) {
667 if (kSignals[i] == signal) { 667 if (kSignals[i] == signal) {
668 found = true; 668 found = true;
669 break; 669 break;
670 } 670 }
671 } 671 }
672 if (!found) return -1; 672 if (!found) return -1;
673 int fds[2]; 673 int fds[2];
674 if (pipe(fds) != 0) { 674 if (NO_RETRY_EXPECTED(pipe2(fds, O_CLOEXEC)) != 0) {
675 return -1; 675 return -1;
676 } 676 }
677 ThreadSignalBlocker blocker(kSignalsCount, kSignals); 677 ThreadSignalBlocker blocker(kSignalsCount, kSignals);
678 MutexLocker lock(signal_mutex); 678 MutexLocker lock(signal_mutex);
679 SignalInfo* handler = signal_handlers; 679 SignalInfo* handler = signal_handlers;
680 bool listen = true; 680 bool listen = true;
681 while (handler != NULL) { 681 while (handler != NULL) {
682 if (handler->signal() == signal) { 682 if (handler->signal() == signal) {
683 listen = false; 683 listen = false;
684 break; 684 break;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 bzero(&act, sizeof(act)); 736 bzero(&act, sizeof(act));
737 act.sa_handler = SIG_DFL; 737 act.sa_handler = SIG_DFL;
738 sigaction(signal, &act, NULL); 738 sigaction(signal, &act, NULL);
739 } 739 }
740 } 740 }
741 741
742 } // namespace bin 742 } // namespace bin
743 } // namespace dart 743 } // namespace dart
744 744
745 #endif // defined(TARGET_OS_LINUX) 745 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/process_android.cc ('k') | runtime/bin/process_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698