<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>Yeah, that's right. I think we should still ensure that clients of Process.Wait and System.Wait don't do anything more than check the non-zero status value that they return. I suspect the packing was there to ensure that current clients were able to do that reliably (are there systems that encode non-zero successful exit status for processes?). Hmm.</div></span></span></span></span></span></span></span></span></div></span> </div><br><div><div>On 14 Jan 2009, at 10:59, Jay wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; "> > I think "what I was missing" here is the option of changing the Process.Wait or<br> > SchedulerPosix.WaitProcess interface to return the status bits. I don't think this<br> > is how it was before, (which I think was implied).<br> <br>It looks like I added SchedulerPosix.WaitProcess only in 2008, while fixing the inefficient waitpid in libm3,<br>so it wasn't some long standing interface, and changing it very reasonable.<br>Had I only noticed sysutils at the time, I /might/ have thought to define it the way you did.<br>(Still the bootstrap issue, neither WaitProcess signature is in older m3core.)<br> <br> - Jay<br><br><br><hr id="stopSpelling"><br>From:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>CC:<span class="Apple-converted-space"> </span><a href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</a><br>Subject: RE: waitpit<br>Date: Tue, 13 Jan 2009 05:50:43 +0000<br><br>I think "what I was missing" here is the option of changing the Process.Wait or SchedulerPosix.WaitProcess interface to return the status bits. I don't think this is how it was before, (which I think was implied).<br>Maybe I misread it, between returning the pid/success vs. the status word?<br>I had added the new interface SchedulerPosix.DoesWaitPidYield, but left others asis.<br>Now, true, I'm arguing both sides, since I did make Uerror.i3 incompatible with some clients.<br>Exposing more information like that seems a good solution, leaving the next level down to waitpid(0) or waitpid(nohang).<br>I think user threads are missing some code now, since ThreadPWait (but not ThreadPScheduler) was used by them. But I admit, I didn't build them either, so whether they worked or not, and whether I kept them working or not, don't know. They are never build by default.<br> <br>I think the problem with the encoded exit status it is just a bit "wierd", and hardly anyone would want to use it asis.<br>The repacked value makes more sense? Slightly?<br>Hm..how about this...?<br> <br> <br>interface Uexec;<br> <br><*external Uexec_WIFEXITED> PROCEDURE WIFEXITED(int status):BOOLEAN;<br>etc. the various other macros/functions in Posix, well, at least two or three of them, the<br>ones that access the relevant fields.<br> <br>Uexec.c<br> typedef size_t BOOLEAN; /* ? safe at least, to return a full word's worth of bits */ <span class="Apple-converted-space"> </span><br> #define TRUE 1 <span class="Apple-converted-space"> </span><br> #define FALSE 1 <span class="Apple-converted-space"> </span><br> <br> BOOLEAN Uexec_WIFEEXITED(int status)<br> { <span class="Apple-converted-space"> </span><br> return WIFEEXITED(status) ? TRUE : FALSE; <span class="Apple-converted-space"> </span><br> }<br> <br>That fits one of the molds well imho.<br>I like what I had in Uwaitpid, but it is hard to argue for it vs. this.<br>They are very similar.<br>This has the advantage of only returning what is asked for.<br>Uwaitpid had the advantage of probably being faster -- less storage efficient, but fewer function calls / roundtrips and such, since WIFEEXITED is likely a macro and Modula-3 loses the inlining. Surely not a big deal either way. Both options are very portable.<br> <br>Then, the rejiggering/repacking of the bits can be done portably, without regard to endiannness and without regard to the bitfield layout of the int; the bitfields can go away, leaving just the int to be unpacked by these macros-wrapped-in-functions. (I believe it is portable defined as an int but I'll check).<br> <br>Ok?<br> <br> - Jay<br><br><br><hr id="EC_stopSpelling"><br><br>From:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>CC:<span class="Apple-converted-space"> </span><a href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</a><br>Subject: RE: [M3commit] CVS Update: cm3<br>Date: Mon, 12 Jan 2009 12:08:29 +0000<br><br>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><br><br><hr id="EC_EC_stopSpelling"><br><br><br>From:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>Date: Mon, 12 Jan 2009 22:25:25 +1100<br>CC:<span class="Apple-converted-space"> </span><a href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</a><br>Subject: Re: [M3commit] CVS Update: cm3<br><br><br><br><br><div><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal 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_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal 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_EC_EC_Apple-interchange-newline"><blockquote><span class="EC_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div class="EC_EC_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_EC_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_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div class="EC_EC_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_EC_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_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div class="EC_EC_EC_hmmessage" style="font-size: 10pt; font-family: Verdana; "> Besides all "my" ports, which don't define those types.<span class="EC_EC_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_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div class="EC_EC_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_EC_EC_Apple-style-span" style="word-spacing: 0px; font: normal normal normal 12px/normal Helvetica; text-transform: none; color: rgb(0, 0, 0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; "><div class="EC_EC_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_EC_EC_Apple-converted-space"> </span><a href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</a><br>> From:<span class="EC_EC_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_EC_EC_Apple-converted-space"> </span><br>> CVSROOT: /usr/cvs<br>> Changes by: hosking@birch. 09/01/12 10:20:33<br>><span class="EC_EC_EC_Apple-converted-space"> </span><br>> Modified files:<br>> cm3/m3-libs/m3core/src/thread/: ThreadPScheduler.m3<span class="EC_EC_EC_Apple-converted-space"> </span><br>> ThreadPWait.m3<span class="EC_EC_EC_Apple-converted-space"> </span><br>> cm3/m3-libs/m3core/src/thread/Common/: SchedulerPosix.i3<span class="EC_EC_EC_Apple-converted-space"> </span><br>> cm3/m3-libs/m3core/src/unix/Common/: UtimeC.c Uwaitpid.i3<span class="EC_EC_EC_Apple-converted-space"> </span><br>> m3makefile<span class="EC_EC_EC_Apple-converted-space"> </span><br>> cm3/m3-libs/libm3/src/os/POSIX/: ProcessPosixCommon.m3<span class="EC_EC_EC_Apple-converted-space"> </span><br>> cm3/m3-libs/sysutils/src/POSIX/: SystemPosix.m3 m3makefile<span class="EC_EC_EC_Apple-converted-space"> </span><br>><span class="EC_EC_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_EC_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_EC_EC_Apple-converted-space"> </span><br>> Not sure if this re-packing is needed by clients, but should verify.<br>><span class="EC_EC_EC_Apple-converted-space"> </span><br><br></div></span></blockquote></div><br></div></span><br class="Apple-interchange-newline"></blockquote></div><br></body></html>