SIGHUP

I want to add a signal handler for SIGHUP, and ignore the signal, like they
saided on;

http://qdn.qnx.com/support/bok/solution.qnx?9696

I want to do this, because i don’t want my program to stop after i logoff
the system.

How can i do this in Watcom programming, do i need to use raise, signal, or
anything else ?

Thanks Roger.


Sigma Automatisation Inc.
Roger Parent
6 Patrice Cote C.P.130
Trois-Pistoles, Qc G0L 4K0
Tel: 418-851-4254 ou 418-857-2172 Ext 121
Fax: 418-851-4580
Email: rparent@sigma-techno.com
Web: www.sigma-techno.com

Roger Parent @ Sigma inc. <rparent@sigma-techno.com> wrote:

I want to add a signal handler for SIGHUP, and ignore the signal, like they
saided on;

http://qdn.qnx.com/support/bok/solution.qnx?9696

I want to do this, because i don’t want my program to stop after i logoff
the system.

How can i do this in Watcom programming, do i need to use raise, signal, or
anything else ?

Take a look at the docs for signal() or for sigaction() – either can be
used. Simplest: signal(SIGHUP, SIG_IGN) – then SIGHUP is discarded.

Or, you can put yourself in a different process group – fork() then do
a setpgid(). The SIGHUP should only be delivered to processes in the
same process group as the session leader that owns the terminal device.

Or, you just run your program using “nohup program &” or “on -s program &”
to start it in a new process group.

Or…

-David

QNX Training Services
dagibbs@qnx.com

I have already use nohup but sometimes it’s not working and i don’t know
why.

I going to try your other alternative.

Thanks

“David Gibbs” <dagibbs@qnx.com> a écrit dans le message news:
96erps$78v$1@nntp.qnx.com

Roger Parent @ Sigma inc. <> rparent@sigma-techno.com> > wrote:
I want to add a signal handler for SIGHUP, and ignore the signal, like
they
saided on;

http://qdn.qnx.com/support/bok/solution.qnx?9696

I want to do this, because i don’t want my program to stop after i
logoff
the system.

How can i do this in Watcom programming, do i need to use raise, signal,
or
anything else ?

Take a look at the docs for signal() or for sigaction() – either can be
used. Simplest: signal(SIGHUP, SIG_IGN) – then SIGHUP is discarded.

Or, you can put yourself in a different process group – fork() then do
a setpgid(). The SIGHUP should only be delivered to processes in the
same process group as the session leader that owns the terminal device.

Or, you just run your program using “nohup program &” or “on -s program &”
to start it in a new process group.

Or…

-David

QNX Training Services
dagibbs@qnx.com