Blame hurd/hurdfault.h

Packit 6c4009
/* Declarations for handling faults in the signal thread.
Packit 6c4009
   Copyright (C) 1994-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _HURD_FAULT_H
Packit 6c4009
#define _HURD_FAULT_H
Packit 6c4009
Packit 6c4009
#include <hurd/sigpreempt.h>
Packit 6c4009
#include <setjmp.h>
Packit 6c4009
Packit 6c4009
/* Call this before code that might fault in the signal thread; SIGNO is
Packit 6c4009
   the signal expected to possibly arrive.  This behaves like setjmp: it
Packit 6c4009
   returns zero the first time, and returns again nonzero if the signal
Packit 6c4009
   does arrive.  */
Packit 6c4009
Packit 6c4009
#define _hurdsig_catch_fault(sigset, firstcode, lastcode)	\
Packit 6c4009
  (_hurdsig_fault_preemptor.signals = (sigset),			\
Packit 6c4009
   _hurdsig_fault_preemptor.first = (long int) (firstcode),	\
Packit 6c4009
   _hurdsig_fault_preemptor.last = (long int) (lastcode),	\
Packit 6c4009
   setjmp (_hurdsig_fault_env))
Packit 6c4009
Packit 6c4009
/* Call this at the end of a section protected by _hurdsig_catch_fault.  */
Packit 6c4009
Packit 6c4009
#define _hurdsig_end_catch_fault() \
Packit 6c4009
  (_hurdsig_fault_preemptor.signals = 0)
Packit 6c4009
Packit 6c4009
extern jmp_buf _hurdsig_fault_env;
Packit 6c4009
extern struct hurd_signal_preemptor _hurdsig_fault_preemptor;
Packit 6c4009
Packit 6c4009
Packit 6c4009
#define _hurdsig_catch_memory_fault(object) \
Packit 6c4009
  _hurdsig_catch_fault (sigmask (SIGSEGV) | sigmask (SIGBUS), \
Packit 6c4009
			(object), (object) + 1)
Packit 6c4009
Packit 6c4009
Packit 6c4009
#endif	/* hurdfault.h */