Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libevent Merge local changes from libevent 2.1....



details:   https://anonhg.NetBSD.org/src/rev/0d1fda3f1815
branches:  trunk
changeset: 961046:0d1fda3f1815
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 07 03:36:48 2021 +0000

description:
Merge local changes from libevent 2.1.8 and 2.1.12

diffstat:

 external/bsd/libevent/Makefile.inc                    |      4 +-
 external/bsd/libevent/dist/Doxyfile                   |     46 +-
 external/bsd/libevent/dist/buffer.c                   |     55 +-
 external/bsd/libevent/dist/bufferevent-internal.h     |     39 +-
 external/bsd/libevent/dist/bufferevent.c              |    120 +-
 external/bsd/libevent/dist/bufferevent_openssl.c      |      6 +-
 external/bsd/libevent/dist/bufferevent_ratelim.c      |     12 +-
 external/bsd/libevent/dist/compile                    |    347 -
 external/bsd/libevent/dist/config.guess               |   1463 --
 external/bsd/libevent/dist/config.sub                 |   1828 --
 external/bsd/libevent/dist/depcomp                    |    791 -
 external/bsd/libevent/dist/evbuffer-internal.h        |      5 +-
 external/bsd/libevent/dist/evconfig-private.h         |     50 -
 external/bsd/libevent/dist/evdns.c                    |    149 +-
 external/bsd/libevent/dist/event-internal.h           |     16 +-
 external/bsd/libevent/dist/event.c                    |    401 +-
 external/bsd/libevent/dist/event_tagging.c            |      9 +-
 external/bsd/libevent/dist/evmap.c                    |     48 +-
 external/bsd/libevent/dist/evrpc.c                    |     11 +-
 external/bsd/libevent/dist/evthread-internal.h        |     19 +-
 external/bsd/libevent/dist/evthread.c                 |      7 +-
 external/bsd/libevent/dist/evutil.c                   |    152 +-
 external/bsd/libevent/dist/evutil_rand.c              |     11 +-
 external/bsd/libevent/dist/http.c                     |    265 +-
 external/bsd/libevent/dist/include/event2/rpc.h       |     51 +-
 external/bsd/libevent/dist/include/event2/util.h      |     37 +-
 external/bsd/libevent/dist/install-sh                 |    501 -
 external/bsd/libevent/dist/kqueue.c                   |     16 +-
 external/bsd/libevent/dist/log-internal.h             |     28 +-
 external/bsd/libevent/dist/log.c                      |     15 +-
 external/bsd/libevent/dist/ltmain.sh                  |  11147 ----------------
 external/bsd/libevent/dist/minheap-internal.h         |      8 +-
 external/bsd/libevent/dist/missing                    |    215 -
 external/bsd/libevent/dist/select.c                   |      6 +-
 external/bsd/libevent/dist/test-driver                |    148 -
 external/bsd/libevent/dist/test/regress.c             |    345 +-
 external/bsd/libevent/dist/test/regress.h             |     10 +-
 external/bsd/libevent/dist/test/regress_buffer.c      |    386 +-
 external/bsd/libevent/dist/test/regress_bufferevent.c |    163 +-
 external/bsd/libevent/dist/test/regress_dns.c         |    531 +-
 external/bsd/libevent/dist/test/regress_et.c          |    151 +-
 external/bsd/libevent/dist/test/regress_http.c        |    496 +-
 external/bsd/libevent/dist/test/regress_listener.c    |    103 +-
 external/bsd/libevent/dist/test/regress_main.c        |     74 +-
 external/bsd/libevent/dist/test/regress_rpc.c         |     54 +-
 external/bsd/libevent/dist/test/regress_ssl.c         |    406 +-
 external/bsd/libevent/dist/test/regress_thread.c      |     13 +-
 external/bsd/libevent/dist/test/regress_util.c        |    201 +-
 external/bsd/libevent/dist/test/tinytest_macros.h     |     15 +-
 external/bsd/libevent/dist/util-internal.h            |     75 +-
 external/bsd/libevent/include/event2/event-config.h   |    125 +-
 external/bsd/libevent/libevent2netbsd                 |      3 +-
 52 files changed, 3517 insertions(+), 17660 deletions(-)

