Unix/Linux Go Back    

RedHat 9 (Linux i386) - man page for getcontext (redhat section 2)

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:   man
Select Man Page Set:       apropos Keyword Search (sections above)

GETCONTEXT(2)			    Linux Programmer's Manual			    GETCONTEXT(2)

       getcontext, setcontext - get or set the user context

       #include <ucontext.h>

       int getcontext(ucontext_t *ucp);
       int setcontext(const ucontext_t *ucp);


       ucp    points to a structure defined in <ucontext.h> containing the signal mask, execution
	      stack, and machine registers.

       getcontext(2) gets the current context of the calling process, storing it in the  ucontext
       struct pointed to by ucp.

       setcontext(2)  sets the context of the calling process to the state stored in the ucontext
       struct pointed to by ucp. The struct must either have been  created  by	getcontext(2)  or
       have been passed as the third parameter of the sigaction(2) signal handler.

       The ucontext struct created by getcontext(2) is defined in <ucontext.h> as follows:

	      typedef struct ucontext
		    unsigned long int uc_flags;
		    struct ucontext *uc_link;
		    stack_t uc_stack;
		    mcontext_t uc_mcontext;
		    __sigset_t uc_sigmask;
		    struct _fpstate __fpregs_mem;
		  } ucontext_t;

       getcontext(2)  returns  0  on  success and -1 on failure.  setcontext(2) does not return a
       value on success and returns -1 on failure.

       These functions comform to: XPG4-UNIX.

       When a signal handler executes, the current user context is saved and  a  new  context  is
       created by the kernel.  If the calling process leaves the signal handler using longjmp(2),
       the original context cannot be restored, and the result of future calls	to  getcontext(2)
       are  unpredictable.  To	avoid  this problem, use siglongjmp(2) or setcontext(2) in signal
       handlers instead of longjmp(2).

       sigaction(2), sigaltstack(2), sigprocmask(2), sigsetjmp(3), setjmp(3).

Red Hat Linux 6.1			20 September 1999			    GETCONTEXT(2)
Unix & Linux Commands & Man Pages : ©2000 - 2018 Unix and Linux Forums

All times are GMT -4. The time now is 03:19 PM.