This site contains older material on Eiffel. For the main Eiffel page, see http://www.eiffel.com.

EiffelBase class
(HTML page generated by ISE Eiffel 4.2)

Eiffel Class
indexing
	description: "Constants used for signal handling. This class may be used as ancestor by classes needing its facilities.";
	status: "See notice at end of class";
	date: "$Date: 2007-03-30 11:10:11 -0800 (Fri, 30 Mar 2007) $";
	revision: "$Revision: 95354 $"

class UNIX_SIGNALS

feature -- Access

	meaning (sig: INTEGER): STRING is
			-- A message in English describing what sig is
		do
			if is_defined (sig) then
				create Result.make (0);
				Result.from_c (c_signal_name (sig))
			end
		end;

	is_defined (sig: INTEGER): BOOLEAN is
			-- Is sig a signal defined for this platform?
		external
			"C | %"eif_sig.h%""
		alias
			"esigdefined"
		end;

	is_ignored (sig: INTEGER): BOOLEAN is
			-- Is sig currently set to be ignored?
		do
			Result := notis_caught (sig)
		end;

	sighup: INTEGER is
			-- Code for `Hangup' signal
		once
			Result := c_signal_map (1)
		end;

	sigint: INTEGER is
			-- Code for `Interrupt' signal
		once
			Result := c_signal_map (2)
		end;

	sigquit: INTEGER is
			-- Code for `Quit' signal
		once
			Result := c_signal_map (3)
		end;

	sigill: INTEGER is
			-- Code for `Illegal instruction' signal
		once
			Result := c_signal_map (4)
		end;

	sigtrap: INTEGER is
			-- Code for `Trace trap' signal
		once
			Result := c_signal_map (5)
		end;

	sigabrt: INTEGER is
			-- Code for `Abort' signal
		once
			Result := c_signal_map (6)
		end;

	sigiot: INTEGER is
			-- Code for `IOT instruction' signal
		once
			Result := c_signal_map (7)
		end;

	sigemt: INTEGER is
			-- Code for `EMT instruction' signal
		once
			Result := c_signal_map (8)
		end;

	sigfpe: INTEGER is
			-- Code for `Floating point exception' signal
		once
			Result := c_signal_map (9)
		end;

	sigkill: INTEGER is
			-- Code for `Terminator' signal
		once
			Result := c_signal_map (10)
		end;

	sigbus: INTEGER is
			-- Code for `Bus error' signal
		once
			Result := c_signal_map (11)
		end;

	sigsegv: INTEGER is
			-- Code for `Segmentation violation' signal
		once
			Result := c_signal_map (12)
		end;

	sigsys: INTEGER is
			-- Code for `Bad argument to system call' signal
		once
			Result := c_signal_map (13)
		end;

	sigpipe: INTEGER is
			-- Code for `Broken pipe' signal
		once
			Result := c_signal_map (14)
		end;

	sigalrm: INTEGER is
			-- Code for `Alarm clock' signal
		once
			Result := c_signal_map (15)
		end;

	sigterm: INTEGER is
			-- Code for `Software termination' signal
		once
			Result := c_signal_map (16)
		end;

	sigusr1: INTEGER is
			-- Code for `User-defined signal #1'
		once
			Result := c_signal_map (17)
		end;

	sigusr2: INTEGER is
			-- Code for `User-defined signal #2'
		once
			Result := c_signal_map (18)
		end;

	sigchld: INTEGER is
			-- Code for `Death of a child' signal.
			-- Signal ignored by default
		once
			Result := c_signal_map (19)
		end;

	sigcld: INTEGER is
			-- Code for `Death of a child' signal.
			-- Signal ignored by default
		once
			Result := c_signal_map (20)
		end;

	sigio: INTEGER is
			-- Code for `Pending I/O on a descriptor' signal.
			-- Signal ignored by default
		once
			Result := c_signal_map (21)
		end;

	sigpoll: INTEGER is
			-- Code for `Selectable event pending' signal
		once
			Result := c_signal_map (22)
		end;

	sigttin: INTEGER is
			-- Code for `Tty input from background' signal.
			-- Signal ignored by default
		once
			Result := c_signal_map (23)
		end;

	sigttou: INTEGER is
			-- Code for `Tty output from background' signal.
			-- Signal ignored by default
		once
			Result := c_signal_map (24)
		end;

	sigstop: INTEGER is
			-- Code for `Stop' signal
		once
			Result := c_signal_map (25)
		end;

	sigtstp: INTEGER is
			-- Code for `Stop from tty' signal
		once
			Result := c_signal_map (26)
		end;

	sigxcpu: INTEGER is
			-- Code for `Cpu time limit exceeded' signal
		once
			Result := c_signal_map (27)
		end;

	sigxfsz: INTEGER is
			-- Code for `File size limit exceeded' signal
		once
			Result := c_signal_map (28)
		end;

	sigvtalarm: INTEGER is
			-- Code for `Virtual time alarm' signal
		once
			Result := c_signal_map (29)
		end;

	sigpwr: INTEGER is
			-- Code for `Power-fail' signal
		once
			Result := c_signal_map (30)
		end;

	sigprof: INTEGER is
			-- Code for `Profiling timer alarm' signal
		once
			Result := c_signal_map (31)
		end;

	sigwinch: INTEGER is
			-- Code for `Window size changed' signal.
			-- Signal ignored by default
		once
			Result := c_signal_map (32)
		end;

	sigwind: INTEGER is
			-- Code for `Window change' signal
		once
			Result := c_signal_map (33)
		end;

	sigphone: INTEGER is
			-- Code for `Line status change' signal
		once
			Result := c_signal_map (34)
		end;

	siglost: INTEGER is
			-- Code for `Resource lost' signal
		once
			Result := c_signal_map (35)
		end;

	sigurg: INTEGER is
			-- Code for `Urgent condition on socket' signal.
			-- Signal ignored by default
		once
			Result := c_signal_map (36)
		end;

	sigcont: INTEGER is
			-- Code for `Continue after stop' signal.
			-- Signal ignored by default
		once
			Result := c_signal_map (37)
		end;

feature -- Status report

	signal: INTEGER is
			-- Code of last signal
		external
			"C | %"eif_sig.h%""
		alias
			"esignum"
		end;

feature -- Status setting

	catch (sig: INTEGER) is
			-- Make sure that future occurrences of sig
			-- will be treated as exceptions.
			-- (This is the default for all signals.)
			-- No effect if signal not defined.
		external
			"C | %"eif_sig.h%""
		alias
			"esigcatch"
		end;

	ignore (sig: INTEGER) is
			-- Make sure that future occurrences of sig
			-- will be ignored. (This is not the default.)
			-- No effect if signal not defined.
		external
			"C | %"eif_sig.h%""
		alias
			"esigignore"
		end;

	reset_all_default is
			-- Make sure that all exceptions will lead to their
			-- default handling.
		external
			"C | %"eif_sig.h%""
		alias
			"esigresall"
		end;

	reset_default (sig: INTEGER) is
			-- Make sure that exception of code code will lead
			-- to its default action.
		require
			is_defined (sig)
		external
			"C | %"eif_sig.h%""
		alias
			"esigresdef"
		end;

feature {NONE} -- Implementation

	is_caught (sig: INTEGER): BOOLEAN is
			-- Is sig currently set to be caught?
		external
			"C | %"eif_sig.h%""
		alias
			"esigiscaught"
		end;

	c_signal_map (i: INTEGER): INTEGER is
		external
			"C | %"eif_sig.h%""
		alias
			"esigmap"
		end;

	c_signal_name (i: INTEGER): POINTER is
		external
			"C | %"eif_sig.h%""
		alias
			"esigname"
		end;

end -- class UNIX_SIGNALS