diffs (truncated from 26000 to 300 lines):

diff -r 720c8da377c1 -r 0d1fda3f1815 external/bsd/libevent/Makefile.inc
--- a/external/bsd/libevent/Makefile.inc        Wed Apr 07 02:59:01 2021 +0000
+++ b/external/bsd/libevent/Makefile.inc        Wed Apr 07 03:36:48 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.3 2017/01/31 23:17:39 christos Exp $
+# $NetBSD: Makefile.inc,v 1.4 2021/04/07 03:36:48 christos Exp $
 
 .include <bsd.own.mk>
 
@@ -10,7 +10,7 @@
 CPPFLAGS+=     -I${LIBEVENT_DIST}/include
 
 SHLIB_MAJOR=   4
-SHLIB_MINOR=   1
+SHLIB_MINOR=   2
 
 WARNS?=                4
 
diff -r 720c8da377c1 -r 0d1fda3f1815 external/bsd/libevent/dist/Doxyfile
--- a/external/bsd/libevent/dist/Doxyfile       Wed Apr 07 02:59:01 2021 +0000
+++ b/external/bsd/libevent/dist/Doxyfile       Wed Apr 07 03:36:48 2021 +0000
@@ -17,11 +17,11 @@
 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
 # by quotes) that should identify the project.
 
-PROJECT_NAME           = libevent
+PROJECT_NAME           = $(PROJECT)-$(VERSION)
 
 # Place all output under 'doxygen/'
 
-OUTPUT_DIRECTORY        = doxygen/
+OUTPUT_DIRECTORY        = $(DOCDIR)
 
 # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
 # will interpret the first line (until the first dot) of a JavaDoc-style 
@@ -64,24 +64,24 @@
 # with spaces.
 
 INPUT                  = \
-        include/event2/buffer.h \
-        include/event2/buffer_compat.h \
-        include/event2/bufferevent.h \
-        include/event2/bufferevent_compat.h \
-        include/event2/bufferevent_ssl.h \
-        include/event2/dns.h \
-        include/event2/dns_compat.h \
-        include/event2/event.h \
-        include/event2/event_compat.h \
-        include/event2/http.h \
-        include/event2/http_compat.h \
-        include/event2/listener.h \
-        include/event2/rpc.h \
-        include/event2/rpc_compat.h \
-        include/event2/tag.h \
-        include/event2/tag_compat.h \
-        include/event2/thread.h \
-        include/event2/util.h
+        $(SRCDIR)/include/event2/buffer.h \
+        $(SRCDIR)/include/event2/buffer_compat.h \
+        $(SRCDIR)/include/event2/bufferevent.h \
+        $(SRCDIR)/include/event2/bufferevent_compat.h \
+        $(SRCDIR)/include/event2/bufferevent_ssl.h \
+        $(SRCDIR)/include/event2/dns.h \
+        $(SRCDIR)/include/event2/dns_compat.h \
+        $(SRCDIR)/include/event2/event.h \
+        $(SRCDIR)/include/event2/event_compat.h \
+        $(SRCDIR)/include/event2/http.h \
+        $(SRCDIR)/include/event2/http_compat.h \
+        $(SRCDIR)/include/event2/listener.h \
+        $(SRCDIR)/include/event2/rpc.h \
+        $(SRCDIR)/include/event2/rpc_compat.h \
+        $(SRCDIR)/include/event2/tag.h \
+        $(SRCDIR)/include/event2/tag_compat.h \
+        $(SRCDIR)/include/event2/thread.h \
+        $(SRCDIR)/include/event2/util.h
 
 #---------------------------------------------------------------------------
 # configuration options related to the HTML output
@@ -90,7 +90,7 @@
 # If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
 # generate HTML output.
 
-GENERATE_HTML          = YES
+GENERATE_HTML          = $(GENERATE_HTML)
 
 #---------------------------------------------------------------------------
 # configuration options related to the LaTeX output
