Am 01.03.2016 um 17:31 schrieb Adrien Nader: > Hi, > > I poked Kaï on IRC about that; here's the log (very slightly reformatted): > >> Well, I admit that I know that pid_t is on standard sdk just a 32-bit value. >> Nevertheless there is a lot of software in FOSS, which assumes that pid_t has >> actually the width of a pointer, and so we decided to make pidt_t on Windows >> 64-bit. >> Nevertheless assuming that pid_t is an int, is also wrong on Windows. >> It is actually a DWORD. See GetThreadId (or something like that is the API >> of >> Win32). >> So negative values are nothing to be concerned about at all. >> API is GetCurrentThreadId() >> I am openminded here, but we might need to expect fallout by this change. >> Not sure if this is worth the change.
IMHO most FOSS programs with assumptions typically fail when assuming that sizeof(long) == sizeof(void *). I assume that all programs which assume that sizeof(pid_t) == sizeof(void *) fall into this category, so pid_t will be their least problem when they do a port to 64 bit Windows. :-) Programs which clean their code while porting to Windows try to use standard interfaces (like QEMU did). Using pid_t and assuming that standard functions like getpid return a pid_t value is typically part of that cleaning, but will fail today for getpid because of the wrong pid_t size. Kai is absolutely right regarding the signedness. I suggest replacing "int" by "unsigned" or "unsigned int" in my patch as DWORD and unsigned int have the same size for Windows. Feel free to do so before committing it (otherwise I'd have to resend it). It's a pity that getpid() still has to return an int (because of compatibility with the MS getpid()) instead of the normal pid_t. A short look at the Mingw-w64 code shows several type casts from pid_t to DWORD. This code will continue to work with my patch, but the type casts are no longer needed. Regards, Stefan
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
