]> Zhao Yanbai Git Server - minix.git/commitdiff
Message type for SYS_SCHEDCTL
authorLionel Sambuc <lionel@minix3.org>
Wed, 14 May 2014 14:39:00 +0000 (16:39 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:42 +0000 (17:05 +0200)
Change-Id: Iaccbac1ef99124bc494b835e0d0cf999ea2e3f5a

include/minix/com.h
include/minix/ipc.h
kernel/system/do_schedctl.c
lib/libsys/sys_schedctl.c

index 6377c68457df2f38c746797e351a1ca6049ddfbc..d2092256992fa84217e40076e57d2c00c8096e8a 100644 (file)
 #define SYS_STATE_CLEAR_IPC_REFS    1  /* clear IPC references */
 
 /* Subfunctions for SYS_SCHEDCTL */
-#define SCHEDCTL_FLAGS         m9_l1   /* flags for setting the scheduler */
 #  define SCHEDCTL_FLAG_KERNEL 1       /* mark kernel scheduler and remove 
                                         * RTS_NO_QUANTUM; otherwise caller is 
                                         * marked scheduler 
                                         */
-#define SCHEDCTL_ENDPOINT      m9_l2   /* endpt of process to be scheduled */
-#define SCHEDCTL_QUANTUM       m9_l3   /* current scheduling quantum */
-#define SCHEDCTL_PRIORITY      m9_s4   /* current scheduling priority */
-#define SCHEDCTL_CPU           m9_l5   /* where to place this process */
 
 /* Field names for SYS_PADCONF */
 #define PADCONF_PADCONF                m2_i1   /* pad to configure */
index d0e94f07cdca0566eb58e79ca6e3303cd7c263d8..1d319402050bc5be90294d4d3333e61875610d69 100644 (file)
@@ -563,6 +563,17 @@ typedef struct {
 } mess_pm_lexec_exec_new;
 _ASSERT_MSG_SIZE(mess_pm_lexec_exec_new);
 
+typedef struct {
+       uint32_t flags;
+       endpoint_t endpoint;
+       int priority;
+       int quantum;
+       int cpu;
+
+       uint8_t padding[36];
+} mess_lsys_krn_schedctl;
+_ASSERT_MSG_SIZE(mess_lsys_krn_schedctl);
+
 typedef struct {
        endpoint_t endpt;
 
@@ -1161,6 +1172,8 @@ typedef struct {
 
                mess_lexec_pm_exec_new  m_lexec_pm_exec_new;
 
+               mess_lsys_krn_schedctl  m_lsys_krn_schedctl;
+
                mess_lsys_pm_getepinfo  m_lsys_pm_getepinfo;
                mess_lsys_pm_getprocnr  m_lsys_pm_getprocnr;
                mess_lsys_pm_srv_fork   m_lsys_pm_srv_fork;
index 498d0d04f74502e1349bd845c99fe65b848b561e..f8b95b43593ed51bc9831e8317f3b21cd4df8c01 100644 (file)
@@ -7,20 +7,20 @@
 int do_schedctl(struct proc * caller, message * m_ptr)
 {
        struct proc *p;
-       unsigned flags;
+       uint32_t flags;
        int priority, quantum, cpu;
        int proc_nr;
        int r;
 
        /* check parameter validity */
-       flags = (unsigned) m_ptr->SCHEDCTL_FLAGS;
+       flags = m_ptr->m_lsys_krn_schedctl.flags;
        if (flags & ~SCHEDCTL_FLAG_KERNEL) {
                printf("do_schedctl: flags 0x%x invalid, caller=%d\n", 
                        flags, caller - proc);
                return EINVAL;
        }
 
-       if (!isokendpt(m_ptr->SCHEDCTL_ENDPOINT, &proc_nr))
+       if (!isokendpt(m_ptr->m_lsys_krn_schedctl.endpoint, &proc_nr))
                return EINVAL;
 
        p = proc_addr(proc_nr);
@@ -29,9 +29,9 @@ int do_schedctl(struct proc * caller, message * m_ptr)
                /* the kernel becomes the scheduler and starts 
                 * scheduling the process.
                 */
-               priority = (int) m_ptr->SCHEDCTL_PRIORITY;
-               quantum = (int) m_ptr->SCHEDCTL_QUANTUM;
-               cpu = (int) m_ptr->SCHEDCTL_CPU;
+               priority = m_ptr->m_lsys_krn_schedctl.priority;
+               quantum = m_ptr->m_lsys_krn_schedctl.quantum;
+               cpu = m_ptr->m_lsys_krn_schedctl.cpu;
 
                /* Try to schedule the process. */
                if((r = sched_proc(p, priority, quantum, cpu) != OK))
index 97ff4832c18648a64e5f60d52afa940e5d221b5b..689193b1a95e42c5288b87c799a3208acd31355c 100644 (file)
@@ -1,17 +1,15 @@
 #include "syslib.h"
 
-int sys_schedctl(unsigned flags,
-                       endpoint_t proc_ep,
-                       int priority,
-                       int quantum,
-                       int cpu)
+int sys_schedctl(uint32_t flags, endpoint_t proc_ep, int priority, int quantum,
+       int cpu)
 {
        message m;
 
-       m.SCHEDCTL_FLAGS = (int) flags;
-       m.SCHEDCTL_ENDPOINT = proc_ep;
-       m.SCHEDCTL_PRIORITY = priority;
-       m.SCHEDCTL_QUANTUM = quantum;
-       m.SCHEDCTL_CPU = cpu;
+       m.m_lsys_krn_schedctl.flags = flags;
+       m.m_lsys_krn_schedctl.endpoint = proc_ep;
+       m.m_lsys_krn_schedctl.priority = priority;
+       m.m_lsys_krn_schedctl.quantum = quantum;
+       m.m_lsys_krn_schedctl.cpu = cpu;
+
        return(_kernel_call(SYS_SCHEDCTL, &m));
 }