[openbeos] Re: Kernel status (POSIX)

  • From: "Manuel Jesus Petit de Gabriel" <freston@xxxxxxxxxxx>
  • To: <openbeos@xxxxxxxxxxxxx>
  • Date: Sun, 30 Dec 2001 17:01:44 -0800

Hi

> I'm always interested as the next guy in getting bogged down in the
details
> and completely off track, but I thought we were talking about :
>
> pid_t  fork(void)
>
> All it does is create a duplicate process (runs the same program),
> as a separate process with it's own variable space. There's no real
> magic there.

It's more than it runs the same program. I makes a bit-by-bit duplicate
of the process, and the new process must continue to execute from
the very same point where the parent called fork(). The new process
must be completely undistinguishable from the parent except for a few
quirks: the return value of fork() itself (0 for the new process, child pid
for the
parent) and asking the OS about it's own identity (getpid(), getppid(),
getrusage().)
You are not going to accomplish that by levering on load_image()
as you suggested.


> As for missing programs etc., personally when I run an application
> I don't tend to delete the executable file while things are in progress.

Happens all the time in some environments, for instance upgrading some
system daemon while it is running without disrupting the service. In any
case is just a matter of *correctness* of the implementation.


> In the case of stacks, a true fork function is, by definition, creating
> a separate process with its own dataspace. Why would I care where
> the stack for a new process is placed, as long as the new process can
> use it?

Pointers to automatic vars in the call chain for instance.


> >Sixth, did i mention signal handlers?
>
> You're assuming that a posix library needs to
> use BeOS signals for this. At its core it probably will.
> However, there is nothing that stops the fork()
> routine from doing a bit of reorganization, or
> from having it's own separate signal queue,
> (ie: posix engine) if you really want to go that far.

You are assuming that you can modify the signal
vectors of a foreign process, which is not usually the
case (it would be quite unsafe to do that).


manuel,


PS: Happy New Year!



Other related posts: