Introduction
As discussed with @laanwj on IRC:
PID file creation was never enabled for Windows, as the
pid_tfiletype is not available for it. However, the WIN32 API contains the headerProcessthreadsapi.hwhich in turn contains the functionGetCurrentProcessId().This function is called at a higher level byEDIT:_getpid()_getpid()is not available to the MSVC compiler used in the AppVeyor build. As a result, I have changed the function call toGetCurrentProcessId(), 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 usualgetpid()otherwise. All code blocks processing PID file logic that avoid WIN32 have been changed to consider it. I have also updated the preprocessor definitions inlibbitcoin_server.vcxproj.into suppress a warning related tostd::strerrorfor 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.
- Applications which build off of
In collaboration with @joernroeder
