The return value is0 on success and-1 on failure. Ifsigaltstack fails,it setserrno to one of these values:
EINVAL
- You tried to disable a stack that was in fact currently in use.
ENOMEM
- The size of the alternate stack was too small. It must be greater than
MINSIGSTKSZ .
sigstackinterface. You should usesigaltstack instead on systems that have it.
struct sigstack
-
This structure describes a signal stack. It contains the following members:
void *ss_sp
- This is the stack pointer. If the stack grows downwards on your machine,this should point to the top of the area you allocated. If the stack grows upwards,it should point to the bottom.
int ss_onstack
- This field is true if the process is currently using this stack.
intsigstack(const struct sigstack *stack,struct sigstack *oldstack)
-
The
sigstack function specifies an alternate stack for use during signal handling. When a signal is received by the process and its action indicates that the signal stack is used,then this is installed as the new stack for use by signal handlers.
The return value is0 on success and-1 on failure.
BSD Unix represents signal masks as anint bit mask,rather than as asigset_t object.
- The BSD facilities use a different default for whether an interrupted primitive should fail or resume. The POSIX facilities make system calls fail unless you specify that they should resume. With the BSD facility,the default is to make system calls resume unless you say they should fail. See section.
`signal.h'.
struct sigvec
-
This data type is the BSD equivalent of
struct sigaction (see section); it is used to specify signal actions to thesigvec function. It contains the following members:
sighandler_t sv_handler
- This is the handler function.
int sv_mask
- This is the mask of additional signals to be blocked while the handler function is being called.
int sv_flags
- This is a bit mask used to specify various flags which affect the behavior of the signal. You can also refer to this field as
sv_onstack .
sv_flagsfield of asigvec structure. This field is a bit mask value,so you bitwise-OR the flags of interest to you together.
intSV_ONSTACK
-
If this bit is set in the
sv_flags field of asigvec structure,it means to use the signal stack when delivering the signal.
intSV_INTERRUPT
-
If this bit is set in the
sv_flags field of asigvec structure,it means that system calls interrupted by this kind of signal should not be restarted if the handler returns; instead,the system calls should return with aEINTR error status. See section.
intSV_RESETHAND
-
If this bit is set in the
sv_flags field of asigvec structure,it means to reset the action for the signal back toSIG_DFL when the signal is received.
intsigvec(intsignum,const struct sigvec *action,struct sigvec *old-action)
-
This function is the equivalent of
sigaction (see section); it installs the actionactionfor the signalsignum,returning information about the previous action in effect for that signal inold-action.
intsiginterrupt(intsignum,intfailflag)
-
This function specifies which approach to use when certain primitives are interrupted by handling signalsignum. Iffailflagis false,signalsignumrestarts primitives. Iffailflagis true,handlingsignumcauses these primitives to fail with error code
EINTR . See section.
intsigmask(intsignum)
-
This macro returns a signal mask that has the bit for signalsignumset. You can bitwise-OR the results of several calls to
sigmask together to specify more than one signal. For example,(sigmask (SIGTSTP) | sigmask (SIGSTOP)
| sigmask (SIGTTIN) | sigmask (SIGTTOU))
(编辑:青岛站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|