From: Lionel Sambuc Date: Wed, 14 May 2014 15:57:12 +0000 (+0200) Subject: Message type for SCHEDULING_{START,INHERIT} X-Git-Tag: v3.3.0~248 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.rndc.html?a=commitdiff_plain;h=9f350d76ef605cda8b11b043aad7390bd87fa223;p=minix.git Message type for SCHEDULING_{START,INHERIT} Change-Id: Iad2b4079f72488ea3c3abef2b4a4fefe26ae9066 --- diff --git a/include/minix/com.h b/include/minix/com.h index a188b3bb4..fb432750c 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -1002,22 +1002,10 @@ #define SCHEDULING_NO_QUANTUM (SCHEDULING_BASE+1) /* These are used for SYS_SCHEDULE, a reply to SCHEDULING_NO_QUANTUM */ # define SCHEDULING_ENDPOINT m9_l1 -# define SCHEDULING_QUANTUM m9_l2 - -/* - * SCHEDULING_START uses _ENDPOINT, _PRIORITY and _QUANTUM from - * SCHEDULING_NO_QUANTUM/SYS_SCHEDULE - */ #define SCHEDULING_START (SCHEDULING_BASE+2) -# define SCHEDULING_SCHEDULER m9_l1 /* Overrides _ENDPOINT on return*/ -# define SCHEDULING_PARENT m9_l3 # define SCHEDULING_MAXPRIO m9_l4 - #define SCHEDULING_STOP (SCHEDULING_BASE+3) - #define SCHEDULING_SET_NICE (SCHEDULING_BASE+4) - -/* SCHEDULING_INHERIT is like SCHEDULING_START, but without _QUANTUM field */ #define SCHEDULING_INHERIT (SCHEDULING_BASE+5) /*===========================================================================* diff --git a/include/minix/ipc.h b/include/minix/ipc.h index c2e809a19..69f8b29ed 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -635,6 +635,23 @@ typedef struct { } mess_lsys_pm_srv_fork; _ASSERT_MSG_SIZE(mess_lsys_pm_srv_fork); +typedef struct { + endpoint_t endpoint; + endpoint_t parent; + int maxprio; + int quantum; + + uint8_t padding[40]; +} mess_lsys_sched_scheduling_start; +_ASSERT_MSG_SIZE(mess_lsys_sched_scheduling_start); + +typedef struct { + endpoint_t scheduler; + + uint8_t padding[52]; +} mess_sched_lsys_scheduling_start; +_ASSERT_MSG_SIZE(mess_sched_lsys_scheduling_start); + typedef struct { endpoint_t endpt; cp_grant_id_t grant; @@ -1205,6 +1222,8 @@ typedef struct { mess_lsys_pm_getprocnr m_lsys_pm_getprocnr; mess_lsys_pm_srv_fork m_lsys_pm_srv_fork; + mess_lsys_sched_scheduling_start m_lsys_sched_scheduling_start; + mess_lsys_vfs_checkperms m_lsys_vfs_checkperms; mess_lsys_vfs_copyfd m_lsys_vfs_copyfd; mess_lsys_vfs_mapdriver m_lsys_vfs_mapdriver; @@ -1225,6 +1244,8 @@ typedef struct { mess_rs_pm_exec_restart m_rs_pm_exec_restart; mess_rs_pm_srv_kill m_rs_pm_srv_kill; + mess_sched_lsys_scheduling_start m_sched_lsys_scheduling_start; + mess_vfs_fs_breadwrite m_vfs_fs_breadwrite; mess_vfs_fs_chmod m_vfs_fs_chmod; mess_vfs_fs_chown m_vfs_fs_chown; diff --git a/lib/libsys/sched_start.c b/lib/libsys/sched_start.c index 7017047b3..1cd2e510e 100644 --- a/lib/libsys/sched_start.c +++ b/lib/libsys/sched_start.c @@ -26,9 +26,9 @@ int sched_inherit(endpoint_t scheduler_e, assert(newscheduler_e); memset(&m, 0, sizeof(m)); - m.SCHEDULING_ENDPOINT = schedulee_e; - m.SCHEDULING_PARENT = parent_e; - m.SCHEDULING_MAXPRIO = (int) maxprio; + m.m_lsys_sched_scheduling_start.endpoint = schedulee_e; + m.m_lsys_sched_scheduling_start.parent = parent_e; + m.m_lsys_sched_scheduling_start.maxprio = maxprio; /* Send the request to the scheduler */ if ((rv = _taskcall(scheduler_e, SCHEDULING_INHERIT, &m))) { @@ -40,7 +40,7 @@ int sched_inherit(endpoint_t scheduler_e, * might have forwarded the scheduling message on to another scheduler * before returning the message. */ - *newscheduler_e = m.SCHEDULING_SCHEDULER; + *newscheduler_e = m.m_sched_lsys_scheduling_start.scheduler; return (OK); } @@ -82,10 +82,10 @@ int sched_start(endpoint_t scheduler_e, /* A user-space scheduler must schedule this process. */ memset(&m, 0, sizeof(m)); - m.SCHEDULING_ENDPOINT = schedulee_e; - m.SCHEDULING_PARENT = parent_e; - m.SCHEDULING_MAXPRIO = (int) maxprio; - m.SCHEDULING_QUANTUM = (int) quantum; + m.m_lsys_sched_scheduling_start.endpoint = schedulee_e; + m.m_lsys_sched_scheduling_start.parent = parent_e; + m.m_lsys_sched_scheduling_start.maxprio = maxprio; + m.m_lsys_sched_scheduling_start.quantum = quantum; /* Send the request to the scheduler */ if ((rv = _taskcall(scheduler_e, SCHEDULING_START, &m))) { @@ -97,6 +97,6 @@ int sched_start(endpoint_t scheduler_e, * might have forwarded the scheduling message on to another scheduler * before returning the message. */ - *newscheduler_e = m.SCHEDULING_SCHEDULER; + *newscheduler_e = m.m_sched_lsys_scheduling_start.scheduler; return (OK); } diff --git a/servers/sched/schedule.c b/servers/sched/schedule.c index 1a01436a3..fd5e04931 100644 --- a/servers/sched/schedule.c +++ b/servers/sched/schedule.c @@ -153,16 +153,16 @@ int do_start_scheduling(message *m_ptr) return EPERM; /* Resolve endpoint to proc slot. */ - if ((rv = sched_isemtyendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr_n)) - != OK) { + if ((rv = sched_isemtyendpt(m_ptr->m_lsys_sched_scheduling_start.endpoint, + &proc_nr_n)) != OK) { return rv; } rmp = &schedproc[proc_nr_n]; /* Populate process slot */ - rmp->endpoint = m_ptr->SCHEDULING_ENDPOINT; - rmp->parent = m_ptr->SCHEDULING_PARENT; - rmp->max_priority = (unsigned) m_ptr->SCHEDULING_MAXPRIO; + rmp->endpoint = m_ptr->m_lsys_sched_scheduling_start.endpoint; + rmp->parent = m_ptr->m_lsys_sched_scheduling_start.parent; + rmp->max_priority = m_ptr->m_lsys_sched_scheduling_start.maxprio; if (rmp->max_priority >= NR_SCHED_QUEUES) { return EINVAL; } @@ -195,14 +195,14 @@ int do_start_scheduling(message *m_ptr) * quanum and priority are set explicitly rather than inherited * from the parent */ rmp->priority = rmp->max_priority; - rmp->time_slice = (unsigned) m_ptr->SCHEDULING_QUANTUM; + rmp->time_slice = m_ptr->m_lsys_sched_scheduling_start.quantum; break; case SCHEDULING_INHERIT: /* Inherit current priority and time slice from parent. Since there * is currently only one scheduler scheduling the whole system, this * value is local and we assert that the parent endpoint is valid */ - if ((rv = sched_isokendpt(m_ptr->SCHEDULING_PARENT, + if ((rv = sched_isokendpt(m_ptr->m_lsys_sched_scheduling_start.parent, &parent_nr_n)) != OK) return rv; @@ -242,10 +242,10 @@ int do_start_scheduling(message *m_ptr) * By default, processes are scheduled by the parents scheduler. In case * this scheduler would want to delegate scheduling to another * scheduler, it could do so and then write the endpoint of that - * scheduler into SCHEDULING_SCHEDULER + * scheduler into the "scheduler" field. */ - m_ptr->SCHEDULING_SCHEDULER = SCHED_PROC_NR; + m_ptr->m_sched_lsys_scheduling_start.scheduler = SCHED_PROC_NR; return OK; }