|
发表于 2004-1-9 12:16:32
|
显示全部楼层
这些东西
man里面都有
建议好好看看
msgrcv
------
int msgrcv (int msqid, struct msgbuf *msgp, int msgsz, long msgtyp,
int msgflg);
* msqid : id obtained by a call to msgget.
* msgsz : maximum size of message to receive.
* msgp : allocated by user to store the message in.
* msgtyp :
0 => get first message on queue.
> 0 => get first message of matching type.
< 0 => get message with least type which is <= abs(msgtyp).
* msgflg :
IPC_NOWAIT : Return immediately if message not found.
MSG_NOERROR : The message is truncated if it is larger than
msgsz.
MSG_EXCEPT : Used with msgtyp > 0 to receive any msg except
of specified type.
* returns : size of message if found. -1 on error.
The first message that meets the `msgtyp' specification is
identified. For msgtyp < 0, the entire queue is searched for the
message with the smallest type.
If its length is smaller than msgsz or if the user specified the
MSG_NOERROR flag, its text and type are copied to msgp->mtext and
msgp->mtype, and it is taken off the queue.
The `msg_cbytes', `msg_qnum', `msg_lrpid', and `msg_rtime' fields
are updated. Writers waiting on the queue are awakened.
Errors:
E2BIG : msg bigger than msgsz and MSG_NOERROR not specified.
EACCES : Do not have permission for reading the queue.
EFAULT : msgp not accessible.
EIDRM : msg queue was removed.
EINTR : msg not found ... would have slept but ... was interrupted.
EINVAL : msgsz > msgmax or msgsz < 0, msqid < 0 or unused.
ENOMSG : msg of requested type not found and IPC_NOWAIT specified. |
|