Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ivykis for openSUSE:Factory checked in at 2024-02-08 19:04:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ivykis (Old) and /work/SRC/openSUSE:Factory/.ivykis.new.1815 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ivykis" Thu Feb 8 19:04:28 2024 rev:14 rq:1145216 version:0.43 Changes: -------- --- /work/SRC/openSUSE:Factory/ivykis/ivykis.changes 2021-05-12 19:32:19.295016181 +0200 +++ /work/SRC/openSUSE:Factory/.ivykis.new.1815/ivykis.changes 2024-02-08 19:06:06.891714799 +0100 @@ -1,0 +2,6 @@ +Thu Feb 8 15:02:36 UTC 2024 - Jan Engelhardt <jeng...@inai.de> + +- Update to release 0.43 + * Added function ``iv_work_pool_submit_continuation`` + +------------------------------------------------------------------- Old: ---- ivykis-0.42.4.tar.gz New: ---- ivykis-0.43.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ivykis.spec ++++++ --- /var/tmp/diff_new_pack.A4YfN4/_old 2024-02-08 19:06:07.343731410 +0100 +++ /var/tmp/diff_new_pack.A4YfN4/_new 2024-02-08 19:06:07.343731410 +0100 @@ -1,7 +1,7 @@ # # spec file for package ivykis # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,68 +18,67 @@ %define lname libivykis0 Name: ivykis -Version: 0.42.4 +Version: 0.43 Release: 0 Summary: An event dispatching library License: LGPL-2.1-only Group: Development/Libraries/C and C++ URL: https://sourceforge.net/projects/libivykis/ -Source: https://downloads.sf.net/libivykis/%{name}-%{version}.tar.gz -BuildRequires: pkgconfig +Source: https://downloads.sf.net/libivykis/%name-%version.tar.gz +BuildRequires: c_compiler +BuildRequires: pkg-config %description -libivykis is a thin wrapper over various OS'es implementation of I/O -readiness notification facilities (such as poll(2), kqueue(2)) and is -mainly intended for writing portable high-performance network -servers. +libivykis is a wrapper over various OS'es implementation of I/O +readiness notification facilities (such as poll(2), kqueue(2)) and +can be used for writing portable network servers. -%package -n %{lname} +%package -n %lname Summary: An event dispatching library Group: System/Libraries -%description -n %{lname} -libivykis is a thin wrapper over various OS'es implementation of I/O -readiness notification facilities (such as poll(2), kqueue(2)) and is -mainly intended for writing portable high-performance network -servers. +%description -n %lname +libivykis is a wrapper over various OS'es implementation of I/O +readiness notification facilities (such as poll(2), kqueue(2)) and +can be used for writing portable network servers. %package devel Summary: Development files for libivykis, an event dispatching library Group: Development/Libraries/C and C++ -Requires: %{lname} = %{version} +Requires: %lname = %version %description devel -libivykis is a thin wrapper over various OS'es implementation of I/O -readiness notification facilities (such as poll(2), kqueue(2)) and is -mainly intended for writing portable high-performance network -servers. +libivykis is a wrapper over various OS'es implementation of I/O +readiness notification facilities (such as poll(2), kqueue(2)) and +can be used for writing portable network servers. This package contains the header files and development symlinks. %prep -%setup -q +%autosetup -p1 %build -%configure --disable-static --includedir=%{_includedir}/%{name}-%{version} +# includedir intentional, cf. bugzilla.opensuse.org/795968 +%configure --disable-static --includedir="%_includedir/%name" %make_build %install %make_install -find %{buildroot} -type f -name "*.la" -delete -print +find %buildroot -type f -name "*.la" -delete -print %check %make_build check -%post -n %{lname} -p /sbin/ldconfig -%postun -n %{lname} -p /sbin/ldconfig +%post -n %lname -p /sbin/ldconfig +%postun -n %lname -p /sbin/ldconfig -%files -n %{lname} -%{_libdir}/libivykis.so.0* +%files -n %lname +%_libdir/libivykis.so.0* %files devel -%{_includedir}/%{name}-%{version} -%{_libdir}/libivykis.so -%{_libdir}/pkgconfig/ivykis.pc -%{_mandir}/man3/iv*.3%{?ext_man} -%{_mandir}/man3/IV*.3%{?ext_man} +%_includedir/%name/ +%_libdir/libivykis.so +%_libdir/pkgconfig/ivykis.pc +%_mandir/man3/iv*.3* +%_mandir/man3/IV*.3* ++++++ ivykis-0.42.4.tar.gz -> ivykis-0.43.tar.gz ++++++ ++++ 30921 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/compile new/ivykis-0.43/compile --- old/ivykis-0.42.4/compile 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/compile 2024-01-29 19:45:10.000000000 +0100 @@ -1,9 +1,9 @@ -#!/usr/bin/sh +#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey <tro...@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/config.h.in new/ivykis-0.43/config.h.in --- old/ivykis-0.42.4/config.h.in 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/config.h.in 2024-01-29 19:45:10.000000000 +0100 @@ -46,9 +46,6 @@ /* Define to 1 if you have the `lwp_gettid' function. */ #undef HAVE_LWP_GETTID -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the `pipe2' function. */ #undef HAVE_PIPE2 @@ -64,8 +61,8 @@ /* Define to 1 if you have the <process.h> header file. */ #undef HAVE_PROCESS_H -/* Define to 1 if the system has the type `pthread_spinlock_t'. */ -#undef HAVE_PTHREAD_SPINLOCK_T +/* Define to 1 if you have the pthread_spin_trylock function */ +#undef HAVE_PTHREAD_SPIN_TRYLOCK /* Define to 1 if you have the `splice' function. */ #undef HAVE_SPLICE @@ -73,6 +70,9 @@ /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the <stdio.h> header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H @@ -139,7 +139,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Version number of package */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/configure.ac new/ivykis-0.43/configure.ac --- old/ivykis-0.42.4/configure.ac 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/configure.ac 2024-01-29 19:45:10.000000000 +0100 @@ -1,5 +1,5 @@ AC_PREREQ(2.59) -AC_INIT([ivykis], [0.42.4], [libivykis-disc...@lists.sourceforge.net]) +AC_INIT([ivykis], [0.43], [libivykis-disc...@lists.sourceforge.net]) AC_CONFIG_SRCDIR([src/iv_avl.c]) AC_CONFIG_SUBDIRS([test.mt]) AC_CONFIG_HEADER(config.h) @@ -123,8 +123,11 @@ )], [ac_cv_header_linux_netfilter_ipv4_h=yes], []) ]) -# Check for pthread_spinlock_t. -AC_CHECK_TYPES([pthread_spinlock_t], [], [], [[#include <pthread.h>]]) +# Check for pthread_spin_trylock +AC_CHECK_LIB([pthread], + [pthread_spin_trylock], + [AC_DEFINE(HAVE_PTHREAD_SPIN_TRYLOCK, 1, + Define to 1 if you have the pthread_spin_trylock function)]) # Check which header file defines 'struct timespec'. for hdr in sys/time.h sys/timers.h time.h pthread.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/libivykis.posix.ver new/ivykis-0.43/libivykis.posix.ver --- old/ivykis-0.42.4/libivykis.posix.ver 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/libivykis.posix.ver 2024-01-29 19:45:10.000000000 +0100 @@ -111,3 +111,7 @@ # iv_timer __iv_now_location_valid; } IVYKIS_0.33; + +IVYKIS_0.42 { + iv_work_pool_submit_continuation; +} IVYKIS_0.40; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/man3/iv_work.3 new/ivykis-0.43/man3/iv_work.3 --- old/ivykis-0.42.4/man3/iv_work.3 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/man3/iv_work.3 2024-01-29 19:45:10.000000000 +0100 @@ -5,7 +5,7 @@ .\" of the modification is added to the header. .TH iv_work 3 2010-09-14 "ivykis" "ivykis programmer's manual" .SH NAME -IV_WORK_POOL_INIT, iv_work_pool_create, iv_work_pool_put, IV_WORK_ITEM_INIT, iv_work_pool_submit_work \- ivykis +IV_WORK_POOL_INIT, iv_work_pool_create, iv_work_pool_put, IV_WORK_ITEM_INIT, iv_work_pool_submit_work, iv_work_pool_submit_continuation \- ivykis worker thread management .SH SYNOPSIS .B #include <iv_work.h> @@ -35,6 +35,8 @@ .br .BI "int iv_work_pool_submit_work(struct iv_work_pool *" this ", struct iv_work_item *" work ");" .br +.BI "int iv_work_pool_submit_continuation(struct iv_work_pool *" this ", struct iv_work_item *" work ");" +.br .SH DESCRIPTION Calling .B iv_work_pool_create @@ -81,6 +83,20 @@ .B iv_work_pool_create was called in for this pool object. .PP +Calling +.B iv_work_pool_submit_continuation +from a worker thread allows submitting a work item similarly to +.B iv_work_pool_submit_work. +But while +.B iv_work_pool_submit_work +can only be called from the thread owning +.B iv_work, +.B iv_work_pool_submit_continuation +can be called from any of the worker threads. The +.B ->completion +callback of these jobs will be executed from the thread owning +.B iv_work. +.PP As a special case, calling .B iv_work_pool_submit_work with a @@ -117,6 +133,8 @@ can only be called from the thread that .B iv_work_pool_create for this pool object was called in. +.B iv_work_pool_submit_continuation +can called from any of the worker threads. .PP There is no way to cancel submitted work items. .PP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/missing new/ivykis-0.43/missing --- old/ivykis-0.42.4/missing 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/missing 2024-01-29 19:45:10.000000000 +0100 @@ -1,9 +1,9 @@ -#!/usr/bin/sh +#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pin...@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/src/Makefile.am new/ivykis-0.43/src/Makefile.am --- old/ivykis-0.42.4/src/Makefile.am 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/src/Makefile.am 2024-01-29 19:45:10.000000000 +0100 @@ -60,9 +60,10 @@ INC += include/iv_inotify.h endif -LINKFLAGS = -version-info 5:6:5 +LINKFLAGS = -version-info 6:0:6 if HAVE_VERSIONING -LINKFLAGS += -Wl,--version-script,$(top_srcdir)/libivykis.posix.ver +LINKFLAGS += -Wl,--version-script,$(top_srcdir)/libivykis.posix.ver \ + -Wl,-undefined-version endif endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/src/include/iv.h.in new/ivykis-0.43/src/include/iv.h.in --- old/ivykis-0.42.4/src/include/iv.h.in 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/src/include/iv.h.in 2024-01-29 19:45:10.000000000 +0100 @@ -54,7 +54,7 @@ /* * Time handling. */ -const struct timespec *__iv_now_location_valid(); +const struct timespec *__iv_now_location_valid(void); #define iv_now (*__iv_now_location_valid()) #define iv_validate_now() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/src/include/iv_work.h new/ivykis-0.43/src/include/iv_work.h --- old/ivykis-0.42.4/src/include/iv_work.h 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/src/include/iv_work.h 2024-01-29 19:45:10.000000000 +0100 @@ -59,6 +59,8 @@ void iv_work_pool_put(struct iv_work_pool *this); void iv_work_pool_submit_work(struct iv_work_pool *this, struct iv_work_item *work); +void iv_work_pool_submit_continuation(struct iv_work_pool *this, + struct iv_work_item *work); #ifdef __cplusplus } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/src/iv_fd.c new/ivykis-0.43/src/iv_fd.c --- old/ivykis-0.42.4/src/iv_fd.c 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/src/iv_fd.c 2024-01-29 19:45:10.000000000 +0100 @@ -21,43 +21,42 @@ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> +#include <limits.h> #include <signal.h> #include <string.h> #include <sys/resource.h> #include "iv_private.h" /* internal use *************************************************************/ -int maxfd; -const struct iv_fd_poll_method *method; +const struct iv_fd_poll_method *method; static void sanitise_nofile_rlimit(int euid) { struct rlimit lim; getrlimit(RLIMIT_NOFILE, &lim); - maxfd = lim.rlim_cur; + if (lim.rlim_cur >= INT_MAX) + return; - if (euid) { - if (lim.rlim_cur < lim.rlim_max) { - lim.rlim_cur = (unsigned int)lim.rlim_max & 0x7FFFFFFF; - if (lim.rlim_cur > 131072) - lim.rlim_cur = 131072; + if (euid == 0) { + int rlim_initial; - if (setrlimit(RLIMIT_NOFILE, &lim) >= 0) - maxfd = lim.rlim_cur; - } - } else { + rlim_initial = lim.rlim_cur; lim.rlim_cur = 131072; lim.rlim_max = 131072; - while (lim.rlim_cur > maxfd) { - if (setrlimit(RLIMIT_NOFILE, &lim) >= 0) { - maxfd = lim.rlim_cur; + + while (lim.rlim_cur > rlim_initial) { + if (setrlimit(RLIMIT_NOFILE, &lim) >= 0) break; - } lim.rlim_cur /= 2; lim.rlim_max /= 2; } + } else if (lim.rlim_cur < lim.rlim_max) { + lim.rlim_cur = lim.rlim_max & 0x7fffffff; + if (lim.rlim_cur > 131072) + lim.rlim_cur = 131072; + setrlimit(RLIMIT_NOFILE, &lim); } } @@ -310,10 +309,8 @@ "still registered"); } - if (fd->fd < 0 || fd->fd >= maxfd) { - iv_fatal("iv_fd_register: called with invalid fd %d " - "(maxfd=%d)", fd->fd, maxfd); - } + if (fd->fd < 0) + iv_fatal("iv_fd_register: called with invalid fd %d", fd->fd); fd->registered = 1; INIT_IV_LIST_HEAD(&fd->list_active); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/src/iv_fd_epoll.c new/ivykis-0.43/src/iv_fd_epoll.c --- old/ivykis-0.42.4/src/iv_fd_epoll.c 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/src/iv_fd_epoll.c 2024-01-29 19:45:10.000000000 +0100 @@ -30,7 +30,7 @@ static int epoll_support = 2; -static int epollfd_grab(int maxfd) +static int epollfd_grab(void) { #if (defined(__NR_epoll_create1) || defined(HAVE_EPOLL_CREATE1)) && \ defined(EPOLL_CLOEXEC) @@ -52,7 +52,7 @@ if (epoll_support) { int ret; - ret = epoll_create(maxfd); + ret = epoll_create(1); if (ret >= 0 || errno != ENOSYS) { if (ret >= 0) iv_fd_set_cloexec(ret); @@ -69,7 +69,7 @@ { int fd; - fd = epollfd_grab(maxfd); + fd = epollfd_grab(); if (fd < 0) return -1; @@ -143,6 +143,32 @@ } } +#ifdef __NR_epoll_pwait2 +static int epoll_pwait2_support = 1; +#endif + +static int iv_fd_epoll_wait(struct iv_state *st, struct epoll_event *events, + int maxevents, const struct timespec *abs) +{ + int epfd = st->u.epoll.epoll_fd; + +#ifdef __NR_epoll_pwait2 + if (epoll_pwait2_support) { + struct timespec rel; + int ret; + + ret = syscall(__NR_epoll_pwait2, epfd, events, maxevents, + to_relative(st, &rel, abs), NULL); + if (ret == 0 || errno != ENOSYS) + return ret; + + epoll_pwait2_support = 0; + } +#endif + + return epoll_wait(epfd, events, maxevents, to_msec(st, abs)); +} + static int iv_fd_epoll_poll(struct iv_state *st, struct iv_list_head *active, const struct timespec *abs) @@ -154,8 +180,7 @@ iv_fd_epoll_flush_pending(st); - ret = epoll_wait(st->u.epoll.epoll_fd, batch, ARRAY_SIZE(batch), - to_msec(st, abs)); + ret = iv_fd_epoll_wait(st, batch, ARRAY_SIZE(batch), abs); __iv_invalidate_now(st); @@ -433,8 +458,7 @@ run_timers = !!(abs != NULL); - ret = epoll_wait(st->u.epoll.epoll_fd, batch, ARRAY_SIZE(batch), - to_msec(st, abs)); + ret = iv_fd_epoll_wait(st, batch, ARRAY_SIZE(batch), abs); __iv_invalidate_now(st); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/src/iv_fd_poll.c new/ivykis-0.43/src/iv_fd_poll.c --- old/ivykis-0.42.4/src/iv_fd_poll.c 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/src/iv_fd_poll.c 2024-01-29 19:45:10.000000000 +0100 @@ -24,13 +24,15 @@ #include <poll.h> #include "iv_private.h" +#define IV_FD_POLL_MAXFD 65536 + static int iv_fd_poll_init(struct iv_state *st) { - st->u.poll.pfds = malloc(maxfd * sizeof(struct pollfd)); + st->u.poll.pfds = malloc(IV_FD_POLL_MAXFD * sizeof(struct pollfd)); if (st->u.poll.pfds == NULL) return -1; - st->u.poll.fds = malloc(maxfd * sizeof(struct iv_fd_ *)); + st->u.poll.fds = malloc(IV_FD_POLL_MAXFD * sizeof(struct iv_fd_ *)); if (st->u.poll.fds == NULL) { free(st->u.poll.pfds); return -1; @@ -97,6 +99,11 @@ static void iv_fd_poll_register_fd(struct iv_state *st, struct iv_fd_ *fd) { + if (fd->fd >= IV_FD_POLL_MAXFD) { + iv_fatal("iv_fd_poll_register_fd: called with fd %d " + "(maxfd = %d)", fd->fd, IV_FD_POLL_MAXFD); + } + fd->u.index = -1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/src/iv_private_posix.h new/ivykis-0.43/src/iv_private_posix.h --- old/ivykis-0.42.4/src/iv_private_posix.h 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/src/iv_private_posix.h 2024-01-29 19:45:10.000000000 +0100 @@ -32,22 +32,22 @@ int numobjs; /* iv_event.c */ - int event_count; struct iv_task events_local; struct iv_event_raw events_kick; ___mutex_t event_list_mutex; struct iv_list_head events_pending; + int event_count; /* iv_fd.c */ int numfds; struct iv_fd_ *handled_fd; - int last_abs_count; struct timespec last_abs; + int last_abs_count; /* iv_task.c */ + uint32_t task_epoch; struct iv_list_head tasks; struct iv_list_head *tasks_current; - uint32_t task_epoch; /* iv_timer.c */ struct timespec time; @@ -196,7 +196,6 @@ } -extern int maxfd; extern const struct iv_fd_poll_method *method; extern const struct iv_fd_poll_method iv_fd_poll_method_dev_poll; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/src/iv_work.c new/ivykis-0.43/src/iv_work.c --- old/ivykis-0.42.4/src/iv_work.c 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/src/iv_work.c 2024-01-29 19:45:10.000000000 +0100 @@ -34,7 +34,9 @@ struct work_pool_priv { ___mutex_t lock; struct iv_event ev; + struct iv_event thread_needed; int shutting_down; + int max_threads; int started_threads; struct iv_list_head idle_threads; void *cookie; @@ -44,6 +46,7 @@ uint32_t seq_tail; struct iv_list_head work_items; struct iv_list_head work_done; + unsigned long tid; }; struct work_pool_thread { @@ -213,6 +216,7 @@ ___mutex_unlock(&pool->lock); ___mutex_destroy(&pool->lock); iv_event_unregister(&pool->ev); + iv_event_unregister(&pool->thread_needed); free(pool); return; } @@ -220,6 +224,22 @@ } } +static int iv_work_start_thread(struct work_pool_priv *pool); + +static void iv_work_thread_needed(void *_pool) +{ + struct work_pool_priv *pool = _pool; + + ___mutex_lock(&pool->lock); + + if (iv_list_empty(&pool->idle_threads) && + pool->started_threads < pool->max_threads) { + iv_work_start_thread(pool); + } + + ___mutex_unlock(&pool->lock); +} + int iv_work_pool_create(struct iv_work_pool *this) { struct work_pool_priv *pool; @@ -240,6 +260,12 @@ pool->ev.handler = iv_work_event; iv_event_register(&pool->ev); + IV_EVENT_INIT(&pool->thread_needed); + pool->thread_needed.cookie = pool; + pool->thread_needed.handler = iv_work_thread_needed; + iv_event_register(&pool->thread_needed); + + pool->max_threads = this->max_threads; pool->shutting_down = 0; pool->started_threads = 0; INIT_IV_LIST_HEAD(&pool->idle_threads); @@ -251,6 +277,8 @@ INIT_IV_LIST_HEAD(&pool->work_items); INIT_IV_LIST_HEAD(&pool->work_done); + pool->tid = iv_get_thread_id(); + this->priv = pool; return 0; @@ -307,10 +335,16 @@ return 0; } -static void -iv_work_submit_pool(struct iv_work_pool *this, struct iv_work_item *work) +static void iv_work_submit_pool(struct iv_work_pool *this, + struct iv_work_item *work, int continuation) { struct work_pool_priv *pool = this->priv; + int called_from_owner_thread = (pool->tid == iv_get_thread_id()); + + if (!continuation && !called_from_owner_thread) { + iv_fatal("iv_work_submit_pool: work items can only be " + "submitted from the owning thread"); + } ___mutex_lock(&pool->lock); @@ -325,7 +359,10 @@ thr->kicked = 1; iv_event_post(&thr->kick); } else if (pool->started_threads < this->max_threads) { - iv_work_start_thread(pool); + if (called_from_owner_thread) + iv_work_start_thread(pool); + else + iv_event_post(&pool->thread_needed); } ___mutex_unlock(&pool->lock); @@ -391,7 +428,16 @@ iv_work_pool_submit_work(struct iv_work_pool *this, struct iv_work_item *work) { if (this != NULL) - iv_work_submit_pool(this, work); + iv_work_submit_pool(this, work, 0); + else + iv_work_submit_local(work); +} + +void iv_work_pool_submit_continuation(struct iv_work_pool *this, + struct iv_work_item *work) +{ + if (this != NULL) + iv_work_submit_pool(this, work, 1); else iv_work_submit_local(work); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/src/spinlock.h new/ivykis-0.43/src/spinlock.h --- old/ivykis-0.42.4/src/spinlock.h 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/src/spinlock.h 2024-01-29 19:45:10.000000000 +0100 @@ -69,14 +69,18 @@ } -#ifdef HAVE_PTHREAD_SPINLOCK_T +#ifdef HAVE_PTHREAD_SPIN_TRYLOCK #ifdef HAVE_PRAGMA_WEAK #pragma weak pthread_spin_trylock #endif static inline int pthread_spinlocks_available(void) { +#ifdef HAVE_PTHREAD_SPIN_TRYLOCK return !!(pthread_spin_trylock != NULL); +#else + return 0; +#endif } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/test/iv_event_raw_bench.c new/ivykis-0.43/test/iv_event_raw_bench.c --- old/ivykis-0.42.4/test/iv_event_raw_bench.c 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/test/iv_event_raw_bench.c 2024-01-29 19:45:10.000000000 +0100 @@ -93,8 +93,8 @@ nsec = 1000000000ULL * (tim_end.tv_sec - tim_start.tv_sec) + (tim_end.tv_nsec - tim_start.tv_nsec); - printf("%s: %d in %ld nsec => %d/sec\n", - iv_poll_method_name(), ev_received, (long)nsec, + printf("%s: %d in %lld nsec => %d/sec\n", + iv_poll_method_name(), ev_received, nsec, (int)(1000000000ULL * ev_received / nsec)); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/test/iv_signal_bench.c new/ivykis-0.43/test/iv_signal_bench.c --- old/ivykis-0.42.4/test/iv_signal_bench.c 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/test/iv_signal_bench.c 2024-01-29 19:45:10.000000000 +0100 @@ -92,8 +92,8 @@ nsec = 1000000000ULL * (tim_end.tv_sec - tim_start.tv_sec) + (tim_end.tv_nsec - tim_start.tv_nsec); - printf("%s: %d in %ld nsec => %d/sec\n", - iv_poll_method_name(), sig_received, (long)nsec, + printf("%s: %d in %lld nsec => %d/sec\n", + iv_poll_method_name(), sig_received, nsec, (int)(1000000000ULL * sig_received / nsec)); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/test-driver new/ivykis-0.43/test-driver --- old/ivykis-0.42.4/test-driver 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/test-driver 2024-01-29 19:45:10.000000000 +0100 @@ -1,9 +1,9 @@ -#!/usr/bin/sh +#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2018 Free Software Foundation, Inc. +# Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -42,11 +42,13 @@ { cat <<END Usage: - test-driver --test-name=NAME --log-file=PATH --trs-file=PATH - [--expect-failure={yes|no}] [--color-tests={yes|no}] - [--enable-hard-errors={yes|no}] [--] + test-driver --test-name NAME --log-file PATH --trs-file PATH + [--expect-failure {yes|no}] [--color-tests {yes|no}] + [--enable-hard-errors {yes|no}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] + The '--test-name', '--log-file' and '--trs-file' options are mandatory. +See the GNU Automake documentation for information. END } @@ -103,8 +105,11 @@ trap "st=141; $do_exit" 13 trap "st=143; $do_exit" 15 -# Test script is run here. -"$@" >$log_file 2>&1 +# Test script is run here. We create the file first, then append to it, +# to ameliorate tests themselves also writing to the log file. Our tests +# don't, but others can (automake bug#35762). +: >"$log_file" +"$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then @@ -126,7 +131,7 @@ # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). -echo "$res $test_name (exit status: $estatus)" >>$log_file +echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/test.mt/config.h.in new/ivykis-0.43/test.mt/config.h.in --- old/ivykis-0.42.4/test.mt/config.h.in 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/test.mt/config.h.in 2024-01-29 19:45:10.000000000 +0100 @@ -9,12 +9,12 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the <stdio.h> header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H @@ -57,7 +57,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Version number of package */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/test.mt/configure.ac new/ivykis-0.43/test.mt/configure.ac --- old/ivykis-0.42.4/test.mt/configure.ac 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/test.mt/configure.ac 2024-01-29 19:45:10.000000000 +0100 @@ -142,9 +142,9 @@ # those (pthread_trace_notify_np is one of those symbols). # AC_SEARCH_LIBS([pthread_create], [pthread thread], [], - AC_SEARCH_LIBS([__pthread_create], [pthread], [], - AC_SEARCH_LIBS([pthread_trace_notify_np], [pthread], [], - AC_MSG_ERROR(pthreads support is required to build ivykis.)))) + [AC_SEARCH_LIBS([__pthread_create], [pthread], [], + [AC_SEARCH_LIBS([pthread_trace_notify_np], [pthread], [], + [AC_MSG_ERROR(pthreads support is required to build ivykis.)])])]) # Checks for libraries. AC_SEARCH_LIBS([socket], [socket]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ivykis-0.42.4/test.mt/iv_event_bench.c new/ivykis-0.43/test.mt/iv_event_bench.c --- old/ivykis-0.42.4/test.mt/iv_event_bench.c 2019-05-17 00:41:51.000000000 +0200 +++ new/ivykis-0.43/test.mt/iv_event_bench.c 2024-01-29 19:45:10.000000000 +0100 @@ -126,8 +126,8 @@ nsec = 1000000000ULL * (tim_end.tv_sec - tim_start.tv_sec) + (tim_end.tv_nsec - tim_start.tv_nsec); - printf("%s: %d in %ld nsec => %d/sec\n", - iv_poll_method_name(), ev_received, (long)nsec, + printf("%s: %d in %lld nsec => %d/sec\n", + iv_poll_method_name(), ev_received, nsec, (int)(1000000000ULL * ev_received / nsec)); return 0;