Background process implementation

Background process implementation

am 29.10.2007 19:34:51 von Payel

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.

Re: Background process implementation

am 29.10.2007 19:49:26 von 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.

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

--
Stéphane

Re: Background process implementation

am 29.10.2007 19:52:55 von Stephane CHAZELAS

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 that you need to do something: set the
> terminal's foreground process group (tcsetpgrp(3)) back to the
> shell.
>


--
Stéphane