vxproc.h (2016B)
1 // 2 // VX process control interface client stubs 3 // XX Should this header perhaps be private to the C library? 4 // 5 #ifndef _VXPROC_H_ 6 #define _VXPROC_H_ 7 8 #include <stdint.h> 9 10 #include <vx/ipc.h> 11 #include <vxipc.h> 12 13 14 // Cause proc to exit with specified status code. 15 // Usually only called by process proc itself. 16 static inline void 17 vxproc_exit(intptr_t proc, int status) { 18 intptr_t h = proc | VXPROC_EXIT | 19 VXIPC_SEND0 | VXIPC_RECV0 | VXIPC_CALL; 20 intptr_t s1 = status, s2 = 0; 21 VXCALL(h, s1, s2, 0, 0); 22 } 23 24 // Close the handle at address va in proc. 25 static inline void 26 vxproc_drop(intptr_t proc, intptr_t va) { 27 intptr_t h = proc | VXPROC_DROP | 28 VXIPC_SEND0 | VXIPC_RECV0 | VXIPC_CALL; 29 intptr_t s1 = va, s2 = 0; 30 VXCALL(h, s1, s2, 0, 0); 31 } 32 33 // Extract handle at 'va' from 'proc', 34 // and place it at 'localva' in current process. 35 static inline void 36 vxproc_get(intptr_t proc, intptr_t va, intptr_t localva) { 37 intptr_t h = proc | VXPROC_GET | 38 VXIPC_SEND0 | VXIPC_RECV1 | VXIPC_CALL; 39 intptr_t s1 = va, s2 = 0; 40 VXCALL(h, s1, s2, localva, 0); 41 } 42 43 // Insert handle from 'localva' in current process 44 // into process 'proc' at address 'va'. 45 static inline void 46 vxproc_put(intptr_t proc, intptr_t localva, intptr_t va) { 47 intptr_t h = proc | VXPROC_PUT | 48 VXIPC_SEND1 | VXIPC_RECV0 | VXIPC_CALL; 49 intptr_t s1 = localva, s2 = va; 50 VXCALL(h, s1, s2, 0, 0); 51 } 52 53 // Allocate a new chunk of memory and place it at 'va' in 'proc'. 54 static inline void 55 vxproc_alloc(intptr_t proc, intptr_t va) { 56 intptr_t h = proc | VXPROC_ALLOC | 57 VXIPC_SEND0 | VXIPC_RECV0 | VXIPC_CALL; 58 intptr_t s1 = va, s2 = 0; 59 VXCALL(h, s1, s2, 0, 0); 60 } 61 62 // Create a new CALL handle referring to 'proc' 63 // and place it in the current process at 'localva'. 64 // Associate opaque value 'id' with new handle 65 static inline void 66 vxproc_mkcall(intptr_t proc, intptr_t id, intptr_t localva) { 67 intptr_t h = proc | VXPROC_MKCALL | 68 VXIPC_SEND0 | VXIPC_RECV1 | VXIPC_CALL; 69 intptr_t s1 = id, s2 = 0; 70 VXCALL(h, s1, s2, localva, 0); 71 } 72 73 74 #endif // _VXPROC_H_