lkml.org 
[lkml]   [2000]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectabout /proc/meminfo and mmap
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/

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.084 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site