mmr_context_open()

Updated: October 26, 2022

Open a handle to an existing context

Synopsis:

#include <mm/renderer.h>
mmr_context_t* mmr_context_open(mmr_connection_t *connection,
                                const char *name)

Arguments:

connection
An mm-renderer connection handle
name
The context name

Library:

mmrndclient

Description:

Open a handle to an existing context. The handle returned by this function is called a secondary handle.

Whether this operation is allowed depends on the command-line options given to mm-renderer. If you set these options to disallow the opening of secondary handles, this function fails and sets errno to EPERM. If you allow this operation, you can open as many secondary handles as you like and the function returns a new one with each successful call.

If the context permission bits don't give the calling process access to the context, the function fails and sets errno to EACCES. The permissions are defined in the mode argument of mmr_context_create().

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)