diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/process.c b/src/process.c index c5e691bf602..3b62f45bf0a 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -133,7 +133,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 133 | 133 | ||
| 134 | #ifdef WINDOWSNT | 134 | #ifdef WINDOWSNT |
| 135 | extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, | 135 | extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, |
| 136 | EMACS_TIME *, void *); | 136 | struct timespec *, void *); |
| 137 | #endif | 137 | #endif |
| 138 | 138 | ||
| 139 | #ifndef SOCK_CLOEXEC | 139 | #ifndef SOCK_CLOEXEC |
| @@ -261,7 +261,7 @@ static EMACS_INT update_tick; | |||
| 261 | #endif | 261 | #endif |
| 262 | 262 | ||
| 263 | #ifdef ADAPTIVE_READ_BUFFERING | 263 | #ifdef ADAPTIVE_READ_BUFFERING |
| 264 | #define READ_OUTPUT_DELAY_INCREMENT (EMACS_TIME_RESOLUTION / 100) | 264 | #define READ_OUTPUT_DELAY_INCREMENT (TIMESPEC_RESOLUTION / 100) |
| 265 | #define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5) | 265 | #define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5) |
| 266 | #define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7) | 266 | #define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7) |
| 267 | 267 | ||
| @@ -3932,9 +3932,9 @@ Return non-nil if we received any output before the timeout expired. */) | |||
| 3932 | { | 3932 | { |
| 3933 | if (XFLOAT_DATA (seconds) > 0) | 3933 | if (XFLOAT_DATA (seconds) > 0) |
| 3934 | { | 3934 | { |
| 3935 | EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (XFLOAT_DATA (seconds)); | 3935 | struct timespec t = dtotimespec (XFLOAT_DATA (seconds)); |
| 3936 | secs = min (EMACS_SECS (t), WAIT_READING_MAX); | 3936 | secs = min (t.tv_sec, WAIT_READING_MAX); |
| 3937 | nsecs = EMACS_NSECS (t); | 3937 | nsecs = t.tv_nsec; |
| 3938 | } | 3938 | } |
| 3939 | } | 3939 | } |
| 3940 | else | 3940 | else |
| @@ -4239,7 +4239,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4239 | bool no_avail; | 4239 | bool no_avail; |
| 4240 | int xerrno; | 4240 | int xerrno; |
| 4241 | Lisp_Object proc; | 4241 | Lisp_Object proc; |
| 4242 | EMACS_TIME timeout, end_time; | 4242 | struct timespec timeout, end_time; |
| 4243 | int wait_channel = -1; | 4243 | int wait_channel = -1; |
| 4244 | bool got_some_input = 0; | 4244 | bool got_some_input = 0; |
| 4245 | ptrdiff_t count = SPECPDL_INDEX (); | 4245 | ptrdiff_t count = SPECPDL_INDEX (); |
| @@ -4272,8 +4272,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4272 | compute the absolute time to return at. */ | 4272 | compute the absolute time to return at. */ |
| 4273 | if (time_limit || nsecs > 0) | 4273 | if (time_limit || nsecs > 0) |
| 4274 | { | 4274 | { |
| 4275 | timeout = make_emacs_time (time_limit, nsecs); | 4275 | timeout = make_timespec (time_limit, nsecs); |
| 4276 | end_time = add_emacs_time (current_emacs_time (), timeout); | 4276 | end_time = timespec_add (current_timespec (), timeout); |
| 4277 | } | 4277 | } |
| 4278 | 4278 | ||
| 4279 | while (1) | 4279 | while (1) |
| @@ -4300,18 +4300,18 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4300 | gobble output available now | 4300 | gobble output available now |
| 4301 | but don't wait at all. */ | 4301 | but don't wait at all. */ |
| 4302 | 4302 | ||
| 4303 | timeout = make_emacs_time (0, 0); | 4303 | timeout = make_timespec (0, 0); |
| 4304 | } | 4304 | } |
| 4305 | else if (time_limit || nsecs > 0) | 4305 | else if (time_limit || nsecs > 0) |
| 4306 | { | 4306 | { |
| 4307 | EMACS_TIME now = current_emacs_time (); | 4307 | struct timespec now = current_timespec (); |
| 4308 | if (EMACS_TIME_LE (end_time, now)) | 4308 | if (timespec_cmp (end_time, now) <= 0) |
| 4309 | break; | 4309 | break; |
| 4310 | timeout = sub_emacs_time (end_time, now); | 4310 | timeout = timespec_sub (end_time, now); |
| 4311 | } | 4311 | } |
| 4312 | else | 4312 | else |
| 4313 | { | 4313 | { |
| 4314 | timeout = make_emacs_time (100000, 0); | 4314 | timeout = make_timespec (100000, 0); |
| 4315 | } | 4315 | } |
| 4316 | 4316 | ||
| 4317 | /* Normally we run timers here. | 4317 | /* Normally we run timers here. |
| @@ -4321,7 +4321,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4321 | if (NILP (wait_for_cell) | 4321 | if (NILP (wait_for_cell) |
| 4322 | && just_wait_proc >= 0) | 4322 | && just_wait_proc >= 0) |
| 4323 | { | 4323 | { |
| 4324 | EMACS_TIME timer_delay; | 4324 | struct timespec timer_delay; |
| 4325 | 4325 | ||
| 4326 | do | 4326 | do |
| 4327 | { | 4327 | { |
| @@ -4356,9 +4356,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4356 | /* A negative timeout means do not wait at all. */ | 4356 | /* A negative timeout means do not wait at all. */ |
| 4357 | if (nsecs >= 0) | 4357 | if (nsecs >= 0) |
| 4358 | { | 4358 | { |
| 4359 | if (EMACS_TIME_VALID_P (timer_delay)) | 4359 | if (timespec_valid_p (timer_delay)) |
| 4360 | { | 4360 | { |
| 4361 | if (EMACS_TIME_LT (timer_delay, timeout)) | 4361 | if (timespec_cmp (timer_delay, timeout) < 0) |
| 4362 | { | 4362 | { |
| 4363 | timeout = timer_delay; | 4363 | timeout = timer_delay; |
| 4364 | timeout_reduced_for_timers = 1; | 4364 | timeout_reduced_for_timers = 1; |
| @@ -4396,7 +4396,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4396 | Atemp = input_wait_mask; | 4396 | Atemp = input_wait_mask; |
| 4397 | Ctemp = write_mask; | 4397 | Ctemp = write_mask; |
| 4398 | 4398 | ||
| 4399 | timeout = make_emacs_time (0, 0); | 4399 | timeout = make_timespec (0, 0); |
| 4400 | if ((pselect (max (max_process_desc, max_input_desc) + 1, | 4400 | if ((pselect (max (max_process_desc, max_input_desc) + 1, |
| 4401 | &Atemp, | 4401 | &Atemp, |
| 4402 | #ifdef NON_BLOCKING_CONNECT | 4402 | #ifdef NON_BLOCKING_CONNECT |
| @@ -4518,8 +4518,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4518 | Vprocess_adaptive_read_buffering is nil. */ | 4518 | Vprocess_adaptive_read_buffering is nil. */ |
| 4519 | if (process_output_skip && check_delay > 0) | 4519 | if (process_output_skip && check_delay > 0) |
| 4520 | { | 4520 | { |
| 4521 | int nsecs = EMACS_NSECS (timeout); | 4521 | int nsecs = timeout.tv_nsec; |
| 4522 | if (EMACS_SECS (timeout) > 0 || nsecs > READ_OUTPUT_DELAY_MAX) | 4522 | if (timeout.tv_sec > 0 || nsecs > READ_OUTPUT_DELAY_MAX) |
| 4523 | nsecs = READ_OUTPUT_DELAY_MAX; | 4523 | nsecs = READ_OUTPUT_DELAY_MAX; |
| 4524 | for (channel = 0; check_delay > 0 && channel <= max_process_desc; channel++) | 4524 | for (channel = 0; check_delay > 0 && channel <= max_process_desc; channel++) |
| 4525 | { | 4525 | { |
| @@ -4539,7 +4539,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4539 | nsecs = XPROCESS (proc)->read_output_delay; | 4539 | nsecs = XPROCESS (proc)->read_output_delay; |
| 4540 | } | 4540 | } |
| 4541 | } | 4541 | } |
| 4542 | timeout = make_emacs_time (0, nsecs); | 4542 | timeout = make_timespec (0, nsecs); |
| 4543 | process_output_skip = 0; | 4543 | process_output_skip = 0; |
| 4544 | } | 4544 | } |
| 4545 | #endif | 4545 | #endif |
| @@ -6543,7 +6543,7 @@ keyboard_bit_set (fd_set *mask) | |||
| 6543 | 6543 | ||
| 6544 | /* Defined on msdos.c. */ | 6544 | /* Defined on msdos.c. */ |
| 6545 | extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, | 6545 | extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *, |
| 6546 | EMACS_TIME *, void *); | 6546 | struct timespec *, void *); |
| 6547 | 6547 | ||
| 6548 | /* Implementation of wait_reading_process_output, assuming that there | 6548 | /* Implementation of wait_reading_process_output, assuming that there |
| 6549 | are no subprocesses. Used only by the MS-DOS build. | 6549 | are no subprocesses. Used only by the MS-DOS build. |
| @@ -6582,7 +6582,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6582 | struct Lisp_Process *wait_proc, int just_wait_proc) | 6582 | struct Lisp_Process *wait_proc, int just_wait_proc) |
| 6583 | { | 6583 | { |
| 6584 | register int nfds; | 6584 | register int nfds; |
| 6585 | EMACS_TIME end_time, timeout; | 6585 | struct timespec end_time, timeout; |
| 6586 | 6586 | ||
| 6587 | if (time_limit < 0) | 6587 | if (time_limit < 0) |
| 6588 | { | 6588 | { |
| @@ -6595,8 +6595,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6595 | /* What does time_limit really mean? */ | 6595 | /* What does time_limit really mean? */ |
| 6596 | if (time_limit || nsecs > 0) | 6596 | if (time_limit || nsecs > 0) |
| 6597 | { | 6597 | { |
| 6598 | timeout = make_emacs_time (time_limit, nsecs); | 6598 | timeout = make_timespec (time_limit, nsecs); |
| 6599 | end_time = add_emacs_time (current_emacs_time (), timeout); | 6599 | end_time = timespec_add (current_timespec (), timeout); |
| 6600 | } | 6600 | } |
| 6601 | 6601 | ||
| 6602 | /* Turn off periodic alarms (in case they are in use) | 6602 | /* Turn off periodic alarms (in case they are in use) |
| @@ -6629,18 +6629,18 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6629 | gobble output available now | 6629 | gobble output available now |
| 6630 | but don't wait at all. */ | 6630 | but don't wait at all. */ |
| 6631 | 6631 | ||
| 6632 | timeout = make_emacs_time (0, 0); | 6632 | timeout = make_timespec (0, 0); |
| 6633 | } | 6633 | } |
| 6634 | else if (time_limit || nsecs > 0) | 6634 | else if (time_limit || nsecs > 0) |
| 6635 | { | 6635 | { |
| 6636 | EMACS_TIME now = current_emacs_time (); | 6636 | struct timespec now = current_timespec (); |
| 6637 | if (EMACS_TIME_LE (end_time, now)) | 6637 | if (timespec_cmp (end_time, now) <= 0) |
| 6638 | break; | 6638 | break; |
| 6639 | timeout = sub_emacs_time (end_time, now); | 6639 | timeout = timespec_sub (end_time, now); |
| 6640 | } | 6640 | } |
| 6641 | else | 6641 | else |
| 6642 | { | 6642 | { |
| 6643 | timeout = make_emacs_time (100000, 0); | 6643 | timeout = make_timespec (100000, 0); |
| 6644 | } | 6644 | } |
| 6645 | 6645 | ||
| 6646 | /* If our caller will not immediately handle keyboard events, | 6646 | /* If our caller will not immediately handle keyboard events, |
| @@ -6649,7 +6649,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6649 | call timer_delay on their own.) */ | 6649 | call timer_delay on their own.) */ |
| 6650 | if (NILP (wait_for_cell)) | 6650 | if (NILP (wait_for_cell)) |
| 6651 | { | 6651 | { |
| 6652 | EMACS_TIME timer_delay; | 6652 | struct timespec timer_delay; |
| 6653 | 6653 | ||
| 6654 | do | 6654 | do |
| 6655 | { | 6655 | { |
| @@ -6669,9 +6669,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6669 | && requeued_events_pending_p ()) | 6669 | && requeued_events_pending_p ()) |
| 6670 | break; | 6670 | break; |
| 6671 | 6671 | ||
| 6672 | if (EMACS_TIME_VALID_P (timer_delay) && nsecs >= 0) | 6672 | if (timespec_valid_p (timer_delay) && nsecs >= 0) |
| 6673 | { | 6673 | { |
| 6674 | if (EMACS_TIME_LT (timer_delay, timeout)) | 6674 | if (timespec_cmp (timer_delay, timeout) < 0) |
| 6675 | { | 6675 | { |
| 6676 | timeout = timer_delay; | 6676 | timeout = timer_delay; |
| 6677 | timeout_reduced_for_timers = 1; | 6677 | timeout_reduced_for_timers = 1; |