[Prev][Next][Index][Thread]

Re: getcontext (fwd)



> 
> Received following useful info from Tim. I am assuming we can use OS2 
> threads and semaphores to acheive the same effect.  I guess that Solaris 
> does not have threads.  Life is very strnge.
> 
> Phil
> http://www.realtime.net/~phil
> 
> ---------- Forwarded message ----------
> Date: Mon, 16 Oct 1995 18:46:54 -0700
> From: Tim Lindholm <lindholm@scndprsn.Eng.Sun.COM>
> To: phil@bga.com
> Subject: Re: getcontext
> 
> It fills a structure with the process state: stack pointer, registers,
> etc.  It's setjmp(), essentially.  I'll append a man page.
> 
> -- Tim
> 
> ----- Begin Included Message -----
> 
> >From phil@bga.com  Mon Oct 16 18:39:17 1995
> Date: Mon, 16 Oct 1995 20:39:13 -0500 (CDT)
> From: Philip R Brenan <phil@bga.com>
> Subject: getcontext
> To: Tim Lindholm <lindholm@scndprsn.Eng.Sun.COM>
> 
> Tim:
> 
> Is there somewhere online that I can look up things like 
> 
> "What does getcontext() do?"  For instance, an online Solaris manual 
> would be very helpful!
> 
> Phil
> http://www.realtime.net/~phil
> 
> 
> ----- End Included Message -----
> 
> 
> 
> 
> getcontext(2)             System Calls              getcontext(2)
> 
> 
> 
> NAME
>      getcontext, setcontext - get and set current user context
> 
> SYNOPSIS
>      #include <ucontext.h>
> 
>      int getcontext(ucontext_t *ucp);
> 
>      int setcontext(ucontext_t *ucp);
> 
> DESCRIPTION
>      These   functions,   along    with    those    defined    in
>      makecontext(3C), are useful for implementing user level con-
>      text switching between multiple threads of control within  a
>      process.
> 
>      getcontext() initializes the structure pointed to by ucp  to
>      the  current  user context of the calling process.  The user
>      context is defined by ucontext(5) and includes the  contents
>      of  the calling process's machine registers, signal mask and
>      execution stack.
> 
>      setcontext() restores the user context pointed  to  by  ucp.
>      The call to setcontext() does not return;  program execution
>      resumes at the point  specified  by  the  context  structure
>      passed  to  setcontext().  The context structure should have
>      been one created either by a prior call to  getcontext()  or
>      makecontext()  or  passed  as the third argument to a signal
>      handler (see sigaction(2)).  If the  context  structure  was
>      one  created  with getcontext(), program execution continues
>      as if  the  corresponding  call  of  getcontext()  had  just
>      returned.   If  the  context  structure was one created with
>      makecontext, program execution continues with  the  function
>      specified to makecontext.
> 
> RETURN VALUES
>      On successful completion, setcontext() does not  return  and
>      getcontext()  returns  0.   Otherwise,  a  value  of  -1  is
>      returned and errno is set to indicate the error.
> 
> ERRORS
>      getcontext() and setcontext() will fail if the following  is
>      true:
> 
>      EFAULT         ucp points to an illegal address.
> 
> SEE ALSO
>      sigaction(2),        sigaltstack(2),         sigprocmask(2),
>      makecontext(3C), ucontext(5)
> 
> NOTES
>      When a signal handler is executed, the current user  context
>      is saved and a new context is created by the kernel.  If the
>      process leaves the signal handler via longjmp(3C) the origi-
>      nal  context  will  not  be  restored,  and  future calls to
>      getcontext() will not be reliable.  Signal  handlers  should
>      use siglongjmp(3C) or setcontext() instead.
> 
> 
> 
> 
> 
> ------------------------------------------------------------------
> OS/2 Java Porting mailing list:  sl65r@hyrum.declab.usu.edu
> To unsubscribe:  send to above address with the single word
> "unsubscribe" as the subject.  (the message body will be ignored)
> Any problems with the list service, please email sl65r@cc.usu.edu.
> ------------------------------------------------------------------
> 

------------------------------------------------------------------
OS/2 Java Porting mailing list:  sl65r@hyrum.declab.usu.edu
To unsubscribe:  send to above address with the single word
"unsubscribe" as the subject.  (the message body will be ignored)
Any problems with the list service, please email sl65r@cc.usu.edu.
------------------------------------------------------------------


References: