panic() cleanup.
[minix.git] / test / safemap / inc.h
blobfaa460c309515f915026d958bf2b609a0f0fbfa9
1 #define _SYSTEM
2 #define _MINIX
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <fcntl.h>
6 #include <stdlib.h>
7 #include <signal.h>
8 #include <sys/types.h>
9 #include <sys/wait.h>
11 #include <minix/config.h>
12 #include <minix/com.h>
13 #include <minix/type.h>
14 #include <minix/const.h>
15 #include <minix/endpoint.h>
16 #include <minix/safecopies.h>
17 #include <minix/syslib.h>
18 #include <minix/sysutil.h>
19 #include <errno.h>
21 #define TEST_PAGE_NUM 4
22 #define BUF_SIZE (TEST_PAGE_NUM * CLICK_SIZE)
23 #define BUF_START_REQUESTOR 10
24 #define BUF_START_GRANTOR 20
26 #define FIFO_REQUESTOR "/usr/src/test/safemap/1fifo"
27 #define FIFO_GRANTOR "/usr/src/test/safemap/2fifo"
29 #define FIFO_WAIT(fid) { \
30 int a; \
31 if(read(fid, &a, sizeof(a)) != sizeof(a)) \
32 panic( "FIFO_WAIT failed"); \
34 #define FIFO_NOTIFY(fid) { \
35 int a = 1; \
36 if(write(fid, &a, sizeof(a)) != sizeof(a)) \
37 panic( "FIFO_NOTIFY failed"); \
40 #define CHECK_TEST(who, result, expected, test_name) { \
41 printf("%-9s: test %s %s\n", who, test_name, \
42 (expected == result ? "succeeded" : "failed")); \
43 if(expected != result) { \
44 exit(1); \
45 } \
48 #define DEBUG 0
49 #if DEBUG
50 # define dprint printf
51 #else
52 # define dprint (void)
53 #endif