<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hm. So I guess the point then is to return one "reasonable" integer, and<BR>
"reasonable" is actually defined as<BR>
 <BR>
(coredump << 15) | (termsig << 8) | exitcode<BR>
 <BR>
That's the point of the repacking?<BR>
and coredump and termsig are usually 0.<BR>
 <BR>
Anyway, I don't think even this 7/1/8/16 split is specified by Posix. Right?<BR>
Uwaitpid.c was a good portable method I think.<BR>
It was based on the example code in online Posix docs (which you originally pointed me to).<BR>
 <BR>
 - Jay<BR><BR><BR>

<HR id=stopSpelling>
<BR>
From: hosking@cs.purdue.edu<BR>To: jay.krell@cornell.edu<BR>Date: Mon, 12 Jan 2009 22:25:25 +1100<BR>CC: m3commit@elegosoft.com<BR>Subject: Re: [M3commit] CVS Update: cm3<BR><BR><BR>
<DIV><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV style="WORD-WRAP: break-word"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate"><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV><BR></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DIV></SPAN></DIV>
<DIV>
<DIV>On 12 Jan 2009, at 21:11, Jay wrote:</DIV><BR class=EC_Apple-interchange-newline>
<BLOCKQUOTE><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV class=EC_hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"> > relies on particular endian-ness of the status<BR> > word they return. Really, those clients should<BR> > be using proper bit-shifts and bit-masks to extract<BR> > the right values rather than some endian- dependent RECORD layout defined in Uexec<BR> <BR> Wasn't Uwaitpid.c a good portable way to do exactly that?<SPAN class=EC_Apple-converted-space> </SPAN></DIV></SPAN></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>I didn't look too closely at that.  I wanted something that retained the simplicity of calling waitpid as:</DIV>
<DIV><BR></DIV>
<DIV>PROCEDURE waitpid(pid: int; VAR status: int; options: int): int;</DIV><BR>
<BLOCKQUOTE><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV class=EC_hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"> I guess it can be written in Modula-3 though, if the headers are cloned as they are.<BR> Aren't {I386,AMD64}_DARWIN broken here?<SPAN class=EC_Apple-converted-space> </SPAN></DIV></SPAN></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>I don't think so -- Uexec is still there.</DIV><BR>
<BLOCKQUOTE><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV class=EC_hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"> Besides all "my" ports, which don't define those types.<SPAN class=EC_Apple-converted-space> </SPAN><BR> Yeah yeah, all I have to do is switch on endian and I can introduce them..</DIV></SPAN></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>But really, clients of waitpid/SchedulerPosix.WaitProcess should be prepared to shift the status return value correctly!  After all, the interface doc for Process.Wait indicates that the return value is the status word.</DIV><BR>
<BLOCKQUOTE><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV class=EC_hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"> I'll see about Cygwin pthreads.</DIV></SPAN></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>Yes, it would be a more coherent solution.</DIV><BR>
<BLOCKQUOTE><SPAN class=EC_Apple-style-span style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate">
<DIV class=EC_hmmessage style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"><BR><BR> - Jay<BR><BR>> Date: Mon, 12 Jan 2009 10:20:33 +0000<BR>> To:<SPAN class=EC_Apple-converted-space> </SPAN><A href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</A><BR>> From:<SPAN class=EC_Apple-converted-space> </SPAN><A href="mailto:hosking@elego.de">hosking@elego.de</A><BR>> Subject: [M3commit] CVS Update: cm3<BR>><SPAN class=EC_Apple-converted-space> </SPAN><BR>> CVSROOT: /usr/cvs<BR>> Changes by: hosking@birch. 09/01/12 10:20:33<BR>><SPAN class=EC_Apple-converted-space> </SPAN><BR>> Modified files:<BR>> cm3/m3-libs/m3core/src/thread/: ThreadPScheduler.m3<SPAN class=EC_Apple-converted-space> </SPAN><BR>> ThreadPWait.m3<SPAN class=EC_Apple-converted-space> </SPAN><BR>> cm3/m3-libs/m3core/src/thread/Common/: SchedulerPosix.i3<SPAN class=EC_Apple-converted-space> </SPAN><BR>> cm3/m3-libs/m3core/src/unix/Common/: UtimeC.c Uwaitpid.i3<SPAN class=EC_Apple-converted-space> </SPAN><BR>> m3makefile<SPAN class=EC_Apple-converted-space> </SPAN><BR>> cm3/m3-libs/libm3/src/os/POSIX/: ProcessPosixCommon.m3<SPAN class=EC_Apple-converted-space> </SPAN><BR>> cm3/m3-libs/sysutils/src/POSIX/: SystemPosix.m3 m3makefile<SPAN class=EC_Apple-converted-space> </SPAN><BR>><SPAN class=EC_Apple-converted-space> </SPAN><BR>> Log message:<BR>> Try to clean up mess with Process.Wait and System.Wait based on waitpid.<BR>><SPAN class=EC_Apple-converted-space> </SPAN><BR>> Packing is now returned to Process.Wait and System.Wait where it used to be.<BR>><SPAN class=EC_Apple-converted-space> </SPAN><BR>> Not sure if this re-packing is needed by clients, but should verify.<BR>><SPAN class=EC_Apple-converted-space> </SPAN><BR><BR></DIV></SPAN></BLOCKQUOTE></DIV><BR></body>
</html>