chromium/sandbox/linux/services/thread_helpers.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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) {}

// Run |cb| in a loop until it returns false. Every time |cb| runs, sleep
// for an exponentially increasing amount of time. |cb| is expected to return
// false very quickly and this will crash if it doesn't happen within ~64ms on
// Debug builds (2s on Release builds).
// This is guaranteed to not sleep more than twice as much as the bare minimum
// amount of time.
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) {}

}  // namespace

// static
bool ThreadHelpers::IsSingleThreaded(int proc_fd) {}

// static
bool ThreadHelpers::IsSingleThreaded() {}

// static
void ThreadHelpers::AssertSingleThreaded(int proc_fd) {}

void ThreadHelpers::AssertSingleThreaded() {}

// static
bool ThreadHelpers::StartThreadAndWatchProcFS(int proc_fd,
                                              base::Thread* thread) {}

// static
bool ThreadHelpers::StopThreadAndWatchProcFS(int proc_fd,
                                             base::Thread* thread) {}

// static
const char* ThreadHelpers::GetAssertSingleThreadedErrorMessageForTests() {}

}  // namespace sandbox