Linuxϵͳµ÷ÓÃ
¹¦ÄÜÃèÊö£º
ÔÚÏûÏ¢¶ÓÁÐÉϽøÐÐÊÕ·¢ÏûÏ¢¡£ÎªÁË·¢ËÍÏûÏ¢£¬µ÷Óýø³Ì¶ÔÏûÏ¢¶ÓÁбØÐëÓÐдȨÄÜ¡£½ÓÊÕÏûϢʱ±ØÐëÓжÁȨÄÜ¡£
Ó÷¨£º
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
²ÎÊý£º
msqid£ºÏûÏ¢¶ÓÁеÄʶ±ðÂë¡£
msgp£ºÖ¸ÏòÏûÏ¢»º³åÇøµÄÖ¸Õ룬´ËλÖÃÓÃÀ´ÔÝʱ´æ´¢·¢ËͺͽÓÊÕµÄÏûÏ¢£¬ÊÇÒ»¸öÓû§¿É¶¨ÒåµÄͨÓýṹ£¬ÐÎ̬ÈçÏÂ
struct msgbuf {
long mtype; /* ÏûÏ¢ÀàÐÍ£¬±ØÐë > 0 */
char mtext[1]; /* ÏûÏ¢Îı¾ */
};
msgsz£ºÏûÏ¢µÄ´óС¡£
msgtyp£º´ÓÏûÏ¢¶ÓÁÐÄÚ¶ÁÈ¡µÄÏûÏ¢ÐÎ̬¡£Èç¹ûֵΪÁ㣬Ôò±íʾÏûÏ¢¶ÓÁÐÖеÄËùÓÐÏûÏ¢¶¼»á±»¶ÁÈ¡¡£
msgflg£ºÓÃÀ´Ö¸Ã÷ºËÐijÌÐòÔÚ¶ÓÁÐûÓÐÊý¾ÝµÄÇé¿öÏÂËùÓ¦²ÉÈ¡µÄÐж¯¡£Èç¹ûmsgflgºÍ³£ÊýIPC_NOWAITºÏÓã¬ÔòÔÚmsgsnd()Ö´ÐÐʱÈôÊÇÏûÏ¢¶ÓÁÐÒÑÂú£¬Ôòmsgsnd()½«²»»á×èÈû£¬¶ø»áÁ¢¼´·µ»Ø-1£¬Èç¹ûÖ´ÐеÄÊÇmsgrcv()£¬ÔòÔÚÏûÏ¢¶ÓÁгʿÕʱ£¬²»×öµÈ´ýÂíÉÏ·µ»Ø-1£¬²¢É趨´íÎóÂëΪENOMSG¡£µ±msgflgΪ0ʱ£¬msgsnd()¼°msgrcv()ÔÚ¶ÓÁгÊÂú»ò³Ê¿ÕµÄÇéÐÎʱ£¬²ÉÈ¡×èÈûµÈ´ýµÄ´¦Àíģʽ¡£
·µ»Ø˵Ã÷£º
³É¹¦Ö´ÐÐʱ£¬msgsnd()·µ»Ø0£¬msgrcv()·µ»Ø¿½±´µ½mtextÊý×éµÄʵ¼Ê×Ö½ÚÊý¡£Ê§°ÜÁ½Õ߶¼·µ»Ø-1£¬errno±»ÉèΪÒÔϵÄij¸öÖµ
[¶ÔÓÚmsgsnd]
EACCES£ºµ÷Óýø³ÌÔÚÏûÏ¢¶ÓÁÐÉÏûÓÐдȨÄÜ£¬Í¬Ê±Ã»ÓÐCAP_IPC_OWNERȨÄÜ
EAGAIN£ºÓÉÓÚÏûÏ¢¶ÓÁеÄmsg_qbytesµÄÏÞÖƺÍmsgflgÖÐÖ¸¶¨IPC_NOWAIT±êÖ¾£¬ÏûÏ¢²»Äܱ»·¢ËÍ
EFAULT£ºmsgpÖ¸ÕëÖ¸ÏòµÄÄÚ´æ¿Õ¼ä²»¿É·ÃÎÊ
EIDRM£ºÏûÏ¢¶ÓÁÐÒѱ»É¾³ý
EINTR£ºµÈ´ýÏûÏ¢¶ÓÁпռä¿ÉÓÃʱ±»ÐźÅÖжÏ
EINVAL£º²ÎÊýÎÞЧ
ENOMEM£ºÏµÍ³ÄÚ´æ²»×㣬ÎÞ·¨½«msgpÖ¸ÏòµÄÏûÏ¢¿½±´½øÀ´
[¶ÔÓÚmsgrcv]
E2BIG£ºÏûÏ¢Îı¾³¤¶È´óÓÚmsgsz£¬²¢ÇÒmsgflgÖÐûÓÐÖ¸¶¨MSG_NOERROR
EACCES£ºµ÷Óýø³ÌûÓжÁȨÄÜ£¬Í¬Ê±Ã»¾ßÓÐCAP_IPC_OWNERȨÄÜ
EAGAIN£ºÏûÏ¢¶ÓÁÐΪ¿Õ£¬²¢ÇÒmsgflgÖÐûÓÐÖ¸¶¨IPC_NOWAIT
EFAULT£ºmsgpÖ¸ÏòµÄ¿Õ¼ä²»¿É·ÃÎÊ
EIDRM£ºµ±½ø³Ì˯Ãߵȴý½ÓÊÕÏûϢʱ£¬ÏûÏ¢Òѱ»É¾³ý
EINTR£ºµ±½ø³Ì˯Ãߵȴý½ÓÊÕÏûϢʱ£¬±»ÐźÅÖжÏ
EINVAL£º²ÎÊýÎÞЧ
ENOMSG£ºmsgflgÖÐÖ¸¶¨ÁËIPC_NOWAIT£¬Í¬Ê±ËùÇëÇ
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
linux ÊØ»¤½ø³Ì
1.´´½¨×Ó½ø³Ì£¬¸¸½ø³ÌÍ˳ö
ÊØ»¤½ø³ÌÊÇÍÑÀëÖն˵ģ¬´ËʱµÄ×Ó½ø³ÌÓÉ1ºÅ½ø³ÌÁìÑø¡£
2.ÔÚ×Ó½ø³ÌÖд´½¨ÐµĻỰ
µ÷ÓÃsetsid£¨£©º¯Êý£¬×÷ÓÃÓÐÈý¸ö£¬Èýø³Ì°ÚÍÑԻỰµÄ¿ØÖÆ£»Èýø³Ì°ÚÍÑÔ½ø³Ì×éµÄ¿ØÖÆ£»
Èýø³Ì°ÚÍÑÔ¿ØÖÆÖն˵ĿØÖÆ
ÕâÀïÐèÒª½éÉܽø³Ì×éºÍ»á»°×éµÄ¸ÅÄî
½ø³Ì×飺ÊÇÒ»¸ö»ò¶à¸ö½ø³ÌµÄ¼¯ºÏ£¬Óɽ ......
¡¡Èç¹ûÄãµÄ·þÎñÆ÷apache»¹Ã»Óа²×°£¬ÄǺܼòµ¥£¬ÔÚ±àÒëapacheʱ½«mod_rewriteÄ£¿é±àÒë½øÈ¥¾Í¿ÉÒÔ£¬Ïà¹ØÎĵµ¿ÉÒÔÔÚhttp://man.ddvip.com/soft/apache2.2/misc/rewriteguide.html
ÖÐÕÒµ½¡£Èç¹ûÄãµÄapacheÒѾ°²×°ºÃÁË£¬ÏÖÔÚÖ»Ïë±àÒë³ömod_rewrite.soÄ£¿é£¬ÔÚapacheÖнøÐмÓÔØ£¬ÏÂÃæÎÒÃǾͽéÉÜÕâ¸ö·½·¨¡£
¡¡¡¡ÒÔFedora² ......