<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Nevermind, of course, I should have known, even though I'm working on fixing the stat struct (probably to blame for files always being out of date) and thought I might have it right, I should have known, I have it too small and the next variable is getting overwritten, causing us to close(0)..<BR>
If I put in arbitrary large padding at the end, it grows enough to cover up the problem..now to get it right..<BR>
null_fd and the entire struct stat need not be globals, just the dev field...of course optimize that and I would have a stack corruption instead, not sure it would have been harder or easier to figure out..I should have started at the bottom of the system and gotten all the headers right in the first place....sigh.<BR>
<BR>
VAR<BR> null_done := FALSE;<BR> null_stat: Ustat.<FONT face="">struct_stat</FONT>;<BR> null_fd: INTEGER;<BR>
<BR>
PROCEDURE IsDevNull(READONLY statbuf: Ustat.<FONT face="">struct_stat</FONT>): BOOLEAN RAISES {} =<BR> VAR result: INTEGER;<BR> BEGIN<BR> IF NOT null_done THEN<BR> null_done := TRUE;<BR> null_fd := Unix.open(<BR> M3toC.FlatTtoS("/dev/null"), Unix.O_RDONLY, Unix.Mrwrwrw);<BR> IF null_fd < 0 THEN RETURN FALSE END;<BR> RTIO.PutText("1 null_fd is " & Fmt.Int(null_fd) & "\n"); 3<BR> result := Ustat.fstat(null_fd, ADR(null_stat));<BR> RTIO.PutText("2 null_fd is " & Fmt.Int(null_fd) & "\n"); 0<BR> EVAL Unix.close(null_fd); and then close 0 here oops<BR> IF result # 0 THEN null_fd := -1 END<BR><BR><BR><BR><BR><BR><BR>
<BLOCKQUOTE>
<HR id=EC_stopSpelling>
From: jayk123@hotmail.com<BR>To: m3devel@elegosoft.com<BR>Subject: RE: [M3devel] NT386GNU status/fishing for guesses..<BR>Date: Sat, 16 Feb 2008 19:37:46 +0000<BR><BR>
<META content="Microsoft SafeHTML" name=Generator>
<STYLE>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass EC_body.hmmessage
{font-size:10pt;font-family:Tahoma;}
</STYLE>
Ok, is this reasonable for all platforms? Otherwise I can push into Unix.m3.<BR> <BR>===================================================================<BR>RCS file: /usr/cvs/cm3/m3-libs/libm3/src/os/POSIX/ProcessPosix.m3,v<BR>retrieving revision 1.6<BR>diff -u -r1.6 ProcessPosix.m3<BR>--- ProcessPosix.m3 29 Nov 2007 05:05:56 -0000 1.6<BR>+++ ProcessPosix.m3 16 Feb 2008 19:36:08 -0000<BR>@@ -266,6 +266,9 @@<BR> (* Make file descriptor "fd" refer to file "h", or set "fd"'s<BR> close-on-exec flag if "h=NoFile". Return "TRUE" if succesful. *)<BR> BEGIN<BR>+ IF fd = h THEN<BR>+ RETURN TRUE;<BR>+ END;<BR> IF h # NoFileDescriptor THEN<BR> RETURN NOT Unix.dup2(h, fd) < 0<BR> ELSIF Unix.fcntl(fd, Unix.F_SETFD, 1) >= 0 THEN<BR><BR><BR> - Jay<BR><BR>
<BLOCKQUOTE>
<HR id=EC_EC_stopSpelling>
From: jayk123@hotmail.com<BR>To: m3devel@elegosoft.com<BR>Date: Sat, 16 Feb 2008 19:30:01 +0000<BR>Subject: [M3devel] NT386GNU status/fishing for guesses..<BR><BR>
<STYLE>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass EC_body.hmmessage
{font-size:10pt;font-family:Tahoma;}
</STYLE>
PROCEDURE ExecChild(<BR> argx: ArrCStr; (* see "AllocArgs" for layout *)<BR> envp: Ctypes.char_star_star;<BR> wdstr: Ctypes.char_star;<BR> stdin, stdout, stderr: INTEGER) : INTEGER<BR> RAISES {} =<BR>(* Modify Unix state using "stdin", ..., and invoke execve using<BR> "argx" and "envp". Do not invoke scheduler, allocator, or<BR> exceptions. Return only if a fatal Unix error is encountered, in<BR> which case Cerrno.GetErrno() is set. *)<BR> VAR res := 0; t: Ctypes.char_star;<BR> BEGIN<BR> IF wdstr # NIL THEN<BR> IF Unix.chdir(wdstr) < 0 THEN RETURN -1; END<BR> END;<BR>(*<BR> IF NOT (SetFd(0, stdin) AND SetFd(1, stdout) AND SetFd(2, stderr)) THEN<BR> RETURN -1;<BR> END;<BR> FOR fd := 3 TO Unix.getdtablesize() - 1 DO<BR> EVAL Unix.close(fd) (* ignore errors *)<BR> END;<BR>*)<BR><BR>Without those lines commented out, only ever one file gets compiled.<BR>The process create for the second cm3cg fails (but not for the first as).<BR>Nearby code uses 99 for the exit code.<BR> <BR>With these commented out, it proceeds to compile everything (at least in one directory).<BR> <BR>Some combinations of the one block vs. the other (I realize there's only four cominations total) go and compile everything but claim failure at the end.<BR> <BR>Different point is that subsequent runs of cm3 always recompile everything.<BR>Probably the timestamps are misunderstood. I need to check the stat structure.<BR> <BR>Any one have any wild guesses on the process create angle?<BR>I figured this out with strace.<BR>The SetFd calls lead to dup failing because 0 isn't open.<BR> <BR>The Cygwin code is all very gnarly.<BR>For example when you do vfork + exec, it seems to relaunch the current .executable first (with kernel32.dll CreateProcess) and then child executables -- running cm3cg+as on just one file takes six CreateProcess calls -- cm3, sh, cm3cg, cm3, sh, as.<BR> <BR>I wonder if "Services for Unix" would satisfy folks at least as well as Cygwin. It is a free (beer) download..<BR> <BR> - Jay<BR><BR>
<HR>
Need to know the score, the latest news, or you need your HotmailŪ-get your "fix". <A href="http://www.msnmobilefix.com/Default.aspx" target=_blank>Check it out.</A> </BLOCKQUOTE><BR>
<HR>
Connect and share in new ways with Windows Live. <A href="http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008" target=_blank>Get it now!</A> </BLOCKQUOTE><br /><hr />Need to know the score, the latest news, or you need your HotmailŪ-get your "fix". <a href='http://www.msnmobilefix.com/Default.aspx' target='_new'>Check it out.</a></body>
</html>