aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-05-04 00:38:15 +0000
committerlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-05-04 00:38:15 +0000
commitd5c89a66e742ee526b3e21f61b72b015dd4b8fee (patch)
treecaa49bdf0255fe00bbf30f6f1b69b0054b23522f
parenteb517ff21bbafae787607eec02666786030c264e (diff)
downloadbusybox-w32-d5c89a66e742ee526b3e21f61b72b015dd4b8fee.tar.gz
busybox-w32-d5c89a66e742ee526b3e21f61b72b015dd4b8fee.tar.bz2
busybox-w32-d5c89a66e742ee526b3e21f61b72b015dd4b8fee.zip
Patch from Shaun Jackman:
Replace uptime with time(NULL). time is more portable than uptime and eliminates the need to define uptime, reducing code size slightly. git-svn-id: svn://busybox.net/trunk/busybox@10245 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, 5 insertions, 14 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index 7cc2be42e..da01ddd71 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 = uptime(); 82 prevTime = time(NULL);
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 -= uptime() - prevTime; 100 timeout -= time(NULL) - prevTime;
101 prevTime = uptime(); 101 prevTime = time(NULL);
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 bf2ac4417..6ca7371d5 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -37,14 +37,6 @@
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
48/* 40/*
49 * This function makes sure our first socket calls 41 * This function makes sure our first socket calls
50 * aren't going to fd 1 (printf badness...) and are 42 * aren't going to fd 1 (printf badness...) and are
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index ca19a2497..cdc51cf8a 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -39,7 +39,6 @@ enum syslog_levels {
39#include <syslog.h> 39#include <syslog.h>
40#endif 40#endif
41 41
42long uptime(void);
43void background(const char *pidfile); 42void background(const char *pidfile);
44void start_log_and_pid(const char *client_server, const char *pidfile); 43void start_log_and_pid(const char *client_server, const char *pidfile);
45void background(const char *pidfile); 44void background(const char *pidfile);
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 8009bec04..028338ff3 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 - uptime(); 313 tv.tv_sec = timeout - time(NULL);
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 = uptime(); 333 now = time(NULL);
334 if (retval == 0) { 334 if (retval == 0) {
335 /* timeout dropped to zero */ 335 /* timeout dropped to zero */
336 switch (state) { 336 switch (state) {