pkgsrc-Changes archive

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

CVS commit: pkgsrc/sysutils



Module Name:    pkgsrc
Committed By:   hauke
Date:           Thu Jun 15 09:55:25 UTC 2023

Modified Files:
        pkgsrc/sysutils: Makefile
Added Files:
        pkgsrc/sysutils/and: DESCR Makefile PLIST distinfo
        pkgsrc/sysutils/and/files: and.service and.sh
        pkgsrc/sysutils/and/patches: patch-Makefile patch-and-NetBSD.c
            patch-and.c

Log Message:
Add the Auto Nice Daemon as sysutils/and

The auto nice daemon will renice or even kill jobs according to a
priority database, after they take up too much CPU time.


To generate a diff of this commit:
cvs rdiff -u -r1.1053 -r1.1054 pkgsrc/sysutils/Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/and/DESCR pkgsrc/sysutils/and/Makefile \
    pkgsrc/sysutils/and/PLIST pkgsrc/sysutils/and/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/and/files/and.service \
    pkgsrc/sysutils/and/files/and.sh
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/and/patches/patch-Makefile \
    pkgsrc/sysutils/and/patches/patch-and-NetBSD.c \
    pkgsrc/sysutils/and/patches/patch-and.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/sysutils/Makefile
diff -u pkgsrc/sysutils/Makefile:1.1053 pkgsrc/sysutils/Makefile:1.1054
--- pkgsrc/sysutils/Makefile:1.1053     Tue Jun 13 13:15:05 2023
+++ pkgsrc/sysutils/Makefile    Thu Jun 15 09:55:25 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1053 2023/06/13 13:15:05 bacon Exp $
+# $NetBSD: Makefile,v 1.1054 2023/06/15 09:55:25 hauke Exp $
 #
 
 COMMENT=       System utilities
@@ -30,6 +30,7 @@ SUBDIR+=      amanda-plot
 SUBDIR+=       amanda-server
 SUBDIR+=       amlogic-meson-fwtools
 SUBDIR+=       amtterm
+SUBDIR+=       and
 SUBDIR+=       ansible
 SUBDIR+=       ansible-core
 SUBDIR+=       ansible-lint

Added files:

