SUMMARY: Disabling Interrupts in C program.

From: John Black (
Date: Fri Nov 27 1998 - 07:19:09 CST


Thank you very much to those who replied.

"Steve Kay" <>
Max Trummer <>
"Brion Leary" <>
"Christopher M. Conway" <> (Kevin Sheehan - Uniq)
Matthew Atkinson <>
Roger Fujii <>
Reddy Muthyala <> (Edward C. Zimmermann)
Chad Price <>

& Special Thanks to: (James R Grinter)
Seth Rothenberg <>
Harvey Wamboldt <>
Renny Koshy <> <Stephen Wolthusen>

The unanimous reply was to use signal() library. It contains various
routineslike sigprocmask(), sigemptyset(),sigfillset(), sigaddset(),
sigdelset(),sigismember(), sigaction() etc to do such rudimentary things.
Some people have advised to use 'trap' command in the parent process which
runs this C program. Another very good suggestion was to use 'stty raw'
command in the parent process.
My apologies to those who thought that my question was off-topic. I will be
careful in future.

Thanks & Regards

John Black
My original Mail:

  I am writing a C program which contains something like this:
  printf("\t\t\t\tA- Archie\n");
  printf("\t\t\t\tN- Finger\n");
  printf("\n\n\n\t\t\tEnter Your Choice (A or F)");
  if (x == 'A')
  printf("\n\t\t\tPress Any Key To Continue");

  else if (x == 'N')
  printf("\n\t\t\tPress Any Key To Continue");
  I want to disable all the interrupts so that if some body presses Ctrl-D or
Ctrl-C to stop the execution of this program then he does not succeed.
  I am compiling this program of solaris 2.5 using gcc.

  Thanks in advance. I will summarize.

  J. Black

Get free e-mail and a permanent address at

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:53 CDT