develooper Front page | perl.perl5.porters | Postings from April 2008

[PATCH] Win32 process ids can have more than 16 bits

Thread Next
From:
Jan Dubois
Date:
April 29, 2008 01:14
Subject:
[PATCH] Win32 process ids can have more than 16 bits
Message ID:
01be01c8a9d1$12b32b10$38198130$@com
Currently the code in pp_system() will truncate PIDs returned by
system(1, ...) to 16 bits unless the code is running on Win9X.

There are bug reports that process ids on current Windows systems
can be larger than 16 bits (which makes sense, given that they are
stored as unsigned 32-bit values):

    http://bugs.activestate.com/show_bug.cgi?id=72443

I did not reproduce the issue myself, but it makes sense to me
to always return the full 32-bit PID, not just for Win9X.

Cheers,
-Jan

PS: system(1, ...) is a special case on Win32 that runs the command
asynchronously and immediately returns the PID and not the exitstatus.
This is documented in perlport.pod and used by e.g. IPC::Open3.

--- win32/win32.c.orig  Tue Mar 25 09:24:01 2008
+++ win32/win32.c       Mon Apr 28 23:59:11 2008
@@ -665,8 +665,7 @@
     }

     if (flag == P_NOWAIT) {
-       if (IsWin95())
-           PL_statusvalue = -1;        /* >16bits hint for pp_system() */
+        PL_statusvalue = -1;   /* >16bits hint for pp_system() */
     }
     else {
        if (status < 0) {
@@ -779,8 +778,7 @@
        Safefree(argv);
     }
     if (exectype == EXECF_SPAWN_NOWAIT) {
-       if (IsWin95())
-           PL_statusvalue = -1;        /* >16bits hint for pp_system() */
+        PL_statusvalue = -1;   /* >16bits hint for pp_system() */
     }
     else {
        if (status < 0) {
End of Patch.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About