Maintain recursive process execution and system time.
This commit is contained in:
parent
1c64a7fda1
commit
5da12519cd
|
@ -147,6 +147,8 @@ public:
|
||||||
Timer alarm_timer;
|
Timer alarm_timer;
|
||||||
Clock execute_clock;
|
Clock execute_clock;
|
||||||
Clock system_clock;
|
Clock system_clock;
|
||||||
|
Clock child_execute_clock;
|
||||||
|
Clock child_system_clock;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int Execute(const char* programname, const uint8_t* program,
|
int Execute(const char* programname, const uint8_t* program,
|
||||||
|
|
|
@ -437,6 +437,11 @@ namespace Sortix
|
||||||
|
|
||||||
thepid = zombie->pid;
|
thepid = zombie->pid;
|
||||||
|
|
||||||
|
// It is safe to access these clocks directly as the child process is no
|
||||||
|
// longer running at this point and the values are nicely frozen.
|
||||||
|
child_execute_clock.Advance(zombie->child_execute_clock.current_time);
|
||||||
|
child_system_clock.Advance(zombie->child_system_clock.current_time);
|
||||||
|
|
||||||
int exitstatus = zombie->exitstatus;
|
int exitstatus = zombie->exitstatus;
|
||||||
if ( exitstatus < 0 )
|
if ( exitstatus < 0 )
|
||||||
exitstatus = W_EXITCODE(128 + SIGKILL, SIGKILL);
|
exitstatus = W_EXITCODE(128 + SIGKILL, SIGKILL);
|
||||||
|
|
|
@ -83,8 +83,10 @@ void OnTick(struct timespec tick_period, bool system_mode)
|
||||||
uptime_clock->Advance(tick_period);
|
uptime_clock->Advance(tick_period);
|
||||||
Process* process = CurrentProcess();
|
Process* process = CurrentProcess();
|
||||||
process->execute_clock.Advance(tick_period);
|
process->execute_clock.Advance(tick_period);
|
||||||
|
process->child_execute_clock.Advance(tick_period);
|
||||||
if ( system_mode )
|
if ( system_mode )
|
||||||
process->system_clock.Advance(tick_period);
|
process->system_clock.Advance(tick_period),
|
||||||
|
process->child_system_clock.Advance(tick_period);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
|
|
|
@ -116,6 +116,10 @@ void InitializeProcessClocks(Process* process)
|
||||||
process->execute_clock.Set(&nul_time, &tick_period);
|
process->execute_clock.Set(&nul_time, &tick_period);
|
||||||
process->system_clock.SetCallableFromInterrupts(true);
|
process->system_clock.SetCallableFromInterrupts(true);
|
||||||
process->system_clock.Set(&nul_time, &tick_period);
|
process->system_clock.Set(&nul_time, &tick_period);
|
||||||
|
process->child_execute_clock.Set(&nul_time, &tick_period);
|
||||||
|
process->child_execute_clock.SetCallableFromInterrupts(true);
|
||||||
|
process->child_system_clock.Set(&nul_time, &tick_period);
|
||||||
|
process->child_system_clock.SetCallableFromInterrupts(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
|
|
Loading…
Reference in New Issue