summaryrefslogtreecommitdiff
path: root/CMake/Platforms
diff options
context:
space:
mode:
authorViktor Szakats <commit@vsz.me>2022-11-01 22:27:28 +0000
committerViktor Szakats <commit@vsz.me>2022-11-01 22:27:28 +0000
commitb563a92cd6797ec40d7cd73d51f9c31e637463f4 (patch)
tree47afd98d829bf281aac506c010f7355537b014d5 /CMake/Platforms
parent480ac6e54daa1df1bf17a95931eab412e26bd608 (diff)
downloadcurl-b563a92cd6797ec40d7cd73d51f9c31e637463f4.tar.gz
tidy-up: process.h detection and use
This patch aims to cleanup the use of `process.h` header and the macro `HAVE_PROCESS_H` associated with it. - `process.h` is always available on Windows. In curl, it is required only for `_beginthreadex()` in `lib/curl_threads.c`. - `process.h` is also available in MS-DOS. In curl, its only use was in `lib/smb.c` for `getpid()`. But `getpid()` is in fact declared by `unistd.h`, which is always enabled via `lib/config-dos.h`. So the header is not necessary. - `HAVE_PROCESS_H` was detected by CMake, forced to 1 on Windows and left to real detection for other platforms. It was also set to always-on in `lib/config-win32.h` and `lib/config-dos.h`. In autotools builds, there was no detection and the macro was never set. Based on these observations, in this patch we: - Rework Windows `getpid` logic in `lib/smb.c` to always use the equivalent direct Win32 API function `GetCurrentProcessId()`, as we already did for Windows UWP apps. This makes `process.h` unnecessary here on Windows. - Stop #including `process.h` into files where it was not necessary. This is everywhere, except `lib/curl_threads.c`. > Strangely enough, `lib/curl_threads.c` compiled fine with autotools > because `process.h` is also indirecty included via `unistd.h`. This > might have been broken in autotools MSVC builds, where the latter > header is missing. - Delete all remaining `HAVE_PROCESS_H` feature guards, for they were unnecessary. - Delete `HAVE_PROCESS_H` detection from CMake and predefined values from `lib/config-*.h` headers. Reviewed-by: Jay Satiro Closes #9703
Diffstat (limited to 'CMake/Platforms')
-rw-r--r--CMake/Platforms/WindowsCache.cmake1
1 files changed, 0 insertions, 1 deletions
diff --git a/CMake/Platforms/WindowsCache.cmake b/CMake/Platforms/WindowsCache.cmake
index 9a513bb6c..3bcfcd1ee 100644
--- a/CMake/Platforms/WindowsCache.cmake
+++ b/CMake/Platforms/WindowsCache.cmake
@@ -34,7 +34,6 @@ if(NOT UNIX)
set(HAVE_NETDB_H 0)
set(HAVE_NETINET_IN_H 0)
set(HAVE_NET_IF_H 0)
- set(HAVE_PROCESS_H 1)
set(HAVE_PWD_H 0)
set(HAVE_SETJMP_H 1)
set(HAVE_SIGNAL_H 1)