Background process implementation

Hi,

I am trying to implement background process(bg command) in my unix
shell. Could anybody please tell me how I can proceed to implement it
in my shell?

Thanks.
Payel [ Mo, 29 Oktober 2007 19:34 ] [ ID #1856601 ]

Re: Background process implementation

2007-10-29, 18:34(-00), Payel:
[...]
> I am trying to implement background process(bg command) in my unix
> shell. Could anybody please tell me how I can proceed to implement it
> in my shell?
[...]

bg only sends a SIGCONT to the process group of the stopped
process.

It's upon the <Ctrl-Z> that you need to do something: set the
terminal's foreground process group (tcsetpgrp(3)) back to the
shell.

--
Stéphane
Stephane CHAZELAS [ Mo, 29 Oktober 2007 19:49 ] [ ID #1856602 ]

Re: Background process implementation

2007-10-29, 18:49(+00), Stephane CHAZELAS:
> 2007-10-29, 18:34(-00), Payel:
> [...]
>> I am trying to implement background process(bg command) in my unix
>> shell. Could anybody please tell me how I can proceed to implement it
>> in my shell?
> [...]
>
> bg only sends a SIGCONT to the process group of the stopped
> process.

Let me rephrase that a bit more sanely:

bg sends a SIGCONT to the stopped process group.

When you start a job, you create a new process group with
setpgid(3). If you start it in foreground (without &), you also
need to make that process group the foreground process group
(tcsetpgrp(3)).


> It's upon the <Ctrl-Z> that you need to do something: set the
> terminal's foreground process group (tcsetpgrp(3)) back to the
> shell.
>


--
Stéphane
Stephane CHAZELAS [ Mo, 29 Oktober 2007 19:52 ] [ ID #1856603 ]
Linux » comp.unix.shell » Background process implementation

Vorheriges Thema: setpgid function
Nächstes Thema: Problem using non-standard filenames