diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/sysdep.c | 33 |
2 files changed, 32 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 65424205f34..e5d77d66b0c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2012-06-23 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * sysdep.c [__FreeBSD__]: Fix recently-introduced typos. | ||
| 4 | Privately reported by Herbert J. Skuhra. | ||
| 5 | [__FreeBSD__]: Remove "*/" typo after "#include". | ||
| 6 | (timeval_to_EMACS_TIME) [__FreeBSD__]: New static function. | ||
| 7 | (TIMEVAL) [__FreeBSD__]: Now a static function rather than a macro. | ||
| 8 | (TIMEVAL, system_process_attributes) [__FreeBSD__]: | ||
| 9 | Don't assume EMACS_TIME and struct timeval are the same type. | ||
| 10 | |||
| 1 | 2012-06-22 Paul Eggert <eggert@cs.ucla.edu> | 11 | 2012-06-22 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 12 | ||
| 3 | Support higher-resolution time stamps (Bug#9000). | 13 | Support higher-resolution time stamps (Bug#9000). |
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/>. */ | |||
| 41 | #ifdef __FreeBSD__ | 41 | #ifdef __FreeBSD__ |
| 42 | #include <sys/sysctl.h> | 42 | #include <sys/sysctl.h> |
| 43 | #include <sys/user.h> | 43 | #include <sys/user.h> |
| 44 | #include <sys/resource.h> */ | 44 | #include <sys/resource.h> |
| 45 | #include <math.h> | 45 | #include <math.h> |
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| @@ -3107,6 +3107,20 @@ system_process_attributes (Lisp_Object pid) | |||
| 3107 | 3107 | ||
| 3108 | #elif defined __FreeBSD__ | 3108 | #elif defined __FreeBSD__ |
| 3109 | 3109 | ||
| 3110 | static EMACS_TIME | ||
| 3111 | timeval_to_EMACS_TIME (struct timeval t) | ||
| 3112 | { | ||
| 3113 | EMACS_TIME e; | ||
| 3114 | EMACS_SET_SECS_NSECS (e, t.tv_sec, t.tv_usec * 1000); | ||
| 3115 | return e; | ||
| 3116 | } | ||
| 3117 | |||
| 3118 | static Lisp_Object | ||
| 3119 | TIMELIST (struct timeval t) | ||
| 3120 | { | ||
| 3121 | return make_lisp_time (timeval_to_EMACS_TIME (t)); | ||
| 3122 | } | ||
| 3123 | |||
| 3110 | Lisp_Object | 3124 | Lisp_Object |
| 3111 | system_process_attributes (Lisp_Object pid) | 3125 | system_process_attributes (Lisp_Object pid) |
| 3112 | { | 3126 | { |
| @@ -3202,19 +3216,18 @@ system_process_attributes (Lisp_Object pid) | |||
| 3202 | attrs = Fcons (Fcons (Qcminflt, make_number (proc.ki_rusage_ch.ru_minflt)), attrs); | 3216 | attrs = Fcons (Fcons (Qcminflt, make_number (proc.ki_rusage_ch.ru_minflt)), attrs); |
| 3203 | attrs = Fcons (Fcons (Qcmajflt, make_number (proc.ki_rusage_ch.ru_majflt)), attrs); | 3217 | attrs = Fcons (Fcons (Qcmajflt, make_number (proc.ki_rusage_ch.ru_majflt)), attrs); |
| 3204 | 3218 | ||
| 3205 | #define TIMELIST(ts) \ | ||
| 3206 | list3 (make_number (EMACS_SECS (ts) >> 16 & 0xffff), \ | ||
| 3207 | make_number (EMACS_SECS (ts) & 0xffff), \ | ||
| 3208 | make_number (EMACS_USECS (ts))) | ||
| 3209 | |||
| 3210 | attrs = Fcons (Fcons (Qutime, TIMELIST (proc.ki_rusage.ru_utime)), attrs); | 3219 | attrs = Fcons (Fcons (Qutime, TIMELIST (proc.ki_rusage.ru_utime)), attrs); |
| 3211 | attrs = Fcons (Fcons (Qstime, TIMELIST (proc.ki_rusage.ru_stime)), attrs); | 3220 | attrs = Fcons (Fcons (Qstime, TIMELIST (proc.ki_rusage.ru_stime)), attrs); |
| 3212 | EMACS_ADD_TIME (t, proc.ki_rusage.ru_utime, proc.ki_rusage.ru_stime); | 3221 | EMACS_ADD_TIME (t, |
| 3222 | timeval_to_EMACS_TIME (proc.ki_rusage.ru_utime), | ||
| 3223 | timeval_to_EMACS_TIME (proc.ki_rusage.ru_stime)); | ||
| 3213 | attrs = Fcons (Fcons (Qtime, TIMELIST (t)), attrs); | 3224 | attrs = Fcons (Fcons (Qtime, TIMELIST (t)), attrs); |
| 3214 | 3225 | ||
| 3215 | attrs = Fcons (Fcons (Qcutime, TIMELIST (proc.ki_rusage_ch.ru_utime)), attrs); | 3226 | attrs = Fcons (Fcons (Qcutime, TIMELIST (proc.ki_rusage_ch.ru_utime)), attrs); |
| 3216 | attrs = Fcons (Fcons (Qcstime, TIMELIST (proc.ki_rusage_ch.ru_utime)), attrs); | 3227 | attrs = Fcons (Fcons (Qcstime, TIMELIST (proc.ki_rusage_ch.ru_utime)), attrs); |
| 3217 | EMACS_ADD_TIME (t, proc.ki_rusage_ch.ru_utime, proc.ki_rusage_ch.ru_stime); | 3228 | EMACS_ADD_TIME (t, |
| 3229 | timeval_to_EMACS_TIME (proc.ki_rusage_ch.ru_utime), | ||
| 3230 | timeval_to_EMACS_TIME (proc.ki_rusage_ch.ru_stime)); | ||
| 3218 | attrs = Fcons (Fcons (Qctime, TIMELIST (t)), attrs); | 3231 | attrs = Fcons (Fcons (Qctime, TIMELIST (t)), attrs); |
| 3219 | 3232 | ||
| 3220 | attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (proc.ki_numthreads)), | 3233 | attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (proc.ki_numthreads)), |
| @@ -3227,11 +3240,9 @@ system_process_attributes (Lisp_Object pid) | |||
| 3227 | attrs); | 3240 | attrs); |
| 3228 | 3241 | ||
| 3229 | EMACS_GET_TIME (now); | 3242 | EMACS_GET_TIME (now); |
| 3230 | EMACS_SUB_TIME (t, now, proc.ki_start); | 3243 | EMACS_SUB_TIME (t, now, timeval_to_EMACS_TIME (proc.ki_start)); |
| 3231 | attrs = Fcons (Fcons (Qetime, TIMELIST (t)), attrs); | 3244 | attrs = Fcons (Fcons (Qetime, TIMELIST (t)), attrs); |
| 3232 | 3245 | ||
| 3233 | #undef TIMELIST | ||
| 3234 | |||
| 3235 | len = sizeof fscale; | 3246 | len = sizeof fscale; |
| 3236 | if (sysctlbyname ("kern.fscale", &fscale, &len, NULL, 0) == 0) | 3247 | if (sysctlbyname ("kern.fscale", &fscale, &len, NULL, 0) == 0) |
| 3237 | { | 3248 | { |