Skip to content

Commit d3730a8

Browse files
committed
remove systemd
1 parent a8cde29 commit d3730a8

File tree

5 files changed

+0
-63
lines changed

5 files changed

+0
-63
lines changed

gn/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ action("gen_buildflags") {
109109
"PERFETTO_ENABLE_WINSCOPE=$enable_perfetto_winscope",
110110
"PERFETTO_ENABLE_RT_MUTEX=$enable_perfetto_rt_mutex",
111111
"PERFETTO_ENABLE_LOCKFREE_TASKRUNNER=$enable_perfetto_lockfree_taskrunner",
112-
"PERFETTO_SYSTEMD=$enable_perfetto_systemd",
113112
]
114113

115114
rel_out_path = rebase_path(gen_header_path, "$root_build_dir")

gn/perfetto.gni

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,6 @@ declare_args() {
353353
(perfetto_build_standalone || perfetto_build_with_android) &&
354354
!is_perfetto_build_generator
355355

356-
# Enables installation of systemd unit files.
357-
# Only for standalone Linux builds where users build Perfetto themselves.
358-
enable_perfetto_systemd =
359-
perfetto_build_standalone && !is_perfetto_build_generator && is_linux
360-
361356
# Enables httpd RPC support in the trace processor.
362357
# Further per-OS conditionals are applied in gn/BUILD.gn.
363358
# Chromium+Win: httpd support depends on enable_perfetto_ipc, which is not

include/perfetto/base/build_configs/android_tree/perfetto_build_flags.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_WINSCOPE() (1)
5555
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_RT_MUTEX() (1)
5656
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_LOCKFREE_TASKRUNNER() (1)
57-
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_SYSTEMD() (0)
5857

5958
struct PerfettoBuildFlag {
6059
const char* name;
@@ -92,7 +91,6 @@ static const struct PerfettoBuildFlag kPerfettoBuildFlags[] = {
9291
{"PERFETTO_ENABLE_WINSCOPE", PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_WINSCOPE()},
9392
{"PERFETTO_ENABLE_RT_MUTEX", PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_RT_MUTEX()},
9493
{"PERFETTO_ENABLE_LOCKFREE_TASKRUNNER", PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_LOCKFREE_TASKRUNNER()},
95-
{"PERFETTO_SYSTEMD", PERFETTO_BUILDFLAG_DEFINE_PERFETTO_SYSTEMD()},
9694
};
9795

9896
static const int kPerfettoBuildFlagsCount = sizeof(kPerfettoBuildFlags) / sizeof(struct PerfettoBuildFlag);

include/perfetto/base/build_configs/bazel/perfetto_build_flags.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_WINSCOPE() (1)
5555
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_RT_MUTEX() (1)
5656
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_LOCKFREE_TASKRUNNER() (1)
57-
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_SYSTEMD() (0)
5857

5958
struct PerfettoBuildFlag {
6059
const char* name;
@@ -92,7 +91,6 @@ static const struct PerfettoBuildFlag kPerfettoBuildFlags[] = {
9291
{"PERFETTO_ENABLE_WINSCOPE", PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_WINSCOPE()},
9392
{"PERFETTO_ENABLE_RT_MUTEX", PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_RT_MUTEX()},
9493
{"PERFETTO_ENABLE_LOCKFREE_TASKRUNNER", PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ENABLE_LOCKFREE_TASKRUNNER()},
95-
{"PERFETTO_SYSTEMD", PERFETTO_BUILDFLAG_DEFINE_PERFETTO_SYSTEMD()},
9694
};
9795

9896
static const int kPerfettoBuildFlagsCount = sizeof(kPerfettoBuildFlags) / sizeof(struct PerfettoBuildFlag);

src/tracebox/tracebox_ctl.cc

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,6 @@ bool CanConnectToSocket(const std::string& path) {
6464

6565
#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
6666

67-
bool IsSystemdServiceInstalled() {
68-
#if PERFETTO_BUILDFLAG(PERFETTO_SYSTEMD)
69-
constexpr const char* kSystemdServices[] = {
70-
"/etc/systemd/system/traced.service",
71-
"/lib/systemd/system/traced.service",
72-
"/usr/lib/systemd/system/traced.service",
73-
};
74-
for (const char* path : kSystemdServices) {
75-
if (base::FileExists(path))
76-
return true;
77-
}
78-
#endif
79-
return false;
80-
}
81-
8267
std::string GetPidFilePath(const char* daemon_name) {
8368
return base::GetSysTempDir() + "/" + daemon_name + ".pid";
8469
}
@@ -150,22 +135,6 @@ int CtlStop() {
150135
printf("Daemons are running. Use Task Manager to stop them.\n");
151136
return 1;
152137
#else
153-
if (IsSystemdServiceInstalled()) {
154-
if (base::GetCurrentUserId() != 0) {
155-
printf(
156-
"Managed by systemd. Use: sudo systemctl stop traced "
157-
"traced-probes\n");
158-
return 0;
159-
}
160-
printf("Systemd service found. Stopping via systemctl...\n");
161-
if (system("systemctl stop traced traced-probes") == 0) {
162-
printf("All daemons stopped.\n");
163-
return 0;
164-
}
165-
printf("Error: Failed to stop systemd services.\n");
166-
return 1;
167-
}
168-
169138
int daemons_stopped = 0, daemons_stored = 0;
170139
for (const char* daemon : kDaemons) {
171140
std::string pid_path = GetPidFilePath(daemon);
@@ -230,22 +199,6 @@ int CtlStart() {
230199
while (true)
231200
base::SleepMicroseconds(1000000);
232201
#else
233-
if (IsSystemdServiceInstalled()) {
234-
if (base::GetCurrentUserId() != 0) {
235-
printf(R"(Error: Systemd service installed but requires root.
236-
Use: sudo systemctl start traced traced-probes
237-
)");
238-
return 1;
239-
}
240-
printf("Starting daemons via systemd...\n");
241-
if (system("systemctl start traced traced-probes") == 0) {
242-
printf("Success: Daemons started via systemd.\n");
243-
return 0;
244-
}
245-
printf("Failure: Not able to start Daemons via systemd.\n");
246-
return 1;
247-
}
248-
249202
printf("Starting daemons...\n");
250203
std::string tracebox_path = base::GetCurExecutablePath();
251204
for (const char* daemon : kDaemons) {
@@ -286,12 +239,6 @@ int CtlStatus() {
286239
}
287240

288241
#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
289-
if (IsSystemdServiceInstalled()) {
290-
printf("Systemd detected. Querying systemctl status:\n");
291-
system("systemctl status traced traced-probes --no-pager -l");
292-
return 0;
293-
}
294-
295242
bool stale_file_found = false;
296243
for (const char* daemon : kDaemons) {
297244
std::string pid_path = GetPidFilePath(daemon);

0 commit comments

Comments
 (0)