aboutsummaryrefslogtreecommitdiff
path: root/tests/ipc-req-exhaustion/init.c
blob: 6dd1a046d378ea8e2aaffd57511b7fdbba3c8d69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <common/test.h>

long counter = 0;

START(pid, tid, d0, d1, d2, d3)
{
	(void)tid;
	(void)d0;
	(void)d1;
	(void)d2;
	(void)d3;

	check(pid == 0 || pid == 1, "illegal pid for init");
	printf("sending ipc req %zd to ourselves\n", counter++);
	struct sys_ret r = sys_ipc_req4(1, 1, 2, 3, 4);
	if (r.s) {
		printf("ran out of stack space at %ld\n", counter);
		printf("starting to unwind\n");
	}

	printf("unwinding at %ld\n", counter--);

	/* the final resp0 should fail, since we're back in our root process */
	sys_ipc_resp0();

	ok();
}