mirror of
https://github.com/sheumann/hush.git
synced 2024-11-19 23:31:39 +00:00
*: compile fixes for 64-bit build
This commit is contained in:
parent
de4c5d3d8c
commit
6ee023cf62
@ -25,8 +25,9 @@ int chvt_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fd = get_console_fd();
|
fd = get_console_fd();
|
||||||
num = xatoul_range(argv[1], 1, 63);
|
num = xatou_range(argv[1], 1, 63);
|
||||||
xioctl(fd, VT_ACTIVATE, (void *)num);
|
/* double cast suppresses "cast to ptr from int of different size */
|
||||||
xioctl(fd, VT_WAITACTIVE, (void *)num);
|
xioctl(fd, VT_ACTIVATE, (void *)(ptrdiff_t)num);
|
||||||
|
xioctl(fd, VT_WAITACTIVE, (void *)(ptrdiff_t)num);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ int deallocvt_main(int argc, char **argv)
|
|||||||
|
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
case 2:
|
case 2:
|
||||||
num = xatoul_range(argv[1], 1, 63);
|
num = xatou_range(argv[1], 1, 63);
|
||||||
/* Fallthrough */
|
/* Fallthrough */
|
||||||
case 1:
|
case 1:
|
||||||
break;
|
break;
|
||||||
@ -31,6 +31,7 @@ int deallocvt_main(int argc, char **argv)
|
|||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
xioctl(get_console_fd(), VT_DISALLOCATE, (void *)num);
|
/* double cast suppresses "cast to ptr from int of different size */
|
||||||
|
xioctl(get_console_fd(), VT_DISALLOCATE, (void *)(ptrdiff_t)num);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -881,7 +881,9 @@ USE_FEATURE_FIND_MAXDEPTH(OPT_MAXDEPTH,)
|
|||||||
fileAction, /* file action */
|
fileAction, /* file action */
|
||||||
fileAction, /* dir action */
|
fileAction, /* dir action */
|
||||||
#if ENABLE_FEATURE_FIND_MAXDEPTH
|
#if ENABLE_FEATURE_FIND_MAXDEPTH
|
||||||
(void*)maxdepth,/* user data */
|
/* double cast suppresses
|
||||||
|
* "cast to ptr from int of different size" */
|
||||||
|
(void*)(ptrdiff_t)maxdepth,/* user data */
|
||||||
#else
|
#else
|
||||||
NULL, /* user data */
|
NULL, /* user data */
|
||||||
#endif
|
#endif
|
||||||
|
@ -91,7 +91,7 @@ int listen_socket(/*uint32_t ip,*/ int port, const char *inf)
|
|||||||
struct ifreq interface;
|
struct ifreq interface;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
|
|
||||||
DEBUG("Opening listen socket on 0x%08x:%d %s", ip, port, inf);
|
DEBUG("Opening listen socket on *:%d %s", port, inf);
|
||||||
fd = xsocket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
fd = xsocket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
|
|
||||||
setsockopt_reuseaddr(fd);
|
setsockopt_reuseaddr(fd);
|
||||||
|
38
procps/top.c
38
procps/top.c
@ -212,30 +212,17 @@ static void do_stats(void)
|
|||||||
}
|
}
|
||||||
#endif /* FEATURE_TOP_CPU_USAGE_PERCENTAGE */
|
#endif /* FEATURE_TOP_CPU_USAGE_PERCENTAGE */
|
||||||
|
|
||||||
/* display generic info (meminfo / loadavg) */
|
#if ENABLE_FEATURE_TOP_CPU_GLOBAL_PERCENTS && ENABLE_FEATURE_TOP_DECIMALS
|
||||||
static unsigned long display_generic(int scr_width)
|
/* formats 7 char string (8 with terminating NUL) */
|
||||||
|
static char *fmt_100percent_8(char pbuf[8], unsigned value, unsigned total)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
|
||||||
char buf[80];
|
|
||||||
char scrbuf[80];
|
|
||||||
unsigned long total, used, mfree, shared, buffers, cached;
|
|
||||||
#if ENABLE_FEATURE_TOP_DECIMALS || ENABLE_FEATURE_TOP_CPU_GLOBAL_PERCENTS
|
|
||||||
unsigned total_diff;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLE_FEATURE_TOP_DECIMALS
|
|
||||||
/* formats 7 char string (8 with terminating NUL) */
|
|
||||||
/* using GCCism (nested function) - we need to access total_diff */
|
|
||||||
/* This produces more than 100 bytes smaller code */
|
|
||||||
char *fmt_100percent_8(char pbuf[8], unsigned value)
|
|
||||||
{
|
|
||||||
unsigned t;
|
unsigned t;
|
||||||
if (value >= total_diff) { /* 100% ? */
|
if (value >= total) { /* 100% ? */
|
||||||
strcpy(pbuf, " 100% ");
|
strcpy(pbuf, " 100% ");
|
||||||
return pbuf;
|
return pbuf;
|
||||||
}
|
}
|
||||||
/* else generate " [N/space]N.N% " string */
|
/* else generate " [N/space]N.N% " string */
|
||||||
value = 1000 * value / total_diff;
|
value = 1000 * value / total;
|
||||||
t = value / 100;
|
t = value / 100;
|
||||||
value = value % 100;
|
value = value % 100;
|
||||||
pbuf[0] = ' ';
|
pbuf[0] = ' ';
|
||||||
@ -247,7 +234,18 @@ static unsigned long display_generic(int scr_width)
|
|||||||
pbuf[6] = ' ';
|
pbuf[6] = ' ';
|
||||||
pbuf[7] = '\0';
|
pbuf[7] = '\0';
|
||||||
return pbuf;
|
return pbuf;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* display generic info (meminfo / loadavg) */
|
||||||
|
static unsigned long display_generic(int scr_width)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
char buf[80];
|
||||||
|
char scrbuf[80];
|
||||||
|
unsigned long total, used, mfree, shared, buffers, cached;
|
||||||
|
#if ENABLE_FEATURE_TOP_CPU_GLOBAL_PERCENTS
|
||||||
|
unsigned total_diff;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* read memory info */
|
/* read memory info */
|
||||||
@ -316,7 +314,7 @@ static unsigned long display_generic(int scr_width)
|
|||||||
#if ENABLE_FEATURE_TOP_DECIMALS
|
#if ENABLE_FEATURE_TOP_DECIMALS
|
||||||
/* Generated code is approx +0.3k */
|
/* Generated code is approx +0.3k */
|
||||||
#define CALC_STAT(xxx) char xxx[8]
|
#define CALC_STAT(xxx) char xxx[8]
|
||||||
#define SHOW_STAT(xxx) fmt_100percent_8(xxx, (unsigned)(jif.xxx - prev_jif.xxx))
|
#define SHOW_STAT(xxx) fmt_100percent_8(xxx, (unsigned)(jif.xxx - prev_jif.xxx), total_diff)
|
||||||
#define FMT "%s"
|
#define FMT "%s"
|
||||||
#else
|
#else
|
||||||
#define CALC_STAT(xxx) unsigned xxx = 100 * (unsigned)(jif.xxx - prev_jif.xxx) / total_diff
|
#define CALC_STAT(xxx) unsigned xxx = 100 * (unsigned)(jif.xxx - prev_jif.xxx) / total_diff
|
||||||
|
@ -86,9 +86,9 @@ extern unsigned pmatch(const char *, const char *, unsigned);
|
|||||||
* runsv / supervise / sv stuff
|
* runsv / supervise / sv stuff
|
||||||
*/
|
*/
|
||||||
typedef struct svstatus_t {
|
typedef struct svstatus_t {
|
||||||
uint64_t time_be64;
|
uint64_t time_be64 ATTRIBUTE_PACKED;
|
||||||
uint32_t time_nsec_be32;
|
uint32_t time_nsec_be32 ATTRIBUTE_PACKED;
|
||||||
uint32_t pid_le32;
|
uint32_t pid_le32 ATTRIBUTE_PACKED;
|
||||||
uint8_t paused;
|
uint8_t paused;
|
||||||
uint8_t want;
|
uint8_t want;
|
||||||
uint8_t got_term;
|
uint8_t got_term;
|
||||||
|
Loading…
Reference in New Issue
Block a user