I wrote a simple module. Why is the kernel function not running?
Source: Internet
Author: User
After writing a simple module, why is the kernel function not running-Linux general technology-Linux programming and kernel information? For details, refer to the following. # If defined (CONFIG_SMP)
# Define _ SMP __
# Endif
# If defined (CONFIG_MODVERSIONS)
# Define MODVERSIONS
# Include
# Endif
# Include
# Include
# Include
# Include
# Define BUFLEN 50
MODULE_LICENSE ("GPL ");
Int errno;
# Define _ kernel_syscils __
# Include
Compile:
Gcc-D__KERNEL _-I/usr/src/linux-2.4.20-8/include/-DMODULE-Wall-O2-c test. c-o test. o
No error reported
Insmod test. o can be correctly loaded and the file "Hello" can be created.
However, you can view the log through dmesg | tail and find
If (file-> f_op-> write)
{
Printk (KERN_DEBUG "AAAAA! \ N ");
File-> f_op-> write (file, "11111", 5, & file-> f_pos );
} Not executed
I don't know why I didn't write 11111 to the file. Please give me some guidance!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.