The namesighandler_t for this data type is a GNU extension.
sighandler_tsignal(intsignum,sighandler_taction)
-
The
signal function establishesactionas the action for the signalsignum.
The first argument,signum,identifies the signal whose behavior you want to control,and should be a signal number. The proper way to specify a signal number is with one of the symbolic signal names described in section---don't use an explicit number,because the numerical code for a given kind of signal may vary from operating system to operating system.
The second argument,action,specifies the action to use for the signalsignum. This can be one of the following:
SIG_DFL
-
SIG_DFL specifies the default action for the particular signal. The default actions for various kinds of signals are stated in section.
SIG_IGN
-
SIG_IGN specifies that the signal should be ignored. Your program generally should not ignore signals that represent serious events or that are normally used to request termination. You cannot ignore theSIGKILL orSIGSTOP signals at all. You can ignore program error signals likeSIGSEGV ,but ignoring the error won't enable the program to continue executing meaningfully. Ignoring user requests such asSIGINT ,SIGQUIT ,andSIGTSTP is unfriendly. When you do not wish signals to be delivered during a certain part of the program,the thing to do is to block them,not ignore them. See section.
handler
- Supply the address of a handler function in your program,to specify running this handler as the way to deliver the signal. For more information about defining signal handler functions,see section.
If you set the action for a signal toSIG_IGN ,or if you set it toSIG_DFL and the default action is to ignore that signal,then any pending signals of that type are discarded (even if they are blocked). Discarding the pending signals means that they will never be delivered,not even if you subsequently specify another action and unblock this kind of signal.
(编辑:威海站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|