setjmp.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * setjmp.h - save/restore calling environment
  3. *
  4. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  5. * See the copyright notice in the ACK home directory, in the file "Copyright".
  6. */
  7. /* $Id$ */
  8. #if !defined(_SETJMP_H)
  9. #define _SETJMP_H
  10. /* In a jmp_buf, there is room for: 1 mask (long), 1 flag (int) and 3
  11. * pointers (stack-pointer, local base and program-counter). This may be
  12. * too big, but that doesn't matter. It could also be too small, when
  13. * sigset_t is larger than a long. The fields is in the structure have no
  14. * meaning, they just get the size right.
  15. * The identifier __setjmp has a special meaning to the compiler.
  16. */
  17. typedef struct {
  18. long __mask;
  19. int __flag;
  20. void (*__pc)(void);
  21. void *__sp;
  22. void *__lb;
  23. } jmp_buf[1];
  24. int __setjmp(jmp_buf _env, int _savemask);
  25. #define setjmp(env) __setjmp(env, 0)
  26. void longjmp(jmp_buf _env, int _val);
  27. #if defined(_POSIX_SOURCE)
  28. typedef jmp_buf sigjmp_buf;
  29. #define sigsetjmp(env, savemask) __setjmp(env, savemask)
  30. int siglongjmp(sigjmp_buf _env, int _val);
  31. #endif
  32. #endif /* _SETJMP_H */