Message type for SYS_SETALARM
Change-Id: I2c2ee24c19085cbd1e7ffba7b2db714b2561ff17
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
* m_type: SYS_SETALARM
|
||||
*
|
||||
* The parameters for this kernel call are:
|
||||
* m2_l1: ALRM_EXP_TIME (alarm's expiration time)
|
||||
* m2_i2: ALRM_ABS_TIME (expiration time is absolute?)
|
||||
* m2_l1: ALRM_TIME_LEFT (return seconds left of previous)
|
||||
* m_lsys_krn_sys_setalarm.exp_time (alarm's expiration time)
|
||||
* m_lsys_krn_sys_setalarm.abs_time (expiration time is absolute?)
|
||||
* m_lsys_krn_sys_setalarm.time_left (return seconds left of previous)
|
||||
*/
|
||||
|
||||
#include "kernel/system.h"
|
||||
@@ -24,12 +24,12 @@ int do_setalarm(struct proc * caller, message * m_ptr)
|
||||
/* A process requests a synchronous alarm, or wants to cancel its alarm. */
|
||||
long exp_time; /* expiration time for this alarm */
|
||||
int use_abs_time; /* use absolute or relative time */
|
||||
minix_timer_t *tp; /* the process' timer structure */
|
||||
minix_timer_t *tp; /* the process' timer structure */
|
||||
clock_t uptime; /* placeholder for current uptime */
|
||||
|
||||
/* Extract shared parameters from the request message. */
|
||||
exp_time = m_ptr->ALRM_EXP_TIME; /* alarm's expiration time */
|
||||
use_abs_time = m_ptr->ALRM_ABS_TIME; /* flag for absolute time */
|
||||
exp_time = m_ptr->m_lsys_krn_sys_setalarm.exp_time; /* alarm's expiration time */
|
||||
use_abs_time = m_ptr->m_lsys_krn_sys_setalarm.abs_time; /* flag for absolute time */
|
||||
if (! (priv(caller)->s_flags & SYS_PROC)) return(EPERM);
|
||||
|
||||
/* Get the timer structure and set the parameters for this alarm. */
|
||||
@@ -40,9 +40,9 @@ int do_setalarm(struct proc * caller, message * m_ptr)
|
||||
/* Return the ticks left on the previous alarm. */
|
||||
uptime = get_monotonic();
|
||||
if ((tp->tmr_exp_time != TMR_NEVER) && (uptime < tp->tmr_exp_time) ) {
|
||||
m_ptr->ALRM_TIME_LEFT = (tp->tmr_exp_time - uptime);
|
||||
m_ptr->m_lsys_krn_sys_setalarm.time_left = (tp->tmr_exp_time - uptime);
|
||||
} else {
|
||||
m_ptr->ALRM_TIME_LEFT = 0;
|
||||
m_ptr->m_lsys_krn_sys_setalarm.time_left = 0;
|
||||
}
|
||||
|
||||
/* Finally, (re)set the timer depending on the expiration time. */
|
||||
|
||||
Reference in New Issue
Block a user