summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-02-23 20:09:03 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-02-23 20:09:03 +0000
commitb8d587ae1d792a414ad08ab28ec3dcfe0b4e7076 (patch)
tree2e5421540092bd7ca2810ed15d1cf51a47d99760 /sbin
parent02a010c7592c7087bd8e0d8dae930ae6fddb9e17 (diff)
remove time_t related crud; henning ok
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dhclient/dhclient.c10
-rw-r--r--sbin/dhclient/dhcpd.h46
-rw-r--r--sbin/dhclient/dispatch.c8
-rw-r--r--sbin/dhclient/osdep.h8
-rw-r--r--sbin/dhclient/parse.c6
-rw-r--r--sbin/dhclient/tree.c12
-rw-r--r--sbin/dhclient/tree.h6
7 files changed, 47 insertions, 49 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 4d1ae26a229..e46da94f249 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.9 2004/02/10 13:12:48 henning Exp $ */
+/* $OpenBSD: dhclient.c,v 1.10 2004/02/23 20:09:02 deraadt Exp $ */
/* DHCP Client. */
@@ -71,9 +71,9 @@
#define CLIENT_PATH "PATH=/usr/bin:/usr/sbin:/bin:/sbin"
-TIME cur_time;
-TIME default_lease_time = 43200; /* 12 hours... */
-TIME max_lease_time = 86400; /* 24 hours... */
+time_t cur_time;
+time_t default_lease_time = 43200; /* 12 hours... */
+time_t max_lease_time = 86400; /* 24 hours... */
struct tree_cache *global_options[256];
char *path_dhclient_conf = _PATH_DHCLIENT_CONF;
@@ -296,7 +296,7 @@ main(int argc, char *argv[])
remote_port = htons(ntohs(local_port) - 1); /* XXX */
/* Get the current time... */
- GET_TIME(&cur_time);
+ time(&cur_time);
memset(&sockaddr_broadcast, 0, sizeof(sockaddr_broadcast));
sockaddr_broadcast.sin_family = AF_INET;
diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h
index 2975b214322..70a57f7692e 100644
--- a/sbin/dhclient/dhcpd.h
+++ b/sbin/dhclient/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.8 2004/02/23 19:51:15 henning Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.9 2004/02/23 20:09:02 deraadt Exp $ */
/* Definitions for dhcpd... */
@@ -75,14 +75,14 @@ struct string_list {
struct name_server {
struct name_server *next;
struct sockaddr_in addr;
- TIME rcdate;
+ time_t rcdate;
};
/* A domain search list element. */
struct domain_search_list {
struct domain_search_list *next;
char *domain;
- TIME rcdate;
+ time_t rcdate;
};
/* A dhcp packet and the pointers to its option values. */
@@ -117,7 +117,7 @@ struct lease {
struct lease *waitq_next;
struct iaddr ip_addr;
- TIME starts, ends, timestamp;
+ time_t starts, ends, timestamp;
unsigned char *uid;
int uid_len;
int uid_max;
@@ -147,7 +147,7 @@ struct lease_state {
struct interface_info *ip;
- TIME offered_expiry;
+ time_t offered_expiry;
struct tree_cache *options[256];
u_int32_t expiry, renewal, rebind;
@@ -197,10 +197,10 @@ struct group {
struct subnet *subnet;
struct shared_network *shared_network;
- TIME default_lease_time;
- TIME max_lease_time;
- TIME bootp_lease_cutoff;
- TIME bootp_lease_length;
+ time_t default_lease_time;
+ time_t max_lease_time;
+ time_t bootp_lease_cutoff;
+ time_t bootp_lease_length;
char *filename;
char *server_name;
@@ -262,7 +262,7 @@ struct class {
/* DHCP client lease structure... */
struct client_lease {
struct client_lease *next; /* Next lease in list. */
- TIME expiry, renewal, rebind; /* Lease timeouts. */
+ time_t expiry, renewal, rebind; /* Lease timeouts. */
struct iaddr address; /* Address being leased. */
char *server_name; /* Name of boot server. */
char *filename; /* Name of file we're supposed to boot. */
@@ -300,22 +300,22 @@ struct client_config {
u_int8_t required_options[256]; /* Options server must supply. */
u_int8_t requested_options[256]; /* Options to request from server. */
int requested_option_count; /* Number of requested options. */
- TIME timeout; /* Start to panic if we don't get a
+ time_t timeout; /* Start to panic if we don't get a
lease in this time period when
SELECTING. */
- TIME initial_interval; /* All exponential backoff intervals
+ time_t initial_interval; /* All exponential backoff intervals
start here. */
- TIME retry_interval; /* If the protocol failed to produce
+ time_t retry_interval; /* If the protocol failed to produce
an address before the timeout,
try the protocol again after this
many seconds. */
- TIME select_interval; /* Wait this many seconds from the
+ time_t select_interval; /* Wait this many seconds from the
first DHCPDISCOVER before
picking an offered lease. */
- TIME reboot_timeout; /* When in INIT-REBOOT, wait this
+ time_t reboot_timeout; /* When in INIT-REBOOT, wait this
long before giving up and going
to INIT. */
- TIME backoff_cutoff; /* When doing exponential backoff,
+ time_t backoff_cutoff; /* When doing exponential backoff,
never back off to an interval
longer than this amount. */
struct string_list *media; /* Possible network media values. */
@@ -340,8 +340,8 @@ struct client_state {
struct iaddr destination; /* Where to send packet. */
u_int32_t xid; /* Transaction ID. */
u_int16_t secs; /* secs value from DHCPDISCOVER. */
- TIME first_sending; /* When was first copy sent? */
- TIME interval; /* What's the current resend interval? */
+ time_t first_sending; /* When was first copy sent? */
+ time_t interval; /* What's the current resend interval? */
struct string_list *medium; /* Last media type tried. */
struct dhcp_packet packet; /* Outgoing DHCP packet. */
@@ -396,7 +396,7 @@ struct hardware_link {
struct timeout {
struct timeout *next;
- TIME when;
+ time_t when;
void (*func)(void *);
void *what;
};
@@ -475,11 +475,11 @@ char *parse_string(FILE *);
char *parse_host_name(FILE *);
int parse_ip_addr(FILE *, struct iaddr *);
void parse_hardware_param(FILE *, struct hardware *);
-void parse_lease_time(FILE *, TIME *);
+void parse_lease_time(FILE *, time_t *);
unsigned char *parse_numeric_aggregate(FILE *, unsigned char *, int *,
int, int, int);
void convert_num(unsigned char *, char *, int, int);
-TIME parse_date(FILE *);
+time_t parse_date(FILE *);
/* tree.c */
pair cons(caddr_t, pair);
@@ -563,7 +563,7 @@ struct interface_info *setup_fallback(void);
void reinitialize_interfaces(void);
void dispatch(void);
void got_one(struct protocol *);
-void add_timeout(TIME, void (*)(void *), void *);
+void add_timeout(time_t, void (*)(void *), void *);
void cancel_timeout(void (*)(void *), void *);
void add_protocol(char *, int, void (*)(struct protocol *), void *);
void remove_protocol(struct protocol *);
@@ -607,7 +607,7 @@ extern char *path_dhclient_conf;
extern char *path_dhclient_db;
extern char *path_dhclient_pid;
extern int interfaces_requested;
-extern TIME cur_time;
+extern time_t cur_time;
extern u_int16_t local_port;
extern int log_priority;
extern int log_perror;
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c
index 8cd0b500029..c293f3c9896 100644
--- a/sbin/dhclient/dispatch.c
+++ b/sbin/dhclient/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.10 2004/02/23 19:19:12 henning Exp $ */
+/* $OpenBSD: dispatch.c,v 1.11 2004/02/23 20:09:02 deraadt Exp $ */
/* Network input dispatcher... */
@@ -364,7 +364,7 @@ another:
/* Not likely to be transitory... */
if (count == -1) {
if (errno == EAGAIN || errno == EINTR) {
- GET_TIME(&cur_time);
+ time(&cur_time);
continue;
}
else
@@ -372,7 +372,7 @@ another:
}
/* Get the current time... */
- GET_TIME(&cur_time);
+ time(&cur_time);
i = 0;
for (l = protocols; l; l = l->next) {
@@ -500,7 +500,7 @@ active:
}
void
-add_timeout(TIME when, void (*where)(void *), void *what)
+add_timeout(time_t when, void (*where)(void *), void *what)
{
struct timeout *t, *q;
diff --git a/sbin/dhclient/osdep.h b/sbin/dhclient/osdep.h
index 056495a0588..59022fc8411 100644
--- a/sbin/dhclient/osdep.h
+++ b/sbin/dhclient/osdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: osdep.h,v 1.9 2004/02/23 18:33:57 henning Exp $ */
+/* $OpenBSD: osdep.h,v 1.10 2004/02/23 20:09:02 deraadt Exp $ */
/* Operating system dependencies... */
@@ -56,6 +56,8 @@ extern int h_errno;
#include <net/route.h>
#include <sys/sockio.h>
+#include <sys/time.h>
+
#define ifr_netmask ifr_addr
/* Varargs stuff... */
@@ -64,10 +66,6 @@ extern int h_errno;
#define EOL '\n'
#define VOIDPTR void *
-/* Time stuff... */
-#include <sys/time.h>
-#define TIME time_t
-#define GET_TIME(x) time ((x))
#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
#define PTRSIZE_64BIT
diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c
index c166a0bafc5..b270a843d8a 100644
--- a/sbin/dhclient/parse.c
+++ b/sbin/dhclient/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.5 2004/02/07 13:59:45 henning Exp $ */
+/* $OpenBSD: parse.c,v 1.6 2004/02/23 20:09:02 deraadt Exp $ */
/* Common parser code for dhcpd and dhclient. */
@@ -266,7 +266,7 @@ parse_hardware_param(FILE *cfile, struct hardware *hardware)
* lease-time :== NUMBER SEMI
*/
void
-parse_lease_time(FILE *cfile, TIME *timep)
+parse_lease_time(FILE *cfile, time_t *timep)
{
char *val;
int token;
@@ -486,7 +486,7 @@ convert_num(unsigned char *buf, char *str, int base, int size)
* year/month/day; next is hours:minutes:seconds on a 24-hour
* clock.
*/
-TIME
+time_t
parse_date(FILE *cfile)
{
struct tm tm;
diff --git a/sbin/dhclient/tree.c b/sbin/dhclient/tree.c
index 37431bedb28..e14977ca750 100644
--- a/sbin/dhclient/tree.c
+++ b/sbin/dhclient/tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tree.c,v 1.5 2004/02/07 13:59:45 henning Exp $ */
+/* $OpenBSD: tree.c,v 1.6 2004/02/23 20:09:02 deraadt Exp $ */
/* Routines for manipulating parse trees... */
@@ -42,9 +42,9 @@
#include "dhcpd.h"
-static TIME tree_evaluate_recurse(
+static time_t tree_evaluate_recurse(
int *, unsigned char **, int *, struct tree *);
-static TIME do_host_lookup(
+static time_t do_host_lookup(
int *, unsigned char **, int *, struct dns_host_entry *);
static void do_data_copy(
int *, unsigned char **, int *, unsigned char *, int);
@@ -236,12 +236,12 @@ tree_evaluate(struct tree_cache *tree_cache)
return (1);
}
-static TIME
+static time_t
tree_evaluate_recurse(int *bufix, unsigned char **bufp, int *bufcount,
struct tree *tree)
{
int limit;
- TIME t1, t2;
+ time_t t1, t2;
switch (tree->op) {
case TREE_CONCAT:
@@ -278,7 +278,7 @@ tree_evaluate_recurse(int *bufix, unsigned char **bufp, int *bufcount,
}
}
-static TIME
+static time_t
do_host_lookup(int *bufix, unsigned char **bufp, int *bufcount,
struct dns_host_entry *dns)
{
diff --git a/sbin/dhclient/tree.h b/sbin/dhclient/tree.h
index 42ea06d5f8e..6d4ea17bb58 100644
--- a/sbin/dhclient/tree.h
+++ b/sbin/dhclient/tree.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tree.h,v 1.3 2004/02/07 13:26:35 henning Exp $ */
+/* $OpenBSD: tree.h,v 1.4 2004/02/23 20:09:02 deraadt Exp $ */
/* Definitions for address trees... */
@@ -79,14 +79,14 @@ struct dns_host_entry {
unsigned char *data;
int data_len;
int buf_len;
- TIME timeout;
+ time_t timeout;
};
struct tree_cache {
unsigned char *value;
int len;
int buf_size;
- TIME timeout;
+ time_t timeout;
struct tree *tree;
int flags;
#define TC_AWAITING_RESOLUTION 1