| OLD | NEW |
| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 state_ = STATE_CHECK_FINISHED; | 66 state_ = STATE_CHECK_FINISHED; |
| 67 } | 67 } |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 base::Lock lock_; | 70 base::Lock lock_; |
| 71 LinuxDistroState state_; | 71 LinuxDistroState state_; |
| 72 }; | 72 }; |
| 73 #endif // if defined(OS_LINUX) | 73 #endif // if defined(OS_LINUX) |
| 74 | 74 |
| 75 // expected prefix of the target of the /proc/self/fd/%d link for a socket | 75 // expected prefix of the target of the /proc/self/fd/%d link for a socket |
| 76 static const char kSocketLinkPrefix[] = "socket:["; | 76 const char kSocketLinkPrefix[] = "socket:["; |
| 77 | 77 |
| 78 // Parse a symlink in /proc/pid/fd/$x and return the inode number of the | 78 // Parse a symlink in /proc/pid/fd/$x and return the inode number of the |
| 79 // socket. | 79 // socket. |
| 80 // inode_out: (output) set to the inode number on success | 80 // inode_out: (output) set to the inode number on success |
| 81 // path: e.g. /proc/1234/fd/5 (must be a UNIX domain socket descriptor) | 81 // path: e.g. /proc/1234/fd/5 (must be a UNIX domain socket descriptor) |
| 82 // log: if true, log messages about failure details | 82 // log: if true, log messages about failure details |
| 83 bool ProcPathGetInode(ino_t* inode_out, const char* path, bool log = false) { | 83 bool ProcPathGetInode(ino_t* inode_out, const char* path, bool log = false) { |
| 84 DCHECK(inode_out); | 84 DCHECK(inode_out); |
| 85 DCHECK(path); | 85 DCHECK(path); |
| 86 | 86 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 298 |
| 299 if (0 == strncmp(expected_data.c_str(), syscall_data.get(), | 299 if (0 == strncmp(expected_data.c_str(), syscall_data.get(), |
| 300 expected_data.length())) { | 300 expected_data.length())) { |
| 301 return current_tid; | 301 return current_tid; |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 return -1; | 304 return -1; |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace base | 307 } // namespace base |
| OLD | NEW |