Date: Mon, 26 May 2014 20:57:18 GMT From: Jesse <jessefrgsmith@yahoo.ca> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/190284: port update: sysutils/cpulimit Message-ID: <201405262057.s4QKvICq029090@cgiserv.freebsd.org> Resent-Message-ID: <201405262100.s4QL00SM085077@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 190284 >Category: ports >Synopsis: port update: sysutils/cpulimit >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Mon May 26 21:00:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Jesse >Release: FreeBSD-10.0 >Organization: RM >Environment: >Description: The following patch brings the cpulimit patch up to date with upstream. This includes a number of bug fixes, a more flexible approach to signals and updated documentation. >How-To-Repeat: >Fix: Patch attached with submission follows: diff -ruN /usr/ports/sysutils/cpulimit/Makefile cpulimit/Makefile --- /usr/ports/sysutils/cpulimit/Makefile 2014-01-22 21:08:56.000000000 -0400 +++ cpulimit/Makefile 2014-05-26 17:37:40.845423090 -0300 @@ -2,7 +2,7 @@ # $FreeBSD: head/sysutils/cpulimit/Makefile 340722 2014-01-22 17:00:46Z mat $ PORTNAME= cpulimit -PORTVERSION= 1.4 +PORTVERSION= 2.2 CATEGORIES= sysutils MASTER_SITES= SF/limitcpu/limitcpu/ @@ -12,7 +12,7 @@ LICENSE= GPLv2 CFLAGS+= -lkvm -Wall -O2 -MANCOMPRESSED= yes +MANCOMPRESSED= no PLIST_FILES= bin/${PORTNAME} MAN1= ${PORTNAME}.1 diff -ruN /usr/ports/sysutils/cpulimit/distinfo cpulimit/distinfo --- /usr/ports/sysutils/cpulimit/distinfo 2014-01-22 21:08:56.000000000 -0400 +++ cpulimit/distinfo 2014-05-26 17:54:12.048412495 -0300 @@ -1,2 +1,2 @@ -SHA256 (cpulimit-1.4.tar.gz) = 48bb37801c83c926bf891ca66927c4c51ed1f2186bb3d61a70b19168d3c576df -SIZE (cpulimit-1.4.tar.gz) = 15950 +SHA256 (cpulimit-2.2.tar.gz) = 3f64daa5c4ab9245fa6ae5b564a2ffb3ae60677785103a207fd5f9c5c4cc29e4 +SIZE (cpulimit-2.2.tar.gz) = 22224 diff -ruN /usr/ports/sysutils/cpulimit/files/patch-Makefile cpulimit/files/patch-Makefile --- /usr/ports/sysutils/cpulimit/files/patch-Makefile 1969-12-31 20:00:00.000000000 -0400 +++ cpulimit/files/patch-Makefile 2014-05-26 17:52:30.891485169 -0300 @@ -0,0 +1,15 @@ +--- ./Makefile.orig 2014-05-26 17:50:50.639513964 -0300 ++++ ./Makefile 2014-05-26 17:51:17.773388294 -0300 +@@ -11,11 +11,8 @@ + minix: + $(CC) -o cpulimit cpulimit.c $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) + +-freebsd: +- $(CC) -o cpulimit cpulimit.c -lrt -DFREEBSD $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) +- + cpulimit: cpulimit.c +- $(CC) -o cpulimit cpulimit.c -lrt -DLINUX $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) ++ $(CC) -o cpulimit cpulimit.c -lrt -lkvm -DFREEBSD $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) + + tests: + $(MAKE) -C test diff -ruN /usr/ports/sysutils/cpulimit/files/patch-cpulimit.c cpulimit/files/patch-cpulimit.c --- /usr/ports/sysutils/cpulimit/files/patch-cpulimit.c 2014-01-22 21:08:56.000000000 -0400 +++ cpulimit/files/patch-cpulimit.c 1969-12-31 20:00:00.000000000 -0400 @@ -1,59 +0,0 @@ ---- ./cpulimit.c.orig 2011-08-12 19:35:36.000000000 -0300 -+++ ./cpulimit.c 2011-08-12 21:31:58.000000000 -0300 -@@ -35,6 +35,15 @@ - #include <limits.h> // for compatibility - - -+#include <limits.h> -+#include <fcntl.h> -+#include <kvm.h> -+#include <paths.h> -+#include <sys/param.h> -+#include <sys/sysctl.h> -+#include <sys/user.h> -+ -+ - //kernel time resolution (inverse of one jiffy interval) in Hertz - //i don't know how to detect it, then define to the default (not very clean!) - #define HZ 100 -@@ -245,6 +254,31 @@ - } - - //get jiffies count from /proc filesystem -+int getjiffies(int pid) -+{ -+ kvm_t *my_kernel = NULL; -+ struct kinfo_proc *process_data = NULL; -+ int processes; -+ int my_jiffies = -1; -+ -+ my_kernel = kvm_open(0, 0, 0, O_RDONLY, "kvm_open"); -+ if (! my_kernel) -+ { -+ printf("Error opening kernel vm. You should be running as root.\n"); -+ return -1; -+ } -+ -+ process_data = kvm_getprocs(my_kernel, KERN_PROC_PID, pid, &processes); -+ if ( (process_data) && (processes >= 1) ) -+ my_jiffies = process_data->ki_runtime; -+ -+ kvm_close(my_kernel); -+ if (my_jiffies >= 0) -+ my_jiffies /= 1000; -+ return my_jiffies; -+} -+ -+/* - int getjiffies(int pid) { - static char stat[20]; - static char buffer[1024]; -@@ -271,6 +305,8 @@ - // could not read info - return -1; - } -+*/ -+ - - //process instant photo - struct process_screenshot { >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405262057.s4QKvICq029090>