@@ -99,7 +99,7 @@
 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
 # generate Latex output.
 
-GENERATE_LATEX         = YES
+GENERATE_LATEX         = $(GENERATE_LATEX)
 
 # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
 # If a relative path is entered the value of OUTPUT_DIRECTORY will be 
@@ -175,7 +175,7 @@
 # If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
 # generate man pages
 
-GENERATE_MAN           = YES
+GENERATE_MAN           = $(GENERATE_MAN)
 
 # The MAN_EXTENSION tag determines the extension that is added to 
 # the generated man pages (default is the subroutine's section .3)
diff -r 720c8da377c1 -r 0d1fda3f1815 external/bsd/libevent/dist/buffer.c
--- a/external/bsd/libevent/dist/buffer.c       Wed Apr 07 02:59:01 2021 +0000
+++ b/external/bsd/libevent/dist/buffer.c       Wed Apr 07 03:36:48 2021 +0000
@@ -1,4 +1,5 @@
-/*     $NetBSD: buffer.c,v 1.4 2017/01/31 23:17:39 christos Exp $      */
+/*     $NetBSD: buffer.c,v 1.5 2021/04/07 03:36:48 christos Exp $      */
+
 /*
  * Copyright (c) 2002-2007 Niels Provos <provos%citi.umich.edu@localhost>
  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
@@ -28,7 +29,7 @@
 
 #include "event2/event-config.h"
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: buffer.c,v 1.4 2017/01/31 23:17:39 christos Exp $");
+__RCSID("$NetBSD: buffer.c,v 1.5 2021/04/07 03:36:48 christos Exp $");
 #include "evconfig-private.h"
 
 #ifdef _WIN32
@@ -98,6 +99,7 @@
 #include "evthread-internal.h"
 #include "evbuffer-internal.h"
 #include "bufferevent-internal.h"
+#include "event-internal.h"
 
 /* some systems do not have MAP_FAILED */
 #ifndef MAP_FAILED
@@ -525,8 +527,8 @@
                        evbuffer_incref_and_lock_(buffer);
                        if (buffer->parent)
                                bufferevent_incref_(buffer->parent);
+                       EVBUFFER_UNLOCK(buffer);
                }
-               EVBUFFER_UNLOCK(buffer);
        }
 
        evbuffer_run_callbacks(buffer, 0);
@@ -706,13 +708,17 @@
 advance_last_with_data(struct evbuffer *buf)
 {
        int n = 0;
+       struct evbuffer_chain **chainp = buf->last_with_datap;
+
        ASSERT_EVBUFFER_LOCKED(buf);
 
-       if (!*buf->last_with_datap)
+       if (!*chainp)
                return 0;
 
-       while ((*buf->last_with_datap)->next && (*buf->last_with_datap)->next->off) {
-               buf->last_with_datap = &(*buf->last_with_datap)->next;
+       while ((*chainp)->next) {
+               chainp = &(*chainp)->next;
+               if ((*chainp)->off)
+                       buf->last_with_datap = chainp;
                ++n;
        }
        return n;
@@ -1149,7 +1155,7 @@
                }
 
                buf->first = chain;
-               EVUTIL_ASSERT(chain && remaining <= chain->off);
+               EVUTIL_ASSERT(remaining <= chain->off);
                chain->misalign += remaining;
                chain->off -= remaining;
        }
@@ -1301,7 +1307,7 @@
                chain = chain->next;
        }
 
