Merge branch 'linux-limbo' into 'master'

Linux limbo

See merge request STJr/SRB2!228
This commit is contained in:
Monster Iestyn 2018-03-04 14:08:21 -05:00
commit 16e60aada9

View file

@ -2709,7 +2709,7 @@ const char *I_LocateWad(void)
return waddir;
}
#if defined(LINUX) || defined(LINUX64)
#ifdef __linux__
#define MEMINFO_FILE "/proc/meminfo"
#define MEMTOTAL "MemTotal:"
#define MEMFREE "MemFree:"
@ -2729,12 +2729,14 @@ UINT32 I_GetFreeMem(UINT32 *total)
};
if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL)
{
if (total)
*total = 0L;
return 0;
}
if (kvm_nlist(kd, namelist) != 0)
{
kvm_close (kd);
if (total)
*total = 0L;
return 0;
}
@ -2742,6 +2744,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
sizeof (sum)) != sizeof (sum))
{
kvm_close(kd);
if (total)
*total = 0L;
return 0;
}
@ -2773,7 +2776,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
(PVOID) &pr_arena, sizeof (UINT32));
return pr_arena;
#elif defined (LINUX) || defined (LINUX64)
#elif defined (__linux__)
/* Linux */
char buf[1024];
char *memTag;
@ -2789,14 +2792,16 @@ UINT32 I_GetFreeMem(UINT32 *total)
if (n < 0)
{
// Error
if (total)
*total = 0L;
return 0;
}
buf[n] = '\0';
if (NULL == (memTag = strstr(buf, MEMTOTAL)))
if ((memTag = strstr(buf, MEMTOTAL)) == NULL)
{
// Error
if (total)
*total = 0L;
return 0;
}
@ -2804,9 +2809,10 @@ UINT32 I_GetFreeMem(UINT32 *total)
memTag += sizeof (MEMTOTAL);
totalKBytes = atoi(memTag);
if (NULL == (memTag = strstr(buf, MEMFREE)))
if ((memTag = strstr(buf, MEMFREE)) == NULL)
{
// Error
if (total)
*total = 0L;
return 0;
}
@ -2822,7 +2828,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
if (total)
*total = 48<<20;
return 48<<20;
#endif /* LINUX */
#endif
}
const CPUInfoFlags *I_CPUInfo(void)