@@ -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-
8267std::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