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

54. POSIX Shared Memory > Creating Shared Memory Objects

Creating Shared Memory Objects

The shm_open() function creates and opens a new shared memory object or opens an existing object. The arguments to shm_open() are analogous to those for open().

#include <fcntl.h>            /* Defines O_* constants */
#include <sys/stat.h>         /* Defines mode constants */
#include <sys/mman.h>

int shm_open(const char *name, int oflag, mode_t mode);

Note

Returns file descriptor on success, or -1 on error

The name argument identifies the shared memory object to be created or opened. The oflag argument is a mask of bits that modify the behavior of the call. The values that can be included in this mask are summarized in Table 54-1.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

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

  

Start a Free 10-Day Trial


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