Index: pkgsrc/sysutils/and/DESCR
diff -u /dev/null pkgsrc/sysutils/and/DESCR:1.1
--- /dev/null   Thu Jun 15 09:55:25 2023
+++ pkgsrc/sysutils/and/DESCR   Thu Jun 15 09:55:25 2023
@@ -0,0 +1,4 @@
+The auto nice daemon will renice or even kill jobs according to a priority
+database, after they take up too much CPU time.
+
+You define what "too much" actually means.
Index: pkgsrc/sysutils/and/Makefile
diff -u /dev/null pkgsrc/sysutils/and/Makefile:1.1
--- /dev/null   Thu Jun 15 09:55:25 2023
+++ pkgsrc/sysutils/and/Makefile        Thu Jun 15 09:55:25 2023
@@ -0,0 +1,64 @@
+# $NetBSD: Makefile,v 1.1 2023/06/15 09:55:25 hauke Exp $
+
+DISTNAME=      and-1.2.2
+CATEGORIES=    sysutils
+MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=and/}
+
+MAINTAINER=    hauke%NetBSD.org@localhost
+HOMEPAGE=      http://and.sourceforge.net/
+COMMENT=       Renice or kill jobs based on priority database
+LICENSE=       gnu-gpl-v2
+
+USE_TOOLS+=    gmake
+
+USE_LANGUAGES= c
+
+BUILD_TARGET=  and doc
+
+RCD_SCRIPTS=   and
+
+EGDIR=         share/examples/and
+CONFIG_FILES=  and.conf and.priorities
+
+.include "../../mk/bsd.prefs.mk"
+
+SUBST_CLASSES+=                paths
+SUBST_MESSAGE.paths=   Fixing hardcoded paths.
+SUBST_STAGE.paths=     pre-configure
+SUBST_FILES.paths=     Makefile
+SUBST_FILES.paths+=    and.service
+SUBST_VARS.paths=      PREFIX PKG_SYSCONFDIR VARBASE
+
+SUBST_CLASSES+=                man
+SUBST_MESSAGE.man=     Fixing hardcoded paths in man pages.
+SUBST_STAGE.man=       pre-configure
+SUBST_FILES.man=       *.man
+SUBST_SED.man=         -e 's,/etc/,${PKG_SYSCONFDIR}/,g'
+
+LIBS.NetBSD+=          -lkvm
+LIBS.FreeBSD+=         -lkvm
+
+MAKE_FLAGS+=           LD=${CC:Q} LIBS=${LIBS:Q}
+
+.for f in ${CONFIG_FILES}
+CONF_FILES+=           ${EGDIR}/${f} ${PKG_SYSCONFDIR}/${f}
+.endfor
+
+INSTALLATION_DIRS+=    sbin ${PKGMANDIR}/man5 ${PKGMANDIR}/man8 ${EGDIR}
+
+post-extract:
+       cp ${FILESDIR}/and.service ${WRKSRC}/
+       cp ${WRKSRC}/and-OpenBSD.c ${WRKSRC}/and-NetBSD.c
+
+
+do-install:
+       ${INSTALL_PROGRAM} ${WRKSRC}/and ${DESTDIR}${PREFIX}/sbin/and
+.for mp in and.conf and.priorities
+       ${INSTALL_MAN} ${WRKSRC}/${mp}.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5/
+.endfor
+       ${INSTALL_MAN} ${WRKSRC}/and.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8/
+.for cf in ${CONFIG_FILES} and.init.debian and.service and.startup
+       ${INSTALL_DATA} ${WRKSRC}/${cf} ${DESTDIR}${PREFIX}/${EGDIR}
+.endfor
+
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/sysutils/and/PLIST
diff -u /dev/null pkgsrc/sysutils/and/PLIST:1.1
--- /dev/null   Thu Jun 15 09:55:25 2023
+++ pkgsrc/sysutils/and/PLIST   Thu Jun 15 09:55:25 2023
@@ -0,0 +1,10 @@
+@comment $NetBSD: PLIST,v 1.1 2023/06/15 09:55:25 hauke Exp $
+man/man5/and.conf.5
+man/man5/and.priorities.5
+man/man8/and.8
+sbin/and
+share/examples/and/and.conf
+share/examples/and/and.init.debian
+share/examples/and/and.priorities
+share/examples/and/and.service
+share/examples/and/and.startup
Index: pkgsrc/sysutils/and/distinfo
diff -u /dev/null pkgsrc/sysutils/and/distinfo:1.1
--- /dev/null   Thu Jun 15 09:55:25 2023
+++ pkgsrc/sysutils/and/distinfo        Thu Jun 15 09:55:25 2023
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.1 2023/06/15 09:55:25 hauke Exp $
+
+BLAKE2s (and-1.2.2.tar.gz) = 0b2c5970802a3698b0239be10227af29675ee370ca6088854b69bfb46b0a3550
+SHA512 (and-1.2.2.tar.gz) = f9ae5a6193a0029b6d1e6ce3c160635d39b152c49ad88b7ae686f3abf8ebcb5ec994edce5915a7f0eaa0f327c3ee7c4f0be2fc7c8bb01b7f374afdd594d6b609
+Size (and-1.2.2.tar.gz) = 29989 bytes
+SHA1 (patch-Makefile) = 78c44b93317d4f726e33c22a490995ec06eb269b
+SHA1 (patch-and-NetBSD.c) = ff29d9d34b2c5e0e3c6c1b58e7e71a42b0b5bddd
+SHA1 (patch-and.c) = 1dd220def1520ef2b3d967eb0c940e001a75c917

