*** empty log message ***

This commit is contained in:
Marc Alexander Lehmann 2019-06-26 00:01:46 +00:00
parent 9d53c7d7db
commit e8f6f2f60a
9 changed files with 58 additions and 15 deletions

View File

@ -3,6 +3,11 @@ Revision history for libev, a high-performance and full-featured event loop.
- linux aio backend almost complete rewritten to work around its
limitations.
- epoll backend now mandatory for linux aio backend.
- fail assertions more aggressively on invalid fd's detected
in the event loop, do not just silently fd_kill in case of
user error.
- ev_io_start/ev_io_stop now verify the watcher fd using
a syscall when EV_VERIFY is 2 or higher.
4.26 (EV only)
- update to libecb 0x00010006.

13
ev.3
View File

@ -293,9 +293,13 @@ it will print a diagnostic message and abort (via the \f(CW\*(C`assert\*(C'\fR m
so \f(CW\*(C`NDEBUG\*(C'\fR will disable this checking): these are programming errors in
the libev caller and need to be fixed there.
.PP
Libev also has a few internal error-checking \f(CW\*(C`assert\*(C'\fRions, and also has
extensive consistency checking code. These do not trigger under normal
circumstances, as they indicate either a bug in libev or worse.
Via the \f(CW\*(C`EV_FREQUENT\*(C'\fR macro you can compile in and/or enable extensive
consistency checking code inside libev that can be used to check for
internal inconsistencies, suually caused by application bugs.
.PP
Libev also has a few internal error-checking \f(CW\*(C`assert\*(C'\fRions. These do not
trigger under normal circumstances, as they indicate either a bug in libev
or worse.
.SH "GLOBAL FUNCTIONS"
.IX Header "GLOBAL FUNCTIONS"
These functions can be called anytime, even before initialising the
@ -5084,6 +5088,9 @@ called once per loop, which can slow down libev. If set to \f(CW3\fR, then the
verification code will be called very frequently, which will slow down
libev considerably.
.Sp
Verification errors are reported via C's \f(CW\*(C`assert\*(C'\fR mechanism, so if you
disable that (e.g. by defining \f(CW\*(C`NDEBUG\*(C'\fR) then no errors will be reported.
.Sp
The default is \f(CW1\fR, unless \f(CW\*(C`EV_FEATURES\*(C'\fR overrides it, in which case it
will be \f(CW0\fR.
.IP "\s-1EV_COMMON\s0" 4

6
ev.c
View File

@ -3925,6 +3925,9 @@ ev_io_start (EV_P_ ev_io *w) EV_NOEXCEPT
assert (("libev: ev_io_start called with negative fd", fd >= 0));
assert (("libev: ev_io_start called with illegal event mask", !(w->events & ~(EV__IOFDSET | EV_READ | EV_WRITE))));
#if EV_VERIFY >= 2
assert (("libev: ev_io_start called on watcher with invalid fd", fd_valid (fd)));
#endif
EV_FREQUENT_CHECK;
ev_start (EV_A_ (W)w, 1);
@ -3950,6 +3953,9 @@ ev_io_stop (EV_P_ ev_io *w) EV_NOEXCEPT
assert (("libev: ev_io_stop called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax));
#if EV_VERIFY >= 2
assert (("libev: ev_io_stop called on watcher with invalid fd", fd_valid (w->fd)));
#endif
EV_FREQUENT_CHECK;
wlist_del (&anfds[w->fd].head, (WL)w);

13
ev.pod
View File

@ -161,9 +161,13 @@ it will print a diagnostic message and abort (via the C<assert> mechanism,
so C<NDEBUG> will disable this checking): these are programming errors in
the libev caller and need to be fixed there.
Libev also has a few internal error-checking C<assert>ions, and also has
extensive consistency checking code. These do not trigger under normal
circumstances, as they indicate either a bug in libev or worse.
Via the C<EV_FREQUENT> macro you can compile in and/or enable extensive
consistency checking code inside libev that can be used to check for
internal inconsistencies, suually caused by application bugs.
Libev also has a few internal error-checking C<assert>ions. These do not
trigger under normal circumstances, as they indicate either a bug in libev
or worse.
=head1 GLOBAL FUNCTIONS
@ -4975,6 +4979,9 @@ called once per loop, which can slow down libev. If set to C<3>, then the
verification code will be called very frequently, which will slow down
libev considerably.
Verification errors are reported via C's C<assert> mechanism, so if you
disable that (e.g. by defining C<NDEBUG>) then no errors will be reported.
The default is C<1>, unless C<EV_FEATURES> overrides it, in which case it
will be C<0>.

View File

@ -130,6 +130,8 @@ epoll_modify (EV_P_ int fd, int oev, int nev)
return;
}
else
assert (("libev: I/O watcher with invalid fd found in epoll_ctl", errno != EBADF && errno != ELOOP && errno != EINVAL));
fd_kill (EV_A_ fd);

View File

@ -129,10 +129,16 @@ kqueue_poll (EV_P_ ev_tstamp timeout)
if (fd_valid (fd))
kqueue_modify (EV_A_ fd, 0, anfds [fd].events);
else
fd_kill (EV_A_ fd);
{
assert (("libev: kqueue found invalid fd", 0));
fd_kill (EV_A_ fd);
}
}
else /* on all other errors, we error out on the fd */
fd_kill (EV_A_ fd);
{
assert (("libev: kqueue found invalid fd", 0));
fd_kill (EV_A_ fd);
}
}
}
else

View File

@ -291,15 +291,18 @@ linuxaio_modify (EV_P_ int fd, int oev, int nev)
if (iocb->io.aio_reqprio < 0)
{
/* we handed this fd over to epoll, so undo this first */
/* we do it manually because the optimisations on epoll_modfy won't do us any good */
/* we do it manually because the optimisations on epoll_modify won't do us any good */
epoll_ctl (backend_fd, EPOLL_CTL_DEL, fd, 0);
anfds [fd].emask = 0;
iocb->io.aio_reqprio = 0;
}
if (iocb->io.aio_buf)
/* io_cancel always returns some error on relevant kernels, but works */
evsys_io_cancel (linuxaio_ctx, &iocb->io, (struct io_event *)0);
{
evsys_io_cancel (linuxaio_ctx, &iocb->io, (struct io_event *)0);
/* on relevant kernels, io_cancel fails with EINPROGRES if everything is fine */
assert (("libev: linuxaio unexpected io_cancel failed", errno != EINPROGRESS));
}
if (nev)
{
@ -510,6 +513,7 @@ linuxaio_poll (EV_P_ ev_tstamp timeout)
}
else if (errno == EBADF)
{
assert (("libev: event loop rejected bad fd", errno != EBADF));
fd_kill (EV_A_ linuxaio_submits [submitted]->aio_fildes);
res = 1; /* skip this iocb */

View File

@ -110,14 +110,17 @@ poll_poll (EV_P_ ev_tstamp timeout)
else
for (p = polls; res; ++p)
{
assert (("libev: poll() returned illegal result, broken BSD kernel?", p < polls + pollcnt));
assert (("libev: poll returned illegal result, broken BSD kernel?", p < polls + pollcnt));
if (expect_false (p->revents)) /* this expect is debatable */
{
--res;
if (expect_false (p->revents & POLLNVAL))
fd_kill (EV_A_ p->fd);
{
assert (("libev: poll found invalid fd in poll set", 0));
fd_kill (EV_A_ p->fd);
}
else
fd_event (
EV_A_

View File

@ -1,7 +1,7 @@
/*
* libev solaris event port backend
*
* Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de>
* Copyright (c) 2007,2008,2009,2010,2011,2019 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
@ -69,7 +69,10 @@ port_associate_and_check (EV_P_ int fd, int ev)
)
{
if (errno == EBADFD)
fd_kill (EV_A_ fd);
{
assert (("libev: port_associate found invalid fd", errno != EBADFD);
fd_kill (EV_A_ fd);
}
else
ev_syserr ("(libev) port_associate");
}