From nobody Sun Jul 10 17:51:10 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AB56517FC65C; Sun, 10 Jul 2022 17:51:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LgvhG4T1Lz3Z25; Sun, 10 Jul 2022 17:51:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657475470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z2RsoJ8zy4+7/GuYrv4YnL/4fAfsMvWu5ElNkhWa8PU=; b=Fgn3R9/oP+Mdc/sWHMGb+OhGq7395U3pfz14VpCK2CaBNynfJjUL17WsZWxjbsHGzdvfCP bajkskqRRyAWiLcGsF0VIWiyGox1EhC7/We+13tcOdP4HCuloHE2ZjmPFnchfWR3kSPPpm 71+INyeT06upvsYubrLnnadEkaNclL0uXZaTwaQNv4XC7SL2nMXXgehlAgEy1rOuciXN/Y lzQNlJTLzNIgz3GtuqUdPsrTByET1Wrb8dxddc15TKED7KM1i1l8d1qpPaEzYcOZq07/12 niDgR1/tFHTnoG3DyXBWVddNxs5q6KuUbJnGF0vqy6m0wkXZQb3QMwQn3ufpQg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LgvhG3XhczYLN; Sun, 10 Jul 2022 17:51:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26AHpAVu083808; Sun, 10 Jul 2022 17:51:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26AHpAXt083807; Sun, 10 Jul 2022 17:51:10 GMT (envelope-from git) Date: Sun, 10 Jul 2022 17:51:10 GMT Message-Id: <202207101751.26AHpAXt083807@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Eugene Grosbein Subject: git: 972bbf13b424 - main - databases/rrdtool: add new port option LOCKTIMEOUT List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 972bbf13b42495101400b8afee66b96775e2f31c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657475470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z2RsoJ8zy4+7/GuYrv4YnL/4fAfsMvWu5ElNkhWa8PU=; b=SLUoYU7cjqSum4ia28jTDGZx808FJiKpLFkCKgcPGQgHqCuIQ1DkfX+3Jl3GRYygRrx66Y MPctLzjy5LHyjZ1AovPXrIw20FEtHl0Sf40Mir87YBmjxnSyMDGF1dobL3NUHTH+04xUzm wAMPiQvzvNjfeG+uMV7mbvYJA37VQQq3ozrdV970OhsR0rvyVzK6UAvIoK1ck8K7mlJmpp TSlx88D3Sa7qnmov5KbtV/LZ2zBqG/aYpnCgLJscgiyYXBCLvG3Wq4xvPbf+MLVc6P2zXV GdCBCYB5RtEKq0t22ckFBuWRQCAWmw4X3qCcx/zB83TZg3ceB9s8+6N/DskRVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657475470; a=rsa-sha256; cv=none; b=HUhF9Q6IvQs0ZEoe8hw3ReNIRl3IgoGSqsTdCcdoIobkmG/1KTmPi8X2t2EF6CdsZQo6o3 l9fpWXtPRjs297mlEpfvwjlEKqfCL9XOzMbnoDaRZGJwwu1ql/YXadJjzyica9DbWeYtsE 3nBvCIcNNbYg4BsEnstd17ZpOyH5+E1475IFRUOWim2XJoqLBAZXbstiKMZcegO8o5C1mP GfVjm+t3OdxTbX5ZMnSUtll01bZRiT4gPACfqptz2gjcoztBR4ktkzuzCcHggZzsvHD5Bu 6/NFNYQt7DARojPxfvDCIvkuXzcx2jqi7cyMVWpSeXSbi9tzDrzPh5QJO8ktig== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/ports/commit/?id=972bbf13b42495101400b8afee66b96775e2f31c commit 972bbf13b42495101400b8afee66b96775e2f31c Author: Eugene Grosbein AuthorDate: 2022-07-10 17:45:05 +0000 Commit: Eugene Grosbein CommitDate: 2022-07-10 17:51:01 +0000 databases/rrdtool: add new port option LOCKTIMEOUT By default, RRDTool tries to lock RRD file and fails if it cannot obtain the lock immediately. New build option LOCKTIMEOUT (disabled by default) allows to change this behavior and specify a time interval (in seconds) with environment variable RRDTOOL_LOCK_TIMEOUT to wait for lock if the file is busy. It will fail if the lock cannot be obtained in time. Zero value makes it wait for the lock indefinitely. The patch documents the feature in the manual page and HTML docs. Default build is not affected, so PORTREVISION not bumped. --- databases/rrdtool/Makefile | 4 +- databases/rrdtool/files/extra-patch-locktimeout | 80 +++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/databases/rrdtool/Makefile b/databases/rrdtool/Makefile index 88591c7e5ada..8d53ecfd2265 100644 --- a/databases/rrdtool/Makefile +++ b/databases/rrdtool/Makefile @@ -26,12 +26,13 @@ CPE_VENDOR= rrdtool_project PORTEXAMPLES= cgi-demo.cgi -OPTIONS_DEFINE= DEJAVU GRAPH MMAP NLS PERL PYTHON \ +OPTIONS_DEFINE= DEJAVU GRAPH MMAP LOCKTIMEOUT NLS PERL PYTHON \ RUBY EXAMPLES DOCS OPTIONS_DEFAULT=DEJAVU GRAPH MMAP PERL OPTIONS_SUB= yes GRAPH_DESC= Enable the rrdtool graph command (needs cairo) DEJAVU_DESC= Use DejaVu fonts (requires X11) +LOCKTIMEOUT_DESC=Enable the patch for lock timeout MMAP_DESC= Use mmap in rrd_update PERL_DESC= Build PERL module PYTHON_DESC= Build PYTHON bindings @@ -46,6 +47,7 @@ GRAPH_CONFIGURE_OFF= --disable-rrdcgi --disable-rrd_graph GRAPH_LIB_DEPENDS= libfreetype.so:print/freetype2 \ libpng.so:graphics/png GRAPH_USE= GNOME=cairo,pango +LOCKTIMEOUT_EXTRA_PATCHES=${PATCHDIR}/extra-patch-locktimeout MMAP_CONFIGURE_ENABLE= mmap NLS_CONFIGURE_ENABLE= nls NLS_USE= GNOME=intltool diff --git a/databases/rrdtool/files/extra-patch-locktimeout b/databases/rrdtool/files/extra-patch-locktimeout new file mode 100644 index 000000000000..9d6d4607a7fb --- /dev/null +++ b/databases/rrdtool/files/extra-patch-locktimeout @@ -0,0 +1,80 @@ +--- src/rrd_open.c.orig 2019-05-28 01:48:09.000000000 +0700 ++++ src/rrd_open.c 2022-07-11 00:05:29.242533000 +0700 +@@ -32,6 +32,16 @@ + #include "rrd_rados.h" + #endif + ++#include ++/* ++ * Signal handler for SIGALRM. ++ */ ++static void ++timeout(int sig) ++{ ++ (void)sig; ++} ++ + #define MEMBLK 8192 + + #ifdef _WIN32 +@@ -776,8 +786,9 @@ int rrd_rwlock( + return 0; + } + #endif +- int rcstat; ++ int rcstat, waitsec; + rrd_simple_file_t *rrd_simple_file; ++ char *endptr, *pwaitsec; + + rrd_simple_file = (rrd_simple_file_t *) rrd_file->pvt; + #ifdef USE_WINDOWS_LOCK +@@ -786,6 +797,25 @@ int rrd_rwlock( + /* Silence unused parameter compiler warning */ + (void) writelock; + #else ++ if ((pwaitsec = getenv("RRDTOOL_LOCK_TIMEOUT")) != NULL) { ++ waitsec = strtol(pwaitsec, &endptr, 0); ++ if (*endptr == '\0' && waitsec >= 0) { ++ if (waitsec > 0) { /* Set up a timeout. */ ++ struct sigaction act; ++ ++ act.sa_handler = timeout; ++ sigemptyset(&act.sa_mask); ++ act.sa_flags = SA_RESETHAND; /* Note that we do not set SA_RESTART. */ ++ sigaction(SIGALRM, &act, NULL); ++ alarm(waitsec); ++ } ++ rcstat = flock(rrd_simple_file->fd, writelock ? LOCK_EX : LOCK_SH); ++ if (waitsec > 0) ++ alarm(0); ++ ++ return (rcstat); ++ } ++ } + { + struct flock lock; + +--- doc/rrdtool.pod.orig 2019-02-04 20:54:28.000000000 +0700 ++++ doc/rrdtool.pod 2022-07-11 00:37:16.486373000 +0700 +@@ -321,6 +321,21 @@ + L, a caching daemon for RRDtool which may help you lessen the + stress on your disks. + ++=head1 ENVIRONMENT ++ ++=over 8 ++ ++=item RRDTOOL_LOCK_TIMEOUT ++ ++By default, B tries to lock RRD file and fails ++if it cannot obtain the lock immediately. ++This variable allows to change this behavior and specify ++a time interval in seconds to wait for lock if the file is busy. ++It will fail if the lock cannot be obtained in time. ++Zero value makes it wait for the lock indefinitely. ++ ++=back ++ + =head1 SEE ALSO + + rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport,