Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

46. System V Message Queues > Creating or Opening a Message Queue

Creating or Opening a Message Queue

The msgget() system call creates a new message queue or obtains the identifier of an existing queue.

#include <sys/types.h>        /* For portability */
#include <sys/msg.h>

int msgget(key_t key, int msgflg);

Note

Returns message queue identifier on success, or -1 on error

The key argument is a key generated using one of the methods described in IPC Keys (i.e., usually the value IPC_PRIVATE or a key returned by ftok()). The msgflg argument is a bit mask that specifies the permissions (Table 15-4, in Permissions on Regular Files) to be placed on a new message queue or checked against an existing queue. In addition, zero or more of the following flags can be ORed (|) in msgflg to control the operation of msgget():


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint