LinuxÄÚºËÔö¼Óϵͳµ÷ÓÃ
1.linux ϵͳµ÷ÓõĻù±¾ÔÀí
linuxµÄϵͳµ÷ÓÃÐÎʽÓëPOSIX¼æÈÝ£¬Ò²ÊÇÒ»Ì×CÓïÑÔº¯ÊýÃûµÄ¼¯ºÏ¡£È»¶ø£¬linuxϵͳµ÷ÓõÄÄÚ²¿ÊµÏÖ·½Ê½È´ÓëDOCµÄINT 21HÏàËÆ£¬ËüÊǾ¹ýINT 0X80HÈíÖжϽøÈëºó£¬ÔÙ¸ù¾Ýϵͳµ÷ÓúŷÖÃűðÀàµØ·þÎñ¡£
´Óϵͳ·ÖÎöµÄ½Ç¶È£¬linuxµÄϵͳµ÷ÓÃÉæ¼°4¸ö·½ÃæµÄÎÊÌâ¡£
(1)Óëϵͳµ÷ÓÃÓйصÄÊý¾Ý½á¹¹ºÍº¯Êý
º¯ÊýÃûÒÔ“sys_”¿ªÍ·£¬ºó¸ú¸Ãϵͳµ÷ÓõÄÃû×Ö¡£ÀýÈ磬ϵͳµ÷ÓÃfork()µÄÏìÓ¦º¯ÊýÊÇsys_fork()(¼ûkernel/fork.c),exit()µÄÏìÓ¦º¯ÊýÊÇsys_exit()(¼ûkernel/fork.c)¡£
Îļþinclude/asm/unisted.hΪÿ¸öϵͳµ÷Óù涨ÁËΨһµÄ±àºÅ¡£¼ÙÉèÓÃname±íʾϵͳµ÷ÓõÄÃû³Æ£¬ÄÇôϵͳµ÷ÓúÅÓëϵͳµ÷ÓÃÏìÓ¦º¯Êý
µÄ¹ØϵÊÇ£ºÒÔϵͳµ÷ÓúÅ_NR_name×÷Ϊϱ꣬¿ÉÕÒ³öϵͳµ÷Óñísys_call_table(¼ûarch/i386/kernel
/entry.S)ÖжÔÓ¦±íÏîµÄÄÚÈÝ£¬ËüÕýºÃ ÊǸÃϵͳµ÷ÓõÄÏìÓ¦º¯Êýsys_nameµÄÈë¿ÚµØÖ·¡£ÏµÍ³µ÷
Óñísys_call_table¼Ç¼Á˸÷sys_nameº¯ÊýÔÚ±íÖеÄλ Ö㬹²190Ïî¡£ÓÐÁËÕâÕÅ±í£¬¾ÍºÜÈÝÒ׸ù¾ÝÌض¨ÏµÍ³µ÷ÓÃ
ÔÚ±íÖеÄÆ«ÒÆÁ¿£¬ÕÒµ½¶ÔÓ¦µÄϵͳµ÷ÓÃÏìÓ¦º¯ÊýµÄÈë¿ÚµØÖ·¡£ÏµÍ³µ÷ÓÃ±í¹²256ÏÓàϵÄÏîÊǿɹ©Óû§×Ô¼ºÌí¼ÓµÄϵͳµ÷Óÿռ䡣
(2)½ø³ÌµÄϵͳµ÷ÓÃÃüÁîת»»ÎªINT 0x80ÖжϵĹý³Ì
ºê¶¨Òå_syscallN()¼ûinclude/asm/unisted.h)ÓÃÓÚϵͳµ÷Óõĸñʽת»»ºÍ²ÎÊýµÄ´«µÝ¡£NÈ¡0~5Ö®¼äµÄÕûÊý¡£
²ÎÊý¸öÊýΪNµÄϵͳµ÷ÓÃÓÉ_syscallN()¸ºÔð¸ñʽת»»ºÍ²ÎÊý´«µÝ¡£ÏµÍ³µ÷ÓúŷÅÈëEAX¼Ä´æÆ÷£¬Æô¶¯INT 0x80
ºó£¬¹æ¶¨·µ»ØÖµËÍEAX¼Ä´æÆ÷¡£
(3)ϵͳµ÷Óù¦ÄÜÄ£¿éµÄ³õʼ»¯
¶Ôϵͳµ÷Óõijõʼ»¯Ò²¾ÍÊǶÔINT
0x80µÄ³õʼ»¯¡£ÏµÍ³Æô¶¯Ê±£¬»ã±à×Ó³ÌÐòsetup_idt(¼ûarch/i386/kernel/head.S)×¼±¸ÁË1ÕÅ256ÏîµÄidt±í£¬ÓÉ
start_kernel()(¼û
init/main.c),trap_init()(¼ûarch/i386/kernel/traps.c)µ÷ÓõÄCÓïÑԺ궨Òå
set_system_gate(0x80,&system_call)(¼û
include/asm/system.h)ÉèÖÃ0x80ºÅÈíÖжϵķþÎñ³ÌÐòΪ
system_call(¼ûarch/i386/kernel/entry.S),system.call¾ÍÊÇËùÓÐϵͳµ÷ÓõÄ×ÜÈë¿Ú¡£
(4)ÄÚºËÈçºÎΪ¸÷ÖÖϵͳµ÷Ó÷þÎñ
µ±½ø³ÌÐèÒª½øÐÐϵͳµ÷ÓÃʱ£¬±ØÐëÒÔCÓïÑÔº¯ÊýµÄÐÎʽдһ¾äϵͳµ÷ÓÃÃüÁî¡£¸ÃÃüÁîÈç¹ûÒÑÔÚij¸öÍ·Îļþ
ÖÐÓÉÏàÓ¦µÄ_syscallN()Õ¹¿ª£¬ÔòÓû§³ÌÐò±ØÐë°üº¬¸ÃÎÄ ¼þ¡£µ±½ø³ÌÖ´Ðе½Óû§³ÌÐòµ
Ïà¹ØÎĵµ£º
[/home/brimmer/src]$ ctags -R
"
-R"±íʾµÝ¹é´´½¨£¬Ò²¾Í°üÀ¨Ô´´úÂë¸ùĿ¼ÏµÄËùÓÐ×ÓĿ¼ÏµÄÔ´³ÌÐò¡£"
tags"ÎļþÖаüÀ¨ÕâЩ¶ÔÏóµÄÁÐ±í£º
l
ÓÃ
#define¶¨ÒåµÄºê
l
ö¾ÙÐͱäÁ¿µÄÖµ
l  ......
LinuxϵĶ¨Ê±Æ÷ÓÐÁ½ÖÖ£¬ÒÔÏ·ֱð½éÉÜ£º
1¡¢alarm
Èç¹û²»ÒªÇóºÜ¾«È·µÄ»°£¬ÓÃalarm()ºÍsignal()¾Í¹»ÁË
unsigned int alarm(unsigned int seconds)
º¯Êý˵Ã÷:
alarm()ÓÃÀ´ÉèÖÃÐźÅSIGALRMÔÚ¾¹ý²ÎÊýsecondsÖ¸¶¨µÄÃëÊýºó´«Ë͸øÄ¿Ç°µÄ½ø³Ì¡£Èç¹û²ÎÊýsecondsΪ0£¬Ôò֮ǰÉèÖõÄÄÖÖӻᱻȡ
......
/boot:ÕâÀï´æ·ÅµÄÊÇÆô¶¯LINUXʱʹÓõÄһЩºËÐÄÎļþ¡£
/dev:devÊÇdevice(É豸)µÄËõд¡£Õâ¸öĿ¼ÏÂÊÇËùÓÐLINUXµÄÍⲿÉ豸£¬Æ书ÄÜÀàËÆDOSϵÄ.sysºÍWinϵÄ.vxd¡£ÔÚLINUXÖÐÉ豸ºÍÎļþÊÇÓÃͬÖÖ·½·¨·ÃÎʵġ£ÀýÈç:/dev/hda´ú±íµÚÒ»¸öÎïÀíIDEÓ²ÅÌ¡£
/etc:Õâ¸öĿ¼ÓÃÀ´´æ·ÅËùÓеÄϵͳ¹ÜÀíËùÐèÒªµÄÅäÖÃÎļþºÍ×ÓĿ¼¡£
/bin:bin ......
ת×Ô£ºhttp://www.linuxdiyf.com/bbs/viewthread.php?tid=106169
LinuxϽ¨ÒéʹÓÃvsftp£¬°²È«¼òµ¥ÊµÓÃ
vsftp¼´Very Security FTP£¬¹ËÃû˼Ò壬·Ç³£°²È«µÄFTP·þÎñÆ÷¡£
Ŀ¼
1 vsFTP·þÎñÆ÷µÄ°²×°
1.1 ÄäÃû·þÎñÆ÷µÄÁ¬½Ó£¨¶ÀÁ¢µÄ·þÎñÆ÷£©
1.2 ¿ªÆôÄäÃûFTP·þÎñÆ÷ÉÏ´«È¨ÏÞ
1.3 ¿ªÆôÄäÃû·þÎñÆ÷Ï´«µÄȨÏÞ
1.4 ......
Ïà¹Øº¯Êý
fork£¬execve£¬waitpid£¬popen
±íÍ·Îļþ
££i nclude<stdlib.h>
¶¨Ò庯Êý
int system(const char * string);
º¯Êý˵Ã÷
system()
»áµ÷ÓÃfork()²úÉú×Ó½ø³Ì£¬ÓÉ×Ó½ø³ÌÀ´µ÷ÓÃ/bin/sh-c
stringÀ´Ö´ÐвÎÊýstring×Ö·û´®Ëù´ú±íµÄÃüÁ´ËÃü>ÁîÖ´ÐÐÍêºóËæ¼´·µ»ØÔµ÷ÓõĽø³Ì¡£ÔÚµ÷ÓÃsystem()ÆÚ¼äSIGCHLD ......