LinuxÏ¿ÉÒÔÌæ»»ÔËÐÐÖеijÌÐòô?
½ñÌì±»ÅóÓÑÎʼ°“LinuxÏ¿ÉÒÔÌæ»»ÔËÐÐÖеijÌÐòô£¿”£¬ÒÔÇ°ÒÀÏ¡¼ÇµÃLinuxÏÂÊÇ¿ÉÒԵģ¨¶øWindows¾Í²»Èã©£¬ÓÚÊÇËæ¿Ú´ðµÀ“OK”¡£½á¹ûÅóÓÑ·¢À´Ò»¸öÖ´Ðнá¹û£º£¨testÕýÔÚÔËÐÐÖУ©
# cp test2 test
cp: cannot create regular file `test': Text file busy
¿´ÆðÀ´ÊdzÌÐò±»Õ¼Óã¬ÎÞ·¨¸²¸Ç¡£ÓÚÊÇ×Ô¼ºÓÖÔÙ×öÁ˼¸¸öʵÑ飺
£¨1£©ÏÈrmɾ³ýÕýÔÚÔËÐеÄtest£¬È»ºócp test2 test¾ÍûÓдíÎóÁË¡£
£¨2£©ÏÈmv¸ÄÃûÕýÔÚÔËÐеÄtest£¬È»ºócp test2 testҲûÓÐÎÊÌâ¡£
²éÁ˲é×ÊÁϲ¢¶¯ÊÖ·ÖÎöÁËһϣ¬ÕÒµ½Á˱ȽÏÂúÒâµÄ½âÊÍ¡£cp²¢²»¸Ä±äÄ¿±êÎļþµÄinode£¬ÊÂʵÉÏËüµÄʵÏÖÊÇÕâÑùµÄ£º
# strace cp test2 test 2>&1 | grep open.*test
open("test2", O_RDONLY|O_LARGEFILE) = 3
open("test", O_WRONLY|O_TRUNC|O_LARGEFILE) = 4
ÎÒÔÒÔΪcpµÄʵÏÖÊÇ“rm + open(O_CREAT)”£¬²»¹ýÏÖÔÚÏëÏëÉÏÃæµÄʵÏÖ·½Ê½²ÅÊÇ×î¿É¿¿µÄ£¨±£Ö¤ÁËʱÐò°²È«ºÍÄ¿±êÎļþµÄÊôÐÔ£©¡£ÕâÒ²¿ÉÒÔ½âÊÍΪʲôcpµÄÄ¿±êÎļþ»á¼Ì³Ð±»¸²¸ÇÎļþµÄÊôÐÔ¶ø·ÇÔ´Îļþ¡£
LinuxÓÉÓÚDemand Paging»úÖƵĹØϵ£¬±ØÐëÈ·±£ÕýÔÚÔËÐÐÖеijÌÐò¾µÏñ£¨×¢Ò⣬²¢·ÇÎļþ±¾Éí£©²»±»ÒâÍâÐ޸ģ¬Òò´ËÄÚºËÔÚÆô¶¯³ÌÐòºó»áËø¶¨Õâ¸ö³ÌÐò¾µÏñµÄinode¡£Õâ¾Í ÊÇΪʲôcpÔÚÓÓO_WRONLY|O_TRUNC”ģʽopenÄ¿±êÎļþʱ»áʧ°Ü¡£¶øÏÈrmÔÙcpµÄ»°£¬ÐÂÎļþµÄinodeÆäʵÒѾ¸Ä±äÁË£¬Ô inode²¢Ã»Óб»ÕæÕýɾ³ý£¬Ö±µ½ÄÚºËÊͷŶÔËüµÄÒýÓá£Í¬Àí£¬mvÖ»ÊǸıäÁËÎļþÃû£¬Æäinode²»±ä£¬ÐÂÎļþʹÓÃÁËеÄinode¡£
ÎÊÌâµ½ÕâÀïÒѾˮÂäʯ³ö£¬²»¹ýÅÙ¸ù¾¿µ×µÄ¸öÐÔÇýʹÎÒÔÙ×öÁËÒÔÏÂÒ»×éʵÑ飬ûÏëµ½½á¹ûÍêÈ«³öºõÎÒÒâÁÏÖ®Í⣡
дÁËÒ»¸ö¼òµ¥µÄ²âÊÔ³ÌÐò£º
#include <stdio.h>
int main(int argc, char * argv[])
{
foo(); // An export function by libtest.so.
sleep(1000);
return 0;
}
foo()ÊÇÁíÒ»¸ö²âÊÔ¶¯Ì¬¿âlibtest.soµÄµ¼³ö½Ó¿Ú£¬Ö»´òÓ¡Ò»ÐÐÌáʾ¾Í·µ»Ø¡£½ÓÏÂÀ´ÎÒ°ÑÉÏÃæ¶ÔÖ´ÐÐÎļþµÄ²âÊÔÓÃÀý¶Ô¶¯Ì¬¿âÓÖ×öÁËÒ»±é£º
£¨1£©cp libtest2.so libtest.so¿ÉÒÔÖ±½Ó¸²¸ÇÒѼÓÔصĶ¯Ì¬¿â¡£
£¨2£©ÏÈrmɾ³ýÒѼÓÔصÄlibtest.so£¬È»ºócp libtest2.so libtest.so³É¹¦¡£
£¨3£©ÏÈmv¸ÄÃûÒѼÓÔصÄlibtest.so£¬È»ºócp libtest2.so libtest.so³É¹¦¡£
³ýÁ˵ÚÒ»¸öÓÃÀýÍ⣬½á¹ûÏàͬ¡£ÕâÑù¿´À´£¬¶¯Ì¬¿â±»¼ÓÔØʱÄѵÀld²¢Ã»ÓÐËø¶¨inode£¿²»¹ýÏëÏëÒ²¿ÉÒÔ¿íË¡£¬±Ï¾¹ldÒ²ÊÇÓû§Ì¬³
Ïà¹ØÎĵµ£º
ʲôÊǵȴý¶ÓÁУ¿
ÔÚÈí¼þ¿ª·¢ÖÐÈÎÎñ¾³£ÓÉÓÚijÖÖÌõ¼þûÓеõ½Âú×ã¶ø²»µÃ²»½øÈë˯Ãß״̬£¬È»ºóµÈ´ýÌõ¼þµÃ
µ½Âú×ãµÄʱºòÔÙ¼ÌÐøÔËÐУ¬½øÈëÔËÐÐ״̬¡£ÕâÖÖÐèÇóÐèÒªµÈ´ý¶ÓÁлúÖƵÄÖ§³Ö¡£
Linux
ÖÐÌṩÁ˵ȴý¶ÓÁеĻúÖÆ£¬¸Ã»úÖÆÔÚ
ÄÚºËÖÐÓ¦Óúܹ㷺¡£
&n ......
¿ÉÒÔ¶ÁÈ¡/proc/devicesÎļþÒÔ»ñµÃLinuxÄں˷ÖÅä¸ø¸ÃÉ豸µÄÖ÷É豸ºÅ¡£
Ö÷É豸ºÅÓÃÀ´Çø·Ö²»Í¬ÖÖÀàµÄÉ豸£¬¶ø´ÎÉ豸ºÅÓÃÀ´Çø·ÖͬһÀàÐ͵Ķà¸öÉ豸
ÔÚLinuxÄں˿´À´£¬Ö÷É豸ºÅ±êʶÉ豸¶ÔÓ¦µÄÇý¶¯³ÌÐò£¬
¸æËßLinuxÄÚºËʹÓÃÄÄÒ»¸öÇý¶¯³ÌÐòΪ¸ÃÉ豸(Ò²¾ÍÊÇ/devϵÄÉ豸Îļþ)·þÎñ£»¶ø´ÎÉ豸ºÅÔòÓÃÀ´±êʶ¾ßÌåÇÒΨһµÄij¸öÉ豸¡£
......
ÓÐÁËϵͳµ÷ÓõľÑ飬Ìí¼ÓÄ£¿é»¹ÊǺÜ˳ÀûµÄ¡£
¡¾ÊµÑé»·¾³¡¿
Fedora£¬ÄÚºË2.6.21.6
¡¾ÊµÑé²½Öè¡¿
1. cd /root/homework/module
2. vi process.c
3. ¼ÓÈëÈçÏ´úÂ룺
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
static int process_init(void)
{
int num= ......
1.failed to open PAM security session: No such file or directory
Òì³£ÃèÊö:²é¿´/var/log/cronʱ»á·¢ÏÖÈçÏÂÒì³£ÈÕÖ¾
May 14 09:10:01 localhost crond[20319]: (CRON) /export/home/username (No such file or directory)
May 14 09:10:01 localhost crond[20319]: CRON (username) ERROR: failed to open PAM securi ......
¶ÔÓÚÒ»°ãÓû§À´Ëµ£¬Ö÷Ŀ¼£¨home directory£©ÊÇÓ²ÅÌÉÏΨһ¿ÉÒÔÔÀ´Ð´¶«Î÷µÄµØ·½¡£Ò»°ãµÄ·¾¶ÃûÊÇ/home/login_user_name¡£
Ö÷Ŀ¼ÓÃÓÚ´æ´¢¸÷ÖÖÓû§Îļþ£ºÉèÖÃÎļþ£¬³ÌÐòÅäÖÃÎļþ£¬Óû§Îĵµ£¬Êý¾Ý netscape µÄ»º´æ£¬ÓʼþµÈµÈ¡£×÷Ϊһ¸öÆÕͨÓû§£¬Äã¿ÉÒÔÔÚÖ÷Ŀ¼Ï½¨Á¢ÐµÄĿ¼°²ÅÅÄã×Ô¼ºµÄĿ¼½á¹¹¡£ÆäËûÓû§ÎÞ·¨ÔĶÁÄãµÄ ......