diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2019-02-25 13:12:44 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2019-02-25 13:20:01 +0100 |
commit | b4fc5257b7dc106ff210d170397d4ce0e024f2c0 (patch) | |
tree | 2bfbbbd5f5c801adf5d099837d4818dcc0f98769 /src/util | |
parent | 1a8a5ede9fc334bd97b774670eb340b8665a0aa4 (diff) | |
parent | 3f5ad622e5fe0781a70bee9e3322b23c2352e956 (diff) |
Merge #15456: Enable PID file creation on WIN
3f5ad622e5fe0781a70bee9e3322b23c2352e956 Enable PID file creation on Windows - Add available WIN PID function - Consider WIN32 in each relevant case - Add new preprocessor definitions to suppress warning - Update error message for generic OS (riordant)
Pull request description:
# Introduction
As discussed with @laanwj on IRC:
- PID file creation was never enabled for Windows, as the `pid_t` filetype is not available for it. However, the WIN32 API contains the header [`Processthreadsapi.h`](https://github.com/CodeShark/x86_64-w64-mingw32/blob/master/include/processthreadsapi.h) which in turn contains the function [`GetCurrentProcessId()`](https://docs.microsoft.com/en-gb/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getcurrentprocessid). ~~This function is called at a higher level by [`_getpid()`](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/getpid?view=vs-2017)~~ EDIT: `_getpid()` is not available to the MSVC compiler used in the AppVeyor build. As a result, I have changed the function call to`GetCurrentProcessId()`, which performs the same function and is available to both MinGW & MSVC.
This allows one to capture the PID in Windows, without any additional includes - the above function is already available.
- Within this PR, I have added a separate line that calls `GetCurrentProcessId()` in the case of a WIN compilation, and the usual `getpid()` otherwise. All code blocks processing PID file logic that avoid WIN32 have been changed to consider it. I have also updated the preprocessor definitions in `libbitcoin_server.vcxproj.in` to suppress a warning related to `std::strerror` for the MSVC build, that was causing the AppVeyor build to fail (see @fanquake comment below).
# Rationale
- Consistency between OS's running Bitcoin
- Applications which build off of `bitcoind`, such as novel front-end clients, often need access to the PID in order to control the daemon. Instead of designing some alternate way of doing this for one system, it should be consistent between all of them.
In collaboration with @joernroeder
Tree-SHA512: 22fcbf866e99115d12ed29716e68d200d4c118ae2f7b188b7705dc0cf5f0cd0ce5fb18f772744c6238eecd9e6d0922c615e2f0e12a7fe7c810062a79d97aa6a2
Diffstat (limited to 'src/util')
0 files changed, 0 insertions, 0 deletions