| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_singleton.h" | 5 #include "chrome/browser/process_singleton.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/un.h> | 10 #include <sys/un.h> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 LOG(ERROR) << "bind() failed: " << strerror(errno); | 48 LOG(ERROR) << "bind() failed: " << strerror(errno); |
| 49 | 49 |
| 50 if (listen(sock, 5) < 0) | 50 if (listen(sock, 5) < 0) |
| 51 NOTREACHED() << "listen failed: " << strerror(errno); | 51 NOTREACHED() << "listen failed: " << strerror(errno); |
| 52 | 52 |
| 53 // TODO(port): register this socket as something we care about getting | 53 // TODO(port): register this socket as something we care about getting |
| 54 // input on, process messages, etc. | 54 // input on, process messages, etc. |
| 55 // http://code.google.com/p/chromium/issues/detail?id=8073 | 55 // http://code.google.com/p/chromium/issues/detail?id=8073 |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ProcessSingleton::HuntForZombieChromeProcesses() { | |
| 59 // On Windows, this examines all the chrome.exe processes to see if one | |
| 60 // is hung. TODO(port): should we do anything here? | |
| 61 // http://code.google.com/p/chromium/issues/detail?id=8073 | |
| 62 } | |
| 63 | |
| 64 void ProcessSingleton::SetupSocket(int* sock, struct sockaddr_un* addr) { | 58 void ProcessSingleton::SetupSocket(int* sock, struct sockaddr_un* addr) { |
| 65 *sock = socket(PF_UNIX, SOCK_STREAM, 0); | 59 *sock = socket(PF_UNIX, SOCK_STREAM, 0); |
| 66 if (*sock < 0) | 60 if (*sock < 0) |
| 67 LOG(FATAL) << "socket() failed: " << strerror(errno); | 61 LOG(FATAL) << "socket() failed: " << strerror(errno); |
| 68 | 62 |
| 69 addr->sun_family = AF_UNIX; | 63 addr->sun_family = AF_UNIX; |
| 70 base::strlcpy(addr->sun_path, socket_path_.value().c_str(), | 64 base::strlcpy(addr->sun_path, socket_path_.value().c_str(), |
| 71 sizeof(addr->sun_path)); | 65 sizeof(addr->sun_path)); |
| 72 } | 66 } |
| OLD | NEW |