Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProcessTree: fix missing direct deps #1288

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Source/santad/ProcessTree/BUILD
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
load("//:helper.bzl", "santa_unit_test")
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("//:helper.bzl", "santa_unit_test")

cc_library(
name = "process",
hdrs = ["process.h"],
visibility = ["//:santa_package_group"],
deps = [
"//Source/santad/ProcessTree/annotations:annotator",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/synchronization",
],
visibility = ["//:santa_package_group"],
)

objc_library(
Expand All @@ -23,6 +23,7 @@ objc_library(
sdk_dylibs = [
"bsm",
],
visibility = ["//:santa_package_group"],
deps = [
":process",
"//Source/santad/ProcessTree:process_tree_cc_proto",
Expand All @@ -33,7 +34,6 @@ objc_library(
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/synchronization",
],
visibility = ["//:santa_package_group"],
)

proto_library(
Expand All @@ -44,15 +44,16 @@ proto_library(

cc_proto_library(
name = "process_tree_cc_proto",
deps = [":process_tree_proto"],
visibility = ["//:santa_package_group"],
deps = [":process_tree_proto"],
)

objc_library(
name = "process_tree_test_helpers",
srcs = ["process_tree_test_helpers.mm"],
hdrs = ["process_tree_test_helpers.h"],
deps = [
":process",
":process_tree",
"@com_google_absl//absl/synchronization",
],
Expand All @@ -65,5 +66,6 @@ santa_unit_test(
":process",
":process_tree_test_helpers",
"//Source/santad/ProcessTree/annotations:annotator",
"@com_google_absl//absl/synchronization",
],
)
12 changes: 5 additions & 7 deletions Source/santad/ProcessTree/process_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ class ProcessTree {
// N.B. new_pid is required as the "pid version" will have changed.
// It is a programming error to pass a new_pid such that
// p.pid_.pid != new_pid.pid.
void HandleExec(uint64_t timestamp, const Process &p,
struct Pid new_pid, struct Program prog,
struct Cred c);
void HandleExec(uint64_t timestamp, const Process &p, struct Pid new_pid,
struct Program prog, struct Cred c);

// Inform the tree of a process exit.
void HandleExit(uint64_t timestamp, const Process &p);
Expand Down Expand Up @@ -98,8 +97,7 @@ class ProcessTree {
void Iterate(std::function<void(std::shared_ptr<const Process>)> f) const;

// Get the Process for the given pid in the tree if it exists.
std::optional<std::shared_ptr<const Process>> Get(
struct Pid target) const;
std::optional<std::shared_ptr<const Process>> Get(struct Pid target) const;

// Traverse the tree from the given Process to its parent.
std::shared_ptr<const Process> GetParent(const Process &p) const;
Expand All @@ -120,8 +118,8 @@ class ProcessTree {
// updated with the results of the event.
bool Step(uint64_t timestamp);

std::optional<std::shared_ptr<Process>> GetLocked(
struct Pid target) const ABSL_SHARED_LOCKS_REQUIRED(mtx_);
std::optional<std::shared_ptr<Process>> GetLocked(struct Pid target) const
ABSL_SHARED_LOCKS_REQUIRED(mtx_);

void DebugDumpLocked(std::ostream &stream, int depth, pid_t ppid) const;

Expand Down
Loading