linuxÄں˻ù±¾Êý¾ÝÀàÐÍ×ܽá
linuxÄں˻ù±¾Êý¾ÝÀàÐÍ×ܽá
¶ÔlinuxÄں˵ÄÊý¾ÝÀàÐÍ×öÒ»ÏÂ×ܽᡣ
ÏÂÃ沿·ÖÄÚÈݲο¼ÁË£ºhttp://book.csdn.net/bookfiles/12/100126.shtml
µ±
Linux
ÄÚºËÔÚÌåϵ½á¹¹²îÒì½Ï´óµÄƽ̨֮¼äÒÆֲʱ£¬»á²úÉúÓëÊý¾ÝÀàÐÍÏà¹ØµÄÎÊÌâ¡£ÔÚ±àÒëÄÚºËʱʹÓÃ
-Wall -Wstrict-prototypes
Ñ¡Ï¿ÉÒÔ±ÜÃâºÜ¶à´íÎóµÄ·¢Éú¡£
ÄÚºËʹÓõĻù±¾Êý¾ÝÀàÐÍÖ÷ÒªÓУº
Ø
Ø
int
±ê×¼
C
ÓïÑÔÕûÊýÀàÐÍ£»
Ø
Ø
u32
32
λÕûÊýÀàÐÍ£»
Ø
Ø
pid_t
Ìض¨Äں˶ÔÏó
pid
µÄÀàÐÍ¡£
ÔÚ²»Í¬µÄ
CPU
Ìåϵ½á¹¹ÉÏ£¬
C
ÓïÑÔµÄÊý¾ÝÀàÐÍËùÕ¼¿Õ¼ä²»Ò»Ñù¡£ÏÂÃæÊÇÔÚ
x86
ÏÂÊý¾ÝÀàÐÍËùÕ¼µÄ×Ö½ÚÊý£º
arch
char
short
int
long
ptr
long-long
u8
u16
u32
u64
i686
1
2
4
4
4
8
1
2
4
8
ÏÂÃæÊÇÔÚÆäËûƽ̨ÉϵÄÊý¾ÝÀàÐÍËùÕ¼µÄ×Ö½ÚÊý£º
arch
char
short
int
long
ptr
long-long
u8
u16
u32
u64
i386
1
2
4
4
4
8
1
2
4
8
alpha
1
2
4
8
8
8
1
2
4
8
armv4l
1
2
4
4
4
8
1
2
4
8
ia64
1
2
4
8
8
8
1
2
4
8
m68k
1
2
4
4
4
8
1
2
4
8
mips
1
2
4
4
4
8
1
2
4
8
ppc
1
2
4
4
4
8
1
2
4
8
sparc
1
2
4
4
4
8
1
2
4
8
sparc64
1
2
4
4
4
8
1
2
4
8
ÆäÖлùÓÚ
sparc64
ƽ̨µÄ
Linux
Óû§¿Õ¼ä¿ÉÒÔÔËÐÐ
32
λ´úÂ룬Óû§¿Õ¼äÖ¸ÕëÊÇ
32
λ¿íµÄ£¬µ«Äں˿ռäÊÇ
64
λµÄ¡£
ÄÚºËÖеĵØÖ·ÊÇ
unsigned long
ÀàÐÍ£¬Ö¸Õë´óСºÍ
long
ÀàÐÍÏàͬ¡£
ÄÚºËÌṩÏÂÁÐÊý¾ÝÀàÐÍ¡£ËùÓÐÀàÐÍÔÚÍ·Îļþ
<include/asm/types.h>
ÖÐÉùÃ÷£¬Õâ¸öÎļþÓÖ±»Í·Îļþ
<Linux/types.h>
Ëù°üº¬¡£ÏÂÃæÊÇ
include/asm/types.h
Îļþ¡£
ÕâÊǶÔARMÌåϵ½á¹¹ÖÐ /asm/types.hÎļþÖеÄһЩ¶¨Ò壺
ÒòΪÎÒÊǶÔarmÌåϵ½á¹¹½øÐÐÁËÅäÖÃ
#
ifndef
__ASM_ARM_TYPES_H
#
define
__ASM_ARM_TYPES_H
#
ifndef
__ASSEMBLY__
typedef
unsigned
short
umode_t;
/*
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
* header files exported to user space
*/
typedef
__signed__
Ïà¹ØÎĵµ£º
1.
¸ÅÊö
¸ù¾ÝÒÔǰѧϰÄÚºËÔ´ÂëµÄ¾Ñ飬ÔÚѧϰÎļþϵͳʵÏÖ֮ǰ£¬ÎÒ´ó¸Å¶¨Á˸öÄ¿±ê£º
1
¡¢
½¨Á¢Ò»¸öÇåÎúµÄÈ«¾Ö¸ÅÄΪ½«À´ÐèÒªÑо¿´úÂëϸ½Ú´òϼáʵ»ù´¡¡£
2
¡¢
Ö»Ñо¿ÐéÄâÎļþϵͳ VFS
µÄʵÏÖ£¬²»Ñо¿¾ßÌåÎļþϵͳ¡£
ΪʲôѡÔñ Linux 2.4.30
£¿ÒòΪ¿ÉÒԲο¼¡ ......
µÚÒ»ÌìÉϰ࣬ÕùÈ¡Ò»¸öÔÂÄÚlinux¸øŪÊìϤÁË
ÌøתÃüÁcd /tmpÌøתµ½tmpĿ¼ cd ../../ Ìøתµ½¸úĿ¼
н¨Îļþ£º touch test.html н¨Ò»¸ötest.html Îļþ
×°µÄÊÇredhatϵͳ ĬÈϵÄapache·þÎñûÓдò¿ª£¬ÐèÒª´òÃüÁî
/etc/init.d/{·þÎñÃû} start»ò ......
rsync ÓÐʲôͻ³öÓŵãÄØ£¿Ê×ÏÈ£¬Ëü±»Éè¼Æ³ÉÖ»´«ËÍÎļþµÄ²»Í¬²¿·Ö£¬¶ø·Ç´«ËÍÕû¸öÎļþ£¬ÒÔ¼ÓËÙÎļþ´«Êä¡£±ÈÈ磬ÎÒÕýÔÚд×÷±¾ÎÄ£¬ÄÇÎҾͿÉÒÔÏÖÔÚʹÓÃ
rsync ¸´ÖÆÒ»´Î£¬¶øÖ®ºóÔÙ½øÐÐÒ»´Î´«Êä¡£µÚ¶þ´Î£¨µÚÈý´Î¡¢µÚËÄ´Î……£©¸¸×ÓÎļþµÄʱºò£¬rsync
Ö»´«ËÍÎļþµÄ²»Í¬²¿·Ö¡£Õ⽫¼«´óµØ½Úʡʱ¼ä£¬ÌرðÊÇÔÚÈÕ³£±¸·ÝµÄ¹ ......
ÎÄռǼÁË×÷ÕßÔÚS3C2440¿ª·¢°åÉÏʵÏÖ°´¼üµãÁÁLEDÇý¶¯¿ª·¢µÄÏêϸ¹ý³Ì£¬»¹¼Ç¼ÁËһЩÈÝÒ׳öÏֵĴíÎó£¬ÒÔ¼°Ôõô½â¾öÕâЩ´íÎó¡£
Ò»¡¢Çý¶¯¿ª·¢Á÷³Ì
LinuxÇý¶¯¿ª·¢²»Í¬ÓÚÓ¦ÓóÌÐòµÄ¿ª·¢¡£Çý¶¯¿ª·¢ÊÇÖ±½ÓºÍÓ²¼þ´ò½»µÀµÄ£¬Í¨¹ý¶ÔÓ²¼þµÄ²Ù×÷¸øÓ¦ÓóÌÐòÌṩһЩ½Ó¿Úº¯Êý£¬Ê¹µÃÓ¦ÓóÌÐòÄܹ»&l ......
ÎÊÌ⣺
gcc -c main.c -L ./include libmmgr.a
µÄʱºò£¬×ÜÊDZ¨´í£¬
ÕýÈ·µÄ×ö·¨ÊÇ
gcc -c main.c -L ./include -lmmgr
ÓÐÒ»¸öÎóÇøÊÇ£¬
gcc -c main.c -L. libmmgr.a
ÓÐʱºòÒ²ÊǶԵģ¬µ«ÕâÊÇÌØÀý£¬ÊÇmain.cºÍlibmmgr.aÔÚͬһ¸ö·¾¶Ï£¬ÕâʱµÄ-L.²»Æð×÷Ó㬼´Ê¹É¾³ýÒ²¿ÉÒÔ¡£ ......