emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108693: * sysdep.c [__FreeBSD__]: Fi


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108693: * sysdep.c [__FreeBSD__]: Fix recently-introduced typos.
Date: Sat, 23 Jun 2012 01:21:48 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108693
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2012-06-23 01:21:48 -0700
message:
  * sysdep.c [__FreeBSD__]: Fix recently-introduced typos.
  
  Privately reported by Herbert J. Skuhra.
  [__FreeBSD__]: Remove "*/" typo after "#include".
  (timeval_to_EMACS_TIME) [__FreeBSD__]: New static function.
  (TIMEVAL) [__FreeBSD__]: Now a static function rather than a macro.
  (TIMEVAL, system_process_attributes) [__FreeBSD__]:
  Don't assume EMACS_TIME and struct timeval are the same type.
modified:
  src/ChangeLog
  src/sysdep.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-06-22 21:17:42 +0000
+++ b/src/ChangeLog     2012-06-23 08:21:48 +0000
@@ -1,3 +1,13 @@
+2012-06-23  Paul Eggert  <address@hidden>
+
+       * sysdep.c [__FreeBSD__]: Fix recently-introduced typos.
+       Privately reported by Herbert J. Skuhra.
+       [__FreeBSD__]: Remove "*/" typo after "#include".
+       (timeval_to_EMACS_TIME) [__FreeBSD__]: New static function.
+       (TIMEVAL) [__FreeBSD__]: Now a static function rather than a macro.
+       (TIMEVAL, system_process_attributes) [__FreeBSD__]:
+       Don't assume EMACS_TIME and struct timeval are the same type.
+
 2012-06-22  Paul Eggert  <address@hidden>
 
        Support higher-resolution time stamps (Bug#9000).

=== modified file 'src/sysdep.c'
--- a/src/sysdep.c      2012-06-22 21:17:42 +0000
+++ b/src/sysdep.c      2012-06-23 08:21:48 +0000
@@ -41,7 +41,7 @@
 #ifdef __FreeBSD__
 #include <sys/sysctl.h>
 #include <sys/user.h>
-#include <sys/resource.h> */
+#include <sys/resource.h>
 #include <math.h>
 #endif
 
@@ -3107,6 +3107,20 @@
 
 #elif defined __FreeBSD__
 
+static EMACS_TIME
+timeval_to_EMACS_TIME (struct timeval t)
+{
+  EMACS_TIME e;
+  EMACS_SET_SECS_NSECS (e, t.tv_sec, t.tv_usec * 1000);
+  return e;
+}
+
+static Lisp_Object
+TIMELIST (struct timeval t)
+{
+  return make_lisp_time (timeval_to_EMACS_TIME (t));
+}
+
 Lisp_Object
 system_process_attributes (Lisp_Object pid)
 {
@@ -3202,19 +3216,18 @@
   attrs = Fcons (Fcons (Qcminflt, make_number (proc.ki_rusage_ch.ru_minflt)), 
attrs);
   attrs = Fcons (Fcons (Qcmajflt, make_number (proc.ki_rusage_ch.ru_majflt)), 
attrs);
 
-#define TIMELIST(ts)                                   \
-  list3 (make_number (EMACS_SECS (ts) >> 16 & 0xffff), \
-        make_number (EMACS_SECS (ts) & 0xffff),        \
-        make_number (EMACS_USECS (ts)))
-
   attrs = Fcons (Fcons (Qutime, TIMELIST (proc.ki_rusage.ru_utime)), attrs);
   attrs = Fcons (Fcons (Qstime, TIMELIST (proc.ki_rusage.ru_stime)), attrs);
-  EMACS_ADD_TIME (t, proc.ki_rusage.ru_utime, proc.ki_rusage.ru_stime);
+  EMACS_ADD_TIME (t,
+                 timeval_to_EMACS_TIME (proc.ki_rusage.ru_utime),
+                 timeval_to_EMACS_TIME (proc.ki_rusage.ru_stime));
   attrs = Fcons (Fcons (Qtime,  TIMELIST (t)), attrs);
 
   attrs = Fcons (Fcons (Qcutime, TIMELIST (proc.ki_rusage_ch.ru_utime)), 
attrs);
   attrs = Fcons (Fcons (Qcstime, TIMELIST (proc.ki_rusage_ch.ru_utime)), 
attrs);
-  EMACS_ADD_TIME (t, proc.ki_rusage_ch.ru_utime, proc.ki_rusage_ch.ru_stime);
+  EMACS_ADD_TIME (t,
+                 timeval_to_EMACS_TIME (proc.ki_rusage_ch.ru_utime),
+                 timeval_to_EMACS_TIME (proc.ki_rusage_ch.ru_stime));
   attrs = Fcons (Fcons (Qctime, TIMELIST (t)), attrs);
 
   attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (proc.ki_numthreads)),
@@ -3227,11 +3240,9 @@
                 attrs);
 
   EMACS_GET_TIME (now);
-  EMACS_SUB_TIME (t, now, proc.ki_start);
+  EMACS_SUB_TIME (t, now, timeval_to_EMACS_TIME (proc.ki_start));
   attrs = Fcons (Fcons (Qetime, TIMELIST (t)), attrs);
 
-#undef TIMELIST
-
   len = sizeof fscale;
   if (sysctlbyname ("kern.fscale", &fscale, &len, NULL, 0) == 0)
     {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]