<p>I'm writing a Linux kernel module that needs to open and read files. What's the best way to accomplish that?</p>

assuming you can get pointers to the relavent function pointers to the
```
open
```
/
```
read
```
/
```
close
```
system calls, you can do something like this:
```
```
mm_segment_t fs = get_fs();
set_fs(KERNEL_DS);

fd = (*syscall_open)(file, flags, mode);
if(fd != -1) {
    (*syscall_read)(fd, buf, size);
    (*syscall_close)(fd);
}
set_fs(fs);
```
```
you will need to create the "
```
syscall_*
```
" function pointers I have shown though. I am sure there is a better way, but I believe that this would work.