On Fri, Oct 18 2019, Charlene Wendling <julianaito@posteo.jp> wrote:
> On Thu, 17 Oct 2019 21:21:14 +0100
> Stuart Henderson wrote:
>
>> On 2019/10/17 10:01, Henry Jensen wrote:
>> > On Wed, 16 Oct 2019 16:07:34 +0100
>> > Stuart Henderson <stu@spacehopper.org> wrote:
>> >
>> > > On 2019/10/16 09:04, Henry Jensen wrote:
>> > > > Ping
>> > > >
>> > > > On Wed, 9 Oct 2019 15:08:00 +0200
>> > > > Henry Jensen <hjensen@mailbox.org> wrote:
>> > > >
>> > > > > Greetings,
>> > > > >
>> > > > > attached is a new port for the perl module Sys::MemInfo.
>> > > > > Sys::MemInfo returns the total amount of free and used
>> > > > > physical memory in bytes in totalmem and freemem variables.
>> > > > > Tested on -current amd64.
>> > >
>> > > Please format Makefile and DESCR a bit nicer. Look at other ports
>> > > in the tree for examples.
>> >
>> > Actually, I used one of the p5-* ports as template. I made minor
>> > modifications now (honoring the 72 character per line limit) and
>> > compared the formatting to other ports.
>>
>> That's better, this one is okay sthen@ if someone would like to
>> import.
>
> Sorry, but this module is broken because it badly computes totalmem,
> see [0], where i have 16 gigs actually. I've modified Makefile.PL, so
> we use the same code as NetBSD, this fixes the issue.
I'd prefer the diff below which involves less hardcoding.
What do you think? ok?
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/p5-Sys-MemInfo/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- Makefile 19 Oct 2019 11:00:17 -0000 1.1.1.1
+++ Makefile 3 Nov 2019 11:32:34 -0000
@@ -3,6 +3,7 @@
COMMENT = return the total amount of free and used physical memory
DISTNAME = Sys-MemInfo-0.99
+REVISION = 0
CATEGORIES = sysutils
# Perl
Index: patches/patch-Makefile_PL
===================================================================
RCS file: /cvs/ports/sysutils/p5-Sys-MemInfo/patches/patch-Makefile_PL,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-Makefile_PL
--- patches/patch-Makefile_PL 19 Oct 2019 11:00:17 -0000 1.1.1.1
+++ patches/patch-Makefile_PL 3 Nov 2019 11:32:34 -0000
@@ -6,15 +6,17 @@ https://rt.cpan.org/Public/Bug/Display.h
Index: Makefile.PL
--- Makefile.PL.orig
+++ Makefile.PL
-@@ -38,9 +38,9 @@ for ($^O) {
+@@ -38,12 +38,7 @@ for ($^O) {
}
} elsif (/bsd/) {
copy ('arch/bsd.xs', 'MemInfo.xs');
- if (/netbsd/) {
-+ if (/netbsd/ or /openbsd/) {
- $define = '-DNETBSD';
+- $define = '-DNETBSD';
- print "Sys::MemInfo for NetBSD\n";
-+ print "Sys::MemInfo for NetBSD and OpenBSD\n";
- } else {
- print "Sys::MemInfo for *BSD\n";
- }
+- } else {
+- print "Sys::MemInfo for *BSD\n";
+- }
++ print "Sys::MemInfo for *BSD\n";
+ } elsif (/hpux/) {
+ copy ('arch/hpux.xs', 'MemInfo.xs');
+ $define ='-D_XOPEN_SOURCE_EXTENDED';
Index: patches/patch-arch_bsd_xs
===================================================================
RCS file: patches/patch-arch_bsd_xs
diff -N patches/patch-arch_bsd_xs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-arch_bsd_xs 3 Nov 2019 11:32:34 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+Fix totalmem computation, see
+https://rt.cpan.org/Public/Bug/Display.html?id=130740
+
+Index: arch/bsd.xs
+--- arch/bsd.xs.orig
++++ arch/bsd.xs
+@@ -22,13 +22,14 @@ double
+ totalmem()
+ PROTOTYPE: DISABLE
+ CODE:
+- unsigned long long ret = 0;
+- size_t len = sizeof (ret);
+-#ifdef NETBSD
++#ifdef HW_PHYSMEM64
++ long long ret = 0;
+ static int mib[2] = { CTL_HW, HW_PHYSMEM64 };
+ #else
++ int ret = 0;
+ static int mib[2] = { CTL_HW, HW_PHYSMEM };
+
No comments:
Post a Comment