tty: try more often to get the config byte.
[minix.git] / servers / vm / rs.c
blobdcda8c98b174f3f90e847361981ebbb8451e930a
2 #define _SYSTEM 1
4 #include <minix/callnr.h>
5 #include <minix/com.h>
6 #include <minix/config.h>
7 #include <minix/const.h>
8 #include <minix/ds.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>
19 #include <errno.h>
20 #include <string.h>
21 #include <env.h>
22 #include <stdio.h>
23 #include <assert.h>
25 #include "glo.h"
26 #include "proto.h"
27 #include "util.h"
28 #include "region.h"
30 /*===========================================================================*
31 * do_rs_set_priv *
32 *===========================================================================*/
33 PUBLIC int do_rs_set_priv(message *m)
35 int r, n, nr;
36 struct vmproc *vmp;
38 nr = m->VM_RS_NR;
40 if ((r = vm_isokendpt(nr, &n)) != OK) {
41 printf("do_rs_set_priv: message from strange source %d\n", nr);
42 return EINVAL;
45 vmp = &vmproc[n];
47 if (m->VM_RS_BUF) {
48 r = sys_datacopy(m->m_source, (vir_bytes) m->VM_RS_BUF,
49 SELF, (vir_bytes) vmp->vm_call_mask,
50 sizeof(vmp->vm_call_mask));
51 if (r != OK)
52 return r;
55 return OK;
58 /*===========================================================================*
59 * do_rs_update *
60 *===========================================================================*/
61 PUBLIC int do_rs_update(message *m_ptr)
63 endpoint_t src_e, dst_e;
64 int r;
66 src_e = m_ptr->VM_RS_SRC_ENDPT;
67 dst_e = m_ptr->VM_RS_DST_ENDPT;
69 /* Let the kernel do the update first. */
70 r = sys_update(src_e, dst_e);
71 if(r != OK) {
72 return r;
75 /* Do the update in VM now. */
76 r = swap_proc(src_e, dst_e);
78 return r;