blob: 83523df831dbff1a15ff5dd92e4057ca6fe6c57e [file] [log] [blame]
[email protected]0381ae22012-06-05 01:03:321// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]75ae5422009-04-21 17:20:102// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]9bc8cff2010-04-03 01:05:395#ifndef BASE_LINUX_UTIL_H_
6#define BASE_LINUX_UTIL_H_
[email protected]75ae5422009-04-21 17:20:107
8#include <stdint.h>
[email protected]b28af7522009-10-29 18:21:309#include <sys/types.h>
[email protected]75ae5422009-04-21 17:20:1010
[email protected]912c6452009-07-17 05:55:5111#include <string>
12
[email protected]0bea7252011-08-05 15:34:0013#include "base/base_export.h"
[email protected]68a008e82011-05-02 17:54:1414
[email protected]75ae5422009-04-21 17:20:1015namespace base {
16
[email protected]6dde9d72010-08-26 08:55:2217// This is declared here so the crash reporter can access the memory directly
18// in compromised context without going through the standard library.
[email protected]0bea7252011-08-05 15:34:0019BASE_EXPORT extern char g_linux_distro[];
[email protected]6dde9d72010-08-26 08:55:2220
[email protected]a8e20582010-12-31 17:18:5021// Get the Linux Distro if we can, or return "Unknown".
[email protected]0bea7252011-08-05 15:34:0022BASE_EXPORT std::string GetLinuxDistro();
[email protected]912c6452009-07-17 05:55:5123
[email protected]6dde9d72010-08-26 08:55:2224// Set the Linux Distro string.
[email protected]0bea7252011-08-05 15:34:0025BASE_EXPORT void SetLinuxDistro(const std::string& distro);
[email protected]6dde9d72010-08-26 08:55:2226
[email protected]662183142010-07-16 19:28:1727// For a given process |pid|, look through all its threads and find the first
28// thread with /proc/[pid]/task/[thread_id]/syscall whose first N bytes matches
29// |expected_data|, where N is the length of |expected_data|.
[email protected]cb7d53e2011-06-21 04:21:0630// Returns the thread id or -1 on error. If |syscall_supported| is
31// set to false the kernel does not support syscall in procfs.
[email protected]0bea7252011-08-05 15:34:0032BASE_EXPORT pid_t FindThreadIDWithSyscall(pid_t pid,
33 const std::string& expected_data,
34 bool* syscall_supported);
[email protected]662183142010-07-16 19:28:1735
[email protected]75ae5422009-04-21 17:20:1036} // namespace base
37
[email protected]9bc8cff2010-04-03 01:05:3938#endif // BASE_LINUX_UTIL_H_