Hi,
Sorry to send an other question concerning share memory but ....
My system was working correctly until I've decided to increase
my share memory to add a large ring buffer. Now the system crash
hardly without debuging information. So I have tryed to run a small
test program without success.
my system is
uname -a
Linux lthemc19.hmg.inpg.fr 2.0.36.RTL1.1 #1 Fri Mar 26 21:27:38 CET 1999
i586 unknown
my lilo.conf is :
more /etc/lilo.conf
boot=/dev/sda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
image=/boot/rt-vmlinuz-2.0.36
label=rtlinux
root=/dev/sda1
read-only
append="mem=126m"
my meminfo :
cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 128937984 126701568 2236416 23920640 85069824 18231296
Swap: 90439680 4096 90435584
MemTotal: 125916 kB
MemFree: 2184 kB
MemShared: 23360 kB
Buffers: 83076 kB
Cached: 17804 kB
SwapTotal: 88320 kB
SwapFree: 88316 kB
The total of mem should be around 126 meg and note 128 ??????
my test program :
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <fcntl.h>
#define ADDRESS (126*0x100000)
main(void)
{
char *user_ptr,*ptr;
int fdm;
int i;
if ((fdm = open("/dev/mem", O_RDONLY)) < 0) {
fprintf(stderr, "Error opening /dev/mem \n");
exit(1);
}
user_ptr = (char * ) mmap ( 0, 0x100000, PROT_READ,
MAP_FILE |MAP_PRIVATE, fdm, ADDRESS);
if (MAP_FAILED == user_ptr)
{
/* handle error here */
close(fdm);
printf("perdu\n");
}
memset(user_ptr, 0,0x100000);
munmap ( user_ptr, 0x100000 );
close(fdm);
}
On the memset I have a core dump ??
Where is my mistake ???
Thank you in advance for your help
Fred
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/