4 #include <minix/callnr.h>
6 #include <minix/config.h>
7 #include <minix/const.h>
9 #include <minix/endpoint.h>
10 #include <minix/keymap.h>
11 #include <minix/minlib.h>
12 #include <minix/type.h>
13 #include <minix/ipc.h>
14 #include <minix/sysutil.h>
15 #include <minix/syslib.h>
16 #include <minix/safecopies.h>
17 #include <minix/bitmap.h>
30 struct query_exit_struct
{
34 static struct query_exit_struct array
[NR_PROCS
];
36 /*===========================================================================*
38 *===========================================================================*/
39 int do_query_exit(message
*m
)
44 for (i
= 0; i
< NR_PROCS
; i
++) {
45 if (!array
[i
].avail
) {
55 for (i
= 0; i
< NR_PROCS
; i
++) {
59 m
->VM_QUERY_RET_PT
= ep
;
60 m
->VM_QUERY_IS_MORE
= (nr
> 0);
65 /*===========================================================================*
67 *===========================================================================*/
68 int do_notify_sig(message
*m
)
71 endpoint_t ep
= m
->VM_NOTIFY_SIG_ENDPOINT
;
72 endpoint_t ipc_ep
= m
->VM_NOTIFY_SIG_IPC
;
77 if(vm_isokendpt(ep
, &pslot
) != OK
) return ESRCH
;
80 /* Only record the event if we've been asked to report it. */
81 if(!(vmp
->vm_flags
& VMF_WATCHEXIT
))
84 for (i
= 0; i
< NR_PROCS
; i
++) {
85 /* its signal is already here */
86 if (!array
[i
].avail
&& array
[i
].ep
== ep
)
92 /* no slot for signals, unlikely */
93 printf("VM: no slot for signals!\n");
97 for (i
= 0; i
< NR_PROCS
; i
++) {
107 /* only care when IPC server starts up,
108 * and bypass the process to be signal is IPC itself.
110 if (ipc_ep
!= 0 && ep
!= ipc_ep
) {
113 printf("VM: notify IPC error!\n");
118 /*===========================================================================*
120 *===========================================================================*/
121 int do_watch_exit(message
*m
)
123 endpoint_t e
= m
->VM_WE_EP
;
126 if(vm_isokendpt(e
, &p
) != OK
) return ESRCH
;
128 vmp
->vm_flags
|= VMF_WATCHEXIT
;
133 /*===========================================================================*
135 *===========================================================================*/
136 void init_query_exit(void)
140 for (i
= 0; i
< NR_PROCS
; i
++) {