Index: pkgsrc/sysutils/and/files/and.service
diff -u /dev/null pkgsrc/sysutils/and/files/and.service:1.1
--- /dev/null   Thu Jun 15 09:55:25 2023
+++ pkgsrc/sysutils/and/files/and.service       Thu Jun 15 09:55:25 2023
@@ -0,0 +1,17 @@
+# Linux systemd service definition
+
+[Unit]
+Description=Auto Nice Daemon
+# We need group information from YP
+Requires=rpcbind.service domainname.service
+After=rpcbind.service domainname.service network.target
+
+[Service]
+Type=forking
+GuessMainPID=yes
+ExecStart=@PREFIX@/sbin/and
+ExecReload=/bin/kill -1 -- $MAINPID
+ExecStop=/bin/kill -- $MAINPID
+
+[Install]
+WantedBy=multi-user.target
Index: pkgsrc/sysutils/and/files/and.sh
diff -u /dev/null pkgsrc/sysutils/and/files/and.sh:1.1
--- /dev/null   Thu Jun 15 09:55:25 2023
+++ pkgsrc/sysutils/and/files/and.sh    Thu Jun 15 09:55:25 2023
@@ -0,0 +1,23 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: and.sh,v 1.1 2023/06/15 09:55:25 hauke Exp $
+#
+# PROVIDE: and
+# REQUIRE: DAEMON
+
+name="and"
+command="@PREFIX@/sbin/${name}"
+
+if [ -f @SYSCONFBASE@/rc.subr ]; then
+       . @SYSCONFBASE@/rc.subr
+
+       rcvar=${name}
+       required_files="@PKG_SYSCONFDIR@/${name}.conf"
+       pidfile="@VARBASE@/run/${name}.pid"
+
+       load_rc_config ${name}
+       run_rc_command "$1"
+else
+        @ECHO@ -n " ${name}"
+       ${command} ${and_flags}
+fi

