From 07a233fb3b002e5a467ba48bb477dda8f905891b Mon Sep 17 00:00:00 2001 From: John Brooks Date: Wed, 24 Apr 2013 16:42:15 -0600 Subject: [PATCH] [mapplauncherd] Remove Booster::boosterTemporaryProcessName --- src/ebooster/ebooster.cpp | 6 ------ src/ebooster/ebooster.h | 7 ------- src/launcherlib/booster.cpp | 7 +++++-- src/launcherlib/booster.h | 6 ------ tests/common/unittests/ut_booster/ut_booster.cpp | 14 +++----------- 5 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/ebooster/ebooster.cpp b/src/ebooster/ebooster.cpp index f98a743..26194cc 100644 --- a/src/ebooster/ebooster.cpp +++ b/src/ebooster/ebooster.cpp @@ -25,12 +25,6 @@ #include const string EBooster::m_boosterType = "generic"; -const string EBooster::m_temporaryProcessName = "booster-generic"; - -const string & EBooster::boosterTemporaryProcessName() const -{ - return m_temporaryProcessName; -} const string & EBooster::boosterType() const { diff --git a/src/ebooster/ebooster.h b/src/ebooster/ebooster.h index a7ad018..463b893 100644 --- a/src/ebooster/ebooster.h +++ b/src/ebooster/ebooster.h @@ -35,9 +35,6 @@ public: EBooster() {} virtual ~EBooster() {} - //! \reimp - virtual const string &boosterTemporaryProcessName() const; - //! \reimp virtual const string & boosterType() const; @@ -59,10 +56,6 @@ private: static const string m_boosterType; - //! Process name to be used when booster is not - //! yet transformed into a running application - static const string m_temporaryProcessName; - //! wait for socket connection void accept(); diff --git a/src/launcherlib/booster.cpp b/src/launcherlib/booster.cpp index 60a4fb5..e21941e 100644 --- a/src/launcherlib/booster.cpp +++ b/src/launcherlib/booster.cpp @@ -98,8 +98,11 @@ void Booster::initialize(int initialArgc, char ** initialArgv, int newBoosterLau if (!m_bootMode) preload(); - // Rename process to temporary booster process name, e.g. "booster-m" - const char * tempArgv[] = {boosterTemporaryProcessName().c_str()}; + // Rename process to temporary booster process name + std::string temporaryProcessName = "booster ["; + temporaryProcessName += boosterType(); + temporaryProcessName += "]"; + const char * tempArgv[] = {temporaryProcessName.c_str()}; renameProcess(initialArgc, initialArgv, 1, tempArgv); // Restore priority diff --git a/src/launcherlib/booster.h b/src/launcherlib/booster.h index e7a8cf9..dd7ef95 100644 --- a/src/launcherlib/booster.h +++ b/src/launcherlib/booster.h @@ -111,12 +111,6 @@ public: */ virtual const string & boosterType() const = 0; - /*! Return the process name to be used when booster is not - * yet transformed into a running application (e.g. "booster-m" - * for MBooster) - */ - virtual const string & boosterTemporaryProcessName() const = 0; - //! Get invoker's pid pid_t invokersPid(); diff --git a/tests/common/unittests/ut_booster/ut_booster.cpp b/tests/common/unittests/ut_booster/ut_booster.cpp index a27f562..e7ca13c 100644 --- a/tests/common/unittests/ut_booster/ut_booster.cpp +++ b/tests/common/unittests/ut_booster/ut_booster.cpp @@ -29,19 +29,16 @@ class MyBooster : public Booster public: MyBooster(); const std::string & boosterType() const; - const std::string & boosterTemporaryProcessName() const; protected: bool preload(); private: const string m_boosterType; - const string m_temporaryProcessName; }; MyBooster::MyBooster() : - m_boosterType("TestBooster"), - m_temporaryProcessName("test booster") + m_boosterType("TestBooster") {} const std::string & MyBooster::boosterType() const @@ -54,11 +51,6 @@ bool MyBooster::preload() return true; } -const std::string & MyBooster::boosterTemporaryProcessName() const -{ - return m_temporaryProcessName; -} - void Ut_Booster::initTestCase() {} @@ -93,11 +85,11 @@ void Ut_Booster::testRenameProcess() char ** initialArgv = packTwoArgs("oldName", " "); // Rename process - const char * tempArgv[] = {m_subject->boosterTemporaryProcessName().c_str()}; + const char * tempArgv[] = {"test booster"}; m_subject->renameProcess(INIT_ARGC, initialArgv, 1, tempArgv); // Check that new name and arguments fit and are correct - QVERIFY(strcmp(initialArgv[0], m_subject->boosterTemporaryProcessName().c_str()) == 0); + QVERIFY(strcmp(initialArgv[0], "test booster") == 0); // Define and copy args because it's assumed that they are allocated in the heap // (AppData deletes the argv on exit)