| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 static void SetChildOsErrorMessage(char* os_error_message, | 81 static void SetChildOsErrorMessage(char* os_error_message, |
| 82 int os_error_message_len) { | 82 int os_error_message_len) { |
| 83 SafeStrNCpy(os_error_message, strerror(errno), os_error_message_len); | 83 SafeStrNCpy(os_error_message, strerror(errno), os_error_message_len); |
| 84 } | 84 } |
| 85 | 85 |
| 86 | 86 |
| 87 void ExitHandler(int process_signal, siginfo_t* siginfo, void* tmp) { | 87 void ExitHandler(int process_signal, siginfo_t* siginfo, void* tmp) { |
| 88 assert(process_signal == SIGCHLD); | 88 ASSERT(process_signal == SIGCHLD); |
| 89 struct sigaction act; | 89 struct sigaction act; |
| 90 bzero(&act, sizeof(act)); | 90 bzero(&act, sizeof(act)); |
| 91 act.sa_handler = SIG_IGN; | 91 act.sa_handler = SIG_IGN; |
| 92 act.sa_flags = SA_NOCLDSTOP | SA_SIGINFO; | 92 act.sa_flags = SA_NOCLDSTOP | SA_SIGINFO; |
| 93 if (sigaction(SIGCHLD, &act, 0) != 0) { | 93 if (sigaction(SIGCHLD, &act, 0) != 0) { |
| 94 perror("Process start: disabling signal handler failed"); | 94 perror("Process start: disabling signal handler failed"); |
| 95 } | 95 } |
| 96 ProcessInfo* process = LookupProcess(siginfo->si_pid); | 96 ProcessInfo* process = LookupProcess(siginfo->si_pid); |
| 97 if (process != NULL) { | 97 if (process != NULL) { |
| 98 intptr_t message[2] = { siginfo->si_pid, siginfo->si_status }; | 98 intptr_t message[2] = { siginfo->si_pid, siginfo->si_status }; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 if (result == -1) { | 330 if (result == -1) { |
| 331 return false; | 331 return false; |
| 332 } | 332 } |
| 333 return true; | 333 return true; |
| 334 } | 334 } |
| 335 | 335 |
| 336 | 336 |
| 337 void Process::Exit(intptr_t id) { | 337 void Process::Exit(intptr_t id) { |
| 338 RemoveProcess(id); | 338 RemoveProcess(id); |
| 339 } | 339 } |
| OLD | NEW |