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

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

Issue 866043003: Use MacOS helper to get address of environ variable (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | 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_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "bin/process.h" 8 #include "bin/process.h"
9 9
10 #include <crt_externs.h> // NOLINT
10 #include <errno.h> // NOLINT 11 #include <errno.h> // NOLINT
11 #include <fcntl.h> // NOLINT 12 #include <fcntl.h> // NOLINT
12 #include <poll.h> // NOLINT 13 #include <poll.h> // NOLINT
13 #include <signal.h> // NOLINT 14 #include <signal.h> // NOLINT
14 #include <stdio.h> // NOLINT 15 #include <stdio.h> // NOLINT
15 #include <stdlib.h> // NOLINT 16 #include <stdlib.h> // NOLINT
16 #include <string.h> // NOLINT 17 #include <string.h> // NOLINT
17 #include <unistd.h> // NOLINT 18 #include <unistd.h> // NOLINT
18 19
19 #include "bin/fdutils.h" 20 #include "bin/fdutils.h"
20 #include "bin/lockers.h" 21 #include "bin/lockers.h"
21 #include "bin/log.h" 22 #include "bin/log.h"
22 #include "bin/thread.h" 23 #include "bin/thread.h"
23 24
24 #include "platform/signal_blocker.h" 25 #include "platform/signal_blocker.h"
25 26
26 27
27 extern char **environ;
28
29 28
30 namespace dart { 29 namespace dart {
31 namespace bin { 30 namespace bin {
32 31
33 // ProcessInfo is used to map a process id to the file descriptor for 32 // ProcessInfo is used to map a process id to the file descriptor for
34 // the pipe used to communicate the exit code of the process to Dart. 33 // the pipe used to communicate the exit code of the process to Dart.
35 // ProcessInfo objects are kept in the static singly-linked 34 // ProcessInfo objects are kept in the static singly-linked
36 // ProcessInfoList. 35 // ProcessInfoList.
37 class ProcessInfo { 36 class ProcessInfo {
38 public: 37 public:
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 ReportChildError(exec_control[1]); 466 ReportChildError(exec_control[1]);
468 } 467 }
469 VOID_TEMP_FAILURE_RETRY(close(read_err[1])); 468 VOID_TEMP_FAILURE_RETRY(close(read_err[1]));
470 469
471 if (working_directory != NULL && 470 if (working_directory != NULL &&
472 TEMP_FAILURE_RETRY(chdir(working_directory)) == -1) { 471 TEMP_FAILURE_RETRY(chdir(working_directory)) == -1) {
473 ReportChildError(exec_control[1]); 472 ReportChildError(exec_control[1]);
474 } 473 }
475 474
476 if (program_environment != NULL) { 475 if (program_environment != NULL) {
476 // On MacOS you have to do a bit of magic to get to the
477 // environment strings.
478 char** environ = *(_NSGetEnviron());
477 environ = program_environment; 479 environ = program_environment;
478 } 480 }
479 481
480 VOID_TEMP_FAILURE_RETRY( 482 VOID_TEMP_FAILURE_RETRY(
481 execvp(path, const_cast<char* const*>(program_arguments))); 483 execvp(path, const_cast<char* const*>(program_arguments)));
482 484
483 ReportChildError(exec_control[1]); 485 ReportChildError(exec_control[1]);
484 } 486 }
485 } 487 }
486 488
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 bzero(&act, sizeof(act)); 887 bzero(&act, sizeof(act));
886 act.sa_handler = SIG_DFL; 888 act.sa_handler = SIG_DFL;
887 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); 889 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL));
888 } 890 }
889 } 891 }
890 892
891 } // namespace bin 893 } // namespace bin
892 } // namespace dart 894 } // namespace dart
893 895
894 #endif // defined(TARGET_OS_MACOS) 896 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698