summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/cpulimit/README6
-rw-r--r--system/cpulimit/cpulimit.SlackBuild66
-rw-r--r--system/cpulimit/cpulimit.info10
-rw-r--r--system/cpulimit/manpages/cpulimit.170
-rw-r--r--system/cpulimit/patches/02_segfault_longoptions.patch27
-rw-r--r--system/cpulimit/slack-desc19
6 files changed, 198 insertions, 0 deletions
diff --git a/system/cpulimit/README b/system/cpulimit/README
new file mode 100644
index 0000000000..c7bc833b55
--- /dev/null
+++ b/system/cpulimit/README
@@ -0,0 +1,6 @@
+cpulimit is a simple program that attempts to limit the cpu usage of a
+process (expressed in percentage, not in cpu time). This is useful to
+control batch jobs, when you don't want them to eat too much cpu. It does
+not act on the nice value or other scheduling priority stuff, but on the
+real cpu usage. Also, it is able to adapt itself to the overall system
+load, dynamically and quickly.
diff --git a/system/cpulimit/cpulimit.SlackBuild b/system/cpulimit/cpulimit.SlackBuild
new file mode 100644
index 0000000000..cc6329e9de
--- /dev/null
+++ b/system/cpulimit/cpulimit.SlackBuild
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# Slackware build script for cpulimit
+
+# Written by Menno Duursma <druiloor@zonnet.nl>
+
+# This program is free software. It comes without any warranty.
+# Granted WTFPL, Version 2, as published by Sam Hocevar. See
+# http://sam.zoy.org/wtfpl/COPYING for more details.
+
+PRGNAM=cpulimit
+VERSION=${VERSION:-1.1}
+ARCH=${ARCH:-i486}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+fi
+
+set -e # Exit on most errors
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Apply a patch from the Debian folks that fixes a segfault
+patch -p1 --verbose < $CWD/patches/02_segfault_longoptions.patch
+
+sed -i "s/-O2/$SLKCFLAGS/" Makefile
+make
+install -D -m 0755 -s cpulimit $PKG/usr/bin/cpulimit
+
+# Generated with: help2man --version-option="--help" ./cpulimit > cpulimit.1
+mkdir -p $PKG/usr/man/man1
+gzip -9c $CWD/manpages/cpulimit.1 > $PKG/usr/man/man1/cpulimit.1.gz
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/cpulimit/cpulimit.info b/system/cpulimit/cpulimit.info
new file mode 100644
index 0000000000..9e387e0085
--- /dev/null
+++ b/system/cpulimit/cpulimit.info
@@ -0,0 +1,10 @@
+PRGNAM="cpulimit"
+VERSION="1.1"
+HOMEPAGE="http://cpulimit.sourceforge.net/"
+DOWNLOAD="http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz"
+MD5SUM="f4ff6d4bfaef1258e8f5cd2041e2e2a3"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="Menno Duursma"
+EMAIL="druiloor@zonnet.nl"
+APPROVED="rworkman"
diff --git a/system/cpulimit/manpages/cpulimit.1 b/system/cpulimit/manpages/cpulimit.1
new file mode 100644
index 0000000000..0924612ef8
--- /dev/null
+++ b/system/cpulimit/manpages/cpulimit.1
@@ -0,0 +1,70 @@
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
+.TH USAGE: "1" "December 2009" "Usage: cpulimit TARGET [OPTIONS...]" "User Commands"
+.SH NAME
+Usage: \- manual page for Usage: cpulimit TARGET [OPTIONS...]
+.SH SYNOPSIS
+.B cpulimit
+\fITARGET \fR[\fIOPTIONS\fR...]
+.SH DESCRIPTION
+.IP
+TARGET must be exactly one of these:
+.TP
+\fB\-p\fR, \fB\-\-pid\fR=\fIN\fR
+pid of the process
+.TP
+\fB\-e\fR, \fB\-\-exe\fR=\fIFILE\fR
+name of the executable program file
+.TP
+\fB\-P\fR, \fB\-\-path\fR=\fIPATH\fR
+absolute path name of the executable program file
+.IP
+OPTIONS
+.TP
+\fB\-l\fR, \fB\-\-limit\fR=\fIN\fR
+percentage of cpu allowed from 0 to 100 (mandatory)
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+show control statistics
+.TP
+\fB\-z\fR, \fB\-\-lazy\fR
+exit if there is no suitable target process, or if it dies
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+display this help and exit
+.IP
+TARGET must be exactly one of these:
+.TP
+\fB\-p\fR, \fB\-\-pid\fR=\fIN\fR
+pid of the process
+.TP
+\fB\-e\fR, \fB\-\-exe\fR=\fIFILE\fR
+name of the executable program file
+.TP
+\fB\-P\fR, \fB\-\-path\fR=\fIPATH\fR
+absolute path name of the executable program file
+.IP
+OPTIONS
+.TP
+\fB\-l\fR, \fB\-\-limit\fR=\fIN\fR
+percentage of cpu allowed from 0 to 100 (mandatory)
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+show control statistics
+.TP
+\fB\-z\fR, \fB\-\-lazy\fR
+exit if there is no suitable target process, or if it dies
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+display this help and exit
+.SH "SEE ALSO"
+The full documentation for
+.B Usage:
+is maintained as a Texinfo manual. If the
+.B info
+and
+.B Usage:
+programs are properly installed at your site, the command
+.IP
+.B info Usage:
+.PP
+should give you access to the complete manual.
diff --git a/system/cpulimit/patches/02_segfault_longoptions.patch b/system/cpulimit/patches/02_segfault_longoptions.patch
new file mode 100644
index 0000000000..ee21484817
--- /dev/null
+++ b/system/cpulimit/patches/02_segfault_longoptions.patch
@@ -0,0 +1,27 @@
+Author: Cesare Tirabassi <norsetto@ubuntu.com>
+Description: Fix long options list of arguments.
+Bugs: #487233, #487236, LP #241538
+
+--- cpulimit-1.1.orig/cpulimit.c
++++ cpulimit-1.1/cpulimit.c
+@@ -360,13 +360,13 @@
+ const char* short_options="p:e:P:l:vzh";
+ /* An array describing valid long options. */
+ const struct option long_options[] = {
+- { "pid", 0, NULL, 'p' },
+- { "exe", 1, NULL, 'e' },
+- { "path", 0, NULL, 'P' },
+- { "limit", 0, NULL, 'l' },
+- { "verbose", 0, NULL, 'v' },
+- { "lazy", 0, NULL, 'z' },
+- { "help", 0, NULL, 'h' },
++ { "pid", required_argument, NULL, 'p' },
++ { "exe", required_argument, NULL, 'e' },
++ { "path", required_argument, NULL, 'P' },
++ { "limit", required_argument, NULL, 'l' },
++ { "verbose", no_argument, NULL, 'v' },
++ { "lazy", no_argument, NULL, 'z' },
++ { "help", no_argument, NULL, 'h' },
+ { NULL, 0, NULL, 0 }
+ };
+ //argument variables
diff --git a/system/cpulimit/slack-desc b/system/cpulimit/slack-desc
new file mode 100644
index 0000000000..1103a2354d
--- /dev/null
+++ b/system/cpulimit/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler---------------------------------------------------|
+cpulimit: cpulimit (limit cpu usage)
+cpulimit:
+cpulimit: A simple program that attempts to limit the cpu usage of a
+cpulimit: process (expressed in percentage, not in cpu time).
+cpulimit:
+cpulimit: cpulimit is written by Angelo Marletta.
+cpulimit:
+cpulimit:
+cpulimit:
+cpulimit:
+cpulimit: