| OLD | NEW | 
|---|
| 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/platform.h" | 8 #include "bin/platform.h" | 
| 9 | 9 | 
| 10 #include <signal.h>  // NOLINT | 10 #include <signal.h>  // NOLINT | 
| 11 #include <string.h>  // NOLINT | 11 #include <string.h>  // NOLINT | 
| 12 #include <unistd.h>  // NOLINT | 12 #include <unistd.h>  // NOLINT | 
| 13 | 13 | 
| 14 #include "bin/fdutils.h" | 14 #include "bin/fdutils.h" | 
| 15 #include "bin/file.h" | 15 #include "bin/file.h" | 
| 16 | 16 | 
| 17 namespace dart { | 17 namespace dart { | 
| 18 namespace bin { | 18 namespace bin { | 
| 19 | 19 | 
| 20 const char* Platform::executable_name_ = NULL; | 20 const char* Platform::executable_name_ = NULL; | 
| 21 char* Platform::resolved_executable_name_ = NULL; | 21 char* Platform::resolved_executable_name_ = NULL; | 
| 22 int Platform::script_index_ = 1; | 22 int Platform::script_index_ = 1; | 
| 23 char** Platform::argv_ = NULL; | 23 char** Platform::argv_ = NULL; | 
| 24 | 24 | 
| 25 |  | 
| 26 static void segv_handler(int signal, siginfo_t* siginfo, void* context) { | 25 static void segv_handler(int signal, siginfo_t* siginfo, void* context) { | 
| 27   Dart_DumpNativeStackTrace(context); | 26   Dart_DumpNativeStackTrace(context); | 
| 28   abort(); | 27   abort(); | 
| 29 } | 28 } | 
| 30 | 29 | 
|  | 30 | 
| 31 bool Platform::Initialize() { | 31 bool Platform::Initialize() { | 
| 32   // Turn off the signal handler for SIGPIPE as it causes the process | 32   // Turn off the signal handler for SIGPIPE as it causes the process | 
| 33   // to terminate on writing to a closed pipe. Without the signal | 33   // to terminate on writing to a closed pipe. Without the signal | 
| 34   // handler error EPIPE is set instead. | 34   // handler error EPIPE is set instead. | 
| 35   struct sigaction act; | 35   struct sigaction act; | 
| 36   bzero(&act, sizeof(act)); | 36   bzero(&act, sizeof(act)); | 
| 37   act.sa_handler = SIG_IGN; | 37   act.sa_handler = SIG_IGN; | 
| 38   if (sigaction(SIGPIPE, &act, 0) != 0) { | 38   if (sigaction(SIGPIPE, &act, 0) != 0) { | 
| 39     perror("Setting signal handler failed"); | 39     perror("Setting signal handler failed"); | 
| 40     return false; | 40     return false; | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 107 | 107 | 
| 108 | 108 | 
| 109 void Platform::Exit(int exit_code) { | 109 void Platform::Exit(int exit_code) { | 
| 110   exit(exit_code); | 110   exit(exit_code); | 
| 111 } | 111 } | 
| 112 | 112 | 
| 113 }  // namespace bin | 113 }  // namespace bin | 
| 114 }  // namespace dart | 114 }  // namespace dart | 
| 115 | 115 | 
| 116 #endif  // defined(TARGET_OS_LINUX) | 116 #endif  // defined(TARGET_OS_LINUX) | 
| OLD | NEW | 
|---|