[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pid_t on 64-bit Windows
From: |
Martin Oberzalek |
Subject: |
Re: pid_t on 64-bit Windows |
Date: |
Tue, 01 Sep 2020 03:11:30 +0200 |
Hi Bruno,
> Your email is hardly readable, because
I'm sorry for that. I hope it is fixed now.
> > _spawnvp(), or _wspawnvp() are not returning a pid. It is a process handle.
>
> No one claimed that _spawnvp() is returning a pid.
What I wan't to point out is that in gnulib on WIN32 API pid_t is not a process
id
like it is on linux. Functions in gnulib that are using pid_t eg waitpid()
accepting
a process handle instead.
I'm using parity[1] in an gentoo prefix environment to compile in linux like
style
win32 as win64 applications.
parity is a wrapper around the visual stdio compiler and it defines pid_t as
int.
Because getpid() return also int. And GetCurrentProcessId() as well.
So if I compile a project that is using gnulib I might get a compiler error
because
of the different definition of pid_t. (In best case. Depending on the
situation, the
programm will simple crash)
For my use case a better solution would be a compile time test in the configure
script
that tests the existance of pid_t.
Another solution would be not using pid_t in gnulib at all. Just redefining it
in a way like
#if ( defined(_WIN64) || _defined(_WIN32) ) && !defined(__CYGWIN__)
intprt_t GNULIB_PID_HANDLE
#else
pid_t GNULIB_PID_HANDLE
#endif
What do you think?
Martin
[1] https://github.com/mduft/parity