delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/02/26/16:37:01

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3E5D3365.16A41275@phekda.freeserve.co.uk>
Date: Wed, 26 Feb 2003 21:36:37 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
CC: Laszlo Molnar <laszlo DOT molnar AT eth DOT ericsson DOT se>
Subject: Re: DJGPP port of Perl 5.6.1 & POSIX::WEXITSTATUS
References: <200302262028 DOT h1QKSl606431 AT speedy DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

ams AT ludd DOT luth DOT se wrote:
> 
> Hi there.
> 
> According to Richard Dawe:
> > There seem to be two solutions:
> >
> > 1. Make POSIX::WEXITSTATUS (and the other POSIX:W*) do something special
> > for DJGPP, to cope with the inconsistency between the return code of
> > Perl's "system" call and POSIX::W*.
> >
> > 2. DJGPP doesn't have working wait*. So we can make W* from <sys/wait.h>
> > compatible with Linux (and other Unices, I'm guessing) without breaking
> > anything. I.e.: follow the Unix Way.
> 
> 3. Make Perl's "system" function compatible with the underlying OS
> (might include documentation changes).

That's already been done. That's why there is special code in Perl to support
Perl's "system" call on DJGPP.

> Don't take the following two points too seriously (even if they are
> true, AFAICT):
> 
> 1 is obviously wrong. POSIX::WEXITSTATUS should match the header.

IMHO it's not really "wrong". There's a workaround to make Perl's "system"
call in the DJGPP port behave like it does on Unix - i.e.: to let you do this
to get the return code:

    $status = $? >> 8;

A lot of Perl scripts do this.

It seems POSIX::WEXITSTATUS was introduced to avoid scripts doing this magic
"$? >> 8" thing. But I guess it's still widely used.

So 1 is a workaround for the workaround. As a hack to make POSIX::WEXITSTATUS
from Perl 5.6.1 work correctly with DJGPP 2.03, I don't think it's bad. It's
not clever, it's not pretty, but it'll work.

> Not 2. It's perl's problem if it can't adjust to the platform.
> 
> However, if nobody's using W* from <sys/wait.h>, then 2 would correct
> it in a perl friendly way.

AFAIK the W* macros from <sys/wait.h> are only used, when dealing with wait &
waitpid's return code. And since wait & waitpid don't work with DJGPP, I think
it's safe to change the definitions of the W* macros. Does anyone know of any
DJGPP add-ons that use the W* macros?

BTW please keep CC'ing Laszlo, until we know whether he's subscribed to
djgpp-workers. He did the most recent work on porting Perl to DJGPP, I think.
I've forwarded your reply to my original message to him.

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019