2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 21:38:16 +00:00

restorer: Implement own BUG_ON_HANDLER

Due to code specifics (we're running without
glibc support) we need own one.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
Cyrill Gorcunov 2011-12-26 15:53:14 +04:00
parent f5a87742a0
commit d7ab5f2f7b
3 changed files with 22 additions and 0 deletions

View File

@ -311,4 +311,20 @@ static void always_inline rst_mutex_unlock(rst_mutex_t *mutex)
sys_futex(mutex, FUTEX_WAKE, 1, NULL, NULL, 0);
}
/* We need own handler */
#ifdef BUG_ON_HANDLER
# undef BUG_ON_HANDLER
#endif
#define BUG_ON_HANDLER(condition) \
do { \
if ((condition)) { \
long tgid = sys_gettid(); \
write_hex_n(0x5a5a5a5a); \
write_num_n(__LINE__); \
sys_tgkill(tgid, tgid, SIGABRT); \
} \
} while (0)
#endif /* CR_RESTORER_H__ */

View File

@ -24,6 +24,7 @@
#define __NR_exit 60
#define __NR_flock 73
#define __NR_unlink 87
#define __NR_tgkill 131
#define __NR__sysctl 156
#define __NR_prctl 157
#define __NR_arch_prctl 158

View File

@ -279,6 +279,11 @@ static void always_inline local_sleep(long seconds)
sys_nanosleep(&req, &rem);
}
static long always_inline sys_tgkill(long tgid, long pid, int sig)
{
return syscall3(__NR_tgkill, tgid, pid, (long)sig);
}
#else /* CONFIG_X86_64 */
# error x86-32 bit mode not yet implemented
#endif /* CONFIG_X86_64 */