LinuxÄ£¿é±à³Ì
ÕªÒª
LinuxÄÚºËÄ£¿é±à³ÌµÄ×ÊÁÏÓÐЩ·×·±¸´ÔÓ£¬ÓеĹýÓÚ¼òµ¥£¬ÓеĹýÓÚÅÓÔÓ£¬ÎÒÊÔͼÓñʼǵÄÐÎʽÏë¶ÁÕßչʾÔõÑùÀ´½ø³ÌLinuxÄ£¿é±à³Ì£¬Á¦Í¼×öµ½¼òÃ÷¶óÒª£¬ÕâƪÎÄÕÂÒ²ÊÇ×÷Ϊ±¾È˱¸ÍüµÄ×ÊÁÏ£¬ËùÒÔÓÐЩµØ·½¹ýÓÚ¼òÂÔÊÇÄÑÃâµÄ¡£±¾À´ÕâƪÎÄÕµÄÄ¿µÄ¾ÍÊÇÈÃÓû§ÖªÆäÈ»£¬ÖÁÓÚËùÒÔÈ»»¹ÊÇÇë²Î¿¼ÏàÓ¦µÄ×ÊÁÏ£¬Æäʵ×îºÃµÄ×ÊÁÏĪ¹ýÓÚLinux Kernel Source¡£
ÊÊÓ÷¶Î§£º
Linux Kernel >= 2.6.0
LinuxÄ£¿é¼ò½é
Ê×ÏÈÕâ¸ömodule²»Í¬ÓÚmicrokernelµÄmodule£¬microkernelµÄmoduleÊÇÒ»¸ö¸öµÄdaemon½ø³Ì£¬¹¤×÷ÓÚÓû§¿Õ¼ä£¬LinuxµÄmoduleÖ»ÊÇÒ»¸öÄں˵ÄÄ¿±ê´úÂ룬ÄÚºËͨ¹ýÖ´ÐÐÔËÐÐʱµÄÁ¬½Ó£¬À´°ÑËüÕûºÏµ½kernelÖÐÈ¥£¬ËùÒÔ˵LinuxµÄmodule»úÖƲ¢Ã»ÓиıäLinuxÄÚºËΪmonolithic OS±¾ÖÊ£¬ÆämoduleÒ²Êǹ¤×÷ÓÚÄÚºËģʽ£¬ÏíÓÐÄں˵ÄËùÓÐÌØȨ¡£
ÖÁÓÚΪʲôҪÒýÈëLinux Kernle Module£¨Ò»Ï¼ò³ÆLKM£©£¬ÎÒÏëÖÁÉÙÓÐһϼ¸µã£º
Ä£¿é»¯±à³ÌµÄÐèÒª£¬½µµÍ¿ª·¢ºÍά»¤³É±¾¡£
ÔöǿϵͳµÄÁé»îÐÔ£¬Ê¹µÃÐÞ¸ÄһЩÄں˹¦Äܶø²»±ØÖØбàÒëÄں˺ÍÖØÆôϵͳ¡£
½µµÍÄں˱à³ÌµÄ¸´ÔÓÐÔ£¬Ê¹ÈëÃÅÃż÷½µµÍ¡£
Ïà¹Øºê¼°Í·Îļþ
LKMÐèÒª°üº¬ÒÔÏÂÍ·Îļþ:<linux/kernel.h> <linux/module.h>
ÐèÒª¶¨ÒåÒÔϺê:__KERNEL__, MODULE
Ò»¸ö¼òµ¥µÄÄÚºËÄ£¿éʾÀý
/*file: hello.c*/
#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#include <linux/module.h>
#include <linux/kernel.h>
static int __init hello_init(void)
{
printk(KERN_ALERT "Hello, my LKM.\n");
return 0;
}
static void __exit hello_exit(void)
{
printk(KERN_ALERT "Bye, my LKM.\n");
}
module_init(hello_init);
module_exit(hello_exit);
ºÜ¼ò´ð°É£¬²»ÊÇÂð£¿Õâ¸öLKMµÄ¹¦ÄÜÆäʵҲºÜ¼òµ¥£¬¾ÍÊǵ±Í¨¹ýinsmod¼ÓÔØËüµÄʱºò£¬Ëû´òÓ¡Hello, my LKM.ͨ¹ýrmmodжÔØËüµÄʱºòËû´òÓ¡bye, my LKM.Ò»¸ö×î»ù±¾µÄÄÚºËÄ£¿éÒ»°ã¶¼°üº¬ÓÐÁ½¸öº¯Êý£¬Ò»¸öÊdzõʼ»¯º¯Êý(±ÈÈç˵ÕâÀïµÄhello_init),Ò»¸öÊÇжÔغ¯Êý(hello_exit), µ±È»Ò²¿ÉÒÔûÓÐÈκκ¯Êý£¬Ö»ÊÇÌṩһЩ±äÁ¿¡£µ«Êdzõʼ»¯º¯ÊýºÍжÔغ¯Êý±ØÐë³É¶Ô³öÏÖ¡£²¢ÇÒinitº¯Êýµ±²Ù×÷³É¹¦Ê±·µ»ØÖµ´óÓÚµÈÓÚÁã,µ±²Ù×÷ʧ°Üʱ£¬·µ»Ø·ÇÁã¡£ºêmodule_initºÍmodule_exitÓÃÓÚ×¢²á³õʼ»¯º¯ÊýºÍжÔغ¯Êý¡£
LKMµÄ±àÒë
Ò»¸öʾÀýµÄMakefileÈçÏÂËùʾ
obj-m := hello.o
KERNELBUILD
Ïà¹ØÎĵµ£º
×ÜÀÀ
ÓÃiptables -ADC À´Ö¸¶¨Á´µÄ¹æ
Ôò
£¬-AÌí¼Ó -Dɾ³ý -C ÐÞ¸Ä
iptables - [RI] chain rule num rule-specification[option]
ÓÃiptables - RI ͨ¹ý¹æÔòµÄ˳ÐòÖ¸¶¨
iptables -D chain rule num[option]
ɾ³ýÖ¸¶¨¹æÔò
iptables -[LFZ] [chain][option]
ÓÃiptables -LFZ Á´Ãû [Ñ¡Ïî]
iptables -[NX] chain
ÓÃ -NX ......
linuxÈçºÎϵͳÐÅÏ¢
Äõ½Ò»¸öϵͳ£¬¿Ï¶¨Òª¿´¿´ÏµÍ³ÅäÖã¬linuxÏ¿´ÅäÖ㬿ÉûÓÐwindowsÄÇôֱ¹Û¡£ÄãÖ»ÄÜÒ»¸öÒ»¸ö²é¿´¡£
Ò»£ºcpu
[root@srv /]# more /proc/cpuinfo | grep "model name"
model name : Intel(R) Xeon(R) CPU X3220 @ 2.40GHz
model name &n ......
ÎÒ·¢ÏÖÏÖÔÚ¹Ø×¢linuxµÄÈËÌرð¶à£¬µ«ÍùÍù¶¼²»ÖªµÀ´ÓÄÄÈëÊÖ£¬ÎÒÏ£Íû´ó¼Ò¿´ÍêÁËÕâƪÎÄÕºóÄÜÄúһЩÆôʾ£¬Í¬Ê±Ò²ÏàÐÅÆäʵÈëÐв¢²»ÄÑ£¬ÄѵÄÊÇѧ¾«µÄµÀÀí¡£
Ò»¡¢´Ó»ù´¡¿ªÊ¼£º³£³£ÓÐЩÅóÓÑÔÚLinuxÂÛ̳ÎÊһЩÎÊÌ⣬²»¹ý£¬ÆäÖдó¶àÊýµÄÎÊÌⶼÊǺܻù´¡ µÄ¡£ÀýÈ磺ΪʲôÎÒʹÓÃÒ»¸öÃüÁîµÄʱºò£¬ÏµÍ³¸æËßÎÒÕÒ²»µ½¸ÃĿ¼£¬ÎÒÒªÈçºÎÏÞÖÆÊ ......
aep1000
Ö§³Ö¿ìËÙ¼ÓÃÜ´¦Àí¿¨ÒÔ¼ÓËÙ°²È«Ì×½Ó×ֲ㣨SSL£©¼ÓÃÜ£¬ÔÚ±¾ÊéÖв»ÓÃÓÚ½¨Á¢¼¯Èº¡£
anacron
ÓëcronºÍatÀàËÆ£¬¶¼ÊÇÔÚÌض¨Ê±¼ä¡¢ÉõÖÁÔÚϵͳûÓÐÁ¬ÐøÔËÐÐʱÆô¶¯ÃüÁîµÄ£¬ÔÚRed HatÉÏ£¬/etc/anacrontabÎļþÁгöÁËÿÌìÖ´ÐеÄcron×÷ÒµµÄÑ»·³£¹æÈÕÖ¾£¬Èç¹ûÄã½ûÓÃÁËËü£¬Ä㽫²»ÄÜÔÙÖ´ÐÐÈÕ־ѻ·£¬ÄãµÄϵͳ´ÅÅÌ×îºó½«±»ÌîÂú£¬Ô ......
ǰЩÌìÔÚ×Ô¼ºµÄ±¾±¾ÉÏ×°ÁËÐéÄâ»ú£¬²¢°²×°ÁËredhat5£¬Ò»Çи㶨֮ºó·¢ÏÖ´ò¿ªÖÐÎÄÍøÒ³²»ÄÜÕý³£ÏÔʾ¡£Æô³õÒÔΪÊÇϵͳ±àÂëÎÊÌ⣬¿É¸ü¸ÄÁËϵͳ±àÂëºóÎÊÌâÒÀÈ»´æÔÚ£¬¶øÇÒϵͳµÄÎÄ×ÖÒ²±ä³ÉÂÒÂë¡£¿´À´²»ÊǼòµ¥µÄȱʡ±àÂëÎÊÌ⣬һ¶¨ÊÇϵͳûÓÐÖÐÎÄ°üµÄÔÒò¡£ÓÚÊǺõÅܵ½ÍøÉÏËÑÑ°ÖÐÎÄ°üµØÖ·£¬·¢ÏÖredhat5¹âÅÌÖдøÓÐÕâЩ°ü¡£ºÃÁË£¬·Ï»°²» ......