LinuxÖÐwaitÓ÷¨
LinuxÖÐwaitÓ÷¨£º
ϵͳÖеĽ©Ê¬½ø³Ì¶¼ÒªÓÉwaitϵͳµ÷ÓÃÀ´»ØÊÕ¡£
º¯ÊýÔÐÍ£º
#include<sys/types.h>
#include<sys/wait.h>
pid_t wait(int *status);
½ø³ÌÒ»µ©µ÷ÓÃÁËwait¾ÍÁ¢¼´×èÈû×Ô¼º£¬ÓÉwait×Ô¶¯·ÖÎöÊÇ·ñµ±Ç°½ø³ÌµÄij¸ö×Ó½ø³ÌÒѾÍ˳ö£¬Èç¹ûÈÃËüÕÒµ½ÁËÕâÑùÒ»¸öÒѾ±ä³É½©Ê¬µÄ×Ó½ø³Ì£¬wait¾Í»áÊÕ¼¯Õâ¸ö×Ó½ø³ÌµÄÐÅÏ¢£¬²¢°ÑËü³¹µ×Ïú»Ùºó·µ»Ø£»Èç¹ûûÓÐÕÒµ½ÕâÑùÒ»¸ö×Ó½ø³Ì£¬wait¾Í»áÒ»Ö±×èÈûÔÚÕâÀֱµ½ÓÐÒ»¸ö³öÏÖΪֹ¡£
²ÎÊýstatusÓÃÀ´±£´æ±»ÊÕ¼¯½ø³ÌÍ˳öʱµÄһЩ״̬£¬ËüÊÇÒ»¸öÖ¸ÏòintÀàÐ͵ÄÖ¸Õë¡£µ«Èç¹ûÎÒÃǶÔÕâ¸ö×Ó½ø³ÌÊÇÈçºÎËÀµôºÁ²»ÔÚÒ⣬ֻÏë°ÑÕâ¸ö½©Ê¬½ø³ÌÏûÃðµô£¬£¨ÊÂʵÉϾø´ó¶àÊýÇé¿öÏ£¬ÎÒÃǶ¼»áÕâÑùÏ룩£¬ÎÒÃǾͿÉÒÔÉ趨Õâ¸ö²ÎÊýΪNULL£¬¾ÍÏñÏÂÃæÕâÑù£º
pid = wait(NULL);
Èç¹û³É¹¦£¬wait»á·µ»Ø±»ÊÕ¼¯µÄ×Ó½ø³ÌµÄ½ø³ÌID£¬Èç¹ûµ÷Óýø³ÌûÓÐ×Ó½ø³Ì£¬µ÷Óþͻáʧ°Ü£¬´Ëʱwait·µ»Ø-1£¬Í¬Ê±errno±»ÖÃΪECHILD¡£
Àý×Ó£º
/*wait.c*/
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
int main()
{
pid_t pc, pr;
pc = fork();
if ( pc < 0 ) /* Èç¹û³ö´í */
{
printf("create child prcocess error: %s\n", strerror(errno));
exit(1);
}
else if ( pc == 0) /* Èç¹ûÊÇ×Ó½ø³Ì */
{
printf("I am child process with pid %d \n", getpid());
sleep(3);/* ˯Ãß3ÃëÖÓ */
exit(0);
}
else /* Èç¹ûÊǸ¸½ø³Ì */
&nbs
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
¹¤×÷ÖÐÓõ½gdbÀ´·ÖÎö³ÌÐò±ÀÀ£Éú²úµÄcoreÎļþÎÊÌ⣺
ÕâÀï´ÓÍøÉϲéÀ´µÄÒ»¸öÃüÁîÓ÷¨£º
1,˵Ã÷:
ulimitÓÃÓÚshellÆô¶¯½ø³ÌËùÕ¼ÓõÄ×ÊÔ´.
2,Àà±ð:
shellÄÚ½¨ÃüÁî
3,Óï·¨¸ñʽ:
  ......
http://www.mcublog.com/more.asp?name=sharkdn&id=8810
=======================================
ºÃЩʱºò£¬ÎÒÃÇÐèÒªÒ»¸öÖ»ÒªÒ»ÕÅÈíÅ̾ÍÄÜÆô¶¯Linux µÄϵͳ£¬±ÈÈç˵×ö·ÓÉÆ÷¡£µ«ÊÇÎÒÃǸÃÔõÑù×öÄØ£¿ Ò²¾ÍÊÇ˵ÎÒÃÇÒª°ÑKernelºÍFileSystem¶¼×öÔÚÒ»ÕÅ3.5'µÄÅÌÉÏ¡£ÎÒÃÇÏÈ°ÑFileSystem ·Ö½â³ÉÈçϼ¸¸ö²¿·Ö°É¡£
¡¡¡¡1. /b ......