From c581a08e3b1781840f39e63c2d2b986496912a50 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 23 Jan 2024 13:36:59 +0100 Subject: [PATCH] make file-select actually reflect what it is supposed to do (thanks to "dzoe" for reporting this) --- manual/Module (chicken file posix) | 4 ++-- posixunix.scm | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/manual/Module (chicken file posix) b/manual/Module (chicken file posix) index 28fb6b76..95574f78 100644 --- a/manual/Module (chicken file posix) +++ b/manual/Module (chicken file posix) @@ -528,8 +528,8 @@ the buffer containing the data and the number of bytes read. Waits until any of the file-descriptors given in the lists {{READFDLIST}} and {{WRITEFDLIST}} is ready for input or output, respectively. If the optional argument {{TIMEOUT}} is -given and not false, then it should specify the number of milliseconds after -which the wait is to be aborted. This procedure returns two values: +given and not false, then it should specify the number of seconds after +which the wait is to be aborted (the value may be a float). This procedure returns two values: the lists of file-descriptors ready for input and output, respectively. {{READFDLIST}} and {{WRITEFDLIST}} may also be file-descriptors instead of lists. In this case the returned values are booleans diff --git a/posixunix.scm b/posixunix.scm index bad9b4c0..665c89e0 100644 --- a/posixunix.scm +++ b/posixunix.scm @@ -409,7 +409,6 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime) (nfds (fx+ nfdsr nfdsw)) (fds-blob (##sys#make-blob (fx* nfds (foreign-value "sizeof(struct pollfd)" int))))) - (when tm (##sys#check-exact-integer tm)) (do ((i 0 (fx+ i 1)) (fdsrl fdsrl (cdr fdsrl))) ((null? fdsrl)) @@ -423,7 +422,7 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime) "struct pollfd *fds = p;" "fds[i].fd = fd; fds[i].events = POLLOUT;") i (car fdswl) fds-blob)) (let ((n ((foreign-lambda int "poll" scheme-pointer int int) - fds-blob nfds (if tm (* (max 0 tm) 1000) -1)))) + fds-blob nfds (if tm (inexact->exact (truncate (* (max 0 tm) 1000))) -1)))) (cond ((fx< n 0) (posix-error #:file-error 'file-select "failed" fdsr fdsw) ) ((fx= n 0) (values (if (pair? fdsr) '() #f) (if (pair? fdsw) '() #f))) -- 2.40.0