On Apr 16, 6:08 pm, Robert Spykerman <robert.spyker...@[EMAIL PROTECTED]
>
wrote:
> Anyways, right now I'm trying to port the SYSTEM word.
>
> The fork syscall appears to work (I get another forth instance on top
> of the old one) but the shell does not get called to do say, something
> quick like "ls" SYSTEM. I changed the vector to the apple one, maybe
> there's a difference. I also had to patch waitpid - it's wait4 on the
> apple.
....
Just a brief update re: my attempt at porting Albert's ciforth to OSX
I've found out what appears to be the problem afflicting my current
attempt at porting the SYSTEM word.
It would seem that the fork syscall appears to return the PID to both
parent and child process which results in the child not knowing it's a
child (because it would expect a PID of zero) and hence execution
pretty much waits there.
I am not sure what's affecting fork and why it's behaving this way, it
must be a porting glitch on my part, but so far the code really looks
quite sane.
How hard is it to call a pid_t fork (void) ...
where pid_t = unsigned 32 bit, ie return a 32 bit value (which I
assume will sit in EAX and appears to otherwise I would not get a PID
back at all, so given I'm getting PID's back I must be doing that bit
right :).
The linux code works as it self describes really, I've double checked
the return values and they check out. Child gets 0. Parent gets PID of
child.
Can't see what I'm doing wrong with my OSX version both get the PID of
the child.... hmmm..
I can't believe even I can stuff that up :) But who knows hehehehe.
/scratches head.
Anyways it would seem all things being equal I may get some time to
work on this this weekend... If anyone's ever come across a problem
like this before, pray do share your wisdom. I'll see if any of the
BSD or mac guys I know have come across anything like this as well.
Robert Spykerman


|