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

Side by Side Diff: chrome/browser/process_singleton_linux.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 // On Linux, when the user tries to launch a second copy of chrome, we check 5 // On Linux, when the user tries to launch a second copy of chrome, we check
6 // for a socket in the user's profile directory. If the socket file is open we 6 // for a socket in the user's profile directory. If the socket file is open we
7 // send a message to the first chrome browser process with the current 7 // send a message to the first chrome browser process with the current
8 // directory and second process command line flags. The second process then 8 // directory and second process command line flags. The second process then
9 // exits. 9 // exits.
10 // 10 //
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 int flags = fcntl(fd, F_GETFD, 0); 118 int flags = fcntl(fd, F_GETFD, 0);
119 if (-1 == flags) 119 if (-1 == flags)
120 return flags; 120 return flags;
121 if (flags & FD_CLOEXEC) 121 if (flags & FD_CLOEXEC)
122 return 0; 122 return 0;
123 return fcntl(fd, F_SETFD, flags | FD_CLOEXEC); 123 return fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
124 } 124 }
125 125
126 // Close a socket and check return value. 126 // Close a socket and check return value.
127 void CloseSocket(int fd) { 127 void CloseSocket(int fd) {
128 int rv = HANDLE_EINTR(close(fd)); 128 int rv = IGNORE_EINTR(close(fd));
129 DCHECK_EQ(0, rv) << "Error closing socket: " << safe_strerror(errno); 129 DCHECK_EQ(0, rv) << "Error closing socket: " << safe_strerror(errno);
130 } 130 }
131 131
132 // Write a message to a socket fd. 132 // Write a message to a socket fd.
133 bool WriteToSocket(int fd, const char *message, size_t length) { 133 bool WriteToSocket(int fd, const char *message, size_t length) {
134 DCHECK(message); 134 DCHECK(message);
135 DCHECK(length); 135 DCHECK(length);
136 size_t bytes_written = 0; 136 size_t bytes_written = 0;
137 do { 137 do {
138 ssize_t rv = HANDLE_EINTR( 138 ssize_t rv = HANDLE_EINTR(
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 } 974 }
975 975
976 void ProcessSingleton::KillProcess(int pid) { 976 void ProcessSingleton::KillProcess(int pid) {
977 // TODO(james.su@gmail.com): Is SIGKILL ok? 977 // TODO(james.su@gmail.com): Is SIGKILL ok?
978 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL); 978 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL);
979 // ESRCH = No Such Process (can happen if the other process is already in 979 // ESRCH = No Such Process (can happen if the other process is already in
980 // progress of shutting down and finishes before we try to kill it). 980 // progress of shutting down and finishes before we try to kill it).
981 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " 981 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: "
982 << safe_strerror(errno); 982 << safe_strerror(errno);
983 } 983 }
OLDNEW
« no previous file with comments | « chrome/browser/process_info_snapshot_mac_unittest.cc ('k') | chrome/browser/process_singleton_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698