drd/tests/swapcontext: Improve the portability of this test further
[valgrind.git] / none / tests / bug234814.c
blob16b561fde6b0f9165ee22a83fcf3d247ce9f1b74
1 /* Refer https://bugs.kde.org/show_bug.cgi?id=234814
2 */
4 #include <stdio.h>
5 #include <signal.h>
6 #include <unistd.h>
8 const char kSigbus[] = "I caught the SIGBUS signal!\n";
10 int GLOB = 3;
12 void mysigbus() {
13 write(1, kSigbus, sizeof(kSigbus)-1);
14 GLOB--;
15 return;
18 int main() {
19 struct sigaction sa;
20 sa.sa_handler = mysigbus;
21 sigemptyset(&sa.sa_mask);
22 sa.sa_flags = 0;
23 if (sigaction(SIGBUS, &sa, NULL) == -1) {
24 perror("ERROR:");
26 while(GLOB) {
27 kill(getpid(), SIGBUS);
29 return 0;