#include "sandbox/linux/services/thread_helpers.h"
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string>
#include "base/files/scoped_file.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
#include "sandbox/linux/services/proc_util.h"
namespace sandbox {
namespace {
const char kAssertSingleThreadedError[] = …;
const char kAssertThreadDoesNotAppearInProcFS[] = …;
const char kAssertThreadDoesNotDisappearInProcFS[] = …;
bool IsSingleThreadedImpl(int proc_fd) { … }
bool IsThreadPresentInProcFS(int proc_fd,
const std::string& thread_id_dir_str) { … }
bool IsNotThreadPresentInProcFS(int proc_fd,
const std::string& thread_id_dir_str) { … }
void RunWhileTrue(const base::RepeatingCallback<bool(void)>& cb,
const char* message) { … }
bool IsMultiThreaded(int proc_fd) { … }
enum class ThreadAction { … };
bool ChangeThreadStateAndWatchProcFS(
int proc_fd, base::Thread* thread, ThreadAction action) { … }
}
bool ThreadHelpers::IsSingleThreaded(int proc_fd) { … }
bool ThreadHelpers::IsSingleThreaded() { … }
void ThreadHelpers::AssertSingleThreaded(int proc_fd) { … }
void ThreadHelpers::AssertSingleThreaded() { … }
bool ThreadHelpers::StartThreadAndWatchProcFS(int proc_fd,
base::Thread* thread) { … }
bool ThreadHelpers::StopThreadAndWatchProcFS(int proc_fd,
base::Thread* thread) { … }
const char* ThreadHelpers::GetAssertSingleThreadedErrorMessageForTests() { … }
}