diff options
author | Viktor Szakats <commit@vsz.me> | 2022-11-01 22:27:28 +0000 |
---|---|---|
committer | Viktor Szakats <commit@vsz.me> | 2022-11-01 22:27:28 +0000 |
commit | b563a92cd6797ec40d7cd73d51f9c31e637463f4 (patch) | |
tree | 47afd98d829bf281aac506c010f7355537b014d5 /lib/config-win32.h | |
parent | 480ac6e54daa1df1bf17a95931eab412e26bd608 (diff) | |
download | curl-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 'lib/config-win32.h')
-rw-r--r-- | lib/config-win32.h | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/lib/config-win32.h b/lib/config-win32.h index 00e8663d2..283738022 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -66,11 +66,6 @@ /* Define if you have the <netinet/in.h> header file. */ /* #define HAVE_NETINET_IN_H 1 */ -/* Define if you have the <process.h> header file. */ -#ifndef __SALFORDC__ -#define HAVE_PROCESS_H 1 -#endif - /* Define if you have the <signal.h> header file. */ #define HAVE_SIGNAL_H 1 |