#include <configfile.h>
#include <machine/archtypes.h>
-#include <timers.h>
+#include <minix/timers.h>
#include "kernel/proc.h"
#include "config.h"
#include <configfile.h>
#include <machine/archtypes.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <err.h>
#include "config.h"
#include <configfile.h>
#include <machine/archtypes.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <err.h>
#include "kernel/proc.h"
./usr/include/term.h minix-sys
./usr/include/termios.h minix-sys
./usr/include/time.h minix-sys
-./usr/include/timers.h minix-sys
+./usr/include/timers.h minix-sys obsolete
./usr/include/tools.h minix-sys obsolete
./usr/include/ttyent.h minix-sys
./usr/include/tzfile.h minix-sys
struct device part[DEV_PER_DRIVE]; /* partition bases and sizes */
struct device subpart[SUB_PER_DRIVE]; /* same for subpartitions */
- timer_t timer; /* port-specific timeout timer */
+ minix_timer_t timer; /* port-specific timeout timer */
int left; /* number of tries left before giving up */
/* (only used for signature probing) */
u32_t pend_mask; /* commands not yet complete */
struct {
thread_id_t tid;/* ID of the worker thread */
- timer_t timer; /* timer associated with each request */
+ minix_timer_t timer; /* timer associated with each request */
int result; /* success/failure result of the commands */
} cmd_info[NR_CMDS];
} port_state[NR_PORTS];
u8_t packet[ATAPI_PACKET_SIZE], prd_t *prdt, int nr_prds, int write);
static void port_issue(struct port_state *ps, int cmd, clock_t timeout);
static int port_exec(struct port_state *ps, int cmd, clock_t timeout);
-static void port_timeout(struct timer *tp);
+static void port_timeout(minix_timer_t *tp);
static void port_disconnect(struct port_state *ps);
static char *ahci_portname(struct port_state *ps);
/*===========================================================================*
* port_timeout *
*===========================================================================*/
-static void port_timeout(struct timer *tp)
+static void port_timeout(minix_timer_t *tp)
{
/* A timeout has occurred on this port. Figure out what the timeout is
* for, and take appropriate action.
#include <machine/pci.h>
#include <minix/ds.h>
#include <minix/vm.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <sys/mman.h>
#include "assert.h"
#include "e1000.h"
*/
#include "floppy.h"
-#include <timers.h>
+#include <minix/timers.h>
#include <machine/diskparm.h>
#include <minix/sysutil.h>
#include <minix/syslib.h>
char fl_calibration; /* CALIBRATED or UNCALIBRATED */
u8_t fl_density; /* NO_DENS = ?, 0 = 360K; 1 = 360K/1.2M; etc.*/
u8_t fl_class; /* bitmap for possible densities */
- timer_t fl_tmr_stop; /* timer to stop motor */
+ minix_timer_t fl_tmr_stop; /* timer to stop motor */
struct device fl_geom; /* Geometry of the drive */
struct device fl_part[NR_PARTITIONS]; /* partition's base & size */
} floppy[NR_DRIVES];
* Besides the 'f_tmr_timeout' timer below, the floppy structure for each
* floppy disk drive contains a 'fl_tmr_stop' timer.
*/
-static timer_t f_tmr_timeout; /* timer for various timeouts */
+static minix_timer_t f_tmr_timeout; /* timer for various timeouts */
static u32_t system_hz; /* system clock frequency */
static void f_expire_tmrs(clock_t stamp);
-static void stop_motor(timer_t *tp);
-static void f_timeout(timer_t *tp);
+static void stop_motor(minix_timer_t *tp);
+static void f_timeout(minix_timer_t *tp);
static struct device *f_prepare(devminor_t device);
static struct device *f_part(devminor_t minor);
/*===========================================================================*
* stop_motor *
*===========================================================================*/
-static void stop_motor(timer_t *tp)
+static void stop_motor(minix_timer_t *tp)
{
/* This routine is called from an alarm timer after several seconds have
* elapsed with no floppy disk activity. It turns the drive motor off.
/*===========================================================================*
* f_timeout *
*===========================================================================*/
-static void f_timeout(timer_t *UNUSED(tp))
+static void f_timeout(minix_timer_t *UNUSED(tp))
{
/* This routine is called when a timer expires. Usually to tell that a
* motor has spun up, but also to forge an interrupt when it takes too long
#include <minix/ds.h>
#include <minix/endpoint.h>
-#include <timers.h>
+#include <minix/timers.h>
#define debug 0
#define RAND_UPDATE /**/
static fxp_t *fxp_state;
-static timer_t fxp_watchdog;
+static minix_timer_t fxp_watchdog;
static u32_t system_hz;
static void fxp_getstat_s(message *mp);
static void fxp_handler(fxp_t *fp);
static void fxp_check_ints(fxp_t *fp);
-static void fxp_watchdog_f(timer_t *tp);
+static void fxp_watchdog_f(minix_timer_t *tp);
static int fxp_link_changed(fxp_t *fp);
static void fxp_report_link(fxp_t *fp);
static void reply(fxp_t *fp);
* fxp_watchdog_f *
*===========================================================================*/
static void fxp_watchdog_f(tp)
-timer_t *tp;
+minix_timer_t *tp;
{
fxp_t *fp;
#include <minix/syslib.h>
#include <minix/type.h>
#include <minix/sysutil.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <machine/pci.h>
#include <minix/ds.h>
#include <minix/endpoint.h>
static void print_linkstatus(t_or * orp, u16_t status);
static int or_get_recvd_packet(t_or *orp, u16_t rxfid, u8_t *databuf);
static void or_reset(void);
-static void or_watchdog_f(timer_t *tp);
+static void or_watchdog_f(minix_timer_t *tp);
static void setup_wepkey(t_or *orp, char *wepkey0);
static void do_hard_int(void);
static void check_int_events(void);
* Will be called regularly to see whether the driver has crashed. If that *
* condition is detected, reset the driver and card *
*****************************************************************************/
-static void or_watchdog_f(timer_t *tp)
+static void or_watchdog_f(minix_timer_t *tp)
{
t_or *orp;
static void dump_phy(re_t *rep);
#endif
static int rl_handler(re_t *rep);
-static void rl_watchdog_f(timer_t *tp);
+static void rl_watchdog_f(minix_timer_t *tp);
static void tell_dev(vir_bytes start, size_t size, int pci_bus, int
pci_dev, int pci_func);
* rl_watchdog_f *
*===========================================================================*/
static void rl_watchdog_f(tp)
-timer_t *tp;
+minix_timer_t *tp;
{
re_t *rep;
/* Use a synchronous alarm instead of a watchdog timer. */
#include <minix/type.h>
#include <minix/sysutil.h>
#include <minix/endpoint.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <net/hton.h>
#include <net/gen/ether.h>
#include <net/gen/eth_io.h>
#include <minix/type.h>
#include <minix/sysutil.h>
#include <minix/endpoint.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <net/hton.h>
#include <net/gen/ether.h>
#include <net/gen/eth_io.h>
static void do_hard_int(void);
static void dump_phy(const re_t *rep);
static void rl_handler(re_t *rep);
-static void rl_watchdog_f(timer_t *tp);
+static void rl_watchdog_f(minix_timer_t *tp);
/*
* The message used in the main loop is made global, so that rl_watchdog_f()
* rl_watchdog_f *
*===========================================================================*/
static void rl_watchdog_f(tp)
-timer_t *tp;
+minix_timer_t *tp;
{
re_t *rep;
/* Use a synchronous alarm instead of a watchdog timer. */
static void parse_escape(console_t *cons, int c);
static void scroll_screen(console_t *cons, int dir);
static void set_6845(int reg, unsigned val);
-static void stop_beep(timer_t *tmrp);
+static void stop_beep(minix_timer_t *tmrp);
static void cons_org0(void);
static void disable_console(void);
static void reenable_console(void);
* This routine works by turning on the bits 0 and 1 in port B of the 8255
* chip that drive the speaker.
*/
- static timer_t tmr_stop_beep;
+ static minix_timer_t tmr_stop_beep;
pvb_pair_t char_out[3];
u32_t port_b_val;
* This routine works by turning on the bits 0 and 1 in port B of the 8255
* chip that drive the speaker.
*/
- static timer_t tmr_stop_beep;
+ static minix_timer_t tmr_stop_beep;
pvb_pair_t char_out[3];
u32_t port_b_val;
/*===========================================================================*
* stop_beep *
*===========================================================================*/
-static void stop_beep(timer_t *UNUSED(tmrp))
+static void stop_beep(minix_timer_t *UNUSED(tmrp))
{
/* Turn off the beeper by turning off bits 0 and 1 in PORT_B. */
u32_t port_b_val;
static int kbd_alive= 1;
static long sticky_alt_mode = 0;
static long debug_fkeys = 1;
-static timer_t tmr_kbd_wd;
+static minix_timer_t tmr_kbd_wd;
static void kbc_cmd0(int cmd);
static void kbc_cmd1(int cmd, int data);
static void show_key_mappings(void);
static int kb_read(struct tty *tp, int try);
static unsigned map_key(int scode);
-static void kbd_watchdog(timer_t *tmrp);
+static void kbd_watchdog(minix_timer_t *tmrp);
static int kbd_open(devminor_t minor, int access, endpoint_t user_endpt);
static int kbd_close(devminor_t minor);
/*===========================================================================*
* kbd_watchdog *
*===========================================================================*/
-static void kbd_watchdog(timer_t *UNUSED(tmrp))
+static void kbd_watchdog(minix_timer_t *UNUSED(tmrp))
{
kbd_watchdog_set= 0;
struct kmessages kmess;
-static void tty_timed_out(timer_t *tp);
+static void tty_timed_out(minix_timer_t *tp);
static void settimer(tty_t *tty_ptr, int enable);
static void in_transfer(tty_t *tp);
static int tty_echo(tty_t *tp, int ch);
/*===========================================================================*
* tty_timed_out *
*===========================================================================*/
-static void tty_timed_out(timer_t *tp)
+static void tty_timed_out(minix_timer_t *tp)
{
/* This timer has expired. Set the events flag, to force processing. */
tty_t *tty_ptr;
/* tty.h - Terminals */
#include <minix/chardriver.h>
-#include <timers.h>
+#include <minix/timers.h>
#undef lock
#undef unlock
devfun_t tty_devread; /* routine to read from low level buffers */
devfun_t tty_icancel; /* cancel any device input */
int tty_min; /* minimum requested #chars in input queue */
- timer_t tty_tmr; /* the timer for this tty */
+ minix_timer_t tty_tmr; /* the timer for this tty */
/* Output section. */
devfun_t tty_devwrite; /* routine to start actual device output */
.if defined(__MINIX)
# MINIX Specific headers.
-INCS+= env.h fetch.h lib.h libutil.h timers.h varargs.h
+INCS+= env.h fetch.h lib.h libutil.h varargs.h
.endif
+/* This library provides generic watchdog timer management functionality.
+ * The functions operate on a timer queue provided by the caller. Note that
+ * the timers must use absolute time to allow sorting. The library provides:
+ *
+ * tmrs_settimer: (re)set a new watchdog timer in the timers queue
+ * tmrs_clrtimer: remove a timer from both the timers queue
+ * tmrs_exptimers: check for expired timers and run watchdog functions
+ *
+ * Author:
+ * Jorrit N. Herder <jnherder@cs.vu.nl>
+ * Adapted from tmr_settimer and tmr_clrtimer in src/kernel/clock.c.
+ * Last modified: September 30, 2004.
+ */
#ifndef _MINIX_TIMERS_H
#define _MINIX_TIMERS_H
+#include <limits.h>
+
+#include <sys/types.h>
+#include <minix/u64.h>
+#include <minix/minlib.h>
+#include <minix/endpoint.h>
+
+struct minix_timer;
+typedef void (*tmr_func_t)(struct minix_timer *tp);
+typedef union { int ta_int; long ta_long; void *ta_ptr; } tmr_arg_t;
+
+/* A minix_timer_t variable must be declare for each distinct timer to be used.
+ * The timers watchdog function and expiration time are automatically set
+ * by the library function tmrs_settimer, but its argument is not.
+ */
+typedef struct minix_timer
+{
+ struct minix_timer *tmr_next; /* next in a timer chain */
+ clock_t tmr_exp_time; /* expiration time */
+ tmr_func_t tmr_func; /* function to call when expired */
+ tmr_arg_t tmr_arg; /* random argument */
+} minix_timer_t;
+
+/* Used when the timer is not active. */
+#define TMR_NEVER ((clock_t) -1 < 0) ? ((clock_t) LONG_MAX) : ((clock_t) -1)
+#undef TMR_NEVER
+#define TMR_NEVER ((clock_t) LONG_MAX)
+
+/* These definitions can be used to set or get data from a timer variable. */
+#define tmr_arg(tp) (&(tp)->tmr_arg)
+#define tmr_exp_time(tp) (&(tp)->tmr_exp_time)
+
+/* Timers should be initialized once before they are being used. Be careful
+ * not to reinitialize a timer that is in a list of timers, or the chain
+ * will be broken.
+ */
+#define tmr_inittimer(tp) (void)((tp)->tmr_exp_time = TMR_NEVER, \
+ (tp)->tmr_next = NULL)
+
+/* The following generic timer management functions are available. They
+ * can be used to operate on the lists of timers. Adding a timer to a list
+ * automatically takes care of removing it.
+ */
+clock_t tmrs_clrtimer(minix_timer_t **tmrs, minix_timer_t *tp, clock_t *new_head);
+void tmrs_exptimers(minix_timer_t **tmrs, clock_t now, clock_t *new_head);
+clock_t tmrs_settimer(minix_timer_t **tmrs, minix_timer_t *tp, clock_t exp_time,
+ tmr_func_t watchdog, clock_t *new_head);
+
+#define PRINT_STATS(cum_spenttime, cum_instances) { \
+ if(ex64hi(cum_spenttime)) { util_stacktrace(); printf(" ( ??? %lu %lu)\n", \
+ ex64hi(cum_spenttime), ex64lo(cum_spenttime)); } \
+ printf("%s:%d,%lu,%lu\n", \
+ __FILE__, __LINE__, cum_instances, \
+ ex64lo(cum_spenttime)); \
+ }
+
+#define RESET_STATS(starttime, cum_instances, cum_spenttime, cum_starttime) { \
+ cum_instances = 0; \
+ cum_starttime = starttime; \
+ cum_spenttime = make64(0,0); \
+}
+
+#define TIME_BLOCK_VAR(timed_code_block, time_interval) do { \
+ static u64_t _cum_spenttime, _cum_starttime; \
+ static int _cum_instances; \
+ u64_t _next_cum_spent, _starttime, _endtime, _dt, _cum_dt; \
+ u32_t _dt_micros; \
+ read_tsc_64(&_starttime); \
+ do { timed_code_block } while(0); \
+ read_tsc_64(&_endtime); \
+ _dt = sub64(_endtime, _starttime); \
+ if(_cum_instances == 0) { \
+ RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
+ } \
+ _next_cum_spent = add64(_cum_spenttime, _dt); \
+ if(ex64hi(_next_cum_spent)) { \
+ PRINT_STATS(_cum_spenttime, _cum_instances); \
+ RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
+ } \
+ _cum_spenttime = add64(_cum_spenttime, _dt); \
+ _cum_instances++; \
+ _cum_dt = sub64(_endtime, _cum_starttime); \
+ if(cmp64(_cum_dt, make64(0, 120)) > 0) { \
+ PRINT_STATS(_cum_spenttime, _cum_instances); \
+ RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
+ } \
+} while(0)
+
+#define TIME_BLOCK(timed_code_block) TIME_BLOCK_VAR(timed_code_block, 100)
+#define TIME_BLOCK_T(timed_code_block, t) TIME_BLOCK_VAR(timed_code_block, t)
+
/* Timers abstraction for system processes. This would be in minix/sysutil.h
* if it weren't for naming conflicts.
*/
-#include <timers.h>
-
-void init_timer(timer_t *tp);
-void set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg);
-void cancel_timer(timer_t *tp);
+void init_timer(minix_timer_t *tp);
+void set_timer(minix_timer_t *tp, int ticks, tmr_func_t watchdog, int arg);
+void cancel_timer(minix_timer_t *tp);
void expire_timers(clock_t now);
#endif /* _MINIX_TIMERS_H */
#undef _BSD_CLOCKID_T_
#endif
-#ifndef __minix
#ifdef _BSD_TIMER_T_
typedef _BSD_TIMER_T_ timer_t;
#undef _BSD_TIMER_T_
#endif
-#endif /* !__minix */
#ifdef __minix
#define CLOCKS_PER_SEC 60
+++ /dev/null
-/* This library provides generic watchdog timer management functionality.
- * The functions operate on a timer queue provided by the caller. Note that
- * the timers must use absolute time to allow sorting. The library provides:
- *
- * tmrs_settimer: (re)set a new watchdog timer in the timers queue
- * tmrs_clrtimer: remove a timer from both the timers queue
- * tmrs_exptimers: check for expired timers and run watchdog functions
- *
- * Author:
- * Jorrit N. Herder <jnherder@cs.vu.nl>
- * Adapted from tmr_settimer and tmr_clrtimer in src/kernel/clock.c.
- * Last modified: September 30, 2004.
- */
-
-#ifndef _TIMERS_H
-#define _TIMERS_H
-
-#include <limits.h>
-
-#include <sys/types.h>
-#include <minix/u64.h>
-#include <minix/minlib.h>
-#include <minix/endpoint.h>
-
-struct timer;
-typedef void (*tmr_func_t)(struct timer *tp);
-typedef union { int ta_int; long ta_long; void *ta_ptr; } tmr_arg_t;
-
-/* A timer_t variable must be declare for each distinct timer to be used.
- * The timers watchdog function and expiration time are automatically set
- * by the library function tmrs_settimer, but its argument is not.
- */
-typedef struct timer
-{
- struct timer *tmr_next; /* next in a timer chain */
- clock_t tmr_exp_time; /* expiration time */
- tmr_func_t tmr_func; /* function to call when expired */
- tmr_arg_t tmr_arg; /* random argument */
-} timer_t;
-
-/* Used when the timer is not active. */
-#define TMR_NEVER ((clock_t) -1 < 0) ? ((clock_t) LONG_MAX) : ((clock_t) -1)
-#undef TMR_NEVER
-#define TMR_NEVER ((clock_t) LONG_MAX)
-
-/* These definitions can be used to set or get data from a timer variable. */
-#define tmr_arg(tp) (&(tp)->tmr_arg)
-#define tmr_exp_time(tp) (&(tp)->tmr_exp_time)
-
-/* Timers should be initialized once before they are being used. Be careful
- * not to reinitialize a timer that is in a list of timers, or the chain
- * will be broken.
- */
-#define tmr_inittimer(tp) (void)((tp)->tmr_exp_time = TMR_NEVER, \
- (tp)->tmr_next = NULL)
-
-/* The following generic timer management functions are available. They
- * can be used to operate on the lists of timers. Adding a timer to a list
- * automatically takes care of removing it.
- */
-clock_t tmrs_clrtimer(timer_t **tmrs, timer_t *tp, clock_t *new_head);
-void tmrs_exptimers(timer_t **tmrs, clock_t now, clock_t *new_head);
-clock_t tmrs_settimer(timer_t **tmrs, timer_t *tp, clock_t exp_time,
- tmr_func_t watchdog, clock_t *new_head);
-
-#define PRINT_STATS(cum_spenttime, cum_instances) { \
- if(ex64hi(cum_spenttime)) { util_stacktrace(); printf(" ( ??? %lu %lu)\n", \
- ex64hi(cum_spenttime), ex64lo(cum_spenttime)); } \
- printf("%s:%d,%lu,%lu\n", \
- __FILE__, __LINE__, cum_instances, \
- ex64lo(cum_spenttime)); \
- }
-
-#define RESET_STATS(starttime, cum_instances, cum_spenttime, cum_starttime) { \
- cum_instances = 0; \
- cum_starttime = starttime; \
- cum_spenttime = make64(0,0); \
-}
-
-#define TIME_BLOCK_VAR(timed_code_block, time_interval) do { \
- static u64_t _cum_spenttime, _cum_starttime; \
- static int _cum_instances; \
- u64_t _next_cum_spent, _starttime, _endtime, _dt, _cum_dt; \
- u32_t _dt_micros; \
- read_tsc_64(&_starttime); \
- do { timed_code_block } while(0); \
- read_tsc_64(&_endtime); \
- _dt = sub64(_endtime, _starttime); \
- if(_cum_instances == 0) { \
- RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
- } \
- _next_cum_spent = _cum_spenttime + _dt; \
- if(ex64hi(_next_cum_spent)) { \
- PRINT_STATS(_cum_spenttime, _cum_instances); \
- RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
- } \
- _cum_spenttime += _dt; \
- _cum_instances++; \
- _cum_dt = sub64(_endtime, _cum_starttime); \
- if(cmp64(_cum_dt, make64(0, 120)) > 0) { \
- PRINT_STATS(_cum_spenttime, _cum_instances); \
- RESET_STATS(_starttime, _cum_instances, _cum_spenttime, _cum_starttime); \
- } \
-} while(0)
-
-#define TIME_BLOCK(timed_code_block) TIME_BLOCK_VAR(timed_code_block, 100)
-#define TIME_BLOCK_T(timed_code_block, t) TIME_BLOCK_VAR(timed_code_block, t)
-
-#endif /* _TIMERS_H */
-
* 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,
}
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); }
*
* 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
*/
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.
}
/*===========================================================================*
- * 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 */
{
}
/*===========================================================================*
- * 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
#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>
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
*/
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
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 */
/* 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);
#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 */
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.
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;
#if USE_SETALARM
-static void cause_alarm(timer_t *tp);
+static void cause_alarm(minix_timer_t *tp);
/*===========================================================================*
* do_setalarm *
/* 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. */
/* 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);
}
/*===========================================================================*
* 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
#include "syslib.h"
#include <assert.h>
#include <machine/archtypes.h>
-#include <timers.h>
+#include <minix/timers.h>
#include "kernel/config.h"
#include "kernel/const.h"
#include "sysutil.h"
-#include <timers.h>
+#include <minix/timers.h>
/*===========================================================================*
* tickdelay *
*/
#include "syslib.h"
-#include <timers.h>
+#include <minix/timers.h>
#include <minix/sysutil.h>
-static timer_t *timers = NULL;
+static minix_timer_t *timers = NULL;
static int expiring = 0;
/*===========================================================================*
* init_timer *
*===========================================================================*/
-void init_timer(timer_t *tp)
+void init_timer(minix_timer_t *tp)
{
tmr_inittimer(tp);
}
/*===========================================================================*
* set_timer *
*===========================================================================*/
-void set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
+void set_timer(minix_timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
{
int r;
clock_t now, prev_time = 0, next_time;
/*===========================================================================*
* cancel_timer *
*===========================================================================*/
-void cancel_timer(timer_t *tp)
+void cancel_timer(minix_timer_t *tp)
{
clock_t next_time, prev_time;
prev_time = tmrs_clrtimer(&timers, tp, &next_time);
/* This library provides generic watchdog timer management functionality.
- * See the comments in <timers.h> for details.
+ * See the comments in <minix/timers.h> for details.
*/
-#include <timers.h> /* definitions and function prototypes */
+#include <minix/timers.h> /* definitions and function prototypes */
#include <sys/null.h>
* tmrs_clrtimer *
*===========================================================================*/
clock_t tmrs_clrtimer(tmrs, tp, next_time)
-timer_t **tmrs; /* pointer to timers queue */
-timer_t *tp; /* timer to be removed */
+minix_timer_t **tmrs; /* pointer to timers queue */
+minix_timer_t *tp; /* timer to be removed */
clock_t *next_time;
{
/* Deactivate a timer and remove it from the timers queue.
*/
- timer_t **atp;
+ minix_timer_t **atp;
clock_t prev_time;
if(*tmrs)
* tmrs_exptimers *
*===========================================================================*/
void tmrs_exptimers(tmrs, now, new_head)
-timer_t **tmrs; /* pointer to timers queue */
+minix_timer_t **tmrs; /* pointer to timers queue */
clock_t now; /* current time */
clock_t *new_head;
{
* Run the watchdog functions for all expired timers and deactivate them.
* The caller is responsible for scheduling a new alarm if needed.
*/
- timer_t *tp;
+ minix_timer_t *tp;
while ((tp = *tmrs) != NULL && tp->tmr_exp_time <= now) {
*tmrs = tp->tmr_next;
* tmrs_settimer *
*===========================================================================*/
clock_t tmrs_settimer(tmrs, tp, exp_time, watchdog, new_head)
-timer_t **tmrs; /* pointer to timers queue */
-timer_t *tp; /* the timer to be added */
+minix_timer_t **tmrs; /* pointer to timers queue */
+minix_timer_t *tp; /* the timer to be added */
clock_t exp_time; /* its expiration time */
tmr_func_t watchdog; /* watchdog function to be run */
clock_t *new_head; /* new earliest timer, if non NULL */
* in the list of active timers with the first to expire in front.
* The caller responsible for scheduling a new alarm for the timer if needed.
*/
- timer_t **atp;
+ minix_timer_t **atp;
clock_t old_head = 0;
if(*tmrs)
#include <stdio.h>
#include <string.h>
#include <lib.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <minix/callnr.h>
#include <minix/type.h>
#include <stdio.h>
#include <string.h>
#include <lib.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <minix/callnr.h>
#include <minix/type.h>
#include <stdio.h>
#include <string.h>
#include <lib.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <minix/callnr.h>
#include <minix/type.h>
static clock_t curr_time;
static clock_t prev_time;
-static timer_t *timer_chain;
+static minix_timer_t *timer_chain;
static time_t next_timeout;
-static void clck_fast_release(timer_t *timer);
+static void clck_fast_release(minix_timer_t *timer);
static void set_timer(void);
void clck_init()
}
void clck_timer(timer, timeout, func, fd)
-timer_t *timer;
+minix_timer_t *timer;
time_t timeout;
timer_func_t func;
int fd;
{
- timer_t *timer_index;
+ minix_timer_t *timer_index;
if (timer->tim_active)
clck_fast_release(timer);
}
static void clck_fast_release (timer)
-timer_t *timer;
+minix_timer_t *timer;
{
- timer_t *timer_index;
+ minix_timer_t *timer_index;
if (!timer->tim_active)
return;
}
void clck_untimer (timer)
-timer_t *timer;
+minix_timer_t *timer;
{
clck_fast_release (timer);
set_timer();
void clck_expire_timers()
{
time_t now;
- timer_t *timer_index;
+ minix_timer_t *timer_index;
clck_call_expire= 0;
struct arp_req
{
- timer_t ar_timer;
+ minix_timer_t ar_timer;
int ar_entry;
int ar_req_count;
} ap_req[AP_REQ_NR];
static int arp_putdata ARGS(( int fd, size_t offset,
acc_t *data, int for_ioctl ));
static void arp_main ARGS(( arp_port_t *arp_port ));
-static void arp_timeout ARGS(( int ref, timer_t *timer ));
+static void arp_timeout ARGS(( int ref, minix_timer_t *timer ));
static void setup_write ARGS(( arp_port_t *arp_port ));
static void setup_read ARGS(( arp_port_t *arp_port ));
static void do_reclist ARGS(( event_t *ev, ev_arg_t ev_arg ));
static void arp_timeout (ref, timer)
int ref;
-timer_t *timer;
+minix_timer_t *timer;
{
int i, port, reqind, acind;
arp_port_t *arp_port;
#ifndef CLOCK_H
#define CLOCK_H
-struct timer;
+struct minix_timer;
-typedef void (*timer_func_t) ARGS(( int fd, struct timer *timer ));
+typedef void (*timer_func_t) ARGS(( int fd, struct minix_timer *timer ));
-typedef struct timer
+typedef struct minix_timer
{
- struct timer *tim_next;
+ struct minix_timer *tim_next;
timer_func_t tim_func;
int tim_ref;
time_t tim_time;
int tim_active;
-} timer_t;
+} minix_timer_t;
extern int clck_call_expire; /* Call clck_expire_timer from the mainloop */
time_t get_time ARGS(( void ));
void reset_time ARGS(( void ));
/* set a timer to go off at the time specified by timeout */
-void clck_timer ARGS(( struct timer *timer, time_t timeout, timer_func_t func,
+void clck_timer ARGS(( minix_timer_t *timer, time_t timeout, timer_func_t func,
int fd ));
-void clck_untimer ARGS(( struct timer *timer ));
+void clck_untimer ARGS(( minix_timer_t *timer ));
void clck_expire_timers ARGS(( void ));
#endif /* CLOCK_H */
u16_t tc_mtu; /* discovered PMTU */
clock_t tc_mtutim; /* Last time MTU/TCF_PMTU flag was changed */
- struct timer tc_transmit_timer;
+ minix_timer_t tc_transmit_timer;
u32_t tc_transmit_seq;
clock_t tc_0wnd_to;
clock_t tc_stt; /* time of first send after last ack */
THIS_FILE
static acc_t *make_pack ARGS(( tcp_conn_t *tcp_conn ));
-static void tcp_send_timeout ARGS(( int conn, struct timer *timer ));
+static void tcp_send_timeout ARGS(( int conn, minix_timer_t *timer ));
static void do_snd_event ARGS(( event_t *ev, ev_arg_t arg ));
void tcp_conn_write (tcp_conn, enq)
static void tcp_send_timeout(conn, timer)
int conn;
-struct timer *timer;
+minix_timer_t *timer;
{
tcp_conn_t *tcp_conn;
u16_t mss, mss2;
/* Debugging dump procedures for the kernel. */
#include "inc.h"
-#include <timers.h>
+#include <minix/timers.h>
#include <assert.h>
#include <machine/interrupt.h>
#include <minix/endpoint.h>
#include "inc.h"
#include "../pm/mproc.h"
-#include <timers.h>
+#include <minix/timers.h>
#include <minix/config.h>
#include <minix/type.h>
*/
#include "inc.h"
-#include <timers.h>
+#include <minix/timers.h>
#include <minix/rs.h>
#include "kernel/priv.h"
#include "../rs/const.h"
#include "inc.h"
#include <sys/mman.h>
#include <minix/vm.h>
-#include <timers.h>
+#include <minix/timers.h>
#include "kernel/proc.h"
#define LINES 24
#include <unistd.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <sys/svrctl.h>
#include <minix/ds.h>
#include <minix/endpoint.h>
endpoint_t lwip_ep;
-static timer_t tcp_ftmr, tcp_stmr, arp_tmr;
+static minix_timer_t tcp_ftmr, tcp_stmr, arp_tmr;
static int arp_ticks, tcp_fticks, tcp_sticks;
static struct netif * netif_lo;
{
}
-static void arp_watchdog(__unused timer_t *tp)
+static void arp_watchdog(__unused minix_timer_t *tp)
{
etharp_tmr();
set_timer(&arp_tmr, arp_ticks, arp_watchdog, 0);
}
-static void tcp_fwatchdog(__unused timer_t *tp)
+static void tcp_fwatchdog(__unused minix_timer_t *tp)
{
tcp_fasttmr();
set_timer(&tcp_ftmr, tcp_fticks, tcp_fwatchdog, 0);
}
-static void tcp_swatchdog(__unused timer_t *tp)
+static void tcp_swatchdog(__unused minix_timer_t *tp)
{
tcp_slowtmr();
set_timer(&tcp_ftmr, tcp_sticks, tcp_swatchdog, 0);
itimerval *value, struct itimerval *ovalue);
static void get_realtimer(struct mproc *mp, struct itimerval *value);
static void set_realtimer(struct mproc *mp, struct itimerval *value);
-static void cause_sigalrm(struct timer *tp);
+static void cause_sigalrm(minix_timer_t *tp);
/*===========================================================================*
* ticks_from_timeval *
* cause_sigalrm *
*===========================================================================*/
static void cause_sigalrm(tp)
-struct timer *tp;
+minix_timer_t *tp;
{
int proc_nr_n;
register struct mproc *rmp;
* of corresponding slots referring to the same process in all three.
*/
#include <limits.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <signal.h>
#include <sys/cdefs.h>
char mp_padding[60]; /* align structure with new libc */
#endif
vir_bytes mp_sigreturn; /* address of C library __sigreturn function */
- struct timer mp_timer; /* watchdog timer for alarm(2), setitimer(2) */
+ minix_timer_t mp_timer; /* watchdog timer for alarm(2), setitimer(2) */
clock_t mp_interval[NR_ITIMERS]; /* setitimer(2) repetition intervals */
unsigned mp_flags; /* flag bits */
struct mem_map;
struct memory;
-#include <timers.h>
+#include <minix/timers.h>
/* alarm.c */
int do_alarm(void);
#include "mproc.h"
#include <machine/archtypes.h>
-#include <timers.h>
+#include <minix/timers.h>
#include "kernel/proc.h"
/*===========================================================================*
#include "param.h"
#include <minix/config.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <string.h>
#include <machine/archtypes.h>
#include "kernel/const.h"
#include <assert.h>
#include <fcntl.h>
#include <lib.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <dirent.h>
#include <minix/callnr.h>
#include <minix/priv.h>
#include <machine/archtypes.h>
-#include <timers.h> /* For priv.h */
+#include <minix/timers.h> /* For priv.h */
#include "kernel/priv.h"
#include "kernel/ipc.h"
/* Function prototypes. */
struct schedproc;
-#include <timers.h>
+#include <minix/timers.h>
/* main.c */
int main(void);
#include <machine/archtypes.h>
#include "kernel/proc.h" /* for queue constants */
-static timer_t sched_timer;
+static minix_timer_t sched_timer;
static unsigned balance_timeout;
#define BALANCE_TIMEOUT 5 /* how often to balance queues in seconds */
static int schedule_process(struct schedproc * rmp, unsigned flags);
-static void balance_queues(struct timer *tp);
+static void balance_queues(minix_timer_t *tp);
#define SCHEDULE_CHANGE_PRIO 0x1
#define SCHEDULE_CHANGE_QUANTUM 0x2
* quantum. This function will find all proccesses that have been bumped down,
* and pulls them back up. This default policy will soon be changed.
*/
-static void balance_queues(struct timer *tp)
+static void balance_queues(minix_timer_t *tp)
{
struct schedproc *rmp;
int proc_nr;
/* Function prototypes. */
-#include "timers.h"
+#include <minix/rs.h>
+#include <minix/timers.h>
+
#include "request.h"
-#include "tll.h"
#include "threads.h"
-#include <minix/rs.h>
+#include "tll.h"
/* Structs used in prototypes must be declared as such first. */
struct filp;
void select_forget(void);
void select_reply1(endpoint_t driver_e, int minor, int status);
void select_reply2(endpoint_t driver_e, int minor, int status);
-void select_timeout_check(timer_t *);
+void select_timeout_check(minix_timer_t *);
void select_unsuspend_by_endpt(endpoint_t proc);
/* worker.c */
char block;
char starting;
clock_t expiry;
- timer_t timer; /* if expiry > 0 */
+ minix_timer_t timer; /* if expiry > 0 */
} selecttab[MAXSELECTS];
static int copy_fdsets(struct selectentry *se, int nfds, int direction);
/*===========================================================================*
* select_timeout_check *
*===========================================================================*/
-void select_timeout_check(timer_t *timer)
+void select_timeout_check(minix_timer_t *timer)
{
/* An alarm has gone off for one of the select queries. This function MUST NOT
* block its calling thread.
#include <minix/endpoint.h>
#include <minix/safecopies.h>
#include <minix/vm.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <stdio.h>
#include "pt.h"
#define _BSD_SSIZE_T_ int /* byte count or error */
#define _BSD_TIME_T_ int /* time() */
#define _BSD_CLOCKID_T_ int /* clockid_t */
-#if !defined(__minix)
-/* Conflict with minix timer_t struct. */
#define _BSD_TIMER_T_ int /* timer_t */
-#endif /* !defined(__minix) */
#define _BSD_SUSECONDS_T_ int /* suseconds_t */
#define _BSD_USECONDS_T_ unsigned int /* useconds_t */
#define _BSD_WCHAR_T_ int /* wchar_t */
* @(#)ansi.h 8.2 (Berkeley) 1/4/94
*/
-/* These types are Minix specific. */
#ifndef _I386_ANSI_H_
#define _I386_ANSI_H_
#define _BSD_SSIZE_T_ int /* byte count or error */
#define _BSD_TIME_T_ int /* time() */
#define _BSD_CLOCKID_T_ int /* clockid_t */
-#if !defined(__minix)
-/* Conflict with minix timer_t struct. */
#define _BSD_TIMER_T_ int /* timer_t */
-#endif /* !defined(__minix) */
#define _BSD_SUSECONDS_T_ int /* suseconds_t */
#define _BSD_USECONDS_T_ unsigned int /* useconds_t */
#define _BSD_WCHAR_T_ int /* wchar_t */
int gettimeofday(struct timeval * __restrict, void *__restrict);
int setitimer(int, const struct itimerval * __restrict,
struct itimerval * __restrict) __RENAME(__setitimer50);
-#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
int utimes(const char *, const struct timeval [2]) __RENAME(__utimes50);
-#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */
#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
int adjtime(const struct timeval *, struct timeval *) __RENAME(__adjtime50);
#undef _BSD_CLOCKID_T_
#endif
-#ifndef __minix
-/* LSC: timer_t is defined as a struct on minix. */
#ifdef _BSD_TIMER_T_
typedef _BSD_TIMER_T_ timer_t;
#undef _BSD_TIMER_T_
#endif
-#endif
#ifdef _BSD_SUSECONDS_T_
typedef _BSD_SUSECONDS_T_ suseconds_t;
#include <unistd.h>
#include <pwd.h>
#include <curses.h>
-#include <timers.h>
+#include <minix/timers.h>
#include <stdlib.h>
#include <limits.h>
#include <termcap.h>