mmr_context_create()

Updated: October 26, 2022

Create a context

Synopsis:

#include <mm/renderer.h>
mmr_context_t* mmr_context_create(mmr_connection_t *connection,
                                  const char *name,
                                  unsigned flags,
                                  mode_t mode)

Arguments:

connection
An mm-renderer connection handle
name
The name of the context. This can be any string.
flags
Must be zero; no context flags are defined for now.
mode
Permission flags controlling which processes can access the context. These flags are specified in a standard POSIX permissions bitfield. The w bits control which processes can open secondary handles to the context. The r and x bits are not currently used.
In this bitfield, the user permissions apply to the caller and to any process with the same effective user ID (euid). You can set the user w bit to grant your application (or other applications running with the same euid) access to the context being created. The group w bit applies to processes with an effective group ID (egid) or a supplementary group ID matching the caller's egid. The other w bit applies to all other processes.

Library:

mmrndclient

Description:

Create the specified context and open a handle to it. If a context with the same name already exists, the function fails. The name can be any string that appropriately identifies the context.

The value given for mode is a standard POSIX permissions bitfield but only the w bits are meaningful; the mode argument description explains how these bits control which other processes can open handles to the context.

When successful, the function returns a handle, called the primary handle, for accessing the new context. You may be able to create secondary handles to the context by calling mmr_context_open(), depending on the mm-renderer command-line options.

To avoid memory leaks, every context handle needs to eventually be closed, either explicitly through an API call or implicitly by disconnecting from mm-renderer or terminating the process.

Returns:

A handle on success, or a NULL pointer on failure (check errno)