Back to index

glibc  2.9
hurdfault.h
Go to the documentation of this file.
00001 /* Declarations for handling faults in the signal thread.
00002    Copyright (C) 1994, 1996 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _HURD_FAULT_H
00021 #define _HURD_FAULT_H
00022 
00023 #include <hurd/sigpreempt.h>
00024 #include <setjmp.h>
00025 
00026 /* Call this before code that might fault in the signal thread; SIGNO is
00027    the signal expected to possibly arrive.  This behaves like setjmp: it
00028    returns zero the first time, and returns again nonzero if the signal
00029    does arrive.  */
00030 
00031 #define _hurdsig_catch_fault(sigset, firstcode, lastcode)      \
00032   (_hurdsig_fault_preemptor.signals = (sigset),                \
00033    _hurdsig_fault_preemptor.first = (long int) (firstcode),    \
00034    _hurdsig_fault_preemptor.last = (long int) (lastcode),      \
00035    setjmp (_hurdsig_fault_env))
00036 
00037 /* Call this at the end of a section protected by _hurdsig_catch_fault.  */
00038 
00039 #define _hurdsig_end_catch_fault() \
00040   (_hurdsig_fault_preemptor.signals = 0)
00041 
00042 extern jmp_buf _hurdsig_fault_env;
00043 extern struct hurd_signal_preemptor _hurdsig_fault_preemptor;
00044 
00045 
00046 #define _hurdsig_catch_memory_fault(object) \
00047   _hurdsig_catch_fault (sigmask (SIGSEGV) | sigmask (SIGBUS), \
00048                      (object), (object) + 1)
00049 
00050 
00051 #endif /* hurdfault.h */