Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/miscutils/time.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 70  static void resuse_end(pid_t pid, resour Line 70  static void resuse_end(pid_t pid, resour
70   return;   return;
71   }   }
72   }   }
73   resp->elapsed_ms = (monotonic_us() / 1000) - resp->elapsed_ms;   resp->elapsed_ms = monotonic_ms() - resp->elapsed_ms;
74  }  }
75    
76  static void printargv(char *const *argv)  static void printargv(char *const *argv)
# Line 89  static void printargv(char *const *argv) Line 89  static void printargv(char *const *argv)
89     This is funky since the pagesize could be less than 1K.     This is funky since the pagesize could be less than 1K.
90     Note: Some machines express getrusage statistics in terms of K,     Note: Some machines express getrusage statistics in terms of K,
91     others in terms of pages.  */     others in terms of pages.  */
92  static unsigned long ptok(unsigned pagesize, unsigned long pages)  static unsigned long ptok(const unsigned pagesize, const unsigned long pages)
93  {  {
94   unsigned long tmp;   unsigned long tmp;
95    
# Line 303  static void summarize(const char *fmt, c Line 303  static void summarize(const char *fmt, c
303   printf("%lu", ptok(pagesize, (UL) resp->ru.ru_ixrss) / cpu_ticks);   printf("%lu", ptok(pagesize, (UL) resp->ru.ru_ixrss) / cpu_ticks);
304   break;   break;
305   case 'Z': /* Page size.  */   case 'Z': /* Page size.  */
306   printf("%u", getpagesize());   printf("%u", pagesize);
307   break;   break;
308   case 'c': /* Involuntary context switches.  */   case 'c': /* Involuntary context switches.  */
309   printf("%lu", resp->ru.ru_nivcsw);   printf("%lu", resp->ru.ru_nivcsw);
# Line 371  static void run_command(char *const *cmd Line 371  static void run_command(char *const *cmd
371   void (*interrupt_signal)(int);   void (*interrupt_signal)(int);
372   void (*quit_signal)(int);   void (*quit_signal)(int);
373    
374   resp->elapsed_ms = monotonic_us() / 1000;   resp->elapsed_ms = monotonic_ms();
375   pid = vfork(); /* Run CMD as child process.  */   pid = vfork(); /* Run CMD as child process.  */
376   if (pid < 0)   if (pid < 0)
377   bb_perror_msg_and_die("fork");   bb_perror_msg_and_die("fork");
# Line 380  static void run_command(char *const *cmd Line 380  static void run_command(char *const *cmd
380     versus merely warnings if the cast is left off.  */     versus merely warnings if the cast is left off.  */
381   BB_EXECVP(cmd[0], cmd);   BB_EXECVP(cmd[0], cmd);
382   xfunc_error_retval = (errno == ENOENT ? 127 : 126);   xfunc_error_retval = (errno == ENOENT ? 127 : 126);
383   bb_error_msg_and_die("cannot run %s", cmd[0]);   bb_error_msg_and_die("can't run %s", cmd[0]);
384   }   }
385    
386   /* Have signals kill the child but not self (if possible).  */   /* Have signals kill the child but not self (if possible).  */
# Line 414  int time_main(int argc UNUSED_PARAM, cha Line 414  int time_main(int argc UNUSED_PARAM, cha
414   run_command(argv, &res);   run_command(argv, &res);
415    
416   /* Cheat. printf's are shorter :) */   /* Cheat. printf's are shorter :) */
417   /* (but see bb_putchar() body for additional wrinkle!) */   xdup2(STDERR_FILENO, STDOUT_FILENO);
  xdup2(2, 1); /* just in case libc does something silly :( */  
  stdout = stderr;  
418   summarize(output_format, argv, &res);   summarize(output_format, argv, &res);
419    
420   if (WIFSTOPPED(res.waitstatus))   if (WIFSTOPPED(res.waitstatus))

Legend:
Removed from v.983  
changed lines
  Added in v.984