In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
1 header file to be done
Header file in "include/linux/moduleparam.h"
2 function description 2.1Kernel module can pass single parameter through module_param
-module_param (name,type,perm)
-name: the name of the module parameter
-type: data type of module parameters (int long short uint ulong ushort class is supported
Type)
-perm: access to module parameters (the S_IRUSR parameter represents all file owners
Readable)
2.2 pass multiple parameters module_param_array (name, type, nump, perm)
-name: the name of the module parameter
-type: data type of module parameters (int long short uint ulong ushort class is supported
Type)
-nump: the address where the number of parameters is saved
-perm: access to module parameters (the S_IRUSR parameter represents all file owners
Readable)
2.3 access to parameters
The parameter perm represents the attribute of the file node corresponding to this parameter in the sysfs file system, whose permissions are in the
It is defined in include/linux/stat.h.
Variable perm
-# defineS_IRUSR 00400 file owner readable
-# defineS_IWUSR00200 file owner writable
-# defineS_IXUSR 00100 file owner executable
-# defineS_IRGRP00040 can be read by users in the same group as the file owner
-# defineS_IWGRP00020
-# defineS_IXGRP 00010
-# defineS_IROTH 00004 can be read by users in a different group from the file owner
-# defineS_IWOTH00002
-# defineS_IXOTH 00001
Convert the last three digits of the number into binary: xxx xxx xxx, the high bit to the low bit in turn, the first bit is 1 for text
The owner of the piece is readable, the second bit 1 means that the file owner is writable, and the third bit 1 indicates that the file owner can hold
Line; the next three represent the permissions of the file owner as members of the same group; the next three represent different group user permissions
3 use the source code for example * define the header file of module_param module_param_array * / # include / * define the header file of perm in module_param module_param_array * / # include MODULE_LICENSE ("Dual BSD/GPL"); / * declare that it is open source and have no kernel version restriction * / MODULE_AUTHOR ("iTOPEET_dz"); / * declaration author * / static int module_arg1,module_arg2;static int int_array [50]; static int int_num Module_param (module_arg1,int,S_IRUSR); module_param (module_arg2,int,S_IRUSR); module_param_array (int_array,int,&int_num,S_IRUSR); static int hello_init (void) {int i; printk (KERN_EMERG "module_arg1 is% d!\ n", module_arg1); printk (KERN_EMERG "module_arg2 is% d!\ n", module_arg2); for
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.