[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

Re: [XaraXtreme-dev] [patch] Have implemented a Linux port of GetMemoryStatus ("Function to find available RAM")



On Sat, May 27, 2006 at 11:02:36PM +0100, Alex Bligh wrote:
> Israel,
> 
> Thanks for this. I will have a look in more detail in the morning but
> a couple of comments:
> 
> 1. (perhaps based on what Phil gave you) it seems to me that
>    we are doing #ifdef MSW, #elif #WXMAC, #else (assume Linux)
>    and then processing a /proc file. Well, that means FreeBSD
>    etc. will fail to compile because hey aren't Mac or MSW.
>    I think we should instead test for MSW (and use that if so),
>    then for Linux (explicitly) and use your code, then if that
>    fails, fail for Mac, FreeBSD etc. as well. That's better than
>    trying to open files that don't exist on FreeBSD. (I think
>    the /proc file is not going to exist on FreeBSD etc. - right
>    Vasil?)
Well, /proc is not mounted by default on a recent FreeBSD versions
(5.x, 6.x and 7.x) so this directory is usually empty.

Anyway it is possible to ``mount_procfs procfs /proc'' and have
the FreeBSD's proc filesystem or ``mount_linprocfs linprocfs /proc''
and have the Linux's proc filesystem which contains the file meminfo.

I think it would be better not to test if it is linux or freebsd but
rather if /proc/meminfo exists and whether contains the necessary
information.

-- 
Vasil Dimov
gro.DSBeerF@dv

Testing can show the presence of bugs, but not their absence.
                -- Edsger W. Dijkstra

Attachment: pgpUVqJHz3SnY.pgp
Description: PGP signature