| 1 |
#ifndef _PYPY_SIGNALS_H |
| 2 |
#define _PYPY_SIGNALS_H |
| 3 |
|
| 4 |
#include "src/precommondefs.h" |
| 5 |
|
| 6 |
#include <limits.h> |
| 7 |
#ifndef PATH_MAX |
| 8 |
#define PATH_MAX 4096 |
| 9 |
#endif |
| 10 |
|
| 11 |
|
| 12 |
RPY_EXTERN |
| 13 |
void pypysig_ignore(int signum); |
| 14 |
RPY_EXTERN |
| 15 |
void pypysig_default(int signum); |
| 16 |
RPY_EXTERN |
| 17 |
void pypysig_setflag(int signum); |
| 18 |
|
| 19 |
RPY_EXTERN |
| 20 |
void pypysig_reinstall(int signum); |
| 21 |
RPY_EXTERN |
| 22 |
int pypysig_set_wakeup_fd(int fd, int with_nul_byte); |
| 23 |
|
| 24 |
|
| 25 |
RPY_EXTERN |
| 26 |
int pypysig_poll(void); |
| 27 |
|
| 28 |
RPY_EXTERN |
| 29 |
int pypysig_get_wakeup_fd_write_errno(void); |
| 30 |
RPY_EXTERN |
| 31 |
void pypysig_pushback(int signum); |
| 32 |
|
| 33 |
|
| 34 |
struct pypysig_long_struct_inner { |
| 35 |
Signed value; |
| 36 |
}; |
| 37 |
|
| 38 |
struct pypysig_long_struct { |
| 39 |
struct pypysig_long_struct_inner inner; |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
char cookie[8]; |
| 46 |
Signed debugger_pending_call; |
| 47 |
char debugger_script_path[PATH_MAX]; |
| 48 |
}; |
| 49 |
RPY_EXPORTED struct pypysig_long_struct pypysig_counter; |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
RPY_EXTERN |
| 55 |
void *pypysig_getaddr_occurred(void); |
| 56 |
#define pypysig_getaddr_occurred() ((void *)(&pypysig_counter)) |
| 57 |
|
| 58 |
|
| 59 |
#ifndef _WIN32 |
| 60 |
RPY_EXTERN |
| 61 |
int pypysig_siginterrupt(int sig, int flag); |
| 62 |
#endif |
| 63 |
|
| 64 |
inline static char pypysig_check_and_reset(void) { |
| 65 |
|
| 66 |
char result = --pypysig_counter.inner.value < 0; |
| 67 |
if (result) |
| 68 |
pypysig_counter.inner.value = 100; |
| 69 |
return result; |
| 70 |
} |
| 71 |
|
| 72 |
#endif |