setjmp.h 670 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <bits/stdint.h>
  8. #include <signal.h>
  9. #include <stdbool.h>
  10. #include <sys/cdefs.h>
  11. #include <sys/types.h>
  12. __BEGIN_DECLS
  13. struct __jmp_buf {
  14. #ifdef __i386__
  15. uint32_t regs[6];
  16. #elif __x86_64__
  17. uint64_t regs[8];
  18. #else
  19. # error
  20. #endif
  21. bool did_save_signal_mask;
  22. sigset_t saved_signal_mask;
  23. };
  24. typedef struct __jmp_buf jmp_buf[1];
  25. typedef struct __jmp_buf sigjmp_buf[1];
  26. int setjmp(jmp_buf);
  27. void longjmp(jmp_buf, int val);
  28. int sigsetjmp(sigjmp_buf, int savesigs);
  29. void siglongjmp(sigjmp_buf, int val);
  30. __END_DECLS