【正文】
tribunal, you should get help straight away from one of the anisations listed under Further help. If you are being represented by a solicitor at the tribunal, they may ask you to sign an agreement where you pay their fee out of your pensation if you win the case. This is known as a damagesbased agreement. In England and Wales, your solicitor can39。 /* last receive pid */ }。 /* last msgrcv time */ __kernel_time_t msg_ctime。 struct list_head q_receivers。 /* last msgsnd time */ time_t q_rtime。 小結(jié): 消息隊列與管道以及有名管道相 比,具有更大的靈活性,首先,它提供有格式字節(jié)流,有利于減少開發(fā)人員的工作量;其次,消息具有類型,在實際應(yīng)用中,可作為優(yōu)先級使用。()))。 } printf(\n)。//刪除消息隊列 if(reval==1) { printf(unlink msg queue error\n)。//just a try =8。 } //發(fā)送一個消息后,輸出消息隊列屬性 msg_stat(msgid,msg_ginfo)。 } //創(chuàng)建一個消息隊列后,輸出消息隊列缺省屬性 msg_stat(msgid,msg_ginfo)。 char* msgpath=/unix/msgqueue。 int reval。 另一個限制是每個消息隊列所能容納的最大消息數(shù):在 redhad ,該限制是受消息隊列容量制約的:消息個數(shù)要小于消息隊列的容量(字節(jié)數(shù))。造成 msgsnd()等待的條件有兩種: ? 當(dāng)前消息的大小與當(dāng)前消息隊列中的字節(jié)數(shù)之和超過了消息隊列的總?cè)萘浚? ? 當(dāng)前消息隊列的消息數(shù)(單位 個 )不小于消息隊列的總?cè)萘浚▎挝?字節(jié)數(shù) ),此時,雖然消息隊列中的消息數(shù)目很多,但基本上都只有一個字節(jié)。 msqid為消息隊列描述字;消息返回后存儲在 msgp指向的地址, msgsz指定 msgbuf 的 mtext成員的長度(即消息內(nèi)容的長度), msgtyp為請求讀取的 消息類型 ;讀消息標(biāo)志 msgflg可以為以下幾個常值的或: ? IPC_NOWAIT 如果沒有滿足條件的消息,調(diào)用 立即返回 ,此時, errno=ENOMSG ? IPC_EXCEPT 與 msgtyp0配合使用,返回隊列中第一個類型不為 msgtyp 的消息 ? IPC_NOERROR 如果隊列中滿足條件的消息內(nèi)容大于所請求的 msgsz字節(jié),則把該消息 截斷 ,截斷部分將丟失。 ? 正如 ipc手冊所說的: ipc()是 linux所特有的,編寫程序時應(yīng)注意程序的移植性問題; ? 該系統(tǒng)調(diào)用的實現(xiàn)不過是把系統(tǒng) V IPC函數(shù)進行了封裝,沒有任何效率上的優(yōu)勢; ? 系統(tǒng) V在 IPC 方面的 API數(shù)量不多,形式也較簡潔。 ? int ipc(MSGGET, int first, int second, int third, void *ptr, long fifth)。 消息隊列 API 文件名到鍵值 include sys/ include sys/ key_t ftok (char*pathname, char proj); 它返回與路徑 pathname相對應(yīng)的一個鍵值。 unsigned long seq。 3. 下圖說明了內(nèi)核與消息隊列是怎樣建立起聯(lián)系的: 其中: struct ipc_ids msg_ids是內(nèi)核中記錄消息隊列的全局?jǐn)?shù)據(jù)結(jié)構(gòu); struct msg_queue是每個消息隊列的隊列頭。 因此,本 文將主要介紹系統(tǒng) V消息隊列及其相應(yīng) API。 消息隊列就是一個消息的鏈表??梢园严⒖醋饕粋€記錄,具有特定的格式以及特定的優(yōu)先級。 在沒有聲明的情況下,以下討論中指的都是系統(tǒng) V消息隊列。 從上圖可以看出,全局?jǐn)?shù)據(jù)結(jié)構(gòu) struct ipc_ids msg_ids 可以訪問到每個消息隊列頭的第一個成員: struct kern_ipc_perm;而每個 struct kern_ipc_perm能夠與具體的消息隊列對應(yīng)起來是因為在該結(jié)構(gòu)中,有一個 key_t類型成員 key,而 key則唯一確定一個消息隊列。 } 二、操作消息隊列 對消息隊列的操作無非有下面三種類型: 打開或創(chuàng)建消息隊列 消息隊列的內(nèi)核持續(xù)性要求每個消息隊列都在系統(tǒng)范圍內(nèi)對應(yīng)唯一的鍵值,所以,要獲得一個 消息隊列的描述字,只需提供該消息隊列的鍵值即可; 注:消息隊列描述字是由在系統(tǒng)范圍內(nèi)唯一的鍵值生成的,而鍵值可以看作對應(yīng)系統(tǒng)內(nèi)的一條路經(jīng)。該函數(shù)不直接對消息隊列操作,但在調(diào)用 ipc(MSGGET,…) 或 msgget()來獲得消息隊列描述字前,往往要調(diào)用該函數(shù)。 與該操作對應(yīng)的系統(tǒng) V調(diào)用為: int msgget( (key_t)first, second)。 V消息隊列 API 系統(tǒng) V消息隊列 API共有四個,使用時需要包括幾個頭文件: include sys/ include sys/ include sys/ 1) int msgget(key_t key, int msgflg) 參數(shù) key是一個鍵值,由 ftok獲得; msgflg參數(shù)是一些標(biāo)志位。 msgrcv手冊中詳細(xì)給出了消息類型取不同值時 (0。 msgsnd()解除阻塞的條件有三個: 1. 不滿足上述兩個條件,即消息隊列中有容納該消息的空間; 2. msqid代表的消息隊列被刪除; 3. 調(diào)用 msgsnd()的進程被信號中斷; 調(diào)用返回: 成功返回 0,否則返回 1。 注:上述兩個限制是針對每個消息隊列而言的,系統(tǒng)對消息隊列的限制還有系統(tǒng)范圍內(nèi)的最大消息 隊列個數(shù),以及整個系統(tǒng)范圍內(nèi)的最大消息數(shù)。 struct msgsbuf{ int mtype。 key=ftok(msgpath,39。 sflags=IPC_NOWAIT。 rflags=IPC_NOWAIT|MSG_NOERROR。// =16388。 return。 printf(current number of bytes on queue is %d\n,)。 printf(last msgrcv time is %s, ctime(amp。這兩點是管道以及有名管道所不能比的。 /* last msgrcv time */ time_t q_ctime。 struct list_head q_senders。 /* last change time */ unsigned long msg_lcbytes。 //可以看出上述兩個結(jié)構(gòu)很相似。t charge you more than 35% of your pensation if you win the case. If you are thinking about signing up for a damagesbased agreement, you should make sure you39。s actions. CSKA said they were surprised and disappointed by Toure39。t really grow up, it seems is not so important。也曾經(jīng)好像已經(jīng)下定了決心去做某件事,但更多的時候是最后又打起了退堂鼓。突然想到那件藍格子襯衫 ;那些被折成各種各樣形狀的信紙;那段從街角深巷伊始的友誼;還有那場還沒有開始就宣告了終結(jié)的邂逅計劃 …… 那些年那些天的非做不可,終于和青春一樣,都將在我們的人生中謝幕。ll be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. It will be like he is diving into the shallow end. Skydiver preps for the big jump When he jumps, he is expected to reach the speed of sound 690 mph (1,110 kph) in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he a