@@ -856,7 +856,7 @@ std::optional<int> PerfettoCmd::ParseCmdlineAndMaybeDaemonize(int argc,
856856 // below.
857857}
858858
859- void PerfettoCmd::Notify (BgProcessStatus status) {
859+ void PerfettoCmd::NotifyFd (WaitStatus status) {
860860#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
861861 if (!notify_fd_) {
862862 return ;
@@ -869,7 +869,7 @@ void PerfettoCmd::Notify(BgProcessStatus status) {
869869#endif // ! PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
870870}
871871
872- void PerfettoCmd::NotifyBgProcessPipe (BgProcessStatus status) {
872+ void PerfettoCmd::NotifyBgProcessPipe (WaitStatus status) {
873873#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
874874 if (!background_wait_pipe_.wr ) {
875875 return ;
@@ -882,43 +882,44 @@ void PerfettoCmd::NotifyBgProcessPipe(BgProcessStatus status) {
882882#endif // ! PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
883883}
884884
885- PerfettoCmd::BgProcessStatus PerfettoCmd::WaitOnBgProcessPipe () {
885+ PerfettoCmd::WaitStatus PerfettoCmd::WaitOnBgProcessPipe () {
886886#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
887887 base::ScopedPlatformHandle fd = std::move (background_wait_pipe_.rd );
888888 PERFETTO_CHECK (fd);
889889
890- BgProcessStatus msg;
890+ WaitStatus msg;
891891 static_assert (sizeof msg == 1 , " Enum bigger than one byte" );
892892 std::array<pollfd, 1 > pollfds = {pollfd{fd.get (), POLLIN, 0 }};
893893
894894 int ret = PERFETTO_EINTR (poll (&pollfds[0 ], pollfds.size (), 30000 /* ms*/ ));
895895 PERFETTO_CHECK (ret >= 0 );
896896 if (ret == 0 ) {
897897 fprintf (stderr, " Timeout waiting for all data sources to start\n " );
898- return kBackgroundTimeout ;
898+ return kWaitTimeout ;
899899 }
900900 ssize_t read_ret = PERFETTO_EINTR (read (fd.get (), &msg, 1 ));
901901 PERFETTO_CHECK (read_ret >= 0 );
902902 if (read_ret == 0 ) {
903903 fprintf (stderr, " Background process didn't report anything\n " );
904- return kBackgroundOtherError ;
904+ return kWaitOtherError ;
905905 }
906906
907- if (msg != kBackgroundOk ) {
908- fprintf (stderr, " Background process failed, BgProcessStatus =%d\n " ,
907+ if (msg != kWaitOk ) {
908+ fprintf (stderr, " Background process failed, WaitStatus =%d\n " ,
909909 static_cast <int >(msg));
910910 return msg;
911911 }
912912#endif // ! PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
913913
914- return kBackgroundOk ;
914+ return kWaitOk ;
915915}
916916
917917int PerfettoCmd::ConnectToServiceRunAndMaybeNotify () {
918918 int exit_code = ConnectToServiceAndRun ();
919919
920- Notify (exit_code == 0 ? kBackgroundOk : kBackgroundOtherError );
921- NotifyBgProcessPipe (exit_code == 0 ? kBackgroundOk : kBackgroundOtherError );
920+ WaitStatus wait_status = exit_code == 0 ? kWaitOk : kWaitOtherError ;
921+ NotifyFd (wait_status);
922+ NotifyBgProcessPipe (wait_status);
922923
923924 return exit_code;
924925}
@@ -1520,8 +1521,8 @@ ID UID STATE BUF (#) KB DUR (s) #DS STARTED NAME
15201521void PerfettoCmd::OnObservableEvents (
15211522 const ObservableEvents& observable_events) {
15221523 if (observable_events.all_data_sources_started ()) {
1523- Notify ( kBackgroundOk );
1524- NotifyBgProcessPipe (kBackgroundOk );
1524+ NotifyFd ( kWaitOk );
1525+ NotifyBgProcessPipe (kWaitOk );
15251526 }
15261527 if (observable_events.has_clone_trigger_hit ()) {
15271528 int64_t tsid = observable_events.clone_trigger_hit ().tracing_session_id ();
0 commit comments