mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
pidfile support for daemon
This commit is contained in:
19
util.cpp
19
util.cpp
@@ -747,6 +747,25 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
|
||||
}
|
||||
}
|
||||
|
||||
string GetPidFile()
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
fs::path pathConfig(GetArg("-pid", "bitcoind.pid"));
|
||||
if (!pathConfig.is_complete())
|
||||
pathConfig = fs::path(GetDataDir()) / pathConfig;
|
||||
return pathConfig.string();
|
||||
}
|
||||
|
||||
void CreatePidFile(string pidFile, pid_t pid)
|
||||
{
|
||||
FILE* file;
|
||||
if (file = fopen(pidFile.c_str(), "w"))
|
||||
{
|
||||
fprintf(file, "%d\n", pid);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
int GetFilesize(FILE* file)
|
||||
{
|
||||
int nSavePos = ftell(file);
|
||||
|
||||
Reference in New Issue
Block a user