diff --git a/kernel/system/alarms.c b/kernel/system/clock.c similarity index 79% rename from kernel/system/alarms.c rename to kernel/system/clock.c index df93ffd87..fcc735040 100644 --- a/kernel/system/alarms.c +++ b/kernel/system/clock.c @@ -1,5 +1,49 @@ /* The system call implemented in this file: - * m_type: CLK_SIGNALRM, CLK_SYNCALRM, CLK_FLAGALRM + * m_type: SYS_TIMES + * + * The parameters for this system call are: + * m4_l1: T_PROC_NR (get info for this process) + * m4_l1: T_USER_TIME (return values ...) + * m4_l2: T_SYSTEM_TIME + * m4_l3: T_CHILD_UTIME + * m4_l4: T_CHILD_STIME + * m4_l5: T_BOOT_TICKS + */ + +#include "../kernel.h" +#include "../system.h" +#include + +/*===========================================================================* + * do_times * + *===========================================================================*/ +PUBLIC int do_times(m_ptr) +register message *m_ptr; /* pointer to request message */ +{ +/* Handle sys_times(). Retrieve the accounting information. */ + + register struct proc *rp; + int proc_nr; + + /* Insert the times needed by the SYS_TIMES system call in the message. */ + proc_nr = (m_ptr->T_PROC_NR == SELF) ? m_ptr->m_source : m_ptr->T_PROC_NR; + if (isokprocn(proc_nr)) { + rp = proc_addr(m_ptr->T_PROC_NR); + + lock(); /* halt the volatile time counters in rp */ + m_ptr->T_USER_TIME = rp->user_time; + m_ptr->T_SYSTEM_TIME = rp->sys_time; + unlock(); + m_ptr->T_CHILD_UTIME = rp->child_utime; + m_ptr->T_CHILD_STIME = rp->child_stime; + } + m_ptr->T_BOOT_TICKS = get_uptime(); + return(OK); +} + + +/* The system call implemented in this file: + * m_type: SYS_SIGNALRM, SYS_SYNCALRM, SYS_FLAGALRM * * The parameters for this system call are: * m2_i1: ALRM_PROC_NR (set alarm for this process) @@ -13,10 +57,6 @@ * May 02, 2004 added new timeout flag alarm (Jorrit N. Herder) */ -#include "../kernel.h" -#include "../system.h" -#include - FORWARD _PROTOTYPE( void cause_syncalrm, (timer_t *tp) ); FORWARD _PROTOTYPE( void cause_flagalrm, (timer_t *tp) ); FORWARD _PROTOTYPE( void cause_signalrm, (timer_t *tp) );