diff options
| author | Paul Eggert | 2018-08-27 21:27:50 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-08-27 21:45:23 -0700 |
| commit | d77d01d22902acdc45c2c7059de4f1b158ab5806 (patch) | |
| tree | 35f2b77594dc43e824852bb29598430945c5e6a4 /src/sysdep.c | |
| parent | 9abaf5f3581ecb76f30e8a6e7ee0e9633c133d1c (diff) | |
| download | emacs-d77d01d22902acdc45c2c7059de4f1b158ab5806.tar.gz emacs-d77d01d22902acdc45c2c7059de4f1b158ab5806.zip | |
Improve bignum support for system types
Use bignums when Emacs converts to and from system types like
off_t for file sizes whose values can exceed fixnum range.
Formerly, Emacs sometimes generted floats and sometimes ad-hoc
conses of integers. Emacs still accepts floats and conses for
these system types, in case some stray Lisp code is generating
them, though this usage is obsolescent.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/hash.texi (Defining Hash):
* doc/lispref/nonascii.texi (Character Sets):
* doc/lispref/os.texi (User Identification):
* doc/lispref/processes.texi (System Processes):
* etc/NEWS:
Document changes.
* src/bignum.c (mpz_set_uintmax, make_biguint)
(mpz_set_uintmax_slow, bignum_to_intmax, bignum_to_uintmax):
New functions.
(mpz_set_intmax_slow): Implement via mpz_limbs_write,
to avoid the need for an extra pass through a negative number.
* src/charset.c (Fencode_char):
* src/composite.h (LGLYPH_SET_CODE):
* src/dired.c (file_attributes):
* src/dosfns.c, src/w32.c (list_system_processes)
(system_process_attributes):
* src/editfns.c (init_editfns, Fuser_uid, Fuser_real_uid)
(Fgroup_gid, Fgroup_real_gid, Femacs_pid):
* src/emacs-module.c (check_vec_index):
* src/fns.c (Fsafe_length):
* src/process.c (record_deleted_pid, Fprocess_id):
* src/sysdep.c (list_system_processes, system_process_attributes):
* src/xselect.c (x_own_selection, selection_data_to_lisp_data):
* src/xterm.c (set_wm_state):
* src/inotify.c (inotifyevent_to_event, add_watch)
(inotify_callback):
If an integer is out of fixnum range, use a bignum
instead of converting it to a float or a cons of integers.
* src/coding.c (Fdefine_coding_system_internal):
* src/frame.c (frame_windows_min_size)
(x_set_frame_parameters):
* src/fringe.c (Fdefine_fringe_bitmap):
* src/nsterm.m (mouseDown:):
* src/syntax.c (find_defun_start):
* src/w32fns.c (x_set_undecorated, w32_createwindow)
(w32_wnd_proc, Fx_create_frame, Fx_show_tip)
(w32_console_toggle_lock_key):
* src/w32inevt.c (key_event):
* src/w32proc.c (Fw32_get_locale_info):
Do not mishandle floats by treating their addresses as their
values.
* src/data.c (store_symval_forwarding):
* src/gnutls.c (Fgnutls_error_fatalp, Fgnutls_error_string):
* src/keyboard.c (command_loop_1, make_lispy_event):
* src/lread.c (read_filtered_event, read1)
(substitute_object_recurse):
* src/window.c (Fcoordinates_in_window_p, Fwindow_at)
(window_resize_apply, Fset_window_vscroll):
* src/xdisp.c (handle_single_display_spec, try_scrolling)
(redisplay_window, calc_pixel_width_or_height)
(calc_line_height_property, on_hot_spot_p):
* src/xfaces.c (check_lface_attrs):
* src/xselect.c (x_get_local_selection, cons_to_x_long)
(lisp_data_to_selection_data, clean_local_selection_data)
(x_check_property_data, x_fill_property_data):
(x_send_client_event):
Do not reject bignums.
* src/data.c (INTBIG_TO_LISP, intbig_to_lisp)
(uintbig_to_lisp):
Remove. All uses removed.
* src/data.c (cons_to_unsigned, cons_to_signed):
* src/dbusbind.c (xd_signature, xd_extract_signed)
(xd_extract_unsigned):
* src/dispnew.c (sit_for):
* src/dosfns.c, src/w32.c (system_process_attributes):
* src/editfns.c (Fuser_full_name):
* src/fileio.c (file_offset):
* src/fileio.c (write_region):
* src/font.c (font_unparse_xlfd, font_open_for_lface, Fopen_font):
* src/frame.c (x_set_screen_gamma):
* src/frame.h (NUMVAL, FRAME_PIXEL_X_FROM_CANON_X)
(FRAME_PIXEL_Y_FROM_CANON_Y):
* src/image.c (parse_image_spec, x_edge_detection)
(compute_image_size):
* src/json.c (json_to_lisp):
* src/lcms.c (PARSE_LAB_LIST_FIELD, Flcms_cie_de2000)
(PARSE_XYZ_LIST_FIELD, PARSE_JCH_LIST_FIELD)
(PARSE_JAB_LIST_FIELD, PARSE_VIEW_CONDITION_FLOAT)
(Flcms_temp_to_white_point):
* src/nsimage.m (ns_load_image, setSizeFromSpec):
* src/process.c (Fsignal_process, handle_child_signal):
* src/sysdep.c (system_process_attributes):
* src/xdisp.c (calc_line_height_property):
Handle bignums.
* src/data.c (Fnumber_to_string): Use proper predicate name in
signal if the argument is not a number.
* src/lisp.h (make_uint): New function.
(INT_TO_INTEGER): New macro.
(FIXED_OR_FLOATP, CHECK_FIXNUM_OR_FLOAT)
(CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER, INTEGER_TO_CONS)
(make_fixnum_or_float): Remove; no longer used.
* src/nsfns.m, src/w32fns.c, src/xfns.c (Fx_create_frame):
Reject floating-point min-width or min-height.
* src/process.c (handle_child_signal): Do not worry
about floating-point pids, as they are no longer generated.
Diffstat (limited to 'src/sysdep.c')
| -rw-r--r-- | src/sysdep.c | 102 |
1 files changed, 47 insertions, 55 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 889ad6bdb01..52afa2f0e16 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -3045,9 +3045,9 @@ list_system_processes (void) | |||
| 3045 | for (i = 0; i < len; i++) | 3045 | for (i = 0; i < len; i++) |
| 3046 | { | 3046 | { |
| 3047 | #ifdef DARWIN_OS | 3047 | #ifdef DARWIN_OS |
| 3048 | proclist = Fcons (make_fixnum_or_float (procs[i].kp_proc.p_pid), proclist); | 3048 | proclist = Fcons (INT_TO_INTEGER (procs[i].kp_proc.p_pid), proclist); |
| 3049 | #else | 3049 | #else |
| 3050 | proclist = Fcons (make_fixnum_or_float (procs[i].ki_pid), proclist); | 3050 | proclist = Fcons (INT_TO_INTEGER (procs[i].ki_pid), proclist); |
| 3051 | #endif | 3051 | #endif |
| 3052 | } | 3052 | } |
| 3053 | 3053 | ||
| @@ -3261,7 +3261,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3261 | Lisp_Object decoded_cmd; | 3261 | Lisp_Object decoded_cmd; |
| 3262 | ptrdiff_t count; | 3262 | ptrdiff_t count; |
| 3263 | 3263 | ||
| 3264 | CHECK_FIXNUM_OR_FLOAT (pid); | 3264 | CHECK_NUMBER (pid); |
| 3265 | CONS_TO_INTEGER (pid, pid_t, proc_id); | 3265 | CONS_TO_INTEGER (pid, pid_t, proc_id); |
| 3266 | sprintf (procfn, "/proc/%"pMd, proc_id); | 3266 | sprintf (procfn, "/proc/%"pMd, proc_id); |
| 3267 | if (stat (procfn, &st) < 0) | 3267 | if (stat (procfn, &st) < 0) |
| @@ -3269,7 +3269,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3269 | 3269 | ||
| 3270 | /* euid egid */ | 3270 | /* euid egid */ |
| 3271 | uid = st.st_uid; | 3271 | uid = st.st_uid; |
| 3272 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); | 3272 | attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs); |
| 3273 | block_input (); | 3273 | block_input (); |
| 3274 | pw = getpwuid (uid); | 3274 | pw = getpwuid (uid); |
| 3275 | unblock_input (); | 3275 | unblock_input (); |
| @@ -3277,7 +3277,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3277 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); | 3277 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); |
| 3278 | 3278 | ||
| 3279 | gid = st.st_gid; | 3279 | gid = st.st_gid; |
| 3280 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); | 3280 | attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs); |
| 3281 | block_input (); | 3281 | block_input (); |
| 3282 | gr = getgrgid (gid); | 3282 | gr = getgrgid (gid); |
| 3283 | unblock_input (); | 3283 | unblock_input (); |
| @@ -3335,17 +3335,15 @@ system_process_attributes (Lisp_Object pid) | |||
| 3335 | state_str[0] = c; | 3335 | state_str[0] = c; |
| 3336 | state_str[1] = '\0'; | 3336 | state_str[1] = '\0'; |
| 3337 | attrs = Fcons (Fcons (Qstate, build_string (state_str)), attrs); | 3337 | attrs = Fcons (Fcons (Qstate, build_string (state_str)), attrs); |
| 3338 | attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (ppid)), attrs); | 3338 | attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (ppid)), attrs); |
| 3339 | attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pgrp)), attrs); | 3339 | attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (pgrp)), attrs); |
| 3340 | attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (sess)), attrs); | 3340 | attrs = Fcons (Fcons (Qsess, INT_TO_INTEGER (sess)), attrs); |
| 3341 | attrs = Fcons (Fcons (Qttname, procfs_ttyname (tty)), attrs); | 3341 | attrs = Fcons (Fcons (Qttname, procfs_ttyname (tty)), attrs); |
| 3342 | attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (tpgid)), attrs); | 3342 | attrs = Fcons (Fcons (Qtpgid, INT_TO_INTEGER (tpgid)), attrs); |
| 3343 | attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (minflt)), attrs); | 3343 | attrs = Fcons (Fcons (Qminflt, INT_TO_INTEGER (minflt)), attrs); |
| 3344 | attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (majflt)), attrs); | 3344 | attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (majflt)), attrs); |
| 3345 | attrs = Fcons (Fcons (Qcminflt, make_fixnum_or_float (cminflt)), | 3345 | attrs = Fcons (Fcons (Qcminflt, INT_TO_INTEGER (cminflt)), attrs); |
| 3346 | attrs); | 3346 | attrs = Fcons (Fcons (Qcmajflt, INT_TO_INTEGER (cmajflt)), attrs); |
| 3347 | attrs = Fcons (Fcons (Qcmajflt, make_fixnum_or_float (cmajflt)), | ||
| 3348 | attrs); | ||
| 3349 | clocks_per_sec = sysconf (_SC_CLK_TCK); | 3347 | clocks_per_sec = sysconf (_SC_CLK_TCK); |
| 3350 | if (clocks_per_sec < 0) | 3348 | if (clocks_per_sec < 0) |
| 3351 | clocks_per_sec = 100; | 3349 | clocks_per_sec = 100; |
| @@ -3371,17 +3369,15 @@ system_process_attributes (Lisp_Object pid) | |||
| 3371 | attrs); | 3369 | attrs); |
| 3372 | attrs = Fcons (Fcons (Qpri, make_fixnum (priority)), attrs); | 3370 | attrs = Fcons (Fcons (Qpri, make_fixnum (priority)), attrs); |
| 3373 | attrs = Fcons (Fcons (Qnice, make_fixnum (niceness)), attrs); | 3371 | attrs = Fcons (Fcons (Qnice, make_fixnum (niceness)), attrs); |
| 3374 | attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount)), | 3372 | attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (thcount)), attrs); |
| 3375 | attrs); | ||
| 3376 | tnow = current_timespec (); | 3373 | tnow = current_timespec (); |
| 3377 | telapsed = get_up_time (); | 3374 | telapsed = get_up_time (); |
| 3378 | tboot = timespec_sub (tnow, telapsed); | 3375 | tboot = timespec_sub (tnow, telapsed); |
| 3379 | tstart = time_from_jiffies (start, clocks_per_sec); | 3376 | tstart = time_from_jiffies (start, clocks_per_sec); |
| 3380 | tstart = timespec_add (tboot, tstart); | 3377 | tstart = timespec_add (tboot, tstart); |
| 3381 | attrs = Fcons (Fcons (Qstart, make_lisp_time (tstart)), attrs); | 3378 | attrs = Fcons (Fcons (Qstart, make_lisp_time (tstart)), attrs); |
| 3382 | attrs = Fcons (Fcons (Qvsize, make_fixnum_or_float (vsize / 1024)), | 3379 | attrs = Fcons (Fcons (Qvsize, INT_TO_INTEGER (vsize / 1024)), attrs); |
| 3383 | attrs); | 3380 | attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (4 * rss)), attrs); |
| 3384 | attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (4 * rss)), attrs); | ||
| 3385 | telapsed = timespec_sub (tnow, tstart); | 3381 | telapsed = timespec_sub (tnow, tstart); |
| 3386 | attrs = Fcons (Fcons (Qetime, make_lisp_time (telapsed)), attrs); | 3382 | attrs = Fcons (Fcons (Qetime, make_lisp_time (telapsed)), attrs); |
| 3387 | us_time = time_from_jiffies (u_time + s_time, clocks_per_sec); | 3383 | us_time = time_from_jiffies (u_time + s_time, clocks_per_sec); |
| @@ -3495,7 +3491,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3495 | Lisp_Object decoded_cmd; | 3491 | Lisp_Object decoded_cmd; |
| 3496 | ptrdiff_t count; | 3492 | ptrdiff_t count; |
| 3497 | 3493 | ||
| 3498 | CHECK_FIXNUM_OR_FLOAT (pid); | 3494 | CHECK_NUMBER (pid); |
| 3499 | CONS_TO_INTEGER (pid, pid_t, proc_id); | 3495 | CONS_TO_INTEGER (pid, pid_t, proc_id); |
| 3500 | sprintf (procfn, "/proc/%"pMd, proc_id); | 3496 | sprintf (procfn, "/proc/%"pMd, proc_id); |
| 3501 | if (stat (procfn, &st) < 0) | 3497 | if (stat (procfn, &st) < 0) |
| @@ -3503,7 +3499,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3503 | 3499 | ||
| 3504 | /* euid egid */ | 3500 | /* euid egid */ |
| 3505 | uid = st.st_uid; | 3501 | uid = st.st_uid; |
| 3506 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); | 3502 | attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs); |
| 3507 | block_input (); | 3503 | block_input (); |
| 3508 | pw = getpwuid (uid); | 3504 | pw = getpwuid (uid); |
| 3509 | unblock_input (); | 3505 | unblock_input (); |
| @@ -3511,7 +3507,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3511 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); | 3507 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); |
| 3512 | 3508 | ||
| 3513 | gid = st.st_gid; | 3509 | gid = st.st_gid; |
| 3514 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); | 3510 | attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs); |
| 3515 | block_input (); | 3511 | block_input (); |
| 3516 | gr = getgrgid (gid); | 3512 | gr = getgrgid (gid); |
| 3517 | unblock_input (); | 3513 | unblock_input (); |
| @@ -3533,9 +3529,9 @@ system_process_attributes (Lisp_Object pid) | |||
| 3533 | 3529 | ||
| 3534 | if (nread == sizeof pinfo) | 3530 | if (nread == sizeof pinfo) |
| 3535 | { | 3531 | { |
| 3536 | attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs); | 3532 | attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (pinfo.pr_ppid)), attrs); |
| 3537 | attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs); | 3533 | attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (pinfo.pr_pgid)), attrs); |
| 3538 | attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (pinfo.pr_sid)), attrs); | 3534 | attrs = Fcons (Fcons (Qsess, INT_TO_INTEGER (pinfo.pr_sid)), attrs); |
| 3539 | 3535 | ||
| 3540 | { | 3536 | { |
| 3541 | char state_str[2]; | 3537 | char state_str[2]; |
| @@ -3565,14 +3561,11 @@ system_process_attributes (Lisp_Object pid) | |||
| 3565 | attrs = Fcons (Fcons (Qctime, make_lisp_time (pinfo.pr_ctime)), attrs); | 3561 | attrs = Fcons (Fcons (Qctime, make_lisp_time (pinfo.pr_ctime)), attrs); |
| 3566 | attrs = Fcons (Fcons (Qpri, make_fixnum (pinfo.pr_lwp.pr_pri)), attrs); | 3562 | attrs = Fcons (Fcons (Qpri, make_fixnum (pinfo.pr_lwp.pr_pri)), attrs); |
| 3567 | attrs = Fcons (Fcons (Qnice, make_fixnum (pinfo.pr_lwp.pr_nice)), attrs); | 3563 | attrs = Fcons (Fcons (Qnice, make_fixnum (pinfo.pr_lwp.pr_nice)), attrs); |
| 3568 | attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (pinfo.pr_nlwp)), | 3564 | attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (pinfo.pr_nlwp)), attrs); |
| 3569 | attrs); | ||
| 3570 | 3565 | ||
| 3571 | attrs = Fcons (Fcons (Qstart, make_lisp_time (pinfo.pr_start)), attrs); | 3566 | attrs = Fcons (Fcons (Qstart, make_lisp_time (pinfo.pr_start)), attrs); |
| 3572 | attrs = Fcons (Fcons (Qvsize, make_fixnum_or_float (pinfo.pr_size)), | 3567 | attrs = Fcons (Fcons (Qvsize, INT_TO_INTEGER (pinfo.pr_size)), attrs); |
| 3573 | attrs); | 3568 | attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (pinfo.pr_rssize)), attrs); |
| 3574 | attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (pinfo.pr_rssize)), | ||
| 3575 | attrs); | ||
| 3576 | 3569 | ||
| 3577 | /* pr_pctcpu and pr_pctmem are unsigned integers in the | 3570 | /* pr_pctcpu and pr_pctmem are unsigned integers in the |
| 3578 | range 0 .. 2**15, representing 0.0 .. 1.0. */ | 3571 | range 0 .. 2**15, representing 0.0 .. 1.0. */ |
| @@ -3630,14 +3623,14 @@ system_process_attributes (Lisp_Object pid) | |||
| 3630 | Lisp_Object attrs = Qnil; | 3623 | Lisp_Object attrs = Qnil; |
| 3631 | Lisp_Object decoded_comm; | 3624 | Lisp_Object decoded_comm; |
| 3632 | 3625 | ||
| 3633 | CHECK_FIXNUM_OR_FLOAT (pid); | 3626 | CHECK_NUMBER (pid); |
| 3634 | CONS_TO_INTEGER (pid, int, proc_id); | 3627 | CONS_TO_INTEGER (pid, int, proc_id); |
| 3635 | mib[3] = proc_id; | 3628 | mib[3] = proc_id; |
| 3636 | 3629 | ||
| 3637 | if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0) | 3630 | if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0) |
| 3638 | return attrs; | 3631 | return attrs; |
| 3639 | 3632 | ||
| 3640 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs); | 3633 | attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (proc.ki_uid)), attrs); |
| 3641 | 3634 | ||
| 3642 | block_input (); | 3635 | block_input (); |
| 3643 | pw = getpwuid (proc.ki_uid); | 3636 | pw = getpwuid (proc.ki_uid); |
| @@ -3645,7 +3638,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3645 | if (pw) | 3638 | if (pw) |
| 3646 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); | 3639 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); |
| 3647 | 3640 | ||
| 3648 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (proc.ki_svgid)), attrs); | 3641 | attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (proc.ki_svgid)), attrs); |
| 3649 | 3642 | ||
| 3650 | block_input (); | 3643 | block_input (); |
| 3651 | gr = getgrgid (proc.ki_svgid); | 3644 | gr = getgrgid (proc.ki_svgid); |
| @@ -3684,9 +3677,9 @@ system_process_attributes (Lisp_Object pid) | |||
| 3684 | attrs = Fcons (Fcons (Qstate, build_string (state)), attrs); | 3677 | attrs = Fcons (Fcons (Qstate, build_string (state)), attrs); |
| 3685 | } | 3678 | } |
| 3686 | 3679 | ||
| 3687 | attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (proc.ki_ppid)), attrs); | 3680 | attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (proc.ki_ppid)), attrs); |
| 3688 | attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs); | 3681 | attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (proc.ki_pgid)), attrs); |
| 3689 | attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)), attrs); | 3682 | attrs = Fcons (Fcons (Qsess, INT_TO_INTEGER (proc.ki_sid)), attrs); |
| 3690 | 3683 | ||
| 3691 | block_input (); | 3684 | block_input (); |
| 3692 | ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR); | 3685 | ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR); |
| @@ -3694,9 +3687,11 @@ system_process_attributes (Lisp_Object pid) | |||
| 3694 | if (ttyname) | 3687 | if (ttyname) |
| 3695 | attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs); | 3688 | attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs); |
| 3696 | 3689 | ||
| 3697 | attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (proc.ki_tpgid)), attrs); | 3690 | attrs = Fcons (Fcons (Qtpgid, INT_TO_INTEGER (proc.ki_tpgid)), attrs); |
| 3698 | attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (proc.ki_rusage.ru_minflt)), attrs); | 3691 | attrs = Fcons (Fcons (Qminflt, INT_TO_INTEGER (proc.ki_rusage.ru_minflt)), |
| 3699 | attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (proc.ki_rusage.ru_majflt)), attrs); | 3692 | attrs); |
| 3693 | attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (proc.ki_rusage.ru_majflt)), | ||
| 3694 | attrs); | ||
| 3700 | attrs = Fcons (Fcons (Qcminflt, make_fixnum (proc.ki_rusage_ch.ru_minflt)), attrs); | 3695 | attrs = Fcons (Fcons (Qcminflt, make_fixnum (proc.ki_rusage_ch.ru_minflt)), attrs); |
| 3701 | attrs = Fcons (Fcons (Qcmajflt, make_fixnum (proc.ki_rusage_ch.ru_majflt)), attrs); | 3696 | attrs = Fcons (Fcons (Qcmajflt, make_fixnum (proc.ki_rusage_ch.ru_majflt)), attrs); |
| 3702 | 3697 | ||
| @@ -3718,8 +3713,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3718 | timeval_to_timespec (proc.ki_rusage_ch.ru_stime)); | 3713 | timeval_to_timespec (proc.ki_rusage_ch.ru_stime)); |
| 3719 | attrs = Fcons (Fcons (Qctime, make_lisp_time (t)), attrs); | 3714 | attrs = Fcons (Fcons (Qctime, make_lisp_time (t)), attrs); |
| 3720 | 3715 | ||
| 3721 | attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (proc.ki_numthreads)), | 3716 | attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (proc.ki_numthreads)), attrs); |
| 3722 | attrs); | ||
| 3723 | attrs = Fcons (Fcons (Qpri, make_fixnum (proc.ki_pri.pri_native)), attrs); | 3717 | attrs = Fcons (Fcons (Qpri, make_fixnum (proc.ki_pri.pri_native)), attrs); |
| 3724 | attrs = Fcons (Fcons (Qnice, make_fixnum (proc.ki_nice)), attrs); | 3718 | attrs = Fcons (Fcons (Qnice, make_fixnum (proc.ki_nice)), attrs); |
| 3725 | attrs = Fcons (Fcons (Qstart, make_lisp_timeval (proc.ki_start)), attrs); | 3719 | attrs = Fcons (Fcons (Qstart, make_lisp_timeval (proc.ki_start)), attrs); |
| @@ -3741,7 +3735,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3741 | { | 3735 | { |
| 3742 | pcpu = (100.0 * proc.ki_pctcpu / fscale | 3736 | pcpu = (100.0 * proc.ki_pctcpu / fscale |
| 3743 | / (1 - exp (proc.ki_swtime * log ((double) ccpu / fscale)))); | 3737 | / (1 - exp (proc.ki_swtime * log ((double) ccpu / fscale)))); |
| 3744 | attrs = Fcons (Fcons (Qpcpu, make_fixnum_or_float (pcpu)), attrs); | 3738 | attrs = Fcons (Fcons (Qpcpu, INT_TO_INTEGER (pcpu)), attrs); |
| 3745 | } | 3739 | } |
| 3746 | } | 3740 | } |
| 3747 | 3741 | ||
| @@ -3751,7 +3745,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3751 | double pmem = (proc.ki_flag & P_INMEM | 3745 | double pmem = (proc.ki_flag & P_INMEM |
| 3752 | ? 100.0 * proc.ki_rssize / npages | 3746 | ? 100.0 * proc.ki_rssize / npages |
| 3753 | : 0); | 3747 | : 0); |
| 3754 | attrs = Fcons (Fcons (Qpmem, make_fixnum_or_float (pmem)), attrs); | 3748 | attrs = Fcons (Fcons (Qpmem, INT_TO_INTEGER (pmem)), attrs); |
| 3755 | } | 3749 | } |
| 3756 | 3750 | ||
| 3757 | mib[2] = KERN_PROC_ARGS; | 3751 | mib[2] = KERN_PROC_ARGS; |
| @@ -3810,7 +3804,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3810 | Lisp_Object attrs = Qnil; | 3804 | Lisp_Object attrs = Qnil; |
| 3811 | Lisp_Object decoded_comm; | 3805 | Lisp_Object decoded_comm; |
| 3812 | 3806 | ||
| 3813 | CHECK_FIXNUM_OR_FLOAT (pid); | 3807 | CHECK_NUMBER (pid); |
| 3814 | CONS_TO_INTEGER (pid, int, proc_id); | 3808 | CONS_TO_INTEGER (pid, int, proc_id); |
| 3815 | mib[3] = proc_id; | 3809 | mib[3] = proc_id; |
| 3816 | 3810 | ||
| @@ -3818,7 +3812,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3818 | return attrs; | 3812 | return attrs; |
| 3819 | 3813 | ||
| 3820 | uid = proc.kp_eproc.e_ucred.cr_uid; | 3814 | uid = proc.kp_eproc.e_ucred.cr_uid; |
| 3821 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); | 3815 | attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs); |
| 3822 | 3816 | ||
| 3823 | block_input (); | 3817 | block_input (); |
| 3824 | pw = getpwuid (uid); | 3818 | pw = getpwuid (uid); |
| @@ -3827,7 +3821,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3827 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); | 3821 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); |
| 3828 | 3822 | ||
| 3829 | gid = proc.kp_eproc.e_pcred.p_svgid; | 3823 | gid = proc.kp_eproc.e_pcred.p_svgid; |
| 3830 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); | 3824 | attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs); |
| 3831 | 3825 | ||
| 3832 | block_input (); | 3826 | block_input (); |
| 3833 | gr = getgrgid (gid); | 3827 | gr = getgrgid (gid); |
| @@ -3867,10 +3861,8 @@ system_process_attributes (Lisp_Object pid) | |||
| 3867 | attrs = Fcons (Fcons (Qstate, build_string (state)), attrs); | 3861 | attrs = Fcons (Fcons (Qstate, build_string (state)), attrs); |
| 3868 | } | 3862 | } |
| 3869 | 3863 | ||
| 3870 | attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (proc.kp_eproc.e_ppid)), | 3864 | attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (proc.kp_eproc.e_ppid)), attrs); |
| 3871 | attrs); | 3865 | attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (proc.kp_eproc.e_pgid)), attrs); |
| 3872 | attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.kp_eproc.e_pgid)), | ||
| 3873 | attrs); | ||
| 3874 | 3866 | ||
| 3875 | tdev = proc.kp_eproc.e_tdev; | 3867 | tdev = proc.kp_eproc.e_tdev; |
| 3876 | block_input (); | 3868 | block_input (); |
| @@ -3879,15 +3871,15 @@ system_process_attributes (Lisp_Object pid) | |||
| 3879 | if (ttyname) | 3871 | if (ttyname) |
| 3880 | attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs); | 3872 | attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs); |
| 3881 | 3873 | ||
| 3882 | attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (proc.kp_eproc.e_tpgid)), | 3874 | attrs = Fcons (Fcons (Qtpgid, INT_TO_INTEGER (proc.kp_eproc.e_tpgid)), |
| 3883 | attrs); | 3875 | attrs); |
| 3884 | 3876 | ||
| 3885 | rusage = proc.kp_proc.p_ru; | 3877 | rusage = proc.kp_proc.p_ru; |
| 3886 | if (rusage) | 3878 | if (rusage) |
| 3887 | { | 3879 | { |
| 3888 | attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (rusage->ru_minflt)), | 3880 | attrs = Fcons (Fcons (Qminflt, INT_TO_INTEGER (rusage->ru_minflt)), |
| 3889 | attrs); | 3881 | attrs); |
| 3890 | attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (rusage->ru_majflt)), | 3882 | attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (rusage->ru_majflt)), |
| 3891 | attrs); | 3883 | attrs); |
| 3892 | 3884 | ||
| 3893 | attrs = Fcons (Fcons (Qutime, make_lisp_timeval (rusage->ru_utime)), | 3885 | attrs = Fcons (Fcons (Qutime, make_lisp_timeval (rusage->ru_utime)), |