ports/89946: [patch] PR_GetPhysicalMemorySize not implemented in devel/nspr resulting in poor performance in Firefox

Juha-Matti Tilli juhis at nallukka.net
Sun Dec 4 21:40:43 UTC 2005


>Number:         89946
>Category:       ports
>Synopsis:       [patch] PR_GetPhysicalMemorySize not implemented in devel/nspr resulting in poor performance in Firefox
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 04 21:40:02 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Juha-Matti Tilli
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD tykki.juhis.ath.cx 6.0-RELEASE FreeBSD 6.0-RELEASE #3: Sat Nov 26 22:57:19 EET 2005 juhis at tykki:/usr/obj/usr/src/sys/TYKKI i386

nspr-4.6_1
firefox-1.5_3,1

>Description:

The PR_GetPhysicalMemorySize() call is not implemented in the FreeBSD port of
nspr. This causes Firefox to disable memory cache.

>How-To-Repeat:

% cd /usr/ports/devel/nspr; make install
% cat > nspr-test.c
#include "prio.h"
#include "prerror.h"
#include "prprf.h"
#include "prsystem.h"

int main(int argc, char **argv) {
  PRUint64 i = PR_GetPhysicalMemorySize();
  PRFileDesc *out = PR_GetSpecialFD(PR_StandardOutput);
  if(i != 0) {
    PR_fprintf(out, "Physical memory size = %llu\n", i);
  }
  else {
    if(PR_GetError() == PR_NOT_IMPLEMENTED_ERROR)
      PR_fprintf(out, "PR_GetPhysicalMemorySize not implemented\n");
  }
  return 0;
}

% cc -Wall -o nspr-test nspr-test.c `nspr-config --cflags` `nspr-config --libs`
% ./nspr-test
PR_GetPhysicalMemorySize not implemented

>Fix:

--- mozilla/nsprpub/pr/src/misc/prsystem.c.orig	Fri May  6 23:35:58 2005
+++ mozilla/nsprpub/pr/src/misc/prsystem.c	Sun Dec  4 23:34:19 2005
@@ -352,6 +352,15 @@
         odm_terminate();
     }
 
+#elif defined(__FreeBSD__)
+
+    int name[] = {CTL_HW, HW_PHYSMEM};
+    unsigned long old;
+    size_t oldlen = sizeof(old);
+    if(sysctl(&name, sizeof(name)/sizeof(*name), &old, &oldlen, NULL, 0) == 0
+        && oldlen == sizeof(old))
+      bytes = old;
+
 #else
 
     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list