Kernel alarms pass the alarm ID
[akaros.git] / tests / arsc_test.c
1 #ifdef CONFIG_ARSC_SERVER
2 #include <parlib.h>
3 #include <vcore.h>
4 #include <ros/syscall.h>
5 #include <arc.h>
6 #include <stdio.h>
7
8 syscall_desc_t* sys_cputs_async(const char *s, size_t len,                                             
9                      void (*cleanup_handler)(void*), void* cleanup_data)
10 {                                                                                                                     
11     /*// could just hardcode 4 0's, will eventually wrap this marshaller anyway                                         
12         syscall_desc_t* desc;
13     syscall_req_t syscall = {REQ_alloc, cleanup_handler, cleanup_data,
14                                                         SYS_cputs,{(uint32_t)s, len, [2 ... (NUM_SYSCALL_ARGS-1)] 0} };                          
15     syscall.cleanup = cleanup_handler;                                                                                  
16     syscall.data = cleanup_data;
17     async_syscall(&syscall, &desc);
18         */
19         return arc_call(SYS_cputs, s, len);
20 }
21
22 int main(int argc, char** argv){
23         int pid = sys_getpid();
24         char testme = 't';
25         printf ("single thread - init arsc \n");
26         syscall_desc_t* sysdesc[2];
27         syscall_rsp_t sysrsp;
28         init_arc(&SYS_CHANNEL);
29
30         printf ("single thread - init complete \n");
31         // cprintf_async(&desc1, "Cross-Core call 1, coming from process %08x\n", pid);
32         sysdesc[0] = sys_cputs_async(&testme, 1, NULL, NULL);
33         sysdesc[1] = sys_cputs_async(&testme, 1, NULL, NULL);
34
35         printf ("single thread - call placed \n");
36         //ignore return value
37         assert(-1 != waiton_syscall(sysdesc[0]));
38         assert(-1 != waiton_syscall(sysdesc[1]));
39         printf ("single thread - dummy call \n");       
40 }
41
42 #else
43 int main(){};
44 #endif