Unable to open /dev/mem: permission denied

Jamie Mortimore jamie.mortimore@googlemail.com
Sat Apr 14 15:36:00 GMT 2007


Hi,

There is probably a straightforward answer to this question. I am
trying to run a c program under cygwin that I have compiled using gcc
in cygwin. The program is trying to open /dev/mem in read/write mode.
However I always get permission denied. The code looks like:

int fd = open("/dev/mem", O_RDWR);

if(fd < 0) {
    perror("Unable to open /dev/mem");
    exit(2);
}

The output I get from this is:

Unable to open /dev/mem: Permission denied

I have set up a root user (in /etc/passwd) and am running the program
as root but this doesn't solve the problem. Any help much appreciated.

Thanks,
Jamie.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list