* [9fans] rfork
@ 2005-01-06 13:24 Sergey Reva
2005-01-06 13:35 ` Tiit Lankots
0 siblings, 1 reply; 4+ messages in thread
From: Sergey Reva @ 2005-01-06 13:24 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
Hello Fans,
How create process in new window, without exit from current?
Now I use:
rfork(RFPROC|RFNOWAIT|RFCFDG|RFNAMEG|RFENVG);
execl("/bin/plumb","plumb",-SomeFileName-,0);
New window created (because page create it), but current process
exited? Whats wrong, and how create new window for new process.
I can't find simple example, please help.
--
http://rs-rlab.narod.ru mailto:rs_rlab@mail.ru
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] rfork
2005-01-06 13:24 [9fans] rfork Sergey Reva
@ 2005-01-06 13:35 ` Tiit Lankots
2005-01-06 13:46 ` Sergey Reva
0 siblings, 1 reply; 4+ messages in thread
From: Tiit Lankots @ 2005-01-06 13:35 UTC (permalink / raw)
To: Sergey Reva, Fans of the OS Plan 9 from Bell Labs
> rfork(RFPROC|RFNOWAIT|RFCFDG|RFNAMEG|RFENVG);
> execl("/bin/plumb","plumb",-SomeFileName-,0);
rfork() literally forks the process. This snippet of code suggests that
_both_ of your processes afterwards get replaced by /bin/plumb; I think
your intention was to execl() only in the child. Check the man pages.
A new window is created by
echo new > /dev/wctl
see rio(4)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] rfork
2005-01-06 13:35 ` Tiit Lankots
@ 2005-01-06 13:46 ` Sergey Reva
2005-01-06 13:52 ` Nigel Roles
0 siblings, 1 reply; 4+ messages in thread
From: Sergey Reva @ 2005-01-06 13:46 UTC (permalink / raw)
To: Tiit Lankots, Fans of the OS Plan 9 from Bell Labs
Hello Tiit,
Thursday, January 6, 2005, 3:35:43 PM, you wrote:
>> rfork(RFPROC|RFNOWAIT|RFCFDG|RFNAMEG|RFENVG);
>> execl("/bin/plumb","plumb",-SomeFileName-,0);
TL> rfork() literally forks the process. This snippet of code suggests that
TL> _both_ of your processes afterwards get replaced by /bin/plumb; I think
TL> your intention was to execl() only in the child. Check the man pages.
rfork is new technique for me, and not shure I understand all exact.
Snippet created while I read man page, but don't work.
Please explain how create new process.
--
http://rs-rlab.narod.ru mailto:rs_rlab@mail.ru
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] rfork
2005-01-06 13:46 ` Sergey Reva
@ 2005-01-06 13:52 ` Nigel Roles
0 siblings, 0 replies; 4+ messages in thread
From: Nigel Roles @ 2005-01-06 13:52 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
Sergey Reva wrote:
>Hello Tiit,
>
>Thursday, January 6, 2005, 3:35:43 PM, you wrote:
>
>
>>>rfork(RFPROC|RFNOWAIT|RFCFDG|RFNAMEG|RFENVG);
>>>execl("/bin/plumb","plumb",-SomeFileName-,0);
>>>
>>>
>TL> rfork() literally forks the process. This snippet of code suggests that
>TL> _both_ of your processes afterwards get replaced by /bin/plumb; I think
>TL> your intention was to execl() only in the child. Check the man pages.
>
>rfork is new technique for me, and not shure I understand all exact.
>Snippet created while I read man page, but don't work.
>Please explain how create new process.
>
>
>
rfork creates two identical processes by cloning the original.
execl replaces the running process with another executable
rfork returns 0 if you are the new process, >0 if you are the original, so
if (rfork(RFPROC|RFNOWAIT|RFCFDG|RFNAMEG|RFENVG) == 0)
execl("/bin/plumb","plumb",-SomeFileName-,0);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-01-06 13:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-06 13:24 [9fans] rfork Sergey Reva
2005-01-06 13:35 ` Tiit Lankots
2005-01-06 13:46 ` Sergey Reva
2005-01-06 13:52 ` Nigel Roles
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).