mirror of
https://github.com/netbirdio/FreeBSD-ports.git
synced 2026-05-22 18:42:42 -07:00
Sys::Load - Perl module for getting the current system load and uptime
WWW: http://search.cpan.org/dist/Sys-Load/ PR: ports/154139 Submitted by: Konstantin Menshikov <kostjnspb at yandex.ru> Approved by: pgollucci (mentor) Feature safe: yes
This commit is contained in:
@@ -598,6 +598,7 @@
|
||||
SUBDIR += p5-Sys-HostIP
|
||||
SUBDIR += p5-Sys-Hostname-FQDN
|
||||
SUBDIR += p5-Sys-Hostname-Long
|
||||
SUBDIR += p5-Sys-Load
|
||||
SUBDIR += p5-Sys-Syslog
|
||||
SUBDIR += p5-Sys-User-UIDhelper
|
||||
SUBDIR += p5-Sys-Utmp
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# New ports collection makefile for: p5-Sys-Load
|
||||
# Date created: 19 January 2010
|
||||
# Whom: Konstantin Menshikov <kostjnspb@yandex.ru>
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= Sys-Load
|
||||
PORTVERSION= 0.2
|
||||
CATEGORIES= sysutils perl5
|
||||
MASTER_SITES= CPAN \
|
||||
http://kostjn.spb.ru/freebsd/
|
||||
PKGNAMEPREFIX= p5-
|
||||
|
||||
MAINTAINER= kostjnspb@yandex.ru
|
||||
COMMENT= Getting the current system load and uptime
|
||||
|
||||
PERL_CONFIGURE= YES
|
||||
|
||||
MAN3= Sys::Load.3
|
||||
|
||||
.include <bsd.port.mk>
|
||||
@@ -0,0 +1,2 @@
|
||||
SHA256 (Sys-Load-0.2.tar.gz) = 27ef03e0fc455cf51b363b1a10609233de105aa3f3d51086a0a9244b1581275d
|
||||
SIZE (Sys-Load-0.2.tar.gz) = 1794
|
||||
@@ -0,0 +1,20 @@
|
||||
--- Load.pm 2002-09-01 09:54:44.000000000 +0000
|
||||
+++ Load.pm 2011-01-19 12:07:33.000000000 +0000
|
||||
@@ -17,17 +17,6 @@
|
||||
bootstrap Sys::Load $VERSION;
|
||||
|
||||
# Preloaded methods go here.
|
||||
-
|
||||
-use constant UPTIME => "/proc/uptime";
|
||||
-
|
||||
-sub uptime {
|
||||
- open(FILE, UPTIME) || return 0;
|
||||
- my $line = <FILE>;
|
||||
- my($uptime, $idle) = split /\s+/, $line;
|
||||
- close FILE;
|
||||
- return $uptime;
|
||||
-}
|
||||
-
|
||||
1;
|
||||
|
||||
__END__
|
||||
@@ -0,0 +1,27 @@
|
||||
--- Load.xs 2002-08-31 02:00:32.000000000 +0000
|
||||
+++ Load.xs 2011-01-19 12:07:14.000000000 +0000
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
#include "stdlib.h"
|
||||
+#include <time.h>
|
||||
|
||||
|
||||
MODULE = Sys::Load PACKAGE = Sys::Load
|
||||
@@ -22,3 +23,16 @@
|
||||
XPUSHs(sv_2mortal(newSVnv(load[2])));
|
||||
}
|
||||
|
||||
+void
|
||||
+uptime()
|
||||
+PROTOTYPE:
|
||||
+PREINIT:
|
||||
+ struct timespec t;
|
||||
+ int i;
|
||||
+PPCODE:
|
||||
+ i = clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
+ if(i == -1)
|
||||
+ XSRETURN_EMPTY;
|
||||
+ else {
|
||||
+ XPUSHs(sv_2mortal(newSVnv(t.tv_sec)));
|
||||
+ }
|
||||
@@ -0,0 +1,3 @@
|
||||
Sys::Load - Perl module for getting the current system load and uptime
|
||||
|
||||
WWW: http://search.cpan.org/dist/Sys-Load/
|
||||
@@ -0,0 +1,7 @@
|
||||
%%SITE_PERL%%/mach/auto/Sys/Load/.packlist
|
||||
%%SITE_PERL%%/mach/auto/Sys/Load/Load.so
|
||||
%%SITE_PERL%%/mach/auto/Sys/Load/Load.bs
|
||||
%%SITE_PERL%%/mach/Sys/Load.pm
|
||||
@dirrmtry %%SITE_PERL%%/mach/auto/Sys/Load
|
||||
@dirrmtry %%SITE_PERL%%/mach/auto/Sys
|
||||
@dirrmtry %%SITE_PERL%%/mach/Sys
|
||||
Reference in New Issue
Block a user