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

Side by Side Diff: base/linux_util.cc

Issue 8507022: Remove the remaining exit time destructors from base for linux and chromeos. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | base/process_linux.cc » ('j') | base/process_linux.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/linux_util.h" 5 #include "base/linux_util.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <glib.h> 10 #include <glib.h>
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // We do this check only once per process. If it fails, there's 147 // We do this check only once per process. If it fails, there's
148 // little reason to believe it will work if we attempt to run 148 // little reason to believe it will work if we attempt to run
149 // lsb_release again. 149 // lsb_release again.
150 std::vector<std::string> argv; 150 std::vector<std::string> argv;
151 argv.push_back("lsb_release"); 151 argv.push_back("lsb_release");
152 argv.push_back("-d"); 152 argv.push_back("-d");
153 std::string output; 153 std::string output;
154 base::GetAppOutput(CommandLine(argv), &output); 154 base::GetAppOutput(CommandLine(argv), &output);
155 if (output.length() > 0) { 155 if (output.length() > 0) {
156 // lsb_release -d should return: Description:<tab>Distro Info 156 // lsb_release -d should return: Description:<tab>Distro Info
157 static const std::string field = "Description:\t"; 157 static const char field[] = "Description:\t";
Mark Mentovai 2011/11/09 21:13:45 This doesn’t even need to be static.
Nico 2011/11/09 21:24:07 Done. Does it make any difference though? String l
Mark Mentovai 2011/11/09 21:29:10 Nico wrote:
158 if (output.compare(0, field.length(), field) == 0) { 158 if (output.compare(0, strlen(field), field) == 0) {
159 SetLinuxDistro(output.substr(field.length())); 159 SetLinuxDistro(output.substr(strlen(field)));
160 } 160 }
161 } 161 }
162 distro_state_singleton->CheckFinished(); 162 distro_state_singleton->CheckFinished();
163 return g_linux_distro; 163 return g_linux_distro;
164 } else if (STATE_CHECK_STARTED == state) { 164 } else if (STATE_CHECK_STARTED == state) {
165 // If the distro check above is in progress in some other thread, we're 165 // If the distro check above is in progress in some other thread, we're
166 // not going to wait for the results. 166 // not going to wait for the results.
167 return "Unknown"; 167 return "Unknown";
168 } else { 168 } else {
169 // In STATE_CHECK_FINISHED, no more writing to |linux_distro|. 169 // In STATE_CHECK_FINISHED, no more writing to |linux_distro|.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 if (0 == strncmp(expected_data.c_str(), syscall_data.get(), 297 if (0 == strncmp(expected_data.c_str(), syscall_data.get(),
298 expected_data.length())) { 298 expected_data.length())) {
299 return current_tid; 299 return current_tid;
300 } 300 }
301 } 301 }
302 return -1; 302 return -1;
303 } 303 }
304 304
305 } // namespace base 305 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/process_linux.cc » ('j') | base/process_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698