system/cpulimit: Added to 13.0 repository

This commit is contained in:
Menno Duursma 2010-05-13 01:00:43 +02:00 committed by Robby Workman
parent c52ae73dea
commit cf8a43d527
6 changed files with 198 additions and 0 deletions

6
system/cpulimit/README Normal file
View file

@ -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.

View file

@ -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}

View file

@ -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"

View file

@ -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.

View file

@ -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

View file

@ -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: