bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Martin Oberzalek <martin.oberzalek@ssi-schaefer.com>
To: bug-gnulib@gnu.org
Cc: Bruno Haible <bruno@clisp.org>
Subject: Re: pid_t on 64-bit Windows
Date: Tue, 01 Sep 2020 03:11:30 +0200	[thread overview]
Message-ID: <1598922690.7789.35.camel@ssi-schaefer.com> (raw)
In-Reply-To: <9000458.LPsGitB5CR@omega>

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 






  reply	other threads:[~2020-09-01  1:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-23 23:30 pid_t on 64-bit Windows Bruno Haible
2020-08-31  8:13 ` Oberzalek Martin
2020-08-31 14:27   ` Bruno Haible
2020-09-01  1:11     ` Martin Oberzalek [this message]
2020-09-01 10:25       ` Bruno Haible
2020-08-31 11:15 ` Oberzalek Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1598922690.7789.35.camel@ssi-schaefer.com \
    --to=martin.oberzalek@ssi-schaefer.com \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).