aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-05-04 02:15:23 +0000
committerlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-05-04 02:15:23 +0000
commitcc06ace9b4d16089d3a7fd53a56a667690da7d4e (patch)
tree445b20bc9b73ebb5f02d63853755ef29c1e4ced7
parentd5c89a66e742ee526b3e21f61b72b015dd4b8fee (diff)
downloadbusybox-w32-cc06ace9b4d16089d3a7fd53a56a667690da7d4e.tar.gz
busybox-w32-cc06ace9b4d16089d3a7fd53a56a667690da7d4e.tar.bz2
busybox-w32-cc06ace9b4d16089d3a7fd53a56a667690da7d4e.zip
Revert the uptime() removal. Let the list sort it out...
git-svn-id: svn://busybox.net/trunk/busybox@10247 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--networking/udhcp/arpping.c6
-rw-r--r--networking/udhcp/common.c8
-rw-r--r--networking/udhcp/common.h1
-rw-r--r--networking/udhcp/dhcpc.c4
4 files changed, 14 insertions, 5 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index da01ddd71..7cc2be42e 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -79,7 +79,7 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
79 79
80 /* wait arp reply, and check it */ 80 /* wait arp reply, and check it */
81 tm.tv_usec = 0; 81 tm.tv_usec = 0;
82 prevTime = time(NULL); 82 prevTime = uptime();
83 while (timeout > 0) { 83 while (timeout > 0) {
84 FD_ZERO(&fdset); 84 FD_ZERO(&fdset);
85 FD_SET(s, &fdset); 85 FD_SET(s, &fdset);
@@ -97,8 +97,8 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
97 break; 97 break;
98 } 98 }
99 } 99 }
100 timeout -= time(NULL) - prevTime; 100 timeout -= uptime() - prevTime;
101 prevTime = time(NULL); 101 prevTime = uptime();
102 } 102 }
103 close(s); 103 close(s);
104 DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V"); 104 DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V");
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 6ca7371d5..bf2ac4417 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -37,6 +37,14 @@
37 37
38static int daemonized; 38static int daemonized;
39 39
40long uptime(void)
41{
42 struct sysinfo info;
43 sysinfo(&info);
44 return info.uptime;
45}
46
47
40/* 48/*
41 * This function makes sure our first socket calls 49 * This function makes sure our first socket calls
42 * aren't going to fd 1 (printf badness...) and are 50 * aren't going to fd 1 (printf badness...) and are
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index cdc51cf8a..ca19a2497 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -39,6 +39,7 @@ enum syslog_levels {
39#include <syslog.h> 39#include <syslog.h>
40#endif 40#endif
41 41
42long uptime(void);
42void background(const char *pidfile); 43void background(const char *pidfile);
43void start_log_and_pid(const char *client_server, const char *pidfile); 44void start_log_and_pid(const char *client_server, const char *pidfile);
44void background(const char *pidfile); 45void background(const char *pidfile);
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 028338ff3..8009bec04 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -310,7 +310,7 @@ int main(int argc, char *argv[])
310 310
311 for (;;) { 311 for (;;) {
312 312
313 tv.tv_sec = timeout - time(NULL); 313 tv.tv_sec = timeout - uptime();
314 tv.tv_usec = 0; 314 tv.tv_usec = 0;
315 315
316 if (listen_mode != LISTEN_NONE && fd < 0) { 316 if (listen_mode != LISTEN_NONE && fd < 0) {
@@ -330,7 +330,7 @@ int main(int argc, char *argv[])
330 retval = select(max_fd + 1, &rfds, NULL, NULL, &tv); 330 retval = select(max_fd + 1, &rfds, NULL, NULL, &tv);
331 } else retval = 0; /* If we already timed out, fall through */ 331 } else retval = 0; /* If we already timed out, fall through */
332 332
333 now = time(NULL); 333 now = uptime();
334 if (retval == 0) { 334 if (retval == 0) {
335 /* timeout dropped to zero */ 335 /* timeout dropped to zero */
336 switch (state) { 336 switch (state) {