linux daemonº¯Êý
#include <unistd.h>
int daemon(int nochdir,int noclose)
ÔÚ´´½¨¾«Áé½ø³ÌµÄʱºò,ÍùÍùÐèÒª½«¾«Áé½ø³ÌµÄ¹¤×÷Ŀ¼ÐÞ¸ÄΪ"/"¸ùĿ¼
²¢ÇÒ½«±ê×¼ÊäÈë,Êä³öºÍ´íÎóÊä³öÖض¨Ïòµ½/dev/null
daemonµÄ×÷ÓþÍÊǵ±²ÎÊýnochdirΪ0ʱ,½«¸ùĿ¼ÐÞ¸ÄΪ¹¤×÷Ŀ¼
nocloseΪ0ʱ,×öÊäÈë,Êä³öÒÔ¼°´íÎóÊä³öÖض¨Ïòµ½/dev/null
Ö´Ðгɹ¦·µ»Ø0
´íÎó·µ»Ø-1
Ïà¹ØÎĵµ£º
chmod £»ÐÞ¸ÄĿ¼ȨÏÞ
eg£ºchmod o-t /tmp
touch:´´½¨ÐÂÎļþ
rm -rf:ɾ³ýÎļþ
set gid ¶ÔĿ¼µÄ×÷ÓÃ
1£ºÄ¬ÈÏÇé¿öÏ£¬Óû§½¨Á¢µÄÎļþÊôÓÚÓû§µ±Ç°ËùÔÚµÄ×é
2£ºÄ¿Â¼ÉÏÉèÖÃÁËsetgid£¬±íʾÔÚ´ËĿ¼ÖУ¬ÈκÎÈ˽¨Á¢µÄÎļþ£¬¶¼»áÊôÓÚĿ¼ËùÊôµÄ×é¡£
rm -rf test //ɾ³ý֮ǰµÄtestĿ¼
mkdir test // ÔÚµ±Ç°Ä¿Â¼´´½¨Ò ......
Ç°ÑÔ£º
Ä¿Ç°ÕýÔÚæÓÚARMƽ̨µÄLinuxÓ¦ÓóÌÐòµÄ¿ª·¢£¨ÆäʵÊǸոÕÆð²½Ñ§Ï°À²£©¡£µ×²ãµÄ¶«Î÷²»Óÿ¼ÂÇÁË£¬¿ª·¢°å×ÓÌṩÁËNAND Bootloader£¬ºÍLinux 2.6µÄÔ´Â룬¶øÇÒ¶¼±àÒëºÃÁË¡£×Ô¼º±àÒëµÄbootloader¿ÉÒÔÓ㬵«ÊÇLinux±àÒëºó£¬ÎļþºÜ´ó£¬ÔÝÇÒ¾ÍÓÃÈ˼ұàÒëµÄϵͳ£¬ÏÈרÐÄдӦÓóÌÐò °É¡£¡£
ÕýÎÄ£ºÒª×öµÄÈÎÎñÊÇ£¬°ÑÒ»¿é°å×ÓÉ쵀 ......
linuxÖÐÒ»¹²ÓÐ32ÖÖÐźţ¬ÔÚ/usr/include/bits/signum.h Í·ÎļþÖпÉÒÔ¿´µ½
#define SIGHUP 1 /* Hangup (POSIX). */
#define SIGINT 2 /* Interrupt (ANSI).& ......
1ºÅ½ø³Ì£¬pidΪ1µÄ½ø³Ì£¬ÓÖ³Æinit½ø³Ì¡£
¡¡¡¡linuxϵͳÆô¶¯ºó£¬µÚÒ»¸ö±»´´½¨µÄÓû§Ì¬½ø³Ì¾ÍÊÇinit½ø³Ì¡£ËüÓÐÁ½ÏîʹÃü£º
¡¡¡¡1¡¢Ö´ÐÐϵͳ³õʼ»¯½Å±¾£¬´´½¨Ò»ÏµÁеĽø³Ì(ËüÃǶ¼ÊÇinit½ø³ÌµÄ×ÓËï);
¡¡¡¡2¡¢ÔÚÒ»¸öËÀÑ»·ÖеȴýÆä×Ó½ø³ÌµÄÍ˳öʼþ£¬²¢µ÷ÓÃwaitidϵͳµ÷ÓÃÀ´Íê³É“ÊÕʬ”¹¤×÷;
¡¡¡¡init½ø³Ì²»»á±»ÔÝ ......
1.ÏÂÔØlinux kernelÔ´´úÂë
µ½http://www.kernel.org/ÏÂÔØlinuxÄÚºËÔ´´úÂë,ÕâÀïÎÒÃÇʹÓÃ2.6.24.4µÄÄÚºË.
½âѹlinux-2.6.24.4.tar.bz2
[matt@localhost GEC2410]$ tar -xvjf linux-2.6.24.4.tar.bz2
[matt@localhost GEC2410]$ cd linux-2.6.24.4
2.ÐÞ¸ÄMakefile,ÉèÖý»²æ±àÒëÆ÷
ARCH ?= arm
CROSS_COMPILE ......