summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Rothenberg <rrwo@cpan.org>2020-03-29 12:51:59 +0100
committerRobert Rothenberg <rrwo@cpan.org>2020-03-29 12:51:59 +0100
commita87be377dd2a3eb781362741939dfe7146dfd697 (patch)
tree845e13a2b782c60455f63d5204e5b8f45ca3e248
parent9e1ceb7c48d44c6ae6fc25d8dbdaba1ef2bc1f56 (diff)
Add getloadavg support for DragonFly BSD
-rw-r--r--Changes2
-rw-r--r--CpuLoad.xs2
-rw-r--r--lib/Sys/CpuLoad.pm2
-rw-r--r--t/10-getloadavg.t2
4 files changed, 5 insertions, 3 deletions
diff --git a/Changes b/Changes
index faf32b5..8fe9926 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
Revision history for Perl extension {{$dist->name}}:
{{$NEXT}}
+ [Enhancements]
+ - Support getloadavg for DragonFly BSD.
0.22 2020-03-27 12:51:39+00:00 Europe/London (TRIAL RELEASE)
[Enhancements]
diff --git a/CpuLoad.xs b/CpuLoad.xs
index 51da1c5..57fc1b9 100644
--- a/CpuLoad.xs
+++ b/CpuLoad.xs
@@ -19,7 +19,7 @@ getloadavg()
double loadavg[3];
int nelem;
PPCODE:
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__linux__) || defined(__sun)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__linux__) || defined(__sun) || defined(__DragonFly__)
nelem = getloadavg(loadavg, 3);
#else
nelem = -1;
diff --git a/lib/Sys/CpuLoad.pm b/lib/Sys/CpuLoad.pm
index ffa60fd..6bc878e 100644
--- a/lib/Sys/CpuLoad.pm
+++ b/lib/Sys/CpuLoad.pm
@@ -124,7 +124,7 @@ sub BEGIN {
my $this = __PACKAGE__;
my $os = lc $^O;
- if ( $os =~ /^(darwin|(free|net|open)bsd|linux|solaris|sunos)$/ ) {
+ if ( $os =~ /^(darwin|dragonfly|(free|net|open)bsd|linux|solaris|sunos)$/ ) {
no strict 'refs'; ## no critic (ProhibitNoStrict)
*{"${this}::load"} = \&getloadavg;
}
diff --git a/t/10-getloadavg.t b/t/10-getloadavg.t
index 6e4b3c0..faf66e1 100644
--- a/t/10-getloadavg.t
+++ b/t/10-getloadavg.t
@@ -3,7 +3,7 @@ use Test::Most;
my $os = lc $^O;
plan skip_all $os
- if $os !~ /^(darwin|(free|net|open)bsd|linux|solaris|sunos)$/;
+ if $os !~ /^(darwin|dragonfly|(free|net|open)bsd|linux|solaris|sunos)$/;
use_ok 'Sys::CpuLoad', 'getloadavg';