How to prevent exiting from running program
Hi all...
I am developing a C programme for database management, and I need to make it unclosable unless the quit button is clicked. So I shall be realy thankful if anybody could help me out and tell me how to do it.
I want to isable everything right from Ctrl+z to suspend to Ctrl+c for exit and Ctrl+Alt+Delete if possibal at all.
Thanks in advance....
Re: How to prevent exiting from running program
Quote:
Originally posted by scorpio_IITR
I want to isable everything right from Ctrl+z to suspend to Ctrl+c for exit and Ctrl+Alt+Delete if possibal at all.
all you can do is catch a bunch of 'allowed' signals:
stopping (sort of ;) ):
SIGINT (Ctrl-C)
SIGABRT(Ctrl-\)
SIGTERM
SIGHUP
pausing:
SIGSTP (Ctrl-Z)
you can't catch SIGKILL (kill -9) or SIGSTOP, as they're handled by the kernel; Ctrl+Alt+Del is a different story: in console mode, init snatches it, in X usually the desktop manager does. either way, you probably won't see it (and well you shouldn't - you can't handle the reset button either :D )
Re: Re: How to prevent exiting from running program
>> SIGABRT(Ctrl-\)
?*?*? SIGQUIT
>> SIGSTP (Ctrl-Z)
SIGTSTP
Re: Re: Re: How to prevent exiting from running program
Quote:
Originally posted by Jaguar
>> SIGABRT(Ctrl-\)
?*?*? SIGQUIT
>> SIGSTP (Ctrl-Z)
SIGTSTP
yeah, SIGTSTP (sorry for the typo).
however, Ctrl-\ may send either the Posix "Quit" (SIGQUIT) or the Ansi "Abort" (SIGABRT) - it's terminal-dependent.