Replacing timer_t by netbsd's timer_t
* Renamed struct timer to struct minix_timer * Renamed timer_t to minix_timer_t * Ensured all the code uses the minix_timer_t typedef * Removed ifdef around _BSD_TIMER_T * Removed include/timers.h and merged it into include/minix/timers.h * Resolved prototype conflict by renaming kernel's (re)set_timer to (re)set_kernel_timer. Change-Id: I56f0f30dfed96e1a0575d92492294cf9a06468a5
This commit is contained in:
@@ -412,7 +412,7 @@ kinfo_t *pre_init(int argc, char **argv)
|
||||
* longer used and the "real" implementations are visible
|
||||
*/
|
||||
int send_sig(endpoint_t proc_nr, int sig_nr) { return 0; }
|
||||
void minix_shutdown(timer_t *t) { arch_shutdown(RBT_PANIC); }
|
||||
void minix_shutdown(minix_timer_t *t) { arch_shutdown(RBT_PANIC); }
|
||||
void busy_delay_ms(int x) { }
|
||||
int raise(int n) { panic("raise(%d)\n", n); }
|
||||
int kern_phys_map_ptr( phys_bytes base_address, vir_bytes io_size,
|
||||
|
||||
@@ -246,6 +246,6 @@ kinfo_t *pre_init(u32_t magic, u32_t ebx)
|
||||
}
|
||||
|
||||
int send_sig(endpoint_t proc_nr, int sig_nr) { return 0; }
|
||||
void minix_shutdown(timer_t *t) { arch_shutdown(RBT_PANIC); }
|
||||
void minix_shutdown(minix_timer_t *t) { arch_shutdown(RBT_PANIC); }
|
||||
void busy_delay_ms(int x) { }
|
||||
int raise(int sig) { panic("raise(%d)\n", sig); }
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
*
|
||||
* In addition to the main clock_task() entry point, which starts the main
|
||||
* loop, there are several other minor entry points:
|
||||
* clock_stop: called just before MINIX shutdown
|
||||
* get_realtime: get wall time since boot in clock ticks
|
||||
* set_realtime: set wall time since boot in clock ticks
|
||||
* set_adjtime_delta: set the number of ticks to adjust realtime
|
||||
* get_monotonic: get monotonic time since boot in clock ticks
|
||||
* set_timer: set a watchdog timer (+)
|
||||
* reset_timer: reset a watchdog timer (+)
|
||||
* read_clock: read the counter of channel 0 of the 8253A timer
|
||||
* clock_stop: called just before MINIX shutdown
|
||||
* get_realtime: get wall time since boot in clock ticks
|
||||
* set_realtime: set wall time since boot in clock ticks
|
||||
* set_adjtime_delta: set the number of ticks to adjust realtime
|
||||
* get_monotonic: get monotonic time since boot in clock ticks
|
||||
* set_kernel_timer: set a watchdog timer (+)
|
||||
* reset_kernel_timer: reset a watchdog timer (+)
|
||||
* read_clock: read the counter of channel 0 of the 8253A timer
|
||||
*
|
||||
* (+) The CLOCK task keeps tracks of watchdog timers for the entire kernel.
|
||||
* It is crucial that watchdog functions not block, or the CLOCK task may
|
||||
@@ -46,14 +46,14 @@
|
||||
*/
|
||||
static void load_update(void);
|
||||
|
||||
/* The CLOCK's timers queue. The functions in <timers.h> operate on this.
|
||||
/* The CLOCK's timers queue. The functions in <minix/timers.h> operate on this.
|
||||
* Each system process possesses a single synchronous alarm timer. If other
|
||||
* kernel parts want to use additional timers, they must declare their own
|
||||
* persistent (static) timer structure, which can be passed to the clock
|
||||
* via (re)set_timer().
|
||||
* via (re)set_kernel_timer().
|
||||
* When a timer expires its watchdog function is run by the CLOCK task.
|
||||
*/
|
||||
static timer_t *clock_timers; /* queue of CLOCK timers */
|
||||
static minix_timer_t *clock_timers; /* queue of CLOCK timers */
|
||||
static clock_t next_timeout; /* monotonic time that next timer expires */
|
||||
|
||||
/* The time is incremented by the interrupt handler on each clock tick.
|
||||
@@ -211,10 +211,10 @@ clock_t get_monotonic(void)
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* set_timer *
|
||||
* set_kernel_timer *
|
||||
*===========================================================================*/
|
||||
void set_timer(tp, exp_time, watchdog)
|
||||
struct timer *tp; /* pointer to timer structure */
|
||||
void set_kernel_timer(tp, exp_time, watchdog)
|
||||
minix_timer_t *tp; /* pointer to timer structure */
|
||||
clock_t exp_time; /* expiration monotonic time */
|
||||
tmr_func_t watchdog; /* watchdog to be called */
|
||||
{
|
||||
@@ -226,10 +226,10 @@ tmr_func_t watchdog; /* watchdog to be called */
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* reset_timer *
|
||||
* reset_kernel_timer *
|
||||
*===========================================================================*/
|
||||
void reset_timer(tp)
|
||||
struct timer *tp; /* pointer to timer structure */
|
||||
void reset_kernel_timer(tp)
|
||||
minix_timer_t *tp; /* pointer to timer structure */
|
||||
{
|
||||
/* The timer pointed to by 'tp' is no longer needed. Remove it from both the
|
||||
* active and expired lists. Always update the next timeout time by setting
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <minix/type.h> /* MINIX specific types, e.g. message */
|
||||
#include <minix/ipc.h> /* MINIX run-time system */
|
||||
#include <minix/sysutil.h> /* MINIX utility library functions */
|
||||
#include <timers.h> /* watchdog timer management */
|
||||
#include <minix/timers.h> /* watchdog timer management */
|
||||
#include <errno.h> /* return codes and error numbers */
|
||||
#include <sys/param.h>
|
||||
#include <minix/param.h>
|
||||
|
||||
@@ -340,7 +340,7 @@ static void announce(void)
|
||||
void prepare_shutdown(const int how)
|
||||
{
|
||||
/* This function prepares to shutdown MINIX. */
|
||||
static timer_t shutdown_timer;
|
||||
static minix_timer_t shutdown_timer;
|
||||
|
||||
/* Continue after 1 second, to give processes a chance to get scheduled to
|
||||
* do shutdown work. Set a watchog timer to call shutdown(). The timer
|
||||
@@ -348,13 +348,13 @@ void prepare_shutdown(const int how)
|
||||
*/
|
||||
printf("MINIX will now be shut down ...\n");
|
||||
tmr_arg(&shutdown_timer)->ta_int = how;
|
||||
set_timer(&shutdown_timer, get_monotonic() + system_hz, minix_shutdown);
|
||||
set_kernel_timer(&shutdown_timer, get_monotonic() + system_hz, minix_shutdown);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* shutdown *
|
||||
*===========================================================================*/
|
||||
void minix_shutdown(timer_t *tp)
|
||||
void minix_shutdown(minix_timer_t *tp)
|
||||
{
|
||||
/* This function is called from prepare_shutdown or stop_sequence to bring
|
||||
* down MINIX. How to shutdown is in the argument: RBT_HALT (return to the
|
||||
|
||||
@@ -42,7 +42,7 @@ struct priv {
|
||||
irq_id_t s_int_pending; /* pending hardware interrupts */
|
||||
sigset_t s_sig_pending; /* pending signals */
|
||||
|
||||
timer_t s_alarm_timer; /* synchronous alarm timer */
|
||||
minix_timer_t s_alarm_timer; /* synchronous alarm timer */
|
||||
reg_t *s_stack_guard; /* stack guard word for kernel tasks */
|
||||
|
||||
int s_nr_io_range; /* allowed I/O ports */
|
||||
|
||||
@@ -11,15 +11,14 @@
|
||||
|
||||
/* Struct declarations. */
|
||||
struct proc;
|
||||
struct timer;
|
||||
|
||||
/* clock.c */
|
||||
clock_t get_realtime(void);
|
||||
void set_realtime(clock_t);
|
||||
void set_adjtime_delta(int32_t);
|
||||
clock_t get_monotonic(void);
|
||||
void set_timer(struct timer *tp, clock_t t, tmr_func_t f);
|
||||
void reset_timer(struct timer *tp);
|
||||
void set_kernel_timer(minix_timer_t *tp, clock_t t, tmr_func_t f);
|
||||
void reset_kernel_timer(minix_timer_t *tp);
|
||||
void ser_dump_proc(void);
|
||||
|
||||
void cycles_accounting_init(void);
|
||||
@@ -45,7 +44,7 @@ void fpu_sigcontext(struct proc *, struct sigframe *fr, struct
|
||||
#endif
|
||||
void kmain(kinfo_t *cbi);
|
||||
void prepare_shutdown(int how);
|
||||
__dead void minix_shutdown(struct timer *tp);
|
||||
__dead void minix_shutdown(minix_timer_t *tp);
|
||||
void bsp_finish_booting(void);
|
||||
|
||||
/* proc.c */
|
||||
|
||||
@@ -48,7 +48,7 @@ int do_clear(struct proc * caller, message * m_ptr)
|
||||
clear_endpoint(rc);
|
||||
|
||||
/* Turn off any alarm timers at the clock. */
|
||||
reset_timer(&priv(rc)->s_alarm_timer);
|
||||
reset_kernel_timer(&priv(rc)->s_alarm_timer);
|
||||
|
||||
/* Make sure that the exiting process is no longer scheduled,
|
||||
* and mark slot as FREE. Also mark saved fpu contents as not significant.
|
||||
|
||||
@@ -113,7 +113,7 @@ int do_privctl(struct proc * caller, message * m_ptr)
|
||||
priv(rp)->s_notify_pending.chunk[i] = 0; /* - notifications */
|
||||
priv(rp)->s_int_pending = 0; /* - interrupts */
|
||||
(void) sigemptyset(&priv(rp)->s_sig_pending); /* - signals */
|
||||
reset_timer(&priv(rp)->s_alarm_timer); /* - alarm */
|
||||
reset_kernel_timer(&priv(rp)->s_alarm_timer); /* - alarm */
|
||||
priv(rp)->s_asyntab= -1; /* - asynsends */
|
||||
priv(rp)->s_asynsize= 0;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#if USE_SETALARM
|
||||
|
||||
static void cause_alarm(timer_t *tp);
|
||||
static void cause_alarm(minix_timer_t *tp);
|
||||
|
||||
/*===========================================================================*
|
||||
* do_setalarm *
|
||||
@@ -24,7 +24,7 @@ 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 */
|
||||
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. */
|
||||
@@ -47,10 +47,10 @@ int do_setalarm(struct proc * caller, message * m_ptr)
|
||||
|
||||
/* Finally, (re)set the timer depending on the expiration time. */
|
||||
if (exp_time == 0) {
|
||||
reset_timer(tp);
|
||||
reset_kernel_timer(tp);
|
||||
} else {
|
||||
tp->tmr_exp_time = (use_abs_time) ? exp_time : exp_time + get_monotonic();
|
||||
set_timer(tp, tp->tmr_exp_time, tp->tmr_func);
|
||||
set_kernel_timer(tp, tp->tmr_exp_time, tp->tmr_func);
|
||||
}
|
||||
return(OK);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ int do_setalarm(struct proc * caller, message * m_ptr)
|
||||
/*===========================================================================*
|
||||
* cause_alarm *
|
||||
*===========================================================================*/
|
||||
static void cause_alarm(timer_t *tp)
|
||||
static void cause_alarm(minix_timer_t *tp)
|
||||
{
|
||||
/* Routine called if a timer goes off and the process requested a synchronous
|
||||
* alarm. The process number is stored in timer argument 'ta_int'. Notify that
|
||||
|
||||
Reference in New Issue
Block a user