[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pid_t on 64-bit Windows
From: |
Bruno Haible |
Subject: |
pid_t on 64-bit Windows |
Date: |
Mon, 24 Aug 2020 01:30:10 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; ) |
On 64-bit Windows, pid_t needs to be 64-bit large, i.e. intptr_t or 'long long'
or '__int64'.
This is because the return type of _spawnv* (when invoked with _P_NOWAIT) and
the argument of the _cwait function are 'intptr_t' (see [1][2]: "The return
value from an asynchronous _spawnvp or _wspawnvp (_P_NOWAIT or _P_NOWAITO
specified for mode) is the process handle."
On mingw, this is already the case. But on MSVC (and MSVC/clang), the 'pid_t'
type is nowhere defined. In this case, gnulib defines it through config.h.
[1]
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/spawnvp-wspawnvp
[2] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/cwait
2020-08-23 Bruno Haible <bruno@clisp.org>
tests: Don't assume that pid_t fits in an 'int'.
* tests/test-nonblocking-pipe-main.c (main): Use type 'pid_t' instead
of 'int'.
* tests/test-nonblocking-socket-main.c (main): Likewise.
sys_types: Fix definition of pid_t on 64-bit MSVC.
* m4/pid_t.m4: New file.
* modules/sys_types (Files): Add it.
* modules/dirent (Files): Likewise.
* modules/fcntl-h (Files): Likewise.
* modules/sched (Files): Likewise.
* modules/signal-h (Files): Likewise.
* modules/spawn (Files): Likewise.
* modules/sys_stat (Files): Likewise.
* modules/sys_wait (Files): Likewise.
* modules/termios (Files): Likewise.
* modules/unistd (Files): Likewise.
0001-sys_types-Fix-definition-of-pid_t-on-64-bit-MSVC.patch
Description: Text Data
0002-tests-Don-t-assume-that-pid_t-fits-in-an-int.patch
Description: Text Data
- pid_t on 64-bit Windows,
Bruno Haible <=