From 70c5d22807c4ffbc13021650a6b6b6be642993dd Mon Sep 17 00:00:00 2001 From: Camm Maguire Date: Sun, 13 Nov 2022 12:55:14 +0000 Subject: [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 Gbp-Pq: Name Version_2_6_13pre31 --- h/386-kfreebsd.h | 1 + h/amd64-kfreebsd.h | 1 + h/elf64_mips_reloc_special.h | 1 - o/main.c | 33 ++++++++++++++++----------------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/h/386-kfreebsd.h b/h/386-kfreebsd.h index c437432..bd78e4d 100644 --- a/h/386-kfreebsd.h +++ b/h/386-kfreebsd.h @@ -46,3 +46,4 @@ #define RELOC_H "elf32_i386_reloc.h" #define BRK_DOES_NOT_GUARANTEE_ALLOCATION +#define FREEBSD diff --git a/h/amd64-kfreebsd.h b/h/amd64-kfreebsd.h index 7c05bdf..2b61fac 100644 --- a/h/amd64-kfreebsd.h +++ b/h/amd64-kfreebsd.h @@ -23,3 +23,4 @@ #define RELOC_H "elf64_i386_reloc.h" #define BRK_DOES_NOT_GUARANTEE_ALLOCATION +#define FREEBSD diff --git a/h/elf64_mips_reloc_special.h b/h/elf64_mips_reloc_special.h index 8ad2078..59a1a5b 100644 --- a/h/elf64_mips_reloc_special.h +++ b/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; diff --git a/o/main.c b/o/main.c index 782ce45..91de009 100755 --- 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 +#include + +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)))>(PAGEWIDTH-10); } +#else /*Linux*/ + #include 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; } -- 2.30.2