Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linux ÎļþËø

´´½¨ËøÎļþ¶ÔÓÚ×ÊÔ´µÄÅÅËû·ÃÎÊ£¬ÀýÈç´®¿Ú£¬ÊÇÏ൱ºÏÊʵģ¬µ«ÊǶÔÓÚ·ÃÎÊ´óµÄ¹²ÏíÎļþ¾ÍÊÇÌ«ºÃÁË¡£¼ÙÈçÎÒÃÇÓµÓÐÒ»¸öÓÉÒ»¸ö³ÌÐòдÈëµÄ´óÎļþ£¬µ«ÊÇÊÇÓÉÐí¶à²»Í¬µÄ³ÌÐò½øÐгÖÐø¸üеġ£µ±Ò»¸ö³ÌÐòÕýÔڼǼһЩÔڽϳ¤µÄʱ¼äÄÚËùµÃµ½µÄÊý¾Ý£¬²¢ÇÒÕýÔÚΪÆäËûµÄһЩ³ÌÐò½øÐд¦Àíʱ¾Í»á³öÏÖÕâÑùµÄÇé¿ö¡£ÕâЩÕýÔÚ´¦ÀíµÄ³ÌÐò²¢²»»áµÈ´ýÈÕÖ¾³ÌÐò½áÊø£­£­ËûÃÇÊÇÁ¬ÐøÔËÐеģ­£­ËùÒÔËûÃÇÐèҪһЩºÏ×÷µÄ·½·¨´Ó¶ø¿ÉÒÔÌṩ¶ÔÓÚͬһ¸öÎļþµÄͬʱ·ÃÎÊ¡£
ÎÒÃÇ¿ÉÒÔͨ¹ýËøסÎļþµÄÒ»¸öÇøÓòÀ´µ½´ïÕâÖÖ½á¹û£¬ÕâÑùÖ»ÊÇÎļþµÄijһ¸öÇøÓò±»Ëøס£¬µ«ÊÇÆäËû³ÌÐò¿ÉÒÔ·ÃÎʳÌÐòµÄÆäËû²¿·Ö¡£Õâ³Æ֮ΪÎļþ¶Î(file-segment)£¬»òÊÇÎļþÇøÓò(file-region)¡£LinuxÓÐÁ½ÖÖ·½·¨¿ÉÒÔ×öµ½ÕâÒ»µã£ºÊ¹ÓÃfcntlϵͳµ÷ÓÃÓëʹÓÃlockfµ÷Óá£ÎÒÃÇ»áÖ÷ÒªÁ˽âfcntl½Ó¿Ú£¬ÒòΪÕâÊÇ×î¾­³£Óõ½µÄ½Ó¿Ú¡£lockfÊÇÏà¶Ô½ÏΪ¼òµ¥µÄ£¬²¢ÇÒÔÚLinuxÉÏÖ»ÊÇfcntlµÄÌæ»»½Ó¿ÚÓ÷¨¡£È»¶ø£¬fcntlÓëlockfËø»úÖƲ»¿ÉÒÔͬʱ¹¤×÷£ºËûÃÇʹÓò»Í¬µÄµ×²ãʵÏÖ£¬ËùÒÔÎÒÃDz»ÄÜ»ìÓÃÕâÁ½ÖÖµ÷Óã»Ö»Ê¹ÓÃÕâÒ»ÖÖ»òÊÇÁíÒ»ÖÖ¡£
ÎÒÃÇÔÚµÚ3Õ½éÉÜÁËfcntlµ÷Óá£Æ䶨ÒåÈçÏ£º
#include <fcntl.h>
int fcntl(int fildes, int command, ...);
fcntlÔÚÎļþÃèÊö·ûÉϽøÐвÙ×÷£¬²¢ÇÒÒÀ¾Ýcommand²ÎÊý¿ÉÒÔÖ´Ðв»Í¬µÄÈÎÎñ¡£¶øÎÒÃÇËù¸ÐÐËȤµÄÓйØÎļþËøµÄÈý¸ö£º
❑ F_GETLK
❑ F_SETLK
❑ F_SETLKW
µ±ÎÒÃÇʹÓÃÕâЩÃüÁîʱ£¬µÚÈý¸ö²ÎÊý±ØÐëÊÇÒ»¸öÖ¸Ïòstruct flockµÄÖ¸Õ룬ËùÒÔʵ¼ÊÉϵÄÔ­ÐÍÐÎʽÈçÏ£º
int fcntl(int fildes, int command, struct flock *flock_structure);
flock½á¹¹ÊÇÒÀÀµÓÚʵÏֵģ¬µ«ÊÇËûÖÁÉÙ°üº¬ÏÂÃæµÄ³ÉÔ±£º
❑ short l_type;
❑ short l_whence;
❑ off_t l_start;
❑ off_t l_len;
❑ pid_t l_pid;
l_type³ÉÔ±¿ÉÒÔÊǼ¸¸öÖµÖеÄÒ»¸ö£¬ÕâЩֵͨ³£¶¨ÒåÔÚfcntl.hÖС£ÈçϱíËùʾ£º
Öµ ÃèÊö
F_RDLCK ¹²ÏíËø(»ò¶ÁËø)¡£¶à¸ö½ø³Ì¿ÉÒÔÔÚÎļþµÄÏàͬÇøÓò(»òÖصþ)¾ßÓÐÒ»¸ö¹²ÏíËø¡£Èç¹ûÈκνø³ÌÔÚÎļþµÄijһ²¿·Ö¾ßÓÐÒ»¸ö¹²ÏíËø£¬ÆäËûµÄ½ø³Ì¾Í²»¿ÉÒÔÔÚÏàͬµÄÇøÓò»ñµÃÅÅËûËø¡£ÎªÁË»ñµÃÒ»¸ö¹²ÏíËø£¬Îļþ±ØÐëʹÓöÁ»òÊǶÁд·ÃÎÊģʽ´ò¿ª¡£
F_UNLCK ½âËø£»ÓÃÓÚÇå³ýËø¡£
F_WRLCK ÅÅËûËø(»òдËø)¡£ÔÚÎļþµÄijһ¸öÌض¨ÇøÓòÖ»¿ÉÒÔÓÐÒ»¸ö½ø³Ì»ñµÃÅÅËûËø¡£Ò»µ©ÓÐÒ»¸ö½ø³Ì¾ßÓÐÒ»¸öÕâÑùµÄËø£¬ÆäËûµÄ½ø³Ì¾Í²»¿ÉÒÔÔÚ´ËÇøÓòÉÏ»ñµÃÈκÎËøÀàÐÍ¡£Òª»ñµÃÒ»¸öÅÅËûËø£¬Îļþ±ØÐë


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

LinuxÖ÷ÒªÐÔÄÜÖ¸±ê¼à¿Ø

1.CPU&½ø³Ì
 
1.1 topÃüÁî
 
top - 20:07:00 up 186 days,  3:47,  3 users,  load average: 0.01, 0.02, 0.00
Tasks:  82 total,   1 running,  80 sleeping,   1 stopped,   0 zombie
Cpu(s):  3.7% us,  0.0% sy,  0.0% ni, ......

linux 0.11 ÄÚºËѧϰ asm.s£¬»úÆ÷ÄÑÃâ³ö¹ÊÕÏ¡£


/*
 *  linux/kernel/asm.s
 *
 *  (C) 1991  Linus Torvalds
 */
/*
 * asm.s contains the low-level code for most hardware faults.
 * page_exception is handled by the mm, so that isn't here. This
 * file also handles (hopefully) fpu-exceptions ......

C×Ö·û´®´¦Àíº¯ÊýµÄʵÏÖ£¨Linux£©

C×Ö·û´®´¦Àíº¯ÊýµÄʵÏÖ£¨Linux£©
#include <stddef.h>
char * ___strtok = NULL;

char * strcpy(char * dest,const char *src)
{
char *tmp = dest;

while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}

char * strncpy(char * des ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