I am working on ubuntu.
I am trying to open /dev/mem
and i am getting permission denied
int32_t open_memdev()
{
int32_t fd;
fd = open("/dev/mem", O_RDONLY);
if (fd < 0) {
printf("Failed to open /dev/mem : %s\n", strerror(errno));
return-EINVAL;
}
return fd;
}
This code always prints "Failed to open /dev/mem : Operation not permitted"
I have searched for this on SO
These q's seem to discuss the issue of not being able to access above 1 MB, but my problem is that i am unable to open even once.
Addtitional details if they help:
1) I checked my configuration that CONFIG_STRICT_DEVMEM is enabled.
2) ls -l /dev/mem
crw-r----- 1 root kmem 1, 1 2014-03-13 13:57 /dev/mem
Please let me know if additional information is required.