Index: pkgsrc/sysutils/and/patches/patch-Makefile
diff -u /dev/null pkgsrc/sysutils/and/patches/patch-Makefile:1.1
--- /dev/null   Thu Jun 15 09:55:25 2023
+++ pkgsrc/sysutils/and/patches/patch-Makefile  Thu Jun 15 09:55:25 2023
@@ -0,0 +1,81 @@
+$NetBSD: patch-Makefile,v 1.1 2023/06/15 09:55:25 hauke Exp $
+
+Use pkgsrc  paths and build options
+
+--- Makefile.orig      2005-03-27 19:39:37.000000000 +0000
++++ Makefile
+@@ -22,11 +22,15 @@ INITSCRIPT=and.init
+ # Target directories. Examples for common configurations are
+ # given below.
+ #
+-PREFIX=/usr/local
+-INSTALL_ETC=$(PREFIX)/etc
+-INSTALL_INITD=/etc/init.d
+-INSTALL_SBIN=$(PREFIX)/sbin
+-INSTALL_MAN=$(PREFIX)/man
++#PREFIX=/usr/local
++#INSTALL_ETC=$(PREFIX)/etc
++#INSTALL_INITD=/etc/init.d
++#INSTALL_SBIN=$(PREFIX)/sbin
++#INSTALL_MAN=$(PREFIX)/man
++
++# pkgsrc
++PREFIX=@PREFIX@
++INSTALL_ETC=@PKG_SYSCONFDIR@
+ 
+ # typical OpenBSD or FreeBSD configuration
+ #PREFIX=/usr/local
+@@ -91,53 +95,6 @@ MANPAGES=and.8 and.conf.5 and.priorities
+ #
+ ARCH=$(shell uname)
+ 
+-#
+-# Architecture-dependent settings: ANSI C compiler and linker
+-#
+-ifeq (${ARCH},Linux)
+-  CC = gcc -ansi -pedantic -Wall -g
+-  LD = gcc
+-  LIBS =
+-else
+-ifeq (${ARCH},OSF1)
+-  CC = cc -ansi
+-  LD = cc
+-  LIBS =
+-else
+-ifeq (${ARCH},OpenBSD)
+-  CC = gcc
+-  LD = gcc
+-  LIBS = -lkvm
+-else
+-ifeq (${ARCH},FreeBSD)
+-  CC = gcc -Wall
+-  LD = gcc
+-  LIBS = -lkvm
+-else
+-ifeq (${ARCH},SunOS)
+-  CC = cc -D__SunOS__
+-  LD = cc
+-else
+-ifeq (${ARCH},IRIX)
+-  CC = cc
+-  LD = cc
+-else
+-ifeq (${ARCH},IRIX64)
+-  CC = cc
+-  LD = cc
+-else
+-  # unsupported architecture
+-  CC = false
+-  LD = false
+-  LIBS =
+-endif
+-endif
+-endif
+-endif
+-endif
+-endif
+-endif
+-
+ 
+ #
+ # Build the auto-nice daemon.
Index: pkgsrc/sysutils/and/patches/patch-and-NetBSD.c
diff -u /dev/null pkgsrc/sysutils/and/patches/patch-and-NetBSD.c:1.1
--- /dev/null   Thu Jun 15 09:55:25 2023
+++ pkgsrc/sysutils/and/patches/patch-and-NetBSD.c      Thu Jun 15 09:55:25 2023
@@ -0,0 +1,39 @@
+$NetBSD: patch-and-NetBSD.c,v 1.1 2023/06/15 09:55:25 hauke Exp $
+
+Make NetBSD kernel data structures visible
+
+Apparently, <sys/resourcevar.h> is not to be exposed to userland, and
+it is not needed, anyway
+
+Drop FreeBSD specific #include
+
+--- and-NetBSD.c.orig  2023-06-14 09:29:04.355389748 +0000
++++ and-NetBSD.c
+@@ -20,23 +20,21 @@
+ 
+ */
+ 
++#define _KMEMUSER
++
+ #include <string.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <kvm.h>
+ #include <fcntl.h>
+ #include <limits.h>
++
++#include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
+ #include <sys/proc.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
+-#include <sys/resourcevar.h>
+-
+-#ifdef __FreeBSD__
+-#include <sys/user.h>
+-#endif
+-
+ 
+ #include "and.h"
+ 
Index: pkgsrc/sysutils/and/patches/patch-and.c
diff -u /dev/null pkgsrc/sysutils/and/patches/patch-and.c:1.1
--- /dev/null   Thu Jun 15 09:55:25 2023
+++ pkgsrc/sysutils/and/patches/patch-and.c     Thu Jun 15 09:55:25 2023
@@ -0,0 +1,59 @@
+$NetBSD: patch-and.c,v 1.1 2023/06/15 09:55:25 hauke Exp $
+
+<values.h> is non-portable, replace with <limits.h> definitions.
+
+--- and.c.orig 2004-04-05 19:19:01.000000000 +0000
++++ and.c
+@@ -47,7 +47,6 @@
+ #include <sys/types.h>
+ #include <signal.h>
+ #include <regex.h>
+-#include <values.h>
+ 
+ #define DEBUG 0
+ 
+@@ -704,7 +703,7 @@ int and_getnice (int uid, int gid, char 
+   /* Strategy: each priority database accumulates accuracy points
+      for every aspect: user, group, command, parent. An exact hit is 
+      worth the configured weight of the aspect (1, 2, 4, 8); a joker
+-     is worth 0; and a miss is with -MAXINT, effectively eliminating
++     is worth 0; and a miss is with -INT_MAX, effectively eliminating
+      the entry (veto). At the end, the highest rated entry is
+       used to determine the new nice level. */
+   for (i=0; i<and_db.n; i++) {
+@@ -714,7 +713,7 @@ int and_getnice (int uid, int gid, char 
+     } else if (and_db.entry[i].uid == -1) {
+       exactness[i] = 0;
+     } else {
+-      exactness[i] = -MAXINT;
++      exactness[i] = -INT_MAX;
+     }
+     /* group id */
+     if (gid == and_db.entry[i].gid) {
+@@ -722,7 +721,7 @@ int and_getnice (int uid, int gid, char 
+     } else if (and_db.entry[i].gid == -1) {
+       exactness[i] += 0;
+     } else {
+-      exactness[i] = -MAXINT;
++      exactness[i] = -INT_MAX;
+     }
+     /* command */
+     if (command!=NULL && regexec(and_db.entry[i].command,command,0,0,0) == 0) {
+@@ -730,7 +729,7 @@ int and_getnice (int uid, int gid, char 
+     } else if (strcmp(and_db.entry[i].command_str,"*") == 0) {
+       exactness[i] += 0;
+     } else {
+-      exactness[i] = -MAXINT;
++      exactness[i] = -INT_MAX;
+     }
+     /* parent */
+     par = parent;
+@@ -745,7 +744,7 @@ int and_getnice (int uid, int gid, char 
+         exactness[i] += 0;
+         break;
+       } else if (last) {
+-        exactness[i] = -MAXINT;
++        exactness[i] = -INT_MAX;
+         break;
+       }
+       par = par->parent;



Home | Main Index | Thread Index | Old Index