linuxÄÚºËÄ£¿é½âÎö
Linux ¾ÍÊÇͨ³£Ëù˵µÄµ¥Äںˣ¨monolithic kernel£©£¬¼´²Ù×÷ϵͳµÄ´ó²¿·Ö¹¦Äܶ¼±»³ÆΪÄںˣ¬²¢ÔÚÌØȨģʽÏÂÔËÐС£ËüÓë΢ÐÍÄÚºË ²»Í¬£¬ºóÕßÖ»°Ñ»ù±¾µÄ¹¦ÄÜ£¨½ø³Ì¼äͨÐÅ [IPC]¡¢µ÷¶È¡¢»ù±¾µÄÊäÈë/Êä³ö [I/O] ºÍÄÚ´æ¹ÜÀí£©µ±×÷ÄÚºËÔËÐУ¬¶ø°ÑÆäËû¹¦ÄÜ£¨Çý¶¯³ÌÐò¡¢ÍøÂç¶ÑÕ»ºÍÎļþϵͳ£©ÅųýÔÚÌØȨ¿Õ¼äÖ®Íâ¡£Òò´Ë£¬Äú¿ÉÄÜÈÏΪ Linux ÊÇÒ»¸öÍêÈ«¾²Ì¬µÄÄںˣ¬µ«ÊÂʵǡǡÏà·´¡£Í¨¹ý Linux ÄÚºËÄ£¿é£¨LKM£©¿ÉÒÔÔÚÔËÐÐʱ¶¯Ì¬µØ¸ü¸Ä Linux¡£
¿É¶¯Ì¬¸ü¸Ä ÊÇÖ¸¿ÉÒÔ½«ÐµĹ¦ÄܼÓÔص½Äںˡ¢´ÓÄÚºËÈ¥³ýij¸ö¹¦ÄÜ£¬ÉõÖÁÌí¼ÓʹÓÃÆäËû LKM µÄРLKM¡£LKM µÄÓŵãÊÇ¿ÉÒÔ×îС»¯Äں˵ÄÄÚ´æÕ¼Óã¬Ö»¼ÓÔØÐèÒªµÄÔªËØ£¨ÕâÊÇǶÈëʽϵͳµÄÖØÒªÌØÐÔ£©¡£
Linux ²»ÊÇ¿ÉÒÔ½øÐж¯Ì¬¸ü¸ÄµÄΩһ£¨Ò²²»ÊǵÚÒ»¸ö£©µ¥Äںˡ£Berkeley Software Distribution£¨BSD£©µÄ±äÌå¡¢Sun Solaris¡¢¸üÀϵÄÄںˣ¨±ÈÈç OpenVMS£©£¬ÒÔ¼°ÆäËûÁ÷ÐеIJÙ×÷ϵͳ£¨±ÈÈç Microsoft® Windows® ºÍ Apple Mac OS X£©¶¼Ö§³Ö¿É¼ÓÔØÄ£¿é¡£
LKM£¬ËüÊÇÒÔÒ»¸öʲôÑùµÄ¶«Î÷ÄØ£¿ÎÒÃÇÖªµÀ£¬Ëû±àÒëÖ®ºó»áÊÇÒ»¸ökoºó׺ÃûµÄ¶«Î÷£¬µ«ÊÇÀïÃæÊÇÒ»¸öʲôÑùµÄ¡£ÎÒÃÇ¿´£¬Ò»°ãµÄÄ£¿éµÄÄ£°å¡£
/*
* hello.c Hello, World! As a Kernel Module
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
/*
* hello_init the init function, called when the module is loaded.
* Returns zero if successfully loaded, nonzero otherwise.
*/
static int hello_init(void)
{
printk(KERN_ALERT "I bear a charmed life.\n");
return 0;
}
/*
* hello_exit the exit function, called when the module is removed.
*/
static void hello_exit(void)
{
printk(KERN_ALERT "Out, out, brief candle!\n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Shakespeare");
Ä£¿é²¢²»ÊÇÇý¶¯£¬Ö»ÊÇLinuxµÄÒ»ÖÖÄÚºËÀ©Õ¹»úÖÆ£¬Çý¶¯¾ÍÊǽèÖúÕâÖÖ»úÖƵģ¬ÀíÂÛÉÏÓ¦¸ÃÕâÑùµÄÀí½â¡£
Õâ¾ÍÊÇÒ»¸öÄ£¿éµÄ»ù±¾Ä£°å£¬Í¨¹ý±àÒëÖ®ºó£¬»áÉú³ÉÒ»¸öko£¬×¢Ò⣬±àÒëµÄʱºòÓëÆäËûµÄÓ¦ÓóÌÐòÓкܴóµÄ²»Í¬£¬ÔÒòÊÇËüÉú³ÉµÄ¶«Î÷Ê
Ïà¹ØÎĵµ£º
ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......
Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......
ÔÚlinuxÖÐËùÓеÄsyscall¶¼Êǵ÷ÓÃint 0x80, int 0x80µÄÖжϷþÎñ³ÌÐòΪsystem_call(arch/x86/kernel/traps_32.c:set_system_gate(SYSCALL_VECTOR,&system_call). system_call (arch/x86/entry_32.S)×îÖÕcall *sys_call_table(,%eax,4)À´Íê³ÉÒ»¸ösyscallµ÷ÓÃ.
¼´ int 0x80 -> system_call -> s ......
Linux²Ù×÷ϵͳ¶¨Ê±µ÷¶ÈϵͳCron½éÉÜ
cronÊÇÒ»¸ölinuxϵĶ¨Ê±Ö´Ðй¤¾ß£¬¿ÉÒÔÔÚÎÞÐèÈ˹¤¸ÉÔ¤µÄÇé¿öÏÂÔËÐÐ×÷Òµ£¬±¾Îĵµ²»½²cronʵÏÖÔÀí£¬Ö÷Òª½²Ò»ÏÂcronµÄ¾ßÌåʹÓü°¼òµ¥½éÉÜ¡£
ÐÂÔöµ÷¶ÈÈÎÎñ
ÍƼöʹÓÃcrontab -eÃüÁîÌí¼Ó×Ô¶¨ÒåµÄÈÎÎñ£¨±à¼µÄÊÇ/var/spool/cron϶ÔÓ ......