Message ID | 20170206044129.19436-3-aserdean@cloudbasesolutions.com |
---|---|
State | Changes Requested |
Headers | show |
diff --git a/include/windows/unistd.h b/include/windows/unistd.h index 8629f7e..3f92616 100644 --- a/include/windows/unistd.h +++ b/include/windows/unistd.h @@ -18,8 +18,11 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> +#include <direct.h> #define fsync _commit +#define getpid GetCurrentProcessId +#define getcwd _getcwd /* Standard file descriptors. */ #define STDIN_FILENO 0 /* Standard input. */
getcwd - is used in lib/util.c. getcwd is deprecated on Windows but has _getcwd which is defined in <direct.h>: https://msdn.microsoft.com/en-us/library/sf98bd4y(v=vs.120).aspx getpid - is used in several files (i.e. lib/vlog.c). getpid is also and deprecated and _getpid should be used: https://msdn.microsoft.com/en-us/library/t2y34y40(v=vs.120).aspx The problem using _getpid is that the definition is in <process.h>. A file called process.h also exists in the lib folder. This will mess up includes. An option would be to use a wrapper like we use for lib/string.h(.in) but that would mean to also add it to the automake chain. A simple solution would be to map it to GetCurrentProcessId https://msdn.microsoft.com/en-us/library/windows/desktop/ms683180(v=vs.85).aspx The disadvantage is the type but Windows recycles pids so in theory it should be ok. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> --- include/windows/unistd.h | 3 +++ 1 file changed, 3 insertions(+)