File tree Expand file tree Collapse file tree 3 files changed +24
-26
lines changed Expand file tree Collapse file tree 3 files changed +24
-26
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,30 @@ std::unique_ptr<BanMan> g_banman;
94
94
95
95
static const char * FEE_ESTIMATES_FILENAME=" fee_estimates.dat" ;
96
96
97
+ /* *
98
+ * The PID file facilities.
99
+ */
100
+ #ifndef WIN32
101
+ static const char * BITCOIN_PID_FILENAME = " bitcoind.pid" ;
102
+
103
+ static fs::path GetPidFile ()
104
+ {
105
+ return AbsPathForConfigVal (fs::path (gArgs .GetArg (" -pid" , BITCOIN_PID_FILENAME)));
106
+ }
107
+
108
+ NODISCARD static bool CreatePidFile ()
109
+ {
110
+ FILE* file = fsbridge::fopen (GetPidFile (), " w" );
111
+ if (file) {
112
+ fprintf (file, " %d\n " , getpid ());
113
+ fclose (file);
114
+ return true ;
115
+ } else {
116
+ return InitError (strprintf (_ (" Unable to create the PID file '%s': %s" ), GetPidFile ().string (), std::strerror (errno)));
117
+ }
118
+ }
119
+ #endif
120
+
97
121
// ////////////////////////////////////////////////////////////////////////////
98
122
//
99
123
// Shutdown
@@ -1194,20 +1218,6 @@ bool AppInitLockDataDirectory()
1194
1218
return true ;
1195
1219
}
1196
1220
1197
- #ifndef WIN32
1198
- NODISCARD static bool CreatePidFile ()
1199
- {
1200
- FILE* file = fsbridge::fopen (GetPidFile (), " w" );
1201
- if (file) {
1202
- fprintf (file, " %d\n " , getpid ());
1203
- fclose (file);
1204
- return true ;
1205
- } else {
1206
- return InitError (strprintf (_ (" Unable to create the PID file '%s': %s" ), GetPidFile ().string (), std::strerror (errno)));
1207
- }
1208
- }
1209
- #endif
1210
-
1211
1221
bool AppInitMain (InitInterfaces& interfaces)
1212
1222
{
1213
1223
const CChainParams& chainparams = Params ();
Original file line number Diff line number Diff line change 79
79
const int64_t nStartupTime = GetTime();
80
80
81
81
const char * const BITCOIN_CONF_FILENAME = " bitcoin.conf" ;
82
- const char * const BITCOIN_PID_FILENAME = " bitcoind.pid" ;
83
82
84
83
ArgsManager gArgs ;
85
84
@@ -958,13 +957,6 @@ std::string ArgsManager::GetChainName() const
958
957
return CBaseChainParams::MAIN;
959
958
}
960
959
961
- #ifndef WIN32
962
- fs::path GetPidFile ()
963
- {
964
- return AbsPathForConfigVal (fs::path (gArgs .GetArg (" -pid" , BITCOIN_PID_FILENAME)));
965
- }
966
- #endif
967
-
968
960
bool RenameOver (fs::path src, fs::path dest)
969
961
{
970
962
#ifdef WIN32
Original file line number Diff line number Diff line change 39
39
int64_t GetStartupTime ();
40
40
41
41
extern const char * const BITCOIN_CONF_FILENAME;
42
- extern const char * const BITCOIN_PID_FILENAME;
43
42
44
43
/* * Translate a message to the native language of the user. */
45
44
const extern std::function<std::string(const char *)> G_TRANSLATION_FUN;
@@ -84,9 +83,6 @@ const fs::path &GetBlocksDir();
84
83
const fs::path &GetDataDir (bool fNetSpecific = true );
85
84
void ClearDatadirCache ();
86
85
fs::path GetConfigFile (const std::string& confPath);
87
- #ifndef WIN32
88
- fs::path GetPidFile ();
89
- #endif
90
86
#ifdef WIN32
91
87
fs::path GetSpecialFolderPath (int nFolder, bool fCreate = true );
92
88
#endif
You can’t perform that action at this time.
0 commit comments