<short summary of the patch>
authorCamm Maguire <camm@debian.org>
Sun, 13 Nov 2022 12:55:14 +0000 (12:55 +0000)
committerCamm Maguire <camm@debian.org>
Sun, 13 Nov 2022 12:55:14 +0000 (12:55 +0000)
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

Gbp-Pq: Name Version_2_6_13pre31

h/386-kfreebsd.h
h/amd64-kfreebsd.h
h/elf64_mips_reloc_special.h
o/main.c

index c43743251b13afd01e89a684034386297bcd5985..bd78e4d21ac5dd8b8b5e560dbc944919a30f94dc 100644 (file)
@@ -46,3 +46,4 @@
 #define RELOC_H "elf32_i386_reloc.h"
 
 #define BRK_DOES_NOT_GUARANTEE_ALLOCATION
+#define FREEBSD
index 7c05bdfd7e4fccb0b2c3da131ce81a255d09f030..2b61facfc3cbce898c8e1c1c6faed4b2d0424fe8 100644 (file)
@@ -23,3 +23,4 @@
 #define RELOC_H "elf64_i386_reloc.h"
 
 #define BRK_DOES_NOT_GUARANTEE_ALLOCATION
+#define FREEBSD
index 8ad20784c1992f21254075858eb526133d0fae3c..59a1a5b0ecf3f6a25ce3990a4c7bb64717524d12 100644 (file)
@@ -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;
index 782ce45830b5134a152f6b36c24d0fce04d12232..91de00974df13f005bc2679219ad6a75cda96cbb 100755 (executable)
--- a/o/main.c
+++ b/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;
   
 }