setjmp.h revision 3852
11539Srgrimes/*- 21539Srgrimes * Copyright (c) 1990, 1993 31539Srgrimes * The Regents of the University of California. All rights reserved. 41539Srgrimes * (c) UNIX System Laboratories, Inc. 51539Srgrimes * All or some portions of this file are derived from material licensed 61539Srgrimes * to the University of California by American Telephone and Telegraph 71539Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with 81539Srgrimes * the permission of UNIX System Laboratories, Inc. 91539Srgrimes * 101539Srgrimes * Redistribution and use in source and binary forms, with or without 111539Srgrimes * modification, are permitted provided that the following conditions 121539Srgrimes * are met: 131539Srgrimes * 1. Redistributions of source code must retain the above copyright 141539Srgrimes * notice, this list of conditions and the following disclaimer. 151539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 161539Srgrimes * notice, this list of conditions and the following disclaimer in the 171539Srgrimes * documentation and/or other materials provided with the distribution. 181539Srgrimes * 3. All advertising materials mentioning features or use of this software 191539Srgrimes * must display the following acknowledgement: 201539Srgrimes * This product includes software developed by the University of 211539Srgrimes * California, Berkeley and its contributors. 221539Srgrimes * 4. Neither the name of the University nor the names of its contributors 231539Srgrimes * may be used to endorse or promote products derived from this software 241539Srgrimes * without specific prior written permission. 251539Srgrimes * 261539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 271539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 281539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 291539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 301539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 311539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 321539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 331539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 341539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 351539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 361539Srgrimes * SUCH DAMAGE. 371539Srgrimes * 381539Srgrimes * @(#)setjmp.h 8.2 (Berkeley) 1/21/94 391539Srgrimes */ 401539Srgrimes 411539Srgrimes#ifndef _SETJMP_H_ 421539Srgrimes#define _SETJMP_H_ 431539Srgrimes 441539Srgrimes#if defined(hp300) || defined(__hp300__) || defined(luna68k) || defined(__luna68k__) 451539Srgrimes#define _JBLEN 17 461539Srgrimes#endif 471539Srgrimes 481539Srgrimes#if defined(i386) || defined(__i386__) 493852Sbde#define _JBLEN 8 501539Srgrimes#endif 511539Srgrimes 521539Srgrimes#if defined(mips) || defined(__mips__) 531539Srgrimes#define _JBLEN 83 541539Srgrimes#endif 551539Srgrimes 561539Srgrimes#if defined(sparc) || defined(__sparc__) 571539Srgrimes#define _JBLEN 10 581539Srgrimes#endif 591539Srgrimes 601539Srgrimes#if defined(tahoe) || defined(__tahoe__) 611539Srgrimes#define _JBLEN 10 621539Srgrimes#endif 631539Srgrimes 641539Srgrimes#if defined(vax) || defined(__vax__) 651539Srgrimes#define _JBLEN 10 661539Srgrimes#endif 671539Srgrimes 681539Srgrimes/* 693852Sbde * jmp_buf and sigjmp_buf are encapsulated in different structs to force 703852Sbde * compile-time diagnostics for mismatches. The structs are the same 713852Sbde * internally to avoid some run-time errors for mismatches. 721539Srgrimes */ 733852Sbde#ifndef _ANSI_SOURCE 743852Sbdetypedef struct { int _sjb[_JBLEN + 1]; } sigjmp_buf[1]; 751539Srgrimes#endif /* not ANSI */ 761539Srgrimes 773852Sbdetypedef struct { int _jb[_JBLEN + 1]; } jmp_buf[1]; 781539Srgrimes 791539Srgrimes#include <sys/cdefs.h> 801539Srgrimes 811539Srgrimes__BEGIN_DECLS 821539Srgrimesint setjmp __P((jmp_buf)); 833852Sbde__dead 843852Sbdevoid longjmp __P((jmp_buf, int)) __dead2; 851539Srgrimes 861539Srgrimes#ifndef _ANSI_SOURCE 871539Srgrimesint sigsetjmp __P((sigjmp_buf, int)); 883852Sbde__dead 893852Sbdevoid siglongjmp __P((sigjmp_buf, int)) __dead2; 901539Srgrimes#endif /* not ANSI */ 911539Srgrimes 921539Srgrimes#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 931539Srgrimesint _setjmp __P((jmp_buf)); 943852Sbde__dead 953852Sbdevoid _longjmp __P((jmp_buf, int)) __dead2; 961539Srgrimesvoid longjmperror __P((void)); 971539Srgrimes#endif /* neither ANSI nor POSIX */ 981539Srgrimes__END_DECLS 991539Srgrimes 1001539Srgrimes#endif /* !_SETJMP_H_ */ 101