I am LAZY bones? AN ancient AND boring SITE

2007年 07月 18日 的归档


看到msgget函数,不知道具体用法,man了一下,居然是“No manual entry for msgget”汗!google了半天也没一个比较像样的介绍。结果上irc上问,说需要按照 manpages-dev 这个包,哈哈。原来如此啊!

MSGGET(2) Linux Programmer’s Manual MSGGET(2)NAME
msgget – get a message queue identifier

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>

int msgget(key_t key, int msgflg);

The msgget() system call returns the message queue identifier associated with the value of the key argument. A new message queue is
created if key has the value IPC_PRIVATE or key isn’t IPC_PRIVATE, no message queue with the given key key exists, and IPC_CREAT is
specified in msgflg.