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

Side by Side Diff: base/process_util_linux.cc

Issue 100225: POSIX: Add a macro for handling EINTR. (Closed)
Patch Set: ... Created 11 years, 7 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
« no previous file with comments | « base/message_pump_libevent.cc ('k') | base/process_util_mac.mm » ('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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 "base/process_util.h" 5 #include "base/process_util.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <dirent.h> 8 #include <dirent.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <unistd.h> 10 #include <unistd.h>
11 #include <string> 11 #include <string>
12 #include <sys/types.h> 12 #include <sys/types.h>
13 #include <sys/wait.h> 13 #include <sys/wait.h>
14 14
15 #include "base/eintr_wrappers.h"
15 #include "base/file_util.h" 16 #include "base/file_util.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/string_tokenizer.h" 18 #include "base/string_tokenizer.h"
18 #include "base/string_util.h" 19 #include "base/string_util.h"
19 20
20 namespace { 21 namespace {
21 22
22 enum ParsingState { 23 enum ParsingState {
23 KEY_NAME, 24 KEY_NAME,
24 KEY_VALUE 25 KEY_VALUE
(...skipping 23 matching lines...) Expand all
48 CloseSuperfluousFds(fd_shuffle); 49 CloseSuperfluousFds(fd_shuffle);
49 50
50 scoped_array<char*> argv_cstr(new char*[argv.size() + 1]); 51 scoped_array<char*> argv_cstr(new char*[argv.size() + 1]);
51 for (size_t i = 0; i < argv.size(); i++) 52 for (size_t i = 0; i < argv.size(); i++)
52 argv_cstr[i] = const_cast<char*>(argv[i].c_str()); 53 argv_cstr[i] = const_cast<char*>(argv[i].c_str());
53 argv_cstr[argv.size()] = NULL; 54 argv_cstr[argv.size()] = NULL;
54 execvp(argv_cstr[0], argv_cstr.get()); 55 execvp(argv_cstr[0], argv_cstr.get());
55 exit(127); 56 exit(127);
56 } else { 57 } else {
57 if (wait) 58 if (wait)
58 waitpid(pid, 0, 0); 59 HANDLE_EINTR(waitpid(pid, 0, 0));
59 60
60 if (process_handle) 61 if (process_handle)
61 *process_handle = pid; 62 *process_handle = pid;
62 } 63 }
63 64
64 return true; 65 return true;
65 } 66 }
66 67
67 bool LaunchApp(const CommandLine& cl, 68 bool LaunchApp(const CommandLine& cl,
68 bool wait, bool start_hidden, 69 bool wait, bool start_hidden,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 (*io_counters).WriteTransferCount = StringToInt64(tokenizer.token()); 218 (*io_counters).WriteTransferCount = StringToInt64(tokenizer.token());
218 } 219 }
219 state = KEY_NAME; 220 state = KEY_NAME;
220 break; 221 break;
221 } 222 }
222 } 223 }
223 return true; 224 return true;
224 } 225 }
225 226
226 } // namespace base 227 } // namespace base
OLDNEW
« no previous file with comments | « base/message_pump_libevent.cc ('k') | base/process_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698