From: Lionel Sambuc Date: Thu, 19 Sep 2013 08:57:10 +0000 (+0200) Subject: Replacing timer_t by netbsd's timer_t X-Git-Tag: v3.3.0~561 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/index.css?a=commitdiff_plain;h=refs%2Fchanges%2F91%2F991%2F2;p=minix.git 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 --- diff --git a/commands/service/parse.c b/commands/service/parse.c index 342080ba0..389f268df 100644 --- a/commands/service/parse.c +++ b/commands/service/parse.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include "kernel/proc.h" #include "config.h" diff --git a/commands/service/print.c b/commands/service/print.c index 52ea796d5..7f42396ba 100644 --- a/commands/service/print.c +++ b/commands/service/print.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include "config.h" diff --git a/commands/service/service.c b/commands/service/service.c index b20b65a14..b1b05e5e7 100644 --- a/commands/service/service.c +++ b/commands/service/service.c @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include "kernel/proc.h" diff --git a/distrib/sets/lists/minix/mi b/distrib/sets/lists/minix/mi index 5e4512501..94db612f7 100644 --- a/distrib/sets/lists/minix/mi +++ b/distrib/sets/lists/minix/mi @@ -1487,7 +1487,7 @@ ./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 diff --git a/drivers/ahci/ahci.c b/drivers/ahci/ahci.c index 17a356502..d3acb5aa6 100644 --- a/drivers/ahci/ahci.c +++ b/drivers/ahci/ahci.c @@ -170,7 +170,7 @@ static struct port_state { 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) */ @@ -178,7 +178,7 @@ static struct port_state { 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]; @@ -232,7 +232,7 @@ static void port_set_cmd(struct port_state *ps, int cmd, cmd_fis_t *fis, 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); @@ -1712,7 +1712,7 @@ static void port_intr(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. diff --git a/drivers/e1000/e1000.c b/drivers/e1000/e1000.c index 47f21f026..9d719a2e3 100644 --- a/drivers/e1000/e1000.c +++ b/drivers/e1000/e1000.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include "assert.h" #include "e1000.h" diff --git a/drivers/floppy/floppy.c b/drivers/floppy/floppy.c index d36c52cc2..1b95108dc 100644 --- a/drivers/floppy/floppy.c +++ b/drivers/floppy/floppy.c @@ -23,7 +23,7 @@ */ #include "floppy.h" -#include +#include #include #include #include @@ -212,7 +212,7 @@ static struct floppy { /* main drive struct, one entry per drive */ 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]; @@ -236,11 +236,11 @@ static u8_t f_results[MAX_RESULTS];/* the controller can give lots of output */ * 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); @@ -785,7 +785,7 @@ static void start_motor(void) /*===========================================================================* * 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. @@ -1199,7 +1199,7 @@ static int f_intr_wait(void) /*===========================================================================* * 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 diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index 077c8b2ea..19f82be44 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -18,7 +18,7 @@ #include #include -#include +#include #define debug 0 #define RAND_UPDATE /**/ @@ -141,7 +141,7 @@ static int fxp_instance; static fxp_t *fxp_state; -static timer_t fxp_watchdog; +static minix_timer_t fxp_watchdog; static u32_t system_hz; @@ -170,7 +170,7 @@ static void fxp_restart_ru(fxp_t *fp); 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); @@ -1627,7 +1627,7 @@ static void fxp_check_ints(fxp_t *fp) * fxp_watchdog_f * *===========================================================================*/ static void fxp_watchdog_f(tp) -timer_t *tp; +minix_timer_t *tp; { fxp_t *fp; diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index 682da5f60..87d960ce9 100644 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -149,7 +149,7 @@ static void or_getstat_s(message * mp); 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); @@ -1092,7 +1092,7 @@ next: * 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; diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 68c71661d..e04221165 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -91,7 +91,7 @@ static void rtl8139_dump(message *m); 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); @@ -1969,7 +1969,7 @@ static int rl_handler(re_t *rep) * 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. */ diff --git a/drivers/rtl8139/rtl8139.h b/drivers/rtl8139/rtl8139.h index 9a4766a22..85d472ce2 100644 --- a/drivers/rtl8139/rtl8139.h +++ b/drivers/rtl8139/rtl8139.h @@ -18,7 +18,7 @@ Created: Aug 2003 by Philip Homburg #include #include #include -#include +#include #include #include #include diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index 94f758034..ecbd76afa 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -223,7 +223,7 @@ static void check_int_events(void); 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() @@ -1888,7 +1888,7 @@ static void rl_handler(re_t *rep) * 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. */ diff --git a/drivers/tty/arch/i386/console.c b/drivers/tty/arch/i386/console.c index d8034190c..ab880b7fd 100644 --- a/drivers/tty/arch/i386/console.c +++ b/drivers/tty/arch/i386/console.c @@ -123,7 +123,7 @@ static void flush(console_t *cons); 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); @@ -789,7 +789,7 @@ static void beep() * 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; @@ -885,7 +885,7 @@ clock_t dur; * 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; @@ -914,7 +914,7 @@ clock_t dur; /*===========================================================================* * 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; diff --git a/drivers/tty/arch/i386/keyboard.c b/drivers/tty/arch/i386/keyboard.c index 60e98378d..4dc8649f0 100644 --- a/drivers/tty/arch/i386/keyboard.c +++ b/drivers/tty/arch/i386/keyboard.c @@ -151,7 +151,7 @@ static int kbd_watchdog_set= 0; 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); @@ -166,7 +166,7 @@ static void set_leds(void); 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); @@ -1323,7 +1323,7 @@ int *isauxp; /*===========================================================================* * kbd_watchdog * *===========================================================================*/ -static void kbd_watchdog(timer_t *UNUSED(tmrp)) +static void kbd_watchdog(minix_timer_t *UNUSED(tmrp)) { kbd_watchdog_set= 0; diff --git a/drivers/tty/tty.c b/drivers/tty/tty.c index cd61f21e7..b0c910a6f 100644 --- a/drivers/tty/tty.c +++ b/drivers/tty/tty.c @@ -63,7 +63,7 @@ unsigned long rs_irq_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); @@ -1608,7 +1608,7 @@ static void tty_init() /*===========================================================================* * 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; diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h index f83a980f7..bc6826295 100644 --- a/drivers/tty/tty.h +++ b/drivers/tty/tty.h @@ -1,7 +1,7 @@ /* tty.h - Terminals */ #include -#include +#include #undef lock #undef unlock @@ -42,7 +42,7 @@ typedef struct tty { 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 */ diff --git a/include/Makefile b/include/Makefile index b9f00bbe5..fa4125d71 100644 --- a/include/Makefile +++ b/include/Makefile @@ -39,7 +39,7 @@ INCS+= ieeefp.h .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 diff --git a/include/minix/timers.h b/include/minix/timers.h index e30701e24..482975e29 100644 --- a/include/minix/timers.h +++ b/include/minix/timers.h @@ -1,15 +1,117 @@ +/* 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 + * 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 + +#include +#include +#include +#include + +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 - -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 */ diff --git a/include/time.h b/include/time.h index 711297140..3a6a5a9a6 100644 --- a/include/time.h +++ b/include/time.h @@ -65,12 +65,10 @@ typedef _BSD_CLOCKID_T_ clockid_t; #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 diff --git a/include/timers.h b/include/timers.h deleted file mode 100644 index 683dca923..000000000 --- a/include/timers.h +++ /dev/null @@ -1,110 +0,0 @@ -/* 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 - * Adapted from tmr_settimer and tmr_clrtimer in src/kernel/clock.c. - * Last modified: September 30, 2004. - */ - -#ifndef _TIMERS_H -#define _TIMERS_H - -#include - -#include -#include -#include -#include - -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 */ - diff --git a/kernel/arch/earm/pre_init.c b/kernel/arch/earm/pre_init.c index 153ec9b5e..4bb133c4d 100644 --- a/kernel/arch/earm/pre_init.c +++ b/kernel/arch/earm/pre_init.c @@ -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, diff --git a/kernel/arch/i386/pre_init.c b/kernel/arch/i386/pre_init.c index 6a53ec9c8..2a9967ac8 100644 --- a/kernel/arch/i386/pre_init.c +++ b/kernel/arch/i386/pre_init.c @@ -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); } diff --git a/kernel/clock.c b/kernel/clock.c index 545198b68..0c71d701c 100644 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -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 operate on this. +/* The CLOCK's timers queue. The functions in 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 diff --git a/kernel/kernel.h b/kernel/kernel.h index f38c22737..f49043279 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -29,7 +29,7 @@ #include /* MINIX specific types, e.g. message */ #include /* MINIX run-time system */ #include /* MINIX utility library functions */ -#include /* watchdog timer management */ +#include /* watchdog timer management */ #include /* return codes and error numbers */ #include #include diff --git a/kernel/main.c b/kernel/main.c index b1c8e2a9a..dd0886ad6 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -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 diff --git a/kernel/priv.h b/kernel/priv.h index f053c3b59..204dacd46 100644 --- a/kernel/priv.h +++ b/kernel/priv.h @@ -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 */ diff --git a/kernel/proto.h b/kernel/proto.h index a26f9cb56..6ebe443b4 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -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 */ diff --git a/kernel/system/do_clear.c b/kernel/system/do_clear.c index f2f8fd8c9..5a9abf9a5 100644 --- a/kernel/system/do_clear.c +++ b/kernel/system/do_clear.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. diff --git a/kernel/system/do_privctl.c b/kernel/system/do_privctl.c index 10cae1c4b..2d3cb15b5 100644 --- a/kernel/system/do_privctl.c +++ b/kernel/system/do_privctl.c @@ -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; diff --git a/kernel/system/do_setalarm.c b/kernel/system/do_setalarm.c index bcfde2fda..fe065ccbc 100644 --- a/kernel/system/do_setalarm.c +++ b/kernel/system/do_setalarm.c @@ -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 diff --git a/lib/libsys/sched_start.c b/lib/libsys/sched_start.c index ce0122670..ee72d38c5 100644 --- a/lib/libsys/sched_start.c +++ b/lib/libsys/sched_start.c @@ -1,7 +1,7 @@ #include "syslib.h" #include #include -#include +#include #include "kernel/config.h" #include "kernel/const.h" diff --git a/lib/libsys/tickdelay.c b/lib/libsys/tickdelay.c index c47a2cf65..1f5d50b93 100644 --- a/lib/libsys/tickdelay.c +++ b/lib/libsys/tickdelay.c @@ -1,5 +1,5 @@ #include "sysutil.h" -#include +#include /*===========================================================================* * tickdelay * diff --git a/lib/libsys/timers.c b/lib/libsys/timers.c index 7cf67b920..178286fba 100644 --- a/lib/libsys/timers.c +++ b/lib/libsys/timers.c @@ -12,16 +12,16 @@ */ #include "syslib.h" -#include +#include #include -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); } @@ -29,7 +29,7 @@ void init_timer(timer_t *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; @@ -51,7 +51,7 @@ void set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg) /*===========================================================================* * 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); diff --git a/lib/libtimers/timers.h b/lib/libtimers/timers.h index 78a8833a4..794c0124d 100644 --- a/lib/libtimers/timers.h +++ b/lib/libtimers/timers.h @@ -1,6 +1,6 @@ /* This library provides generic watchdog timer management functionality. - * See the comments in for details. + * See the comments in for details. */ -#include /* definitions and function prototypes */ +#include /* definitions and function prototypes */ #include diff --git a/lib/libtimers/tmrs_clr.c b/lib/libtimers/tmrs_clr.c index 5b97570b3..2d0b0f6a7 100644 --- a/lib/libtimers/tmrs_clr.c +++ b/lib/libtimers/tmrs_clr.c @@ -4,13 +4,13 @@ * 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) diff --git a/lib/libtimers/tmrs_exp.c b/lib/libtimers/tmrs_exp.c index 6ad353cc1..d54ca839f 100644 --- a/lib/libtimers/tmrs_exp.c +++ b/lib/libtimers/tmrs_exp.c @@ -4,7 +4,7 @@ * 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; { @@ -12,7 +12,7 @@ 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; diff --git a/lib/libtimers/tmrs_set.c b/lib/libtimers/tmrs_set.c index 71e56a9f5..6d1cf709c 100644 --- a/lib/libtimers/tmrs_set.c +++ b/lib/libtimers/tmrs_set.c @@ -4,8 +4,8 @@ * 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 */ @@ -15,7 +15,7 @@ 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) diff --git a/servers/devman/buf.c b/servers/devman/buf.c index e7f0024e5..961e7f769 100755 --- a/servers/devman/buf.c +++ b/servers/devman/buf.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include diff --git a/servers/devman/devman.h b/servers/devman/devman.h index df8cd6282..dff8d7c69 100644 --- a/servers/devman/devman.h +++ b/servers/devman/devman.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include diff --git a/servers/devman/main.c b/servers/devman/main.c index 78521cdc1..91477ff9f 100644 --- a/servers/devman/main.c +++ b/servers/devman/main.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include diff --git a/servers/inet/clock.c b/servers/inet/clock.c index 7c1b37b45..fa51929db 100644 --- a/servers/inet/clock.c +++ b/servers/inet/clock.c @@ -16,10 +16,10 @@ int clck_call_expire; 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() @@ -66,12 +66,12 @@ void reset_time() } 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); @@ -111,9 +111,9 @@ message *mess; } 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; @@ -158,7 +158,7 @@ static void set_timer() } void clck_untimer (timer) -timer_t *timer; +minix_timer_t *timer; { clck_fast_release (timer); set_timer(); @@ -167,7 +167,7 @@ timer_t *timer; void clck_expire_timers() { time_t now; - timer_t *timer_index; + minix_timer_t *timer_index; clck_call_expire= 0; diff --git a/servers/inet/generic/arp.c b/servers/inet/generic/arp.c index 2b68997ed..6fe6ad4a8 100644 --- a/servers/inet/generic/arp.c +++ b/servers/inet/generic/arp.c @@ -77,7 +77,7 @@ typedef struct arp_port struct arp_req { - timer_t ar_timer; + minix_timer_t ar_timer; int ar_entry; int ar_req_count; } ap_req[AP_REQ_NR]; @@ -139,7 +139,7 @@ static acc_t *arp_getdata ARGS(( int fd, size_t offset, 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 )); @@ -1193,7 +1193,7 @@ put_userdata_t put_userdata; 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; diff --git a/servers/inet/generic/clock.h b/servers/inet/generic/clock.h index a0f69a0a5..61d4232ed 100644 --- a/servers/inet/generic/clock.h +++ b/servers/inet/generic/clock.h @@ -7,18 +7,18 @@ Copyright 1995 Philip Homburg #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 */ @@ -27,9 +27,9 @@ void set_time ARGS(( clock_t time )); 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 */ diff --git a/servers/inet/generic/tcp_int.h b/servers/inet/generic/tcp_int.h index 58cf174a2..b20e74f24 100644 --- a/servers/inet/generic/tcp_int.h +++ b/servers/inet/generic/tcp_int.h @@ -160,7 +160,7 @@ typedef struct tcp_conn 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 */ diff --git a/servers/inet/generic/tcp_send.c b/servers/inet/generic/tcp_send.c index d437d57a5..044641b4b 100644 --- a/servers/inet/generic/tcp_send.c +++ b/servers/inet/generic/tcp_send.c @@ -20,7 +20,7 @@ Copyright 1995 Philip Homburg 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) @@ -812,7 +812,7 @@ tcp_send_timeout 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; diff --git a/servers/is/dmp_kernel.c b/servers/is/dmp_kernel.c index e8ed5b6f1..6c6a318b2 100644 --- a/servers/is/dmp_kernel.c +++ b/servers/is/dmp_kernel.c @@ -1,7 +1,7 @@ /* Debugging dump procedures for the kernel. */ #include "inc.h" -#include +#include #include #include #include diff --git a/servers/is/dmp_pm.c b/servers/is/dmp_pm.c index 7dfe1d3d3..c1d724d23 100644 --- a/servers/is/dmp_pm.c +++ b/servers/is/dmp_pm.c @@ -9,7 +9,7 @@ #include "inc.h" #include "../pm/mproc.h" -#include +#include #include #include diff --git a/servers/is/dmp_rs.c b/servers/is/dmp_rs.c index be6652834..f71145d71 100644 --- a/servers/is/dmp_rs.c +++ b/servers/is/dmp_rs.c @@ -8,7 +8,7 @@ */ #include "inc.h" -#include +#include #include #include "kernel/priv.h" #include "../rs/const.h" diff --git a/servers/is/dmp_vm.c b/servers/is/dmp_vm.c index 70c14c1b1..c94459935 100644 --- a/servers/is/dmp_vm.c +++ b/servers/is/dmp_vm.c @@ -3,7 +3,7 @@ #include "inc.h" #include #include -#include +#include #include "kernel/proc.h" #define LINES 24 diff --git a/servers/lwip/lwip.c b/servers/lwip/lwip.c index c7f75a85d..00bee12ae 100644 --- a/servers/lwip/lwip.c +++ b/servers/lwip/lwip.c @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -25,7 +25,7 @@ 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; @@ -38,19 +38,19 @@ static void sys_init(void) { } -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); diff --git a/servers/pm/alarm.c b/servers/pm/alarm.c index 177304401..b7fb28935 100644 --- a/servers/pm/alarm.c +++ b/servers/pm/alarm.c @@ -26,7 +26,7 @@ static void getset_vtimer(struct mproc *mp, int nwhich, struct 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 * @@ -345,7 +345,7 @@ clock_t ticks; /* how many ticks delay before the signal */ * cause_sigalrm * *===========================================================================*/ static void cause_sigalrm(tp) -struct timer *tp; +minix_timer_t *tp; { int proc_nr_n; register struct mproc *rmp; diff --git a/servers/pm/mproc.h b/servers/pm/mproc.h index 80afb4eba..62a7c66b2 100644 --- a/servers/pm/mproc.h +++ b/servers/pm/mproc.h @@ -5,7 +5,7 @@ * of corresponding slots referring to the same process in all three. */ #include -#include +#include #include #include @@ -50,7 +50,7 @@ EXTERN struct mproc { 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 */ diff --git a/servers/pm/proto.h b/servers/pm/proto.h index 6ee81edf6..9789a9cd6 100644 --- a/servers/pm/proto.h +++ b/servers/pm/proto.h @@ -5,7 +5,7 @@ struct stat; struct mem_map; struct memory; -#include +#include /* alarm.c */ int do_alarm(void); diff --git a/servers/pm/schedule.c b/servers/pm/schedule.c index a35c89fb1..976d6ab88 100644 --- a/servers/pm/schedule.c +++ b/servers/pm/schedule.c @@ -11,7 +11,7 @@ #include "mproc.h" #include -#include +#include #include "kernel/proc.h" /*===========================================================================* diff --git a/servers/pm/utility.c b/servers/pm/utility.c index 0ebe296e1..b41da9526 100644 --- a/servers/pm/utility.c +++ b/servers/pm/utility.c @@ -22,7 +22,7 @@ #include "param.h" #include -#include +#include #include #include #include "kernel/const.h" diff --git a/servers/procfs/inc.h b/servers/procfs/inc.h index 342694a60..da784d16f 100644 --- a/servers/procfs/inc.h +++ b/servers/procfs/inc.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include diff --git a/servers/rs/inc.h b/servers/rs/inc.h index ecc518df4..676b2aa80 100644 --- a/servers/rs/inc.h +++ b/servers/rs/inc.h @@ -38,7 +38,7 @@ #include #include -#include /* For priv.h */ +#include /* For priv.h */ #include "kernel/priv.h" #include "kernel/ipc.h" diff --git a/servers/sched/proto.h b/servers/sched/proto.h index 0e1287331..a4262e247 100644 --- a/servers/sched/proto.h +++ b/servers/sched/proto.h @@ -1,7 +1,7 @@ /* Function prototypes. */ struct schedproc; -#include +#include /* main.c */ int main(void); diff --git a/servers/sched/schedule.c b/servers/sched/schedule.c index 65fd5523c..1a01436a3 100644 --- a/servers/sched/schedule.c +++ b/servers/sched/schedule.c @@ -14,13 +14,13 @@ #include #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 @@ -348,7 +348,7 @@ void init_scheduling(void) * 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; diff --git a/servers/vfs/proto.h b/servers/vfs/proto.h index 8da3eef1e..0197dc22e 100644 --- a/servers/vfs/proto.h +++ b/servers/vfs/proto.h @@ -3,11 +3,12 @@ /* Function prototypes. */ -#include "timers.h" +#include +#include + #include "request.h" -#include "tll.h" #include "threads.h" -#include +#include "tll.h" /* Structs used in prototypes must be declared as such first. */ struct filp; @@ -357,7 +358,7 @@ void select_callback(struct filp *, int ops); 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 */ diff --git a/servers/vfs/select.c b/servers/vfs/select.c index e831afc28..975166b37 100644 --- a/servers/vfs/select.c +++ b/servers/vfs/select.c @@ -45,7 +45,7 @@ static struct selectentry { 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); @@ -704,7 +704,7 @@ void select_forget(void) /*===========================================================================* * 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. diff --git a/servers/vm/proto.h b/servers/vm/proto.h index 995a99e6d..869bfc8a9 100644 --- a/servers/vm/proto.h +++ b/servers/vm/proto.h @@ -10,7 +10,7 @@ struct phys_region; #include #include #include -#include +#include #include #include "pt.h" diff --git a/sys/arch/arm/include/ansi.h b/sys/arch/arm/include/ansi.h index d76b6a049..13ca1bac4 100644 --- a/sys/arch/arm/include/ansi.h +++ b/sys/arch/arm/include/ansi.h @@ -55,10 +55,7 @@ #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 */ diff --git a/sys/arch/i386/include/ansi.h b/sys/arch/i386/include/ansi.h index 4f5e2ecc8..a7fe07d42 100644 --- a/sys/arch/i386/include/ansi.h +++ b/sys/arch/i386/include/ansi.h @@ -31,7 +31,6 @@ * @(#)ansi.h 8.2 (Berkeley) 1/4/94 */ -/* These types are Minix specific. */ #ifndef _I386_ANSI_H_ #define _I386_ANSI_H_ @@ -55,10 +54,7 @@ #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 */ diff --git a/sys/sys/time.h b/sys/sys/time.h index bfb2a89bc..ff688bc07 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -281,10 +281,8 @@ int getitimer(int, struct itimerval *) __RENAME(__getitimer50); 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); diff --git a/sys/sys/types.h b/sys/sys/types.h index a62c541d0..4b0abc350 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -324,13 +324,10 @@ typedef _BSD_CLOCKID_T_ clockid_t; #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; diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index b82c69157..a6e5654e5 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include