aboutsummaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-04-15 12:09:50 -0400
committerGavin Andresen <gavinandresen@gmail.com>2011-04-15 12:09:50 -0400
commitbf3a0902ef98365d803e4a03853dbf0f83511026 (patch)
tree02957d6a4731a99b93232631285b363ad85d1dcb /util.cpp
parent9a189be7401c583fd74fc7f3d7812327323ceecb (diff)
parent66fb32d267d90fe2e1f652570bc45aba26be55fa (diff)
Merge branch 'master' of https://github.com/gjs278/bitcoin
Diffstat (limited to 'util.cpp')
-rw-r--r--util.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/util.cpp b/util.cpp
index 1c685ba42d..2359616689 100644
--- a/util.cpp
+++ b/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);