Re:

From: Cooper Yuan
Date: Sun Jan 11 2009 - 00:44:35 EST


try following code, hope it helpful:

unsigned long old_fs;
orig_open=sys_call_table(__NR_open);
orig_read=sys_call_table(__NR_read);
orig_close=sys_call_table(__NR_close);
old_fs = get_fs();
set_fs(get_ds());
fd=orig_open(pathname,O_RDWR,"rwx-rwx-rwx");
orig_read(fd,buffer,size);
orig_close(fd);
set_fs(old_fs);


On Sun, Jan 11, 2009 at 11:41 AM, Jose Luis Marchetti
<joseluismarchetti@xxxxxxxxxxxx> wrote:
> Hi,
>
> I would like to open/read/write/close a regular file from my device
> driver.
> I think it would be possible, but I am confused, the "The Linux Kernel
> Module Programming Guide" states that I can not use standard libraries
> from within a module, I know the standard library ends up calling
> system calls, but which calls should I use to deal with regular
> files ?
> I am developing a Ethernet driver and the Mac address configuration
>
> Thanks in advance!
>
> Josà LuÃs Marchetti
>
>
> Veja quais sÃo os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
N‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i