Results 1 to 4 of 4
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 ...
- 04-23-2007 #1Just Joined!
- Join Date
- Apr 2007
- Posts
- 3
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:
Code:warning: implicit declaration of function 'open' ... WARNING: "open" [<Path to module.ko>] undefined!
- 04-23-2007 #2Just Joined!
- Join Date
- Jan 2006
- Location
- India
- Posts
- 52
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.
--Regards,
rajesh
- 04-23-2007 #3Just Joined!
- Join Date
- Apr 2007
- Posts
- 3
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.
- 05-12-2007 #4Just Joined!
- Join Date
- Apr 2007
- Posts
- 3
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.


Reply With Quote
