chromium/base/process/internal_linux.cc

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

#include "base/process/internal_linux.h"

#include <limits.h>
#include <unistd.h>

#include <algorithm>
#include <map>
#include <string>
#include <string_view>
#include <vector>

#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "build/build_config.h"

// Not defined on AIX by default.
#if BUILDFLAG(IS_AIX)
#define NAME_MAX
#endif

namespace base::internal {

namespace {

void TrimKeyValuePairs(StringPairs* pairs) {}

}  // namespace

const char kProcDir[] =;

const char kStatFile[] =;

FilePath GetProcPidDir(pid_t pid) {}

pid_t ProcDirSlotToPid(std::string_view d_name) {}

bool ReadProcFile(const FilePath& file, std::string* buffer) {}

bool ReadProcFileToTrimmedStringPairs(pid_t pid,
                                      std::string_view filename,
                                      StringPairs* key_value_pairs) {}

size_t ReadProcStatusAndGetKbFieldAsSizeT(pid_t pid, std::string_view field) {}

bool ReadProcStatusAndGetFieldAsUint64(pid_t pid,
                                       std::string_view field,
                                       uint64_t* result) {}

bool ReadProcStats(pid_t pid, std::string* buffer) {}

bool ParseProcStats(const std::string& stats_data,
                    std::vector<std::string>* proc_stats) {}

ProcStatMap;
void ParseProcStat(const std::string& contents, ProcStatMap* output) {}

int64_t GetProcStatsFieldAsInt64(const std::vector<std::string>& proc_stats,
                                 ProcStatsFields field_num) {}

std::optional<int64_t> GetProcStatsFieldAsOptionalInt64(
    base::span<const std::string> proc_stats,
    ProcStatsFields field_num) {}

size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats,
                                ProcStatsFields field_num) {}

int64_t ReadStatFileAndGetFieldAsInt64(const FilePath& stat_file,
                                       ProcStatsFields field_num) {}

int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num) {}

int64_t ReadProcSelfStatsAndGetFieldAsInt64(ProcStatsFields field_num) {}

size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, ProcStatsFields field_num) {}

Time GetBootTime() {}

TimeDelta GetUserCpuTimeSinceBoot() {}

TimeDelta ClockTicksToTimeDelta(int64_t clock_ticks) {}

}  // namespace base::internal