Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the initialization process of the Linux kernel module

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Linux kernel module initialization process is how, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

I. Code

Module 1 derives the function void output (void), and module 2 calls the functions in module 1. (load module 1 first, then module 2)

Module 1:

# include # include / / static int int_var = 0 default modulekeeper param (int_var, int, 0644); MODULE_PARM_DESC (int_var, "An integer variable"); static char* str_var = "default"; module_param_named (str_var_alias, str_var, charp, 0644); MODULE_PARM_DESC (str_var_alias, "A string variable"); static char str_var2 [10]; module_param_string (str_var2_alias, str_var2, 10, 0644) MODULE_PARM_DESC (str_var2_alias, "A string variable"); static int int_arr [10]; int narr;module_param_array (int_arr, int, & narr, 0644); MODULE_PARM_DESC (int_arr, "An integer array"); static int int_arr2 [10]; int narr2;module_param_array_named (int_arr2_alias, int_arr2, int, & narr2, 0644); MODULE_PARM_DESC (int_arr2_alias, "An integer array") / / static void output (void) {printk ("hello world!\ n");} EXPORT_SYMBOL_GPL (output); static int_ _ init init_marker (void) {int i; printk ("init marker.\ n"); / / printk ("int_var:%d\ n", int_var); printk ("str_var:%s\ n", str_var); printk ("str_var2:%s\ n", str_var2); for (iTun0) I

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report