Commit d7ab5f2f authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

restorer: Implement own BUG_ON_HANDLER

Due to code specifics (we're running without
glibc support) we need own one.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent f5a87742
......@@ -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__ */
......@@ -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
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment