Blob Blame History Raw
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gcl (2.6.12-24) unstable; urgency=medium
 .
   * Version_2_6_13pre30
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gcl-2.6.12.orig/h/386-kfreebsd.h
+++ gcl-2.6.12/h/386-kfreebsd.h
@@ -46,3 +46,4 @@
 #define RELOC_H "elf32_i386_reloc.h"
 
 #define BRK_DOES_NOT_GUARANTEE_ALLOCATION
+#define FREEBSD
--- gcl-2.6.12.orig/h/amd64-kfreebsd.h
+++ gcl-2.6.12/h/amd64-kfreebsd.h
@@ -23,3 +23,4 @@
 #define RELOC_H "elf64_i386_reloc.h"
 
 #define BRK_DOES_NOT_GUARANTEE_ALLOCATION
+#define FREEBSD
--- gcl-2.6.12.orig/h/elf64_mips_reloc_special.h
+++ gcl-2.6.12/h/elf64_mips_reloc_special.h
@@ -23,7 +23,6 @@ write_stub(ul s,ul *got,ul *gote) {
   call_16_tramp *t=(void *)gote;
 
   *t=t1;
-  *got=can_gp;
 
   t->entry=(ul)(gote+2);
   t->gotoff=s;
--- gcl-2.6.12.orig/o/main.c
+++ gcl-2.6.12/o/main.c
@@ -152,6 +152,7 @@ mbrk(void *v) {
 
 static ufixnum
 get_phys_pages_no_malloc(char n) {
+
   MEMORYSTATUS m;
 
   m.dwLength=sizeof(m);
@@ -166,6 +167,7 @@ get_phys_pages_no_malloc(char n) {
 
 static ufixnum
 get_phys_pages_no_malloc(char n) {
+
   uint64_t s;
   size_t z=sizeof(s);
   int m[2]={CTL_HW,HW_MEMSIZE};
@@ -186,33 +188,30 @@ get_phys_pages_no_malloc(char n) {
 
 }
 
-#else 
+#elif defined(FREEBSD)
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+static ufixnum
+get_phys_pages_no_malloc(char n) {
+
+  size_t i,len=sizeof(i);
 
-ufixnum
-get_proc_meminfo_value_in_pages(const char *k) {
-  int l,m;
-  char b[PAGESIZE],*c;
-  ufixnum n;
+  return (sysctlbyname("hw.physmem",&i,&len,NULL,0) ? 0 : i)>>PAGEWIDTH;
   
-  massert((l=open("/proc/meminfo",O_RDONLY))!=-1);
-  massert((n=read(l,b,sizeof(b)))<sizeof(b));
-  b[n]=0;
-  massert(!close(l));
-  massert((c=strstr(b,k)));
-  c+=strlen(k);
-  massert(sscanf(c,"%lu%n",&n,&m)==1);
-  massert(!strncmp(c+m," kB\n",4));
-  return n>>(PAGEWIDTH-10);
 }
 
+#else /*Linux*/
+
 #include <sys/sysinfo.h>
 
 static ufixnum
 get_phys_pages_no_malloc(char freep) {
 
   struct sysinfo s;
-  sysinfo(&s);
-  return ((freep ? s.freeram : s.totalram)>>PAGEWIDTH)*s.mem_unit;
+
+  return sysinfo(&s) ? 0 : ((freep ? s.freeram : s.totalram)>>PAGEWIDTH)*s.mem_unit;
   
 }