static void set_timer()
{
time_t new_time;
- time_t curr_time;
+ time_t now;
if (!timer_chain)
return;
- curr_time= get_time();
+ now= get_time();
new_time= timer_chain->tim_time;
- if (new_time <= curr_time)
+ if (new_time <= now)
{
clck_call_expire= 1;
return;
if (next_timeout == 0 || new_time < next_timeout)
{
next_timeout= new_time;
- new_time -= curr_time;
+ new_time -= now;
if (sys_setalarm(new_time, 0) != OK)
ip_panic(("can't set timer"));
void clck_expire_timers()
{
- time_t curr_time;
+ time_t now;
timer_t *timer_index;
clck_call_expire= 0;
if (timer_chain == NULL)
return;
- curr_time= get_time();
- while (timer_chain && timer_chain->tim_time<=curr_time)
+ now= get_time();
+ while (timer_chain && timer_chain->tim_time<=now)
{
assert(timer_chain->tim_active);
timer_chain->tim_active= 0;
+
+#include <assert.h>
+
/*
assert.h
void bad_assertion(char *file, int line, char *what) _NORETURN;
void bad_compare(char *file, int line, int lhs, char *what, int rhs) _NORETURN;
-#define assert(x) ((void)(!(x) ? bad_assertion(this_file, __LINE__, \
- #x),0 : 0))
-#define compare(a,t,b) (!((a) t (b)) ? bad_compare(this_file, __LINE__, \
- (a), #a " " #t " " #b, (b)) : (void) 0)
+#define compare(a,t,b) assert((a) t (b))
#else /* NDEBUG */
-#define assert(x) 0
#define compare(a,t,b) 0
#endif /* NDEBUG */
}
#endif /* BUF_CONSISTENCY_CHECK */
+__dead
static void ip_bad_callback(ip_port)
struct ip_port *ip_port;
{
static void ds_event()
{
char key[DS_MAX_KEYLEN];
- char *driver_prefix = "drv.net.";
+ char *driver_prefix = (char *) "drv.net.";
char *label;
u32_t value;
int type;
printf("panic at %s, %d: ", file, line);
}
-void inet_panic()
+__dead
+void inet_panic(void)
{
printf("\ninet stacktrace: ");
util_stacktrace();
}
#if !NDEBUG
+__dead
void bad_assertion(file, line, what)
char *file;
int line;
{
panic0(file, line);
printf("assertion \"%s\" failed", what);
- panic();
+ panic("help");
}
+__dead
void bad_compare(file, line, lhs, what, rhs)
char *file;
int line;
{
panic0(file, line);
printf("compare (%d) %s (%d) failed", lhs, what, rhs);
- panic();
+ panic("help");
}
#endif /* !NDEBUG */
#define PRIVATE static
#define FORWARD static
-#define THIS_FILE static char *this_file= __FILE__;
+#define THIS_FILE
+#define this_file __FILE__
void panic0(char *file, int line);
void inet_panic(void) _NORETURN;
+#if 0
#define ip_panic(print_list) \
- (panic0(this_file, __LINE__), printf print_list, panic())
+ (panic0(this_file, __LINE__), printf print_list, panic())
#define panic() inet_panic()
+#else
+#define ip_panic(print_list) do { panic print_list; } while(0)
+#endif
#if DEBUG
#define ip_warning(print_list) \
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/cdefs.h>
#include <minix/type.h>
#include <minix/sysutil.h>
#include <minix/syslib.h>
static u8_t iftype[IP_PORT_MAX]; /* Interface in use as? */
static int ifdefault= -1; /* Default network interface. */
-static void fatal(char *label)
+__dead
+static void fatal(char *label)
{
printf("init: %s: %s\n", label, strerror(errno));
exit(1);
mode_t mode;
u8_t minor_off;
} devlist[] = {
- { "/dev/eth", 0600, ETH_DEV_OFF },
- { "/dev/psip", 0600, PSIP_DEV_OFF },
- { "/dev/ip", 0600, IP_DEV_OFF },
- { "/dev/tcp", 0666, TCP_DEV_OFF },
- { "/dev/udp", 0666, UDP_DEV_OFF },
+ { (char *) "/dev/eth", 0600, ETH_DEV_OFF },
+ { (char *) "/dev/psip", 0600, PSIP_DEV_OFF },
+ { (char *) "/dev/ip", 0600, IP_DEV_OFF },
+ { (char *) "/dev/tcp", 0666, TCP_DEV_OFF },
+ { (char *) "/dev/udp", 0666, UDP_DEV_OFF },
};
struct devlist *dvp;
int i;
static unsigned char line[256], *lineptr;
static unsigned linenr;
+__dead
static void error(void)
{
printf("inet: error on line %u\n", linenr);
/* See what the device number of /dev/ip is. That's what we
* used last time for the network devices, so we keep doing so.
*/
- if (stat("/dev/ip", &st) < 0) fatal("/dev/ip");
+ if (stat("/dev/ip", &st) < 0) fatal((char *) "/dev/ip");
ip_dev= st.st_rdev;
for (i= 0; i < IP_PORT_MAX; i++) {
#define INET__INET_CONFIG_H
/* Inet configuration file. */
-#define PATH_INET_CONF "/etc/inet.conf"
+#define PATH_INET_CONF (char *) "/etc/inet.conf"
#define IP_PORT_MAX 32 /* Up to this many network devices */
extern int eth_conf_nr; /* Number of ethernets */
/* To compute the minor device number for a device on an interface. */
#define if2minor(ifno, dev) (1 + (ifno) * 8 + (dev))
-#define IPSTAT_DEV "/dev/ipstat"
+#define IPSTAT_DEV (char *) "/dev/ipstat"
#define IPSTAT_MODE 0666 /* Is this right? What about just setuid apps */
#define IPSTAT_MINOR 0 /* Minor number of /dev/ipstat */
epl= ep->list;
while (c != 0 && c != ',') {
- prefix= "x";
+ prefix= (char *) "x";
n= 0;
for (;;) {
};
#ifdef __STDC__
-#define qp_stringize(var) #var
-#define qp_dotstringize(var) "." #var
+#define qp_stringize(var) (char *) #var
+#define qp_dotstringize(var) "." (char *) #var
#else
#define qp_stringize(var) "var"
#define qp_dotstringize(var) ".var"
#endif
#define QP_VARIABLE(var) { qp_stringize(var), &(var), sizeof(var) }
-#define QP_ARRAY(var) { "[", 0, sizeof((var)[0]) }
+#define QP_ARRAY(var) { (char *) "[", 0, sizeof((var)[0]) }
#define QP_VECTOR(var,ptr,len) { qp_stringize(var), &(ptr), -1 },\
- { "[", &(len), sizeof(*(ptr)) }
+ { (char *) "[", &(len), sizeof(*(ptr)) }
#define QP_FIELD(field, type) { qp_dotstringize(field), \
(void *)offsetof(type, field), \
sizeof(((type *)0)->field) }