diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-23 10:52:52 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-23 10:52:52 +0000 |
commit | 6ee023cf629c83af8d10b383ab0780ec043f0785 (patch) | |
tree | 4ec08b459891bde261e36eef785e92eb71bac44c | |
parent | de4c5d3d8c77f0c1f68b72fff3d7e3be0dc2dec2 (diff) | |
download | busybox-w32-6ee023cf629c83af8d10b383ab0780ec043f0785.tar.gz busybox-w32-6ee023cf629c83af8d10b383ab0780ec043f0785.tar.bz2 busybox-w32-6ee023cf629c83af8d10b383ab0780ec043f0785.zip |
*: compile fixes for 64-bit build
-rw-r--r-- | console-tools/chvt.c | 7 | ||||
-rw-r--r-- | console-tools/deallocvt.c | 5 | ||||
-rw-r--r-- | findutils/find.c | 4 | ||||
-rw-r--r-- | networking/udhcp/socket.c | 2 | ||||
-rw-r--r-- | procps/top.c | 56 | ||||
-rw-r--r-- | runit/runit_lib.h | 6 |
6 files changed, 41 insertions, 39 deletions
diff --git a/console-tools/chvt.c b/console-tools/chvt.c index 86d3f2ddb..b1f81a20e 100644 --- a/console-tools/chvt.c +++ b/console-tools/chvt.c | |||
@@ -25,8 +25,9 @@ int chvt_main(int argc, char **argv) | |||
25 | } | 25 | } |
26 | 26 | ||
27 | fd = get_console_fd(); | 27 | fd = get_console_fd(); |
28 | num = xatoul_range(argv[1], 1, 63); | 28 | num = xatou_range(argv[1], 1, 63); |
29 | xioctl(fd, VT_ACTIVATE, (void *)num); | 29 | /* double cast suppresses "cast to ptr from int of different size */ |
30 | xioctl(fd, VT_WAITACTIVE, (void *)num); | 30 | xioctl(fd, VT_ACTIVATE, (void *)(ptrdiff_t)num); |
31 | xioctl(fd, VT_WAITACTIVE, (void *)(ptrdiff_t)num); | ||
31 | return EXIT_SUCCESS; | 32 | return EXIT_SUCCESS; |
32 | } | 33 | } |
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index a69026664..bf2bac186 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c | |||
@@ -23,7 +23,7 @@ int deallocvt_main(int argc, char **argv) | |||
23 | 23 | ||
24 | switch (argc) { | 24 | switch (argc) { |
25 | case 2: | 25 | case 2: |
26 | num = xatoul_range(argv[1], 1, 63); | 26 | num = xatou_range(argv[1], 1, 63); |
27 | /* Fallthrough */ | 27 | /* Fallthrough */ |
28 | case 1: | 28 | case 1: |
29 | break; | 29 | break; |
@@ -31,6 +31,7 @@ int deallocvt_main(int argc, char **argv) | |||
31 | bb_show_usage(); | 31 | bb_show_usage(); |
32 | } | 32 | } |
33 | 33 | ||
34 | xioctl(get_console_fd(), VT_DISALLOCATE, (void *)num); | 34 | /* double cast suppresses "cast to ptr from int of different size */ |
35 | xioctl(get_console_fd(), VT_DISALLOCATE, (void *)(ptrdiff_t)num); | ||
35 | return EXIT_SUCCESS; | 36 | return EXIT_SUCCESS; |
36 | } | 37 | } |
diff --git a/findutils/find.c b/findutils/find.c index 86f787d3f..21584681b 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -881,7 +881,9 @@ USE_FEATURE_FIND_MAXDEPTH(OPT_MAXDEPTH,) | |||
881 | fileAction, /* file action */ | 881 | fileAction, /* file action */ |
882 | fileAction, /* dir action */ | 882 | fileAction, /* dir action */ |
883 | #if ENABLE_FEATURE_FIND_MAXDEPTH | 883 | #if ENABLE_FEATURE_FIND_MAXDEPTH |
884 | (void*)maxdepth,/* user data */ | 884 | /* double cast suppresses |
885 | * "cast to ptr from int of different size" */ | ||
886 | (void*)(ptrdiff_t)maxdepth,/* user data */ | ||
885 | #else | 887 | #else |
886 | NULL, /* user data */ | 888 | NULL, /* user data */ |
887 | #endif | 889 | #endif |
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c index 79ddfb1e2..2cbd4aa88 100644 --- a/networking/udhcp/socket.c +++ b/networking/udhcp/socket.c | |||
@@ -91,7 +91,7 @@ int listen_socket(/*uint32_t ip,*/ int port, const char *inf) | |||
91 | struct ifreq interface; | 91 | struct ifreq interface; |
92 | struct sockaddr_in addr; | 92 | struct sockaddr_in addr; |
93 | 93 | ||
94 | DEBUG("Opening listen socket on 0x%08x:%d %s", ip, port, inf); | 94 | DEBUG("Opening listen socket on *:%d %s", port, inf); |
95 | fd = xsocket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); | 95 | fd = xsocket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); |
96 | 96 | ||
97 | setsockopt_reuseaddr(fd); | 97 | setsockopt_reuseaddr(fd); |
diff --git a/procps/top.c b/procps/top.c index 494509c7c..c02a959e0 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -212,6 +212,31 @@ static void do_stats(void) | |||
212 | } | 212 | } |
213 | #endif /* FEATURE_TOP_CPU_USAGE_PERCENTAGE */ | 213 | #endif /* FEATURE_TOP_CPU_USAGE_PERCENTAGE */ |
214 | 214 | ||
215 | #if ENABLE_FEATURE_TOP_CPU_GLOBAL_PERCENTS && ENABLE_FEATURE_TOP_DECIMALS | ||
216 | /* formats 7 char string (8 with terminating NUL) */ | ||
217 | static char *fmt_100percent_8(char pbuf[8], unsigned value, unsigned total) | ||
218 | { | ||
219 | unsigned t; | ||
220 | if (value >= total) { /* 100% ? */ | ||
221 | strcpy(pbuf, " 100% "); | ||
222 | return pbuf; | ||
223 | } | ||
224 | /* else generate " [N/space]N.N% " string */ | ||
225 | value = 1000 * value / total; | ||
226 | t = value / 100; | ||
227 | value = value % 100; | ||
228 | pbuf[0] = ' '; | ||
229 | pbuf[1] = t ? t + '0' : ' '; | ||
230 | pbuf[2] = '0' + (value / 10); | ||
231 | pbuf[3] = '.'; | ||
232 | pbuf[4] = '0' + (value % 10); | ||
233 | pbuf[5] = '%'; | ||
234 | pbuf[6] = ' '; | ||
235 | pbuf[7] = '\0'; | ||
236 | return pbuf; | ||
237 | } | ||
238 | #endif | ||
239 | |||
215 | /* display generic info (meminfo / loadavg) */ | 240 | /* display generic info (meminfo / loadavg) */ |
216 | static unsigned long display_generic(int scr_width) | 241 | static unsigned long display_generic(int scr_width) |
217 | { | 242 | { |
@@ -219,37 +244,10 @@ static unsigned long display_generic(int scr_width) | |||
219 | char buf[80]; | 244 | char buf[80]; |
220 | char scrbuf[80]; | 245 | char scrbuf[80]; |
221 | unsigned long total, used, mfree, shared, buffers, cached; | 246 | unsigned long total, used, mfree, shared, buffers, cached; |
222 | #if ENABLE_FEATURE_TOP_DECIMALS || ENABLE_FEATURE_TOP_CPU_GLOBAL_PERCENTS | 247 | #if ENABLE_FEATURE_TOP_CPU_GLOBAL_PERCENTS |
223 | unsigned total_diff; | 248 | unsigned total_diff; |
224 | #endif | 249 | #endif |
225 | 250 | ||
226 | #if ENABLE_FEATURE_TOP_DECIMALS | ||
227 | /* formats 7 char string (8 with terminating NUL) */ | ||
228 | /* using GCCism (nested function) - we need to access total_diff */ | ||
229 | /* This produces more than 100 bytes smaller code */ | ||
230 | char *fmt_100percent_8(char pbuf[8], unsigned value) | ||
231 | { | ||
232 | unsigned t; | ||
233 | if (value >= total_diff) { /* 100% ? */ | ||
234 | strcpy(pbuf, " 100% "); | ||
235 | return pbuf; | ||
236 | } | ||
237 | /* else generate " [N/space]N.N% " string */ | ||
238 | value = 1000 * value / total_diff; | ||
239 | t = value / 100; | ||
240 | value = value % 100; | ||
241 | pbuf[0] = ' '; | ||
242 | pbuf[1] = t ? t + '0' : ' '; | ||
243 | pbuf[2] = '0' + (value / 10); | ||
244 | pbuf[3] = '.'; | ||
245 | pbuf[4] = '0' + (value % 10); | ||
246 | pbuf[5] = '%'; | ||
247 | pbuf[6] = ' '; | ||
248 | pbuf[7] = '\0'; | ||
249 | return pbuf; | ||
250 | } | ||
251 | #endif | ||
252 | |||
253 | /* read memory info */ | 251 | /* read memory info */ |
254 | fp = xfopen("meminfo", "r"); | 252 | fp = xfopen("meminfo", "r"); |
255 | 253 | ||
@@ -316,7 +314,7 @@ static unsigned long display_generic(int scr_width) | |||
316 | #if ENABLE_FEATURE_TOP_DECIMALS | 314 | #if ENABLE_FEATURE_TOP_DECIMALS |
317 | /* Generated code is approx +0.3k */ | 315 | /* Generated code is approx +0.3k */ |
318 | #define CALC_STAT(xxx) char xxx[8] | 316 | #define CALC_STAT(xxx) char xxx[8] |
319 | #define SHOW_STAT(xxx) fmt_100percent_8(xxx, (unsigned)(jif.xxx - prev_jif.xxx)) | 317 | #define SHOW_STAT(xxx) fmt_100percent_8(xxx, (unsigned)(jif.xxx - prev_jif.xxx), total_diff) |
320 | #define FMT "%s" | 318 | #define FMT "%s" |
321 | #else | 319 | #else |
322 | #define CALC_STAT(xxx) unsigned xxx = 100 * (unsigned)(jif.xxx - prev_jif.xxx) / total_diff | 320 | #define CALC_STAT(xxx) unsigned xxx = 100 * (unsigned)(jif.xxx - prev_jif.xxx) / total_diff |
diff --git a/runit/runit_lib.h b/runit/runit_lib.h index c73befcb6..c644f5b9d 100644 --- a/runit/runit_lib.h +++ b/runit/runit_lib.h | |||
@@ -86,9 +86,9 @@ extern unsigned pmatch(const char *, const char *, unsigned); | |||
86 | * runsv / supervise / sv stuff | 86 | * runsv / supervise / sv stuff |
87 | */ | 87 | */ |
88 | typedef struct svstatus_t { | 88 | typedef struct svstatus_t { |
89 | uint64_t time_be64; | 89 | uint64_t time_be64 ATTRIBUTE_PACKED; |
90 | uint32_t time_nsec_be32; | 90 | uint32_t time_nsec_be32 ATTRIBUTE_PACKED; |
91 | uint32_t pid_le32; | 91 | uint32_t pid_le32 ATTRIBUTE_PACKED; |
92 | uint8_t paused; | 92 | uint8_t paused; |
93 | uint8_t want; | 93 | uint8_t want; |
94 | uint8_t got_term; | 94 | uint8_t got_term; |