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
This commit is contained in:
Denis Vlasenko
2007-07-03 15:47:50 +00:00
parent 54e19da86d
commit 42b3dea9bf
11 changed files with 177 additions and 185 deletions

View File

@@ -10,31 +10,10 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <syslog.h>
#include "common.h"
const uint8_t MAC_BCAST_ADDR[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
long uptime(void)
{
struct sysinfo info;
sysinfo(&info);
return info.uptime;
}
static void create_pidfile(const char *pidfile)
{
if (!pidfile)
return;
if (!write_pidfile(pidfile)) {
bb_perror_msg("cannot create pidfile %s", pidfile);
return;
}
}
void udhcp_make_pidfile(const char *pidfile)
{
/* Make sure fd 0,1,2 are open */
@@ -44,7 +23,8 @@ void udhcp_make_pidfile(const char *pidfile)
setlinebuf(stdout);
/* Create pidfile */
create_pidfile(pidfile);
if (pidfile && !write_pidfile(pidfile))
bb_perror_msg("cannot create pidfile %s", pidfile);
bb_info_msg("%s (v%s) started", applet_name, BB_VER);
}