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

Side by Side Diff: chrome/browser/process_info_snapshot_mac_unittest.cc

Issue 100253002: Don't HANDLE_EINTR(close). Either IGNORE_EINTR(close) or just close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/process_info_snapshot.h" 5 #include "chrome/browser/process_info_snapshot.h"
6 6
7 #include <sys/types.h> // For |uid_t| (and |pid_t|). 7 #include <sys/types.h> // For |uid_t| (and |pid_t|).
8 #include <unistd.h> // For |getpid()|, |getuid()|, etc. 8 #include <unistd.h> // For |getpid()|, |getuid()|, etc.
9 9
10 #include <vector> 10 #include <vector>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 std::vector<std::string> argv; 110 std::vector<std::string> argv;
111 argv.push_back("/usr/bin/top"); 111 argv.push_back("/usr/bin/top");
112 argv.push_back("-l"); 112 argv.push_back("-l");
113 argv.push_back("0"); 113 argv.push_back("0");
114 114
115 base::ProcessHandle process_handle; 115 base::ProcessHandle process_handle;
116 base::LaunchOptions options; 116 base::LaunchOptions options;
117 options.fds_to_remap = &fds_to_remap; 117 options.fds_to_remap = &fds_to_remap;
118 ASSERT_TRUE(base::LaunchProcess(argv, options, &process_handle)); 118 ASSERT_TRUE(base::LaunchProcess(argv, options, &process_handle));
119 PCHECK(HANDLE_EINTR(close(fds[1])) == 0); 119 PCHECK(IGNORE_EINTR(close(fds[1])) == 0);
120 120
121 // Wait until there's some output form top. This is an easy way to tell that 121 // Wait until there's some output form top. This is an easy way to tell that
122 // the exec() call is done and top is actually running. 122 // the exec() call is done and top is actually running.
123 char buf[1]; 123 char buf[1];
124 PCHECK(HANDLE_EINTR(read(fds[0], buf, 1)) == 1); 124 PCHECK(HANDLE_EINTR(read(fds[0], buf, 1)) == 1);
125 125
126 std::vector<base::ProcessId> pid_list; 126 std::vector<base::ProcessId> pid_list;
127 pid_list.push_back(process_handle); 127 pid_list.push_back(process_handle);
128 ProcessInfoSnapshot snapshot; 128 ProcessInfoSnapshot snapshot;
129 ASSERT_TRUE(snapshot.Sample(pid_list)); 129 ASSERT_TRUE(snapshot.Sample(pid_list));
130 130
131 ProcessInfoSnapshot::ProcInfoEntry proc_info; 131 ProcessInfoSnapshot::ProcInfoEntry proc_info;
132 ASSERT_TRUE(snapshot.GetProcInfo(process_handle, &proc_info)); 132 ASSERT_TRUE(snapshot.GetProcInfo(process_handle, &proc_info));
133 // Effective user ID should be 0 (root). 133 // Effective user ID should be 0 (root).
134 EXPECT_EQ(proc_info.euid, 0u); 134 EXPECT_EQ(proc_info.euid, 0u);
135 // Real user ID should match the calling process's user id. 135 // Real user ID should match the calling process's user id.
136 EXPECT_EQ(proc_info.uid, geteuid()); 136 EXPECT_EQ(proc_info.uid, geteuid());
137 137
138 ASSERT_TRUE(base::KillProcess(process_handle, 0, true)); 138 ASSERT_TRUE(base::KillProcess(process_handle, 0, true));
139 PCHECK(HANDLE_EINTR(close(fds[0])) == 0); 139 PCHECK(IGNORE_EINTR(close(fds[0])) == 0);
140 } 140 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/serial/serial_connection_posix.cc ('k') | chrome/browser/process_singleton_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698