Exemple #1
0
void
_hurdsig_longjmp_from_handler (void *data, jmp_buf env, int val)
{
  struct sigcontext *scp = data;
  struct hurd_sigstate *ss = _hurd_self_sigstate ();
  int onstack;
  inline void cleanup (void)
    {
      /* Destroy the MiG reply port used by the signal handler, and restore
	 the reply port in use by the thread when interrupted.  */
      mach_port_t *reply_port =
	(mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY);
      if (*reply_port)
	{
	  mach_port_t port = *reply_port;
	  /* Assigning MACH_PORT_DEAD here tells libc's mig_get_reply_port
	     not to get another reply port, but avoids mig_dealloc_reply_port
	     trying to deallocate it after the receive fails (which it will,
	     because the reply port will be bogus, regardless).  */
	  *reply_port = MACH_PORT_DEAD;
	  __mach_port_destroy (__mach_task_self (), port);
	}
      if (scp->sc_reply_port)
	__mach_port_destroy (__mach_task_self (), scp->sc_reply_port);
    }
int *
__errno_location (void)
{
  return (int *) __hurd_threadvar_location (_HURD_THREADVAR_ERRNO);
}