⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 signal.texi

📁 一个C源代码分析器
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
Floating underflow trap.  (Trapping on floating underflow is notnormally enabled.)@comment signal.h@comment BSD@item FPE_DECOVF_TRAP@vindex FPE_DECOVF_TRAPDecimal overflow trap.  (Only a few machines have decimal arithmetic andC never uses it.)@ignore @c These seem redundant@comment signal.h@comment BSD@item FPE_FLTOVF_FAULT@vindex FPE_FLTOVF_FAULTFloating overflow fault.@comment signal.h@comment BSD@item FPE_FLTDIV_FAULT@vindex FPE_FLTDIV_FAULTFloating divide by zero fault.@comment signal.h@comment BSD@item FPE_FLTUND_FAULT@vindex FPE_FLTUND_FAULTFloating underflow fault.@end ignore@end table@comment signal.h@comment ANSI@deftypevr Macro int SIGILLThe name of this signal is derived from ``illegal instruction''; itusually means your program is trying to execute garbage or a privilegedinstruction.  Since the C compiler generates only valid instructions,@code{SIGILL} typically indicates that the executable file is corrupted,or that you are trying to execute data.  Some common ways of gettinginto the latter situation are by passing an invalid object where apointer to a function was expected, or by writing past the end of anautomatic array (or similar problems with pointers to automaticvariables) and corrupting other data on the stack such as the returnaddress of a stack frame.@code{SIGILL} can also be generated when the stack overflows, or whenthe system has trouble running the handler for a signal.@end deftypevr@cindex illegal instruction@comment signal.h@comment ANSI@deftypevr Macro int SIGSEGV@cindex segmentation violationThis signal is generated when a program tries to read or write outsidethe memory that is allocated for it, or to write memory that can only beread.  (Actually, the signals only occur when the program goes farenough outside to be detected by the system's memory protectionmechanism.)  The name is an abbreviation for ``segmentation violation''.Common ways of getting a @code{SIGSEGV} condition include dereferencinga null or uninitialized pointer, or when you use a pointer to stepthrough an array, but fail to check for the end of the array.  It variesamong systems whether dereferencing a null pointer generates@code{SIGSEGV} or @code{SIGBUS}.@end deftypevr@comment signal.h@comment BSD@deftypevr Macro int SIGBUSThis signal is generated when an invalid pointer is dereferenced.  Like@code{SIGSEGV}, this signal is typically the result of dereferencing anuninitialized pointer.  The difference between the two is that@code{SIGSEGV} indicates an invalid access to valid memory, while@code{SIGBUS} indicates an access to an invalid address.  In particular,@code{SIGBUS} signals often result from dereferencing a misalignedpointer, such as referring to a four-word integer at an address notdivisible by four.  (Each kind of computer has its own requirements foraddress alignment.)The name of this signal is an abbreviation for ``bus error''.@end deftypevr@cindex bus error@comment signal.h@comment ANSI@deftypevr Macro int SIGABRT@cindex abort signalThis signal indicates an error detected by the program itself andreported by calling @code{abort}.  @xref{Aborting a Program}.@end deftypevr@comment signal.h@comment Unix@deftypevr Macro int SIGIOTGenerated by the PDP-11 ``iot'' instruction.  On most machines, this isjust another name for @code{SIGABRT}.@end deftypevr@comment signal.h@comment BSD@deftypevr Macro int SIGTRAPGenerated by the machine's breakpoint instruction, and possibly othertrap instructions.  This signal is used by debuggers.  Your program willprobably only see @code{SIGTRAP} if it is somehow executing badinstructions.@end deftypevr@comment signal.h@comment BSD@deftypevr Macro int  SIGEMTEmulator trap; this results from certain unimplemented instructionswhich might be emulated in software, or the operating system'sfailure to properly emulate them.@end deftypevr@comment signal.h@comment Unix@deftypevr Macro int  SIGSYSBad system call; that is to say, the instruction to trap to theoperating system was executed, but the code number for the system callto perform was invalid.@end deftypevr@node Termination Signals@subsection Termination Signals@cindex program termination signalsThese signals are all used to tell a process to terminate, in one wayor another.  They have different names because they're used for slightlydifferent purposes, and programs might want to handle them differently.The reason for handling these signals is usually so your program cantidy up as appropriate before actually terminating.  For example, youmight want to save state information, delete temporary files, or restorethe previous terminal modes.  Such a handler should end by specifyingthe default action for the signal that happened and then reraising it;this will cause the program to terminate with that signal, as if it hadnot had a handler.  (@xref{Termination in Handler}.)The (obvious) default action for all of these signals is to cause theprocess to terminate.@comment signal.h@comment ANSI@deftypevr Macro int SIGTERM@cindex termination signalThe @code{SIGTERM} signal is a generic signal used to cause programtermination.  Unlike @code{SIGKILL}, this signal can be blocked,handled, and ignored.  It is the normal way to politely ask a program toterminate.The shell command @code{kill} generates @code{SIGTERM} by default.@pindex kill@end deftypevr@comment signal.h@comment ANSI@deftypevr Macro int SIGINT@cindex interrupt signalThe @code{SIGINT} (``program interrupt'') signal is sent when the usertypes the INTR character (normally @kbd{C-c}).  @xref{SpecialCharacters}, for information about terminal driver support for@kbd{C-c}.@end deftypevr@comment signal.h@comment POSIX.1@deftypevr Macro int SIGQUIT@cindex quit signal@cindex quit signalThe @code{SIGQUIT} signal is similar to @code{SIGINT}, except that it'scontrolled by a different key---the QUIT character, usually@kbd{C-\}---and produces a core dump when it terminates the process,just like a program error signal.  You can think of this as aprogram error condition ``detected'' by the user.@xref{Program Error Signals}, for information about core dumps.@xref{Special Characters}, for information about terminal driversupport.Certain kinds of cleanups are best omitted in handling @code{SIGQUIT}.For example, if the program creates temporary files, it should handlethe other termination requests by deleting the temporary files.  But itis better for @code{SIGQUIT} not to delete them, so that the user canexamine them in conjunction with the core dump.@end deftypevr@comment signal.h@comment POSIX.1@deftypevr Macro int SIGKILLThe @code{SIGKILL} signal is used to cause immediate program termination.It cannot be handled or ignored, and is therefore always fatal.  It isalso not possible to block this signal.This signal is usually generated only by explicit request.  Since itcannot be handled, you should generate it only as a last resort, afterfirst trying a less drastic method such as @kbd{C-c} or @code{SIGTERM}.If a process does not respond to any other termination signals, sendingit a @code{SIGKILL} signal will almost always cause it to go away.In fact, if @code{SIGKILL} fails to terminate a process, that by itselfconstitutes an operating system bug which you should report.The system will generate @code{SIGKILL} for a process itself under someunusual conditions where the program cannot possible continue to run(even to run a signal handler).@end deftypevr@cindex kill signal@comment signal.h@comment POSIX.1@deftypevr Macro int SIGHUP@cindex hangup signalThe @code{SIGHUP} (``hang-up'') signal is used to report that the user'sterminal is disconnected, perhaps because a network or telephoneconnection was broken.  For more information about this, see @ref{ControlModes}.This signal is also used to report the termination of the controllingprocess on a terminal to jobs associated with that session; thistermination effectively disconnects all processes in the session fromthe controlling terminal.  For more information, see @ref{TerminationInternals}.@end deftypevr@node Alarm Signals@subsection Alarm SignalsThese signals are used to indicate the expiration of timers.@xref{Setting an Alarm}, for information about functions that causethese signals to be sent.The default behavior for these signals is to cause program termination.This default is rarely useful, but no other default would be useful;most of the ways of using these signals would require handler functionsin any case.@comment signal.h@comment POSIX.1@deftypevr Macro int SIGALRMThis signal typically indicates expiration of a timer that measures realor clock time.  It is used by the @code{alarm} function, for example.@end deftypevr@cindex alarm signal@comment signal.h@comment BSD@deftypevr Macro int SIGVTALRMThis signal typically indicates expiration of a timer that measures CPUtime used by the current process.  The name is an abbreviation for``virtual time alarm''.@end deftypevr@cindex virtual time alarm signal@comment signal.h@comment BSD@deftypevr Macro int SIGPROFThis signal is typically indicates expiration of a timer that measuresboth CPU time used by the current process, and CPU time expended on behalf of the process by the system.  Such a timer is used to implementcode profiling facilities, hence the name of this signal.@end deftypevr@cindex profiling alarm signal@node Asynchronous I/O Signals@subsection Asynchronous I/O SignalsThe signals listed in this section are used in conjunction withasynchronous I/O facilities.  You have to take explicit action bycalling @code{fcntl} to enable a particular file descriptior to generatethese signals (@pxref{Interrupt Input}).  The default action for thesesignals is to ignore them.@comment signal.h@comment BSD@deftypevr Macro int SIGIO@cindex input available signal@cindex output possible signalThis signal is sent when a file descriptor is ready to perform inputor output.On most operating systems, terminals and sockets are the only kinds offiles that can generate @code{SIGIO}; other kinds, including ordinaryfiles, never generate @code{SIGIO} even if you ask them to.In the GNU system @code{SIGIO} will always be generated properly if you successfully set asynchronous mode with @code{fcntl}.@end deftypevr@comment signal.h@comment BSD@deftypevr Macro int SIGURG@cindex urgent data signalThis signal is sent when ``urgent'' or out-of-band data arrives on asocket.  @xref{Out-of-Band Data}.@end deftypevr@comment signal.h@comment SVID@deftypevr Macro int SIGPOLLThis is a System V signal name, more or less similar to @code{SIGIO}.It is defined only for compatibility.@end deftypevr@node Job Control Signals@subsection Job Control Signals@cindex job control signalsThese signals are used to support job control.  If your systemdoesn't support job control, then these macros are defined but thesignals themselves can't be raised or handled.You should generally leave these signals alone unless you reallyunderstand how job control works.  @xref{Job Control}.@comment signal.h@comment POSIX.1@deftypevr Macro int SIGCHLD@cindex child process signalThis signal is sent to a parent process whenever one of its childprocesses terminates or stops.The default action for this signal is to ignore it.  If you establish ahandler for this signal while there are child processes that haveterminated but not reported their status via @code{wait} or@code{waitpid} (@pxref{Process Completion}), whether your new handlerapplies to those processes or not depends on the particular operatingsystem.@end deftypevr@comment signal.h@comment SVID@deftypevr Macro int SIGCLDThis is an obsolete name for @code{SIGCHLD}.@end deftypevr@comment signal.h@comment POSIX.1@deftypevr Macro int SIGCONT@cindex continue signalYou can send a @code{SIGCONT} signal to a process to make it continue.This signal is special---it always makes the process continue if it isstopped, before the signal is delivered.  The default behavior is to donothing else.  You cannot block this signal.  You can set a handler, but

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -