about /proc/meminfo and mmap

From: Zhixu Liu (liuzx@bnl.gov)
Date: Fri Oct 20 2000 - 19:24:33 EST


Hi, all:

My PC have 128M RAM, but in /proc/meminfo, it display 122424K, not
128*1024K = 131072K, what does this mean?

My program need to a 32M buffer, so I add "append="mem=96M"" to lilo.conf,
then the PC only know 96M mem, I can use the rest 32M. Following is a
simple example:

/****************************************************************/
 int fd = open("/dev/mem", O_RDWR);
 if (fd < 0) {
        printf("failed to open /dev/mem\n");
        return -1;
        }
 start = (DATA *) mmap(0, length*sizeof(DATA),PROT_READ|PROT_WRITE,
       MAP_SHARED, fd, BASE_ADDRESS);
 if (start == (DATA *) (-1) ) {
        printf("failed to map /dev/mem\n");
        return -1;
        }

 // do ...

 munmap(start, length);
 
/****************************************************************/

Is there some problem? Or does the DATA are all in real RAM? Any
suggestions are welcome.

Thanks a lot.

Regards.

Zhixu

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:17 EST