-       if (nread) {
+       if (chain != src->first) {
                /* we can remove the chain */
                struct evbuffer_chain **chp;
                chp = evbuffer_free_trailing_empty_chains(dst);
@@ -1419,9 +1425,11 @@
        for (; chain != NULL && (size_t)size >= chain->off; chain = next) {
                next = chain->next;
 
-               memcpy(buffer, chain->buffer + chain->misalign, chain->off);
-               size -= chain->off;
-               buffer += chain->off;
+               if (chain->buffer) {
+                       memcpy(buffer, chain->buffer + chain->misalign, chain->off);
+                       size -= chain->off;
+                       buffer += chain->off;
+               }
                if (chain == last_with_data)
                        removed_last_with_data = 1;
                if (&chain->next == buf->last_with_datap)
@@ -1537,11 +1545,11 @@
        return (-1);
 }
 
-static inline int
+static inline size_t
 evbuffer_strspn(
        struct evbuffer_ptr *ptr, const char *chrset)
 {
-       int count = 0;
+       size_t count = 0;
        struct evbuffer_chain *chain = ptr->internal_.chain;
        size_t i = ptr->internal_.pos_in_chain;
 
@@ -1827,6 +1835,10 @@
 
        EVBUFFER_LOCK(buf);
 
+       if (datlen == 0) {
+               result = 0;
+               goto done;
+       }
        if (buf->freeze_start) {
                goto done;
        }
@@ -1880,7 +1892,7 @@
        if ((tmp = evbuffer_chain_new(datlen)) == NULL)
                goto done;
        buf->first = tmp;
-       if (buf->last_with_datap == &buf->first)
+       if (buf->last_with_datap == &buf->first && chain->off)
                buf->last_with_datap = &tmp->next;
 
        tmp->next = chain;
@@ -2230,11 +2242,13 @@
        so_far = 0;
        /* Let firstchain be the first chain with any space on it */
        firstchainp = buf->last_with_datap;
+       EVUTIL_ASSERT(*firstchainp);
        if (CHAIN_SPACE_LEN(*firstchainp) == 0) {
                firstchainp = &(*firstchainp)->next;
        }
 
        chain = *firstchainp;
+       EVUTIL_ASSERT(chain);
        for (i = 0; i < n_vecs_avail && so_far < (size_t)howmuch; ++i) {
                size_t avail = (size_t) CHAIN_SPACE_LEN(chain);
                if (avail > (howmuch - so_far) && exact)
@@ -2468,7 +2482,7 @@
        ev_off_t len = chain->off;
 #elif defined(SENDFILE_IS_LINUX) || defined(SENDFILE_IS_SOLARIS)
        ev_ssize_t res;
-       ev_off_t offset = chain->misalign;
+       off_t offset = chain->misalign;
 #endif
 
        ASSERT_EVBUFFER_LOCKED(buffer);
@@ -3201,7 +3215,6 @@
                        }
                }
        }
-       ++seg->refcnt;
        EVLOCK_UNLOCK(seg->lock, 0);
 
        if (buf->freeze_end)
@@ -3265,6 +3278,9 @@
                chain->off = length;
        }
 
+       EVLOCK_LOCK(seg->lock, 0);
+       ++seg->refcnt;
+       EVLOCK_UNLOCK(seg->lock, 0);
        extra->segment = seg;
        buf->n_add_for_cb += length;
        evbuffer_chain_insert(buf, chain);
@@ -3296,7 +3312,7 @@
        return r;
 }
 
-void
+int
 evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg)
 {
        EVBUFFER_LOCK(buffer);
@@ -3307,10 +3323,15 @@
        if (cb) {
                struct evbuffer_cb_entry *ent =
                    evbuffer_add_cb(buffer, NULL, cbarg);
+               if (!ent) {
+                       EVBUFFER_UNLOCK(buffer);
+                       return -1;
+               }
                ent->cb.cb_obsolete = cb;
                ent->flags |= EVBUFFER_CB_OBSOLETE;
        }
        EVBUFFER_UNLOCK(buffer);
+       return 0;
 }
 
 struct evbuffer_cb_entry *
diff -r 720c8da377c1 -r 0d1fda3f1815 external/bsd/libevent/dist/bufferevent-internal.h
--- a/external/bsd/libevent/dist/bufferevent-internal.h Wed Apr 07 02:59:01 2021 +0000
+++ b/external/bsd/libevent/dist/bufferevent-internal.h Wed Apr 07 03:36:48 2021 +0000
@@ -1,4 +1,5 @@



Home | Main Index | Thread Index | Old Index