linux ¹²Ïí¿â»ù±¾Ê¹ÓãÛת£Ý
linux ¹²Ïí¿â»ù±¾Ê¹ÓÃ[ת]
xzq200 ·¢±íÓÚ 2007-6-16 11:02:00
0
ÍƼö
1 ´´½¨ºÍʹÓþ²Ì¬¿â
´´½¨Ò»¸ö¾²Ì¬¿âÊÇÏ൱¼òµ¥µÄ¡£Í¨³£Ê¹Óà ar ³ÌÐò°ÑһЩĿ±êÎļþ£¨.o£©×éºÏÔÚÒ»Æð£¬
³ÉΪһ¸öµ¥¶ÀµÄ¿â£¬È»ºóÔËÐÐ ranlib£¬ÒÔ¸ø¿â¼ÓÈëһЩË÷ÒýÐÅÏ¢¡£
2 ´´½¨ºÍʹÓù²Ïí¿â
ÌØÊâµÄ±àÒëºÍÁ¬½ÓÑ¡Ïî
-D_REENTRANT ʹµÃÔ¤´¦ÀíÆ÷·ûºÅ _REENTRANT ±»¶¨Ò壬Õâ¸ö·ûºÅ¼¤»îһЩºêÌØÐÔ¡£
-fPIC Ñ¡Ïî²úÉúλÖöÀÁ¢µÄ´úÂë¡£ÓÉÓÚ¿âÊÇÔÚÔËÐеÄʱºò±»µ÷È룬Òò´ËÕâ¸ö
Ñ¡ÏîÊDZØÐèµÄ£¬ÒòΪÔÚ±àÒëµÄʱºò£¬×°ÈëÄÚ´æµÄµØÖ·»¹²»ÖªµÀ¡£Èç¹û
²»Ê¹ÓÃÕâ¸öÑ¡Ï¿âÎļþ¿ÉÄܲ»»áÕýÈ·ÔËÐС£
-shared Ñ¡Ïî¸æËß±àÒëÆ÷²úÉú¹²Ïí¿â´úÂë¡£
-Wl,-soname -Wl ¸æËß±àÒëÆ÷½«ºóÃæµÄ²ÎÊý´«µÝµ½Á¬½ÓÆ÷¡£¶ø -soname Ö¸¶¨ÁË
¹²Ïí¿âµÄ soname¡£
££ ¿ÉÒÔ°Ñ¿âÎļþ¿½±´µ½ /etc/ld.so.conf ÖÐÁоٳöµÄÈκÎĿ¼ÖУ¬²¢ÒÔ
root Éí·ÝÔËÐÐ ldconfig£»»òÕß
££ ÔËÐÐ export LD_LIBRARY_PATH='pwd'£¬Ëü°Ñµ±Ç°Â·¾¶¼Óµ½¿âËÑË÷·¾¶ÖÐÈ¥¡£
1.7.9 ʹÓø߼¶¹²Ïí¿âÌØÐÔ
1. ldd ¹¤¾ß
ldd ÓÃÀ´ÏÔʾִÐÐÎļþÐèÒªÄÄЩ¹²Ïí¿â, ¹²Ïí¿â×°ÔعÜÀíÆ÷ÔÚÄÄÀïÕÒµ½ÁËÐèÒªµÄ¹²Ïí¿â.
2. soname
¹²Ïí¿âµÄÒ»¸ö·Ç³£ÖØÒªµÄ£¬Ò²ÊǷdz£ÄѵĸÅÄîÊÇ soname——¼òд¹²ÏíÄ¿±êÃû£¨short for shared object name£©¡£ÕâÊÇÒ»¸öΪ¹²Ïí¿â£¨.so£©Îļþ¶øÄÚǶÔÚ¿ØÖÆÊý¾ÝÖеÄÃû×Ö¡£ÈçÇ°ÃæÌáµ½µÄ£¬Ã¿Ò»¸ö³ÌÐò¶¼ÓÐÒ»¸öÐèҪʹÓõĿâµÄÇåµ¥¡£Õâ¸öÇåµ¥µÄÄÚÈÝÊÇһϵÁпâµÄ soname£¬Èçͬ ldd ÏÔʾµÄÄÇÑù£¬¹²Ïí¿â×°ÔØÆ÷±ØÐëÕÒµ½Õâ¸öÇåµ¥¡£
soname µÄ¹Ø¼ü¹¦ÄÜÊÇËüÌṩÁ˼æÈÝÐԵıê×¼¡£µ±ÒªÉý¼¶ÏµÍ³ÖеÄÒ»¸ö¿âʱ£¬²¢ÇÒпâµÄ soname ºÍÀϵĿâµÄ soname Ò»Ñù£¬ÓþɿâÁ¬½ÓÉú³ÉµÄ³ÌÐò£¬Ê¹ÓÃеĿâÒÀÈ»ÄÜÕý³£ÔËÐС£Õâ¸öÌØÐÔʹµÃÔÚ Linux Ï£¬Éý¼¶Ê¹Óù²Ïí¿âµÄ³ÌÐòºÍ¶¨Î»´íÎó±äµÃÊ®·ÖÈÝÒ
Ïà¹ØÎĵµ£º
²Ù×÷ϵͳµÄÒ»¸ö¾µäÎÊÌâÊÇ"Éú²úÕß-Ïû·ÑÕß"ÎÊÌâ, ÕâÉ漰ͬ²½ÐźÅÁ¿ºÍ»¥³âÐźÅÁ¿µÄÓ¦ÓÃ, ÔÚÕâÀï,ÎÒÓÃÏ̵߳Äͬ²½ºÍ»¥³âÀ´ÊµÏÖ.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#define N 2 // Ïû·ÑÕß» ......
ronÊÇÒ»¸ölinuxϵĶ¨Ê±Ö´Ðй¤¾ß£¬¿ÉÒÔÔÚÎÞÐèÈ˹¤¸ÉÔ¤µÄÇé¿öÏÂÔËÐÐ×÷Òµ¡£ÓÉÓÚCron ÊÇLinuxµÄÄÚÖ÷þÎñ£¬µ«Ëü²»×Ô¶¯ÆðÀ´£¬¿ÉÒÔÓÃÒÔϵķ½·¨Æô¶¯¡¢¹Ø±ÕÕâ¸ö·þÎñ:
¡¡¡¡/sbin/service crond start //Æô¶¯·þÎñ
¡¡¡¡/sbin/service crond stop //¹Ø±Õ·þÎñ
¡¡¡¡/sbin/service crond restart //ÖØÆô·þÎñ
¡¡¡¡/sbin/service crond ......
Load Bios
Read MBR's config to find out the os
Load the kernel of the os
init Process starts
execute /etc/rc.d /sysinit
start other modules (etc/modules.conf)
execute the run level scripts
execute /etc/rc.d/rc.local
execute /bin/login
shell started
......
½«ÖÐÎÄ°æ±¾µÄLINUXÇл»¿ØÖÆ̨µ½ÖÕ¶Ëģʽʱºò£¬²¿·ÖÃüÁîºÍ²Ù×÷¹ý³ÌÖÐÏÔʾÂÒÂ룬Ö÷ÒªÊÇÒòΪ°²×°µÄ¹ý³ÌÖÐֻѡÔñÁ˼òÌåÖÐÎĵÄÖ§³Ö£¬ÐèÒªÐÞ¸ÄÅäÖÃÎļþÖеÄÓïÑÔÖ§³ÖÑ¡Ï¼ÓÉÏÓ¢ÎÄÖ§³Ö¼´¿É¡£¾ßÌå²Ù×÷ÈçÏ£º
·½·¨Ò»: ÐÞ¸ÄϵͳÅäÖÃ(½¨Òé)
#vi /etc/sysconfig/i18n
// ÔÚÎļþÖмÓÈëÒÔÏÂÅäÖ ......