| OLD | NEW |
| 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/crash_handler_host_linux.h" | 5 #include "chrome/browser/crash_handler_host_linux.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/syscall.h> | 10 #include <sys/syscall.h> |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 // The kernel doesn't translate PIDs in SCM_CREDENTIALS across PID | 254 // The kernel doesn't translate PIDs in SCM_CREDENTIALS across PID |
| 255 // namespaces. Thus |crashing_pid| might be garbage from our point of view. | 255 // namespaces. Thus |crashing_pid| might be garbage from our point of view. |
| 256 // In the future we can remove this workaround, but we have to wait a couple | 256 // In the future we can remove this workaround, but we have to wait a couple |
| 257 // of years to be sure that it's worked its way out into the world. | 257 // of years to be sure that it's worked its way out into the world. |
| 258 // TODO(thestig) Remove the workaround when Ubuntu Lucid is deprecated. | 258 // TODO(thestig) Remove the workaround when Ubuntu Lucid is deprecated. |
| 259 | 259 |
| 260 // The crashing process closes its copy of the signal_fd immediately after | 260 // The crashing process closes its copy of the signal_fd immediately after |
| 261 // calling sendmsg(). We can thus not reliably look for with with | 261 // calling sendmsg(). We can thus not reliably look for with with |
| 262 // FindProcessHoldingSocket(). But by necessity, it has to keep the | 262 // FindProcessHoldingSocket(). But by necessity, it has to keep the |
| 263 // partner_fd open until the crashdump is complete. | 263 // partner_fd open until the crashdump is complete. |
| 264 uint64_t inode_number; | 264 ino_t inode_number; |
| 265 if (!base::FileDescriptorGetInode(&inode_number, partner_fd)) { | 265 if (!base::FileDescriptorGetInode(&inode_number, partner_fd)) { |
| 266 LOG(WARNING) << "Failed to get inode number for passed socket"; | 266 LOG(WARNING) << "Failed to get inode number for passed socket"; |
| 267 (void) HANDLE_EINTR(close(partner_fd)); | 267 (void) HANDLE_EINTR(close(partner_fd)); |
| 268 (void) HANDLE_EINTR(close(signal_fd)); | 268 (void) HANDLE_EINTR(close(signal_fd)); |
| 269 return; | 269 return; |
| 270 } | 270 } |
| 271 (void) HANDLE_EINTR(close(partner_fd)); | 271 (void) HANDLE_EINTR(close(partner_fd)); |
| 272 | 272 |
| 273 pid_t actual_crashing_pid = -1; | 273 pid_t actual_crashing_pid = -1; |
| 274 if (!base::FindProcessHoldingSocket(&actual_crashing_pid, inode_number)) { | 274 if (!base::FindProcessHoldingSocket(&actual_crashing_pid, inode_number)) { |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 } | 526 } |
| 527 | 527 |
| 528 void RendererCrashHandlerHostLinux::SetProcessType() { | 528 void RendererCrashHandlerHostLinux::SetProcessType() { |
| 529 process_type_ = "renderer"; | 529 process_type_ = "renderer"; |
| 530 } | 530 } |
| 531 | 531 |
| 532 // static | 532 // static |
| 533 RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() { | 533 RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() { |
| 534 return Singleton<RendererCrashHandlerHostLinux>::get(); | 534 return Singleton<RendererCrashHandlerHostLinux>::get(); |
| 535 } | 535 } |
| OLD | NEW |