From nobody Sun Aug 28 21:19:38 2022 X-Original-To: dev-commits-ports-main@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 4MG60B4f3Qz4bNsR; Sun, 28 Aug 2022 21:19:38 +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 4MG60B4P1lz3qrk; Sun, 28 Aug 2022 21:19:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661721578; 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=S2l1QiZdpIA+ATgAnoM5f8EVT3gUUUmVrrNfQZH5qlM=; b=D5LABwoK16kpMKcnbnw9UjhaCjO0CDjtaPO3xUGn1aajdFhOmobIKgrhn0mfPRC7ilTgQg yJc5tLwh1kbdxIFi2KXw79kFD5dzvId47LD8HJBsRPIbA2Gj0xGdIkkS+yIQVWqUf0TdeI voh8UZe1B/gzunEM4apMA9G4N+4Yz1U3E5opB3ErwA3Ot8TO4H9IRCuoUvxR5XmX/A6+Sh G9h2nrvSgp2wVJbJIrmczzBEznFjEHrzosbHf5HuCRvam5lwG+UdlynNRJ/3n2HhMHtH3L 7bq5yDtNY/jMBKE4O9vJRNB0/sSMHKByeAV5I5akcJOVCB5SnraPHg2jBgstiw== 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 4MG60B3MPwz1CRc; Sun, 28 Aug 2022 21:19:38 +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 27SLJcSt034155; Sun, 28 Aug 2022 21:19:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27SLJc7f034154; Sun, 28 Aug 2022 21:19:38 GMT (envelope-from git) Date: Sun, 28 Aug 2022 21:19:38 GMT Message-Id: <202208282119.27SLJc7f034154@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Cy Schubert Subject: git: dec4ecc3afec - main - sysutils/nut*: Add upslog support for multiple UPSs List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dec4ecc3afecab035a4d4fa59c35093d9f53ffd5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661721578; 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=S2l1QiZdpIA+ATgAnoM5f8EVT3gUUUmVrrNfQZH5qlM=; b=XT+j+dy153ES3Q/pxaRbvoCYAvKICVNVaflvwWyA8zBK55XGQGaxv5MXyDA1vvWktdlqTt SoyZDIXtcjEY3SihFSF7p0ZFo5LluhdCKd8pw0p45HXLh4UJqJWuH6Hr2X+cgDIzVMxdXO mZ2e1t+1FUORDroYr5KZ/EDUvK3mx+Cbndm+HjgKKKsEJ/3z8iH4p8027bkCyC8NC6nOt/ YYFnwj7IMNpV7dqzLOQ78YaDlHrP5OR6wQYClROkpUSvazue8JdcOfVmaZ7YSbwsVeWHop yo+4Ct8o3/zfG4/WN0F759xeFK+YS0gOkhb8NkpM3xOnVmIRBlfQou5l4lkJPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661721578; a=rsa-sha256; cv=none; b=RCDrd0VdlBAWHqkeuGjOHXoC/UhrF7ucw3y/+47phl9z80ltXJnrblXabZd1aXFmdeJ4JJ BLGoFE3I8RlGmmLgcFp6LhrkKL42tPRcL1K6jnpgsEIkk4gkpsytmXquK/pUPVcyXXk32u Yw7qp68baNuJ1sXhKEn4eS2ZF/iqLpVcP6SNFd9XCBocZ+uJv1fzk/RQsad8B44bICkRZy emLy27kURKtEyjh0m+QhFxU8cXugAjDPpUSxc4C/dLc/0ZqB5eGpzI0Adp8Q9yyH5JwDUE jBAv8XyGPveLx7QEVQWopyczbMPtj/RcrZ1pjVDj09GdFqbku36uWAlEscDweA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/ports/commit/?id=dec4ecc3afecab035a4d4fa59c35093d9f53ffd5 commit dec4ecc3afecab035a4d4fa59c35093d9f53ffd5 Author: Cy Schubert AuthorDate: 2022-08-21 15:21:51 +0000 Commit: Cy Schubert CommitDate: 2022-08-28 21:16:40 +0000 sysutils/nut*: Add upslog support for multiple UPSs upslog is a utility that logs UPS status at regular intervals, specified by the -i option. Unfortunately upslog supports only on UPS. For sites that need to monitor multiple UPSs the options are to cobble an rc script for each or doctor up the nut_upslog.in script to support cloning of the script. Unfortunately an rc script capable of being cloned would become the source of more PRs and would require significanly more tehcnical documentation that by itself might become confusing for the average system administrator. Therefore a new -m option is added to support multiple UPSs using the same invocation of upslog. The patch parses a -m option and forks almost immediately following the getopt(3) invokation to monitor each individual UPS using a separate upslog process. This is not ideal but better than scripting. Lightweight threads might be a better solution. An rc.conf exemple of how to use this new feature: nut_upslog_flags="-p /var/db/nut/upslog.pid -m ups1@localhost,/var/log/nut\ /ups1.log,/var/db/nut/ups1.pid -m ups1@localhost,/var/log/nut/ups2.log,/var\ /db/nut/ups2.pid" Sending a TERM signal to the parent PID, kill `cat /var/db/nut/upslog.pid`, will terminate the entire process tree. This patch submitted upstream, is in the process of being refined and accepted. PR: 265963 Reported by: vvd@unislabs.com --- sysutils/nut-devel/Makefile | 1 + sysutils/nut-devel/files/patch-clients_upslog.c | 167 +++++++++++++++++++++ sysutils/nut-devel/files/patch-docs_man_upslog.txt | 16 ++ sysutils/nut/Makefile | 2 +- sysutils/nut/files/patch-clients_upslog.c | 166 ++++++++++++++++++++ sysutils/nut/files/patch-docs_man_upslog.8 | 16 ++ sysutils/nut/files/patch-include_nut__stdint.h | 31 ++++ 7 files changed, 398 insertions(+), 1 deletion(-) diff --git a/sysutils/nut-devel/Makefile b/sysutils/nut-devel/Makefile index 9e30974d0999..e40b38582e55 100644 --- a/sysutils/nut-devel/Makefile +++ b/sysutils/nut-devel/Makefile @@ -1,5 +1,6 @@ PORTNAME= nut PORTVERSION= ${NUT_COMMIT_DATE} +PORTREVISION= 1 CATEGORIES= sysutils PKGNAMESUFFIX= -devel # MASTER_SITES= http://www.networkupstools.org/source/${PORTVERSION:R}/ diff --git a/sysutils/nut-devel/files/patch-clients_upslog.c b/sysutils/nut-devel/files/patch-clients_upslog.c new file mode 100644 index 000000000000..b00846526b21 --- /dev/null +++ b/sysutils/nut-devel/files/patch-clients_upslog.c @@ -0,0 +1,167 @@ +--- clients/upslog.c.orig 2022-08-26 15:25:26.539215000 -0700 ++++ clients/upslog.c 2022-08-26 15:26:10.909994000 -0700 +@@ -32,6 +32,10 @@ + */ + + #include "common.h" ++#include ++#include ++#include ++#include + #include "nut_platform.h" + #include "upsclient.h" + +@@ -41,17 +45,32 @@ + #include "upslog.h" + + static int reopen_flag = 0, exit_flag = 0; ++ static int wait_status; + static uint16_t port; + static char *upsname, *hostname; + static UPSCONN_t ups; + + static FILE *logfile; +- static const char *logfn, *monhost; ++ static char *logfn, *monhost; + static sigset_t nut_upslog_sigmask; + static char logbuffer[LARGEBUF], *logformat; + + static flist_t *fhead = NULL; ++ struct monhost_child { ++ char *monhost; ++ char *logfn; ++ char *pidfilebase; ++ pid_t pid; ++ struct monhost_child *next; ++ }; ++ static struct monhost_child *monhost_child_anchor = NULL; ++ static struct monhost_child *monhost_child_current = NULL; ++ static struct monhost_child *monhost_child_prev = NULL; ++ static struct sigaction upslog_sigaction; ++ static int trapped_signals[] = { SIGHUP, SIGINT, SIGTERM, SIGCHLD }; ++ static pid_t daemon_pid; + ++ + #define DEFAULT_LOGFORMAT "%TIME @Y@m@d @H@M@S% %VAR battery.charge% " \ + "%VAR input.voltage% %VAR ups.load% [%VAR ups.status%] " \ + "%VAR ups.temperature% %VAR input.frequency%" +@@ -131,6 +150,8 @@ + printf(" -p - Base name for PID file (defaults to \"%s\")\n", prog); + printf(" -s - Monitor UPS - @[:]\n"); + printf(" - Example: -s myups@server\n"); ++ printf(" -m - Monitor UPS ,\n"); ++ printf(" - Example: -m myups@server,/var/log/myups.log,/var/run/myups.pid\n"); + printf(" -u - Switch to if started as root\n"); + + printf("\n"); +@@ -393,9 +414,25 @@ + * -u + */ + ++static void term_handler(int signo) ++{ ++ if (signo != SIGCHLD && monhost_child_anchor != NULL) { ++ for (monhost_child_current = monhost_child_anchor; ++ monhost_child_current != NULL; ++ monhost_child_current = monhost_child_current->next ++ ) { ++ kill(monhost_child_current->pid, signo); ++ } ++ ++ if (signo != SIGHUP) ++ fatalx(EXIT_FAILURE, "Killed by user"); ++ } ++} ++ + int main(int argc, char **argv) + { + int interval = 30, i, foreground = -1; ++ size_t monhost_len = 0, mh; + const char *prog = xbasename(argv[0]); + time_t now, nextpoll = 0; + const char *user = NULL; +@@ -407,7 +444,7 @@ + + printf("Network UPS Tools %s %s\n", prog, UPS_VERSION); + +- while ((i = getopt(argc, argv, "+hs:l:i:f:u:Vp:FB")) != -1) { ++ while ((i = getopt(argc, argv, "+hs:l:i:f:u:Vp:FBm:")) != -1) { + switch(i) { + case 'h': + help(prog); +@@ -415,6 +452,33 @@ + break; + #endif + ++ case 'm': { /* var scope */ ++ char *m_arg, *s; ++ ++ monhost_child_prev = monhost_child_current; ++ monhost_child_current = xmalloc(sizeof(struct monhost_child)); ++ if (monhost_child_anchor == NULL) ++ monhost_child_anchor = monhost_child_current; ++ else ++ monhost_child_prev->next = monhost_child_current; ++ monhost_child_current->next = NULL; ++ monhost_len++; ++ ++ /* Be sure to not mangle original optarg, nor rely on its longevity */ ++ s = xstrdup(optarg); ++ m_arg = s; ++ monhost_child_current->monhost = xstrdup(strsep(&m_arg, ",")); ++ if (!m_arg) ++ fatalx(EXIT_FAILURE, "Argument '-m upsspec,logfile,pidfile' requires exactly 3 components in the tuple"); ++ monhost_child_current->logfn = xstrdup(strsep(&m_arg, ",")); ++ if (!m_arg) ++ fatalx(EXIT_FAILURE, "Argument '-m upsspec,logfile,pidfile' requires exactly 3 components in the tuple"); ++ monhost_child_current->pidfilebase = xstrdup(strsep(&m_arg, ",")); ++ if (m_arg) /* Had a third comma - also unexpected! */ ++ fatalx(EXIT_FAILURE, "Argument '-m upsspec,logfile,pidfile' requires exactly 3 components in the tuple"); ++ free(s); ++ } /* var scope */ ++ break; + case 's': + monhost = optarg; + break; +@@ -477,6 +541,41 @@ + + for (i = 3; i < argc; i++) + snprintfcat(logformat, LARGEBUF, "%s ", argv[i]); ++ } ++ ++ if (monhost_child_anchor != NULL) { ++ if (foreground > 0) ++ daemon_pid = 0; ++ else ++ daemon_pid = fork(); ++ if (!daemon_pid) { ++ upsdebugx(1,"Forking to log %" PRIuSIZE " devices", monhost_len); ++ for (monhost_child_current = monhost_child_anchor; ++ monhost_child_current != NULL; ++ monhost_child_current = monhost_child_current->next) { ++ if ((monhost_child_current->pid = fork()) == 0) { ++ monhost = monhost_child_current->monhost; ++ logfn = monhost_child_current->logfn; ++ pidfilebase = monhost_child_current->pidfilebase; ++ foreground = 1; ++ break; ++ } ++ } ++ if (monhost_child_anchor->pid) { /* parent */ ++ for (mh = 0; mh < sizeof(trapped_signals)/sizeof(trapped_signals[0]); mh++) { ++ upslog_sigaction.sa_handler = &term_handler; ++ sigfillset(&upslog_sigaction.sa_mask); ++ upslog_sigaction.sa_flags = SA_NOCLDSTOP | SA_NOCLDWAIT; ++ sigaction(trapped_signals[mh], &upslog_sigaction, NULL); ++ } ++ become_user(get_user_pwent(user)); ++ writepid(pidfilebase); ++ while(wait(&wait_status) > 0); ++ exit(EXIT_SUCCESS); ++ } ++ } else { ++ exit(EXIT_SUCCESS); ++ } + } + + if (!monhost) diff --git a/sysutils/nut-devel/files/patch-docs_man_upslog.txt b/sysutils/nut-devel/files/patch-docs_man_upslog.txt new file mode 100644 index 000000000000..a8b41f0f7569 --- /dev/null +++ b/sysutils/nut-devel/files/patch-docs_man_upslog.txt @@ -0,0 +1,16 @@ +diff --git a/docs/man/upslog.txt b/docs/man/upslog.txt +index f4051048..f49695fe 100644 +--- docs/man/upslog.txt ++++ docs/man/upslog.txt +@@ -78,6 +78,11 @@ upslog will run in the background, regardless of logging target. + Monitor this UPS. The format for this option is + +upsname[@hostname[:port]]+. The default hostname is "localhost". + ++*-m* 'tuple':: ++Monitor multiple UPSs. The format for this option is a tuple of ++ups, logfile, and pidfile separated by commas. An example would be: ++`upsname@hostname:9999,/var/log/nut/cps.log,/var/run/cps.pid` ++ + *-u* 'username':: + + If started as root, upslog will *setuid*(2) to the user id diff --git a/sysutils/nut/Makefile b/sysutils/nut/Makefile index 4409b60de0af..e388164c19b6 100644 --- a/sysutils/nut/Makefile +++ b/sysutils/nut/Makefile @@ -1,6 +1,6 @@ PORTNAME= nut PORTVERSION= 2.8.0 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= sysutils MASTER_SITES= http://www.networkupstools.org/source/${PORTVERSION:R}/ diff --git a/sysutils/nut/files/patch-clients_upslog.c b/sysutils/nut/files/patch-clients_upslog.c new file mode 100644 index 000000000000..1602d8b65067 --- /dev/null +++ b/sysutils/nut/files/patch-clients_upslog.c @@ -0,0 +1,166 @@ +--- clients/upslog.c.orig 2022-08-26 15:25:00.233023000 -0700 ++++ clients/upslog.c 2022-08-26 15:26:30.983822000 -0700 +@@ -32,6 +32,10 @@ + */ + + #include "common.h" ++#include ++#include ++#include ++#include + #include "nut_platform.h" + #include "upsclient.h" + +@@ -41,17 +45,32 @@ + #include "upslog.h" + + static int reopen_flag = 0, exit_flag = 0; ++ static int wait_status; + static uint16_t port; + static char *upsname, *hostname; + static UPSCONN_t ups; + + static FILE *logfile; +- static const char *logfn, *monhost; ++ static char *logfn, *monhost; + static sigset_t nut_upslog_sigmask; + static char logbuffer[LARGEBUF], *logformat; + + static flist_t *fhead = NULL; ++ struct monhost_child { ++ char *monhost; ++ char *logfn; ++ char *pidfilebase; ++ pid_t pid; ++ struct monhost_child *next; ++ }; ++ static struct monhost_child *monhost_child_anchor = NULL; ++ static struct monhost_child *monhost_child_current = NULL; ++ static struct monhost_child *monhost_child_prev = NULL; ++ static struct sigaction upslog_sigaction; ++ static int trapped_signals[] = { SIGHUP, SIGINT, SIGTERM, SIGCHLD }; ++ static pid_t daemon_pid; + ++ + #define DEFAULT_LOGFORMAT "%TIME @Y@m@d @H@M@S% %VAR battery.charge% " \ + "%VAR input.voltage% %VAR ups.load% [%VAR ups.status%] " \ + "%VAR ups.temperature% %VAR input.frequency%" +@@ -131,6 +150,8 @@ + printf(" -p - Base name for PID file (defaults to \"%s\")\n", prog); + printf(" -s - Monitor UPS - @[:]\n"); + printf(" - Example: -s myups@server\n"); ++ printf(" -m - Monitor UPS ,\n"); ++ printf(" - Example: -m myups@server,/var/log/myups.log,/var/run/myups.pid\n"); + printf(" -u - Switch to if started as root\n"); + + printf("\n"); +@@ -393,9 +414,25 @@ + * -u + */ + ++static void term_handler(int signo) ++{ ++ if (signo != SIGCHLD && monhost_child_anchor != NULL) { ++ for (monhost_child_current = monhost_child_anchor; ++ monhost_child_current != NULL; ++ monhost_child_current = monhost_child_current->next ++ ) { ++ kill(monhost_child_current->pid, signo); ++ } ++ ++ if (signo != SIGHUP) ++ fatalx(EXIT_FAILURE, "Killed by user"); ++ } ++} ++ + int main(int argc, char **argv) + { + int interval = 30, i, foreground = -1; ++ size_t monhost_len = 0, mh; + const char *prog = xbasename(argv[0]); + time_t now, nextpoll = 0; + const char *user = NULL; +@@ -407,7 +444,7 @@ + + printf("Network UPS Tools %s %s\n", prog, UPS_VERSION); + +- while ((i = getopt(argc, argv, "+hs:l:i:f:u:Vp:FB")) != -1) { ++ while ((i = getopt(argc, argv, "+hs:l:i:f:u:Vp:FBm:")) != -1) { + switch(i) { + case 'h': + help(prog); +@@ -415,6 +452,33 @@ + break; + #endif + ++ case 'm': { /* var scope */ ++ char *m_arg, *s; ++ ++ monhost_child_prev = monhost_child_current; ++ monhost_child_current = xmalloc(sizeof(struct monhost_child)); ++ if (monhost_child_anchor == NULL) ++ monhost_child_anchor = monhost_child_current; ++ else ++ monhost_child_prev->next = monhost_child_current; ++ monhost_child_current->next = NULL; ++ monhost_len++; ++ ++ /* Be sure to not mangle original optarg, nor rely on its longevity */ ++ s = xstrdup(optarg); ++ m_arg = s; ++ monhost_child_current->monhost = xstrdup(strsep(&m_arg, ",")); ++ if (!m_arg) ++ fatalx(EXIT_FAILURE, "Argument '-m upsspec,logfile,pidfile' requires exactly 3 components in the tuple"); ++ monhost_child_current->logfn = xstrdup(strsep(&m_arg, ",")); ++ if (!m_arg) ++ fatalx(EXIT_FAILURE, "Argument '-m upsspec,logfile,pidfile' requires exactly 3 components in the tuple"); ++ monhost_child_current->pidfilebase = xstrdup(strsep(&m_arg, ",")); ++ if (m_arg) /* Had a third comma - also unexpected! */ ++ fatalx(EXIT_FAILURE, "Argument '-m upsspec,logfile,pidfile' requires exactly 3 components in the tuple"); ++ free(s); ++ } /* var scope */ ++ break; + case 's': + monhost = optarg; + break; +@@ -477,6 +541,40 @@ + + for (i = 3; i < argc; i++) + snprintfcat(logformat, LARGEBUF, "%s ", argv[i]); ++ } ++ ++ if (monhost_child_anchor != NULL) { ++ if (foreground > 0) ++ daemon_pid = 0; ++ else ++ daemon_pid = fork(); ++ if (!daemon_pid) { ++ for (monhost_child_current = monhost_child_anchor; ++ monhost_child_current != NULL; ++ monhost_child_current = monhost_child_current->next) { ++ if ((monhost_child_current->pid = fork()) == 0) { ++ monhost = monhost_child_current->monhost; ++ logfn = monhost_child_current->logfn; ++ pidfilebase = monhost_child_current->pidfilebase; ++ foreground = 1; ++ break; ++ } ++ } ++ if (monhost_child_anchor->pid) { /* parent */ ++ for (mh = 0; mh < sizeof(trapped_signals)/sizeof(trapped_signals[0]); mh++) { ++ upslog_sigaction.sa_handler = &term_handler; ++ sigfillset(&upslog_sigaction.sa_mask); ++ upslog_sigaction.sa_flags = SA_NOCLDSTOP | SA_NOCLDWAIT; ++ sigaction(trapped_signals[mh], &upslog_sigaction, NULL); ++ } ++ become_user(get_user_pwent(user)); ++ writepid(pidfilebase); ++ while(wait(&wait_status) > 0); ++ exit(EXIT_SUCCESS); ++ } ++ } else { ++ exit(EXIT_SUCCESS); ++ } + } + + if (!monhost) diff --git a/sysutils/nut/files/patch-docs_man_upslog.8 b/sysutils/nut/files/patch-docs_man_upslog.8 new file mode 100644 index 000000000000..10335395cea9 --- /dev/null +++ b/sysutils/nut/files/patch-docs_man_upslog.8 @@ -0,0 +1,16 @@ +--- docs/man/upslog.8.orig 2022-04-26 15:07:16.000000000 -0700 ++++ docs/man/upslog.8 2022-08-24 07:39:07.356811000 -0700 +@@ -134,6 +134,13 @@ + upsname[@hostname[:port]]\&. The default hostname is "localhost"\&. + .RE + .PP ++\fB\-m\fR \fItuple\fR ++.RS 4 ++Monitor multiple UPSs. The format for this option is a tuple of ++ups, logfile, and pidfile separated by commas. An example would be: ++`upsname@hostname:9999,/var/log/nut/cps.log,/var/run/cps.pid` ++.RE ++.PP + \fB\-u\fR \fIusername\fR + .RS 4 + If started as root, upslog will diff --git a/sysutils/nut/files/patch-include_nut__stdint.h b/sysutils/nut/files/patch-include_nut__stdint.h new file mode 100644 index 000000000000..fdd2bd783c61 --- /dev/null +++ b/sysutils/nut/files/patch-include_nut__stdint.h @@ -0,0 +1,31 @@ +--- include/nut_stdint.h.orig 2022-08-24 07:49:23.934399000 -0700 ++++ include/nut_stdint.h 2022-08-24 07:56:48.050406000 -0700 +@@ -52,6 +52,28 @@ + #endif + + /* Printing format for size_t and ssize_t */ ++#ifndef PRIuSIZE ++# ifdef PRIsize ++# define PRIuSIZE PRIsize ++# else ++# if defined(__MINGW32__) || defined (WIN32) ++# define PRIuSIZE "llu" ++# else ++# define PRIuSIZE "zu" ++# endif ++# endif ++#endif ++ ++#ifndef PRIxSIZE ++# if defined(__MINGW32__) || defined (WIN32) ++# define PRIxSIZE "llx" ++# else ++# define PRIxSIZE "zx" ++# endif ++#endif ++ ++/* Note: Windows headers are known to define at least "d" values, ++ * so macros below revolve around that and not "i" directly */ + #ifndef PRIsize + # if defined(__MINGW32__) + # define PRIsize "u"