0

I am working with systemtap probe which is in linux kernel space and so I can't use the regular pread syscall. Is there a equivalence of pread syscall in kernel space?

my friend found this: http://lxr.free-electrons.com/source/fs/read_write.c?v=2.6.32#L433 but what is the header file that I need to include?

Thanks!

Erben

Erben Mo
  • 3,528
  • 3
  • 19
  • 32

1 Answers1

0

The pread system call is actually calling vfs_read(), so you can use vfs_read() in the kernel space.

vfs_read is an exported symbol and you don't need to include any header file.

Brienza
  • 51
  • 2
  • Thanks! another thing, vfs_read seems to only take a buffer in user space. If a do a kmalloc and pass the buffer to vfs_read, it returns EFAULT. Is there a way for me to get a user_space memory from kernel_space? – Erben Mo Dec 11 '14 at 00:58
  • http://stackoverflow.com/questions/7629141/allocate-user-space-memory-from-kernel – Erben Mo Dec 11 '14 at 01:12