Get the App
SLTechnology News&Howtos  ›  Development  › 

How to pass parameters to Linux kernel code

Shulou Source: shulou.com Published: 2022-06-03 05:54:56 11月17日 Update

This article introduces the Linux kernel code, pass parameters, the content is very detailed, interested friends can refer to, hope to be helpful to you.

1. Source code

1.1 temp_main.c

# include # define LOG_INFO (fmt,args...) Printk (KERN_INFO fmt, # # args) static int int_var = 0 position static const char * str_var = "default"; static int int_arr [6]; int narr;module_param (int_var, int, 0644); MODULE_PARM_DESC (int_var, "An integer variable"); module_param (str_var, charp, 0644); MODULE_PARM_DESC (str_var, "A string variable"); module_param_array (int_arr, int, & narr, 0644) MODULE_PARM_DESC (int_arr, "An integer array"); static int init_marker (void) {int I; LOG_INFO ("int_var:% d.\ n", int_var); LOG_INFO ("str_var:% s.\ n", str_var); for (iTuno; I)

Tags: Code kernel parameters content more help run good interest guys buddies articles source code knowledge articles results references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Tech Info NVidia Microsoft Apple