Line 0
Link Here
|
|
|
1 |
--- src/taucs_memory.c.orig 2003-09-01 06:16:13 UTC |
2 |
+++ src/taucs_memory.c |
3 |
@@ -123,7 +123,6 @@ double taucs_system_memory_size() |
4 |
} |
5 |
#endif |
6 |
|
7 |
-#ifdef OSTYPE_darwin |
8 |
#define TAUCS_SYSTEM_MEMORY_SIZE_DEFINED |
9 |
|
10 |
/* This is a BSD4.4 interface, so it should work on other BSD systems */ |
11 |
@@ -134,15 +133,15 @@ double taucs_system_memory_size() |
12 |
double taucs_system_memory_size() |
13 |
{ |
14 |
int mib[2] = { CTL_HW, HW_PHYSMEM }; |
15 |
- int int_retval; |
16 |
+ unsigned long int_retval; |
17 |
size_t len = sizeof(int); |
18 |
|
19 |
taucs_printf("taucs_system_memory_size: calling sysctl\n"); |
20 |
mib[1] = HW_PAGESIZE; |
21 |
if ( sysctl(mib,2, |
22 |
&int_retval,&len, |
23 |
- NULL, 0)) { |
24 |
- taucs_printf("taucs_system_memory_size: ERROR, sysctl failed (on darwin)\n"); |
25 |
+ NULL, 0) < 0) { |
26 |
+ taucs_printf("taucs_system_memory_size: ERROR, HW_PAGESIZE sysctl failed (on bsd)\n"); |
27 |
return -1.0; |
28 |
} |
29 |
taucs_printf(" sysctl pagesize %d bytes\n",int_retval); |
30 |
@@ -150,15 +149,14 @@ double taucs_system_memory_size() |
31 |
mib[1] = HW_PHYSMEM; |
32 |
if ( sysctl(mib,2, |
33 |
&int_retval,&len, |
34 |
- NULL, 0)) { |
35 |
- taucs_printf("taucs_system_memory_size: ERROR, sysctl failed (on darwin)\n"); |
36 |
+ NULL, 0) < 0) { |
37 |
+ taucs_printf("taucs_system_memory_size: ERROR, HW_PHYSMEM sysctl failed (on bsd)\n"); |
38 |
return -1.0; |
39 |
} |
40 |
taucs_printf(" sysctl physmem %d bytes\n",int_retval); |
41 |
|
42 |
return (double) int_retval; |
43 |
} |
44 |
-#endif |
45 |
|
46 |
#ifdef OSTYPE_aix |
47 |
#define TAUCS_SYSTEM_MEMORY_SIZE_DEFINED |