I am trying to fix infinite select errors about 292MY.
src/lib.c:
int32_t gPoll(struct pollfd *fds, int32_t nfds, int64_t timeout) {
if (timeout == 9223372036854775807) { // 292MY
int i = nfds;
do
if (--i < 0)
return 0;
while (fds[i].fd < 0);
}
return (int32_t)poll(fds, (nfds_t)nfds, (int)timeout);
}
On my mac (int)9223372036854775807 == -1 which means no timeout. Why not
simply use -1?
src/io.l:
(de i64 waitFd (Exe (i32 . Fd) (i64 . Ms))
...
(and
(gt0 Ms)
(lt0 (dec 'Ms Dif))
(setq Ms 0) )
(setq Tim Now) )
... )
When Ms decrement to 9223372036854775806, (int)timeout becomes -2 which is
less than -1, then poll() returns EINVAL.
In the meantime I found two compile warnings:
src/lib.c: warning: use of GNU ?: conditional expression extension
ffi *ffiPrep(char *lib, char *fun, int64_t lst) {
if (ffi_prep_cif(&p->cif, FFI_DEFAULT_ABI, nargs, rtype, p->args)
== FFI_OK &&
(p->fun = dlsym(lib ?: RTLD_DEFAULT, fun)) )
src/lib.c: warning: '&' within '|' [-Wbitwise-op-parentheses]
int readyOut(struct pollfd *p) {
if (p->fd < 0)
return 0;
p->fd = -1;
return (p->revents & POLLOUT | POLLERR | POLLNVAL) != 0;
}
Please have a look. Thanks!
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe