This is funky since the pagesize could be less than 1K.
Note: Some machines express getrusage statistics in terms of K,
others in terms of pages. */
-static unsigned long ptok(unsigned pagesize, unsigned long pages)
+static unsigned long ptok(const unsigned pagesize, const unsigned long pages)
{
unsigned long tmp;
printf("%lu", ptok(pagesize, (UL) resp->ru.ru_ixrss) / cpu_ticks);
break;
case 'Z': /* Page size. */
- printf("%u", getpagesize());
+ printf("%u", pagesize);
break;
case 'c': /* Involuntary context switches. */
printf("%lu", resp->ru.ru_nivcsw);
void (*quit_signal)(int);
resp->elapsed_ms = monotonic_us() / 1000;
- pid = xvfork(); /* Run CMD as child process. */
+ pid = vfork(); /* Run CMD as child process. */
+ if (pid < 0)
+ bb_perror_msg_and_die("fork");
if (pid == 0) { /* If child. */
/* Don't cast execvp arguments; that causes errors on some systems,
versus merely warnings if the cast is left off. */
}
int time_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int time_main(int argc ATTRIBUTE_UNUSED, char **argv)
+int time_main(int argc UNUSED_PARAM, char **argv)
{
resource_t res;
const char *output_format = default_format;
int opt;
+ opt_complementary = "-1"; /* at least one arg */
/* "+": stop on first non-option */
opt = getopt32(argv, "+vp");
argv += optind;