aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/common.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-07-03 15:47:50 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-07-03 15:47:50 +0000
commit42b3dea9bfb8ac595c71089ee23012f44dd43eb2 (patch)
treeb7b86d06a574d2af72bc79536d399905b5619959 /networking/udhcp/common.c
parent54e19da86d5496ec5f5787b85a2b6342be1d63d4 (diff)
downloadbusybox-w32-42b3dea9bfb8ac595c71089ee23012f44dd43eb2.tar.gz
busybox-w32-42b3dea9bfb8ac595c71089ee23012f44dd43eb2.tar.bz2
busybox-w32-42b3dea9bfb8ac595c71089ee23012f44dd43eb2.zip
udhcp: many small fixes:
* arpping(): smaller and even probably fixed * lots of variables/params converted: ulong -> uint32_t * uptime() nuked in favor of monotonic_sec() * udhcp_get_packet(): only one "bad vendor", simplify function old new delta reservedIp 36 35 -1 udhcpc_main 2462 2460 -2 addStaticLease 64 62 -2 static.broken_vendors 16 - -16 uptime 19 - -19 udhcpd_main 1273 1238 -35 udhcp_get_packet 223 184 -39 .rodata 144162 144106 -56 arpping 690 609 -81 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/7 up/down: 0/-251) Total: -251 bytes text data bss dec hex filename 734241 3028 14400 751669 b7835 busybox_old 734005 3028 14400 751433 b7749 busybox_unstripped
Diffstat (limited to 'networking/udhcp/common.c')
-rw-r--r--networking/udhcp/common.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 76f8bf703..108ab2e95 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -10,31 +10,10 @@
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
11 */ 11 */
12 12
13#include <syslog.h>
14
15#include "common.h" 13#include "common.h"
16 14
17
18const uint8_t MAC_BCAST_ADDR[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 15const uint8_t MAC_BCAST_ADDR[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
19 16
20long uptime(void)
21{
22 struct sysinfo info;
23 sysinfo(&info);
24 return info.uptime;
25}
26
27static void create_pidfile(const char *pidfile)
28{
29 if (!pidfile)
30 return;
31
32 if (!write_pidfile(pidfile)) {
33 bb_perror_msg("cannot create pidfile %s", pidfile);
34 return;
35 }
36}
37
38void udhcp_make_pidfile(const char *pidfile) 17void udhcp_make_pidfile(const char *pidfile)
39{ 18{
40 /* Make sure fd 0,1,2 are open */ 19 /* Make sure fd 0,1,2 are open */
@@ -44,7 +23,8 @@ void udhcp_make_pidfile(const char *pidfile)
44 setlinebuf(stdout); 23 setlinebuf(stdout);
45 24
46 /* Create pidfile */ 25 /* Create pidfile */
47 create_pidfile(pidfile); 26 if (pidfile && !write_pidfile(pidfile))
27 bb_perror_msg("cannot create pidfile %s", pidfile);
48 28
49 bb_info_msg("%s (v%s) started", applet_name, BB_VER); 29 bb_info_msg("%s (v%s) started", applet_name, BB_VER);
50} 30}