diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-06-23 01:21:48 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-06-23 01:21:48 -0700 |
commit | d054f3fb9af7399ee67be94e1602b45d21fc555f (patch) | |
tree | 3b0d5dbabad380358d8483fb9be38a54ce6ff819 /src/sysdep.c | |
parent | b68581e26c51dd78674a5a83928f680cdbd22213 (diff) | |
download | emacs-d054f3fb9af7399ee67be94e1602b45d21fc555f.tar.gz emacs-d054f3fb9af7399ee67be94e1602b45d21fc555f.tar.bz2 emacs-d054f3fb9af7399ee67be94e1602b45d21fc555f.zip |
* 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.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r-- | src/sysdep.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 8d1c3d0ca3c..875f343135e 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -41,7 +41,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #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 @@ system_process_attributes (Lisp_Object pid) #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 @@ system_process_attributes (Lisp_Object pid) 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 @@ system_process_attributes (Lisp_Object pid) 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) { |