<div>Hi Prasad,</div>
<div> </div>
<div>question is: anyother way to access like iopl(3) function?.</div>
<div> </div>
<div>FYI, With iopl it is possible. But in my kernel i could not locate iopl function. Is there any similar function like iopl so that i will set the permission as root id.<br><br></div>
<div class="gmail_quote">On Sun, Apr 3, 2011 at 3:47 PM, Prasad Joshi <span dir="ltr"><<a href="mailto:prasadjoshi124@gmail.com">prasadjoshi124@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="im">On Sun, Apr 3, 2011 at 6:11 PM, Sengottuvelan S<br><<a href="mailto:sengottuvelan.s@gmail.com">sengottuvelan.s@gmail.com</a>> wrote:<br>> Hi All,<br>><br>> I am trying to access /dev/mem in my user process. I could not access<br>
> because not a privileged access. I tried to use iopl(3) call in linux 2.6,<br><br></div>I am not sure, but after reading the manpage, it looks like iopl will<br>give access to the IO ports not the files.<br>
<div class="im"><br>> but i am getting unresolved symbol for this. Is any other way to get access<br>> in user process. I am not sure how to solve this. Can you someone throw some<br>> light on this.<br>><br>
> if(iopl(3)){<br>> fprintf(stderr, "Cannot get I/O permissions (being root helps)");<br>> return -1;<br>> }<br>> if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) < 0) {<br>
> fprintf(stderr, "Failed to open /dev/mem");<br>> return -1;<br>> }<br><br></div>If you look at the file permission, you will notice only root has<br>permission to write the /dev/mem<br>
<br>$ ls -l /dev/mem<br>crw-r----- 1 root kmem 1, 1 2011-04-03 08:42 /dev/mem<br><br>Opening it for read/write will surely fail.<br><br>Thanks and Regards,<br>Prasad<br><br>><br>> --<br>
<div class="im">> Regards,<br>> S. Sengottuvelan.<br>><br>> --<br>> Regards,<br>> S. Sengottuvelan.<br>><br></div>> _______________________________________________<br>> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
><br>><br></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>S. Sengottuvelan.<br>