2 * Tests for various context functions
16 #include "../../memcheck.h"
21 volatile int flag
= 0;
22 if (-1 == getcontext(&uc
)) {
23 perror("getcontext failed: ");
29 if (-1 == setcontext(&uc
)) {
30 perror("setcontext failed: ");
38 if (-1 == swapcontext(&uc2
, &uc
)) {
39 perror("swapcontext failed: ");
46 ucontext_t
* ucp
= malloc(sizeof(*ucp
));
47 ucontext_t
* ucp2
= malloc(sizeof(*ucp2
));
48 (void)VALGRIND_MAKE_MEM_NOACCESS(ucp
, sizeof(*ucp
));
49 (void)VALGRIND_MAKE_MEM_NOACCESS(ucp2
, sizeof(*ucp2
));
51 if (-1 == getcontext(ucp
)) {
52 perror("getcontext failed: ");
58 (void)VALGRIND_MAKE_MEM_NOACCESS(ucp
, sizeof(*ucp
));
59 if (-1 == setcontext(ucp
)) {
60 perror("setcontext failed: ");
62 fprintf(stderr
, "should never see setcontext return\n");
68 (void)VALGRIND_MAKE_MEM_NOACCESS(ucp
, sizeof(*ucp
));
69 if (-1 == swapcontext(ucp2
, ucp
)) {
70 perror("swapcontext failed: ");
72 fprintf(stderr
, "should never see swapcontest return\n");