Skip to content

Commit

Permalink
changed title-name for process
Browse files Browse the repository at this point in the history
  • Loading branch information
ketoo committed Nov 6, 2016
1 parent 86bf9fc commit 5b231d0
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 31 deletions.
7 changes: 7 additions & 0 deletions NFComm/NFPluginLoader/NFPluginLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ std::string strArgvList;
std::string strPluginName;
std::string strAppName;
std::string strAppID;
std::string strTitleName;

#if NF_PLATFORM == NF_PLATFORM_WIN

Expand Down Expand Up @@ -220,6 +221,12 @@ void ProcessParameter(int argc, char* argv[])
}
}

strTitleName = strAppName + "[" + strAppID + "] PID[" + NFGetPID() + "]";
#if NF_PLATFORM == NF_PLATFORM_WIN
SetConsoleTitle(strTitleName.c_str());
#else
setproctitle(strTitleName.c_str());
#endif
}

int main(int argc, char* argv[])
Expand Down
12 changes: 8 additions & 4 deletions NFComm/NFPluginModule/NFPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,12 @@ typedef int64_t NFINT64;
//#define GOOGLE_GLOG_DLL_DECL=

///////////////////////////////////////////////////////////////
#include <string>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <sstream>
#include <common/lexical_cast.hpp>

#ifndef _MSC_VER
#include <sys/time.h>
Expand All @@ -282,6 +286,7 @@ typedef int64_t NFINT64;
#else
#include <windows.h>
#include <time.h>
#include <process.h>
#define EPOCHFILETIME 11644473600000000Ui64
#endif

Expand All @@ -290,10 +295,12 @@ typedef int64_t NFINT64;
#define NFSPRINTF sprintf_s
#define NFSTRICMP stricmp
#define NFSLEEP(s) Sleep(s)
#define NFGetPID() lexical_cast<std::string>(getpid())
#else
#define NFSPRINTF snprintf
#define NFSTRICMP strcasecmp
#define NFSLEEP(s) usleep(s)
#define NFGetPID() lexical_cast<std::string>(getpid())
#endif

#ifndef NF_DYNAMIC_PLUGIN
Expand Down Expand Up @@ -326,10 +333,7 @@ typedef int64_t NFINT64;
#define NF_SHARE_PTR std::shared_ptr
#define NF_NEW new

#include <string>
#include <algorithm>
#include <cmath>
#include <common/lexical_cast.hpp>

template<typename DTYPE>
bool NF_StrTo(const std::string& strValue, DTYPE& nValue)
{
Expand Down
4 changes: 0 additions & 4 deletions NFServer/NFGameServerPlugin/NFGameServerPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@

NF_EXPORT void DllStartPlugin(NFIPluginManager* pm)
{
#if NF_PLATFORM == NF_PLATFORM_WIN
SetConsoleTitle("NFGameServer");
#endif // NF_PLATFORM
CREATE_PLUGIN(pm, NFGameServerPlugin)

};

NF_EXPORT void DllStopPlugin(NFIPluginManager* pm)
Expand Down
4 changes: 0 additions & 4 deletions NFServer/NFLoginLogicPlugin/NFLoginLogicPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@

NF_EXPORT void DllStartPlugin(NFIPluginManager* pm)
{
#if NF_PLATFORM == NF_PLATFORM_WIN
SetConsoleTitle("NFLoginServer");
#endif
CREATE_PLUGIN(pm, NFLoginLogicPlugin)

};

NF_EXPORT void DllStopPlugin(NFIPluginManager* pm)
Expand Down
6 changes: 0 additions & 6 deletions NFServer/NFMasterServerPlugin/NFMasterServerPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@

NF_EXPORT void DllStartPlugin(NFIPluginManager* pm)
{
#if NF_PLATFORM == NF_PLATFORM_WIN
SetConsoleTitle("NFMasterServer");
#endif

CREATE_PLUGIN(pm, NFMasterServerPlugin)

//std::cout << "DllStartPlugin::thread id=" << GetCurrentThreadId() << std::endl;
};

NF_EXPORT void DllStopPlugin(NFIPluginManager* pm)
Expand Down
6 changes: 0 additions & 6 deletions NFServer/NFProxyLogicPlugin/NFCProxyLogicPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@
#include "NFCProxyLogicPlugin.h"
#include "NFCProxyLogicModule.h"

//
//
#ifdef NF_DYNAMIC_PLUGIN

NF_EXPORT void DllStartPlugin(NFIPluginManager* pm)
{
#if NF_PLATFORM == NF_PLATFORM_WIN
SetConsoleTitle("NFProxyServer");
#endif
CREATE_PLUGIN(pm, NFProxyLogicPlugin)

};

NF_EXPORT void DllStopPlugin(NFIPluginManager* pm)
Expand Down
3 changes: 0 additions & 3 deletions NFServer/NFWorldLogicPlugin/NFWorldLogicPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

NF_EXPORT void DllStartPlugin(NFIPluginManager* pm)
{
#if NF_PLATFORM == NF_PLATFORM_WIN
SetConsoleTitle("NFWorldServer");
#endif // NF_PLATFORM
CREATE_PLUGIN(pm, NFWorldLogicPlugin)
};

Expand Down
4 changes: 0 additions & 4 deletions Tutorial/Tutorial3/Tutorial3Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@

NF_EXPORT void DllStartPlugin(NFIPluginManager* pm)
{
#if NF_PLATFORM == NF_PLATFORM_WIN
SetConsoleTitle("Tutorial3");
#endif
CREATE_PLUGIN(pm, Tutorial3Plugin)

};

NF_EXPORT void DllStopPlugin(NFIPluginManager* pm)
Expand Down

0 comments on commit 5b231d0

Please sign in to comment.