open() from <linux/fs.h>
I'm new to programming for the Linux kernel, but I'm wondering how to open devices. For example, I want to open "/dev/tty0." Right now, I have included <linux/fs.h> and then called open() with the full path of the device as a parameter. However, during compilation I receive the following messages:
warning: implicit declaration of function 'open'
WARNING: "open" [<Path to module.ko>] undefined!
When you are opening a device file "/dev/tty0", then dont include the "linux/fs.h"
header file. This header file is used in developing the device drivers code.
When you are writting an user mode program, see the manual page for the system calls or library calls your making use.
For e.g check manual page for open: "man 2 open" in command line.
Sorry, perhaps I was a bit unclear in my description. I'm writing a kernel module that needs to open the device, so I can't use the usual <stdio.h> to open files. I'm looking for the kernel-space equivalent method. Thanks.
No one has responded for 2 weeks, so I'm wondering if anyone can solve my problem. I basically want to open the TTY device from a kernel module that I am writing, which means that I need to use a kernel space header. From what I know, I'm assuming that I need to use <linux/fs.h>. However, even after including that header file, the compiler complains about not finding a valid prototype for the open() function. Should I even call open(), or am I using the wrong function to open the device? Any assistance in the right direction would be most appreciated.