---
name: "zmq_ctx_get_ext"
section: "3"
platform: "linux"
package: "zeromq"
version: "4.3.5-3"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/zmq_ctx_get_ext"
---

# zmq\_ctx\_get\_ext(3)

get extended context options

## NAME

zmq\_ctx\_get\_ext - get extended context options

## SYNOPSIS

**int zmq\_ctx\_get\_ext (void** *\*context***, int** *option\_name***, void** *\*option\_value***, size\_t** *\*option\_len***);**

## DESCRIPTION

The *zmq\_ctx\_get()* function shall retrieve the value for the option specified by the *option\_name* argument and store it in the buffer pointed to by the *option\_value* argument. The *option\_len* argument is the size in bytes of the buffer pointed to by *option\_value*; upon successful completion *zmq\_ctx\_get\_ext()* shall modify the *option\_len* argument to indicate the actual size of the option value stored in the buffer.

The *zmq\_ctx\_get\_ext()* function accepts all the option names accepted by *zmq\_ctx\_get()*. Options that make most sense to retrieve using *zmq\_ctx\_get\_ext()* instead of *zmq\_ctx\_get()* are:

### ZMQ\_THREAD\_NAME\_PREFIX: Get name prefix for I/O threads

The *ZMQ\_THREAD\_NAME\_PREFIX* argument gets the string prefix of each thread created for the internal context’s thread pool.

| | |
| --- | --- |
| Option value type | character string |
| Option value unit | N/A |
| Default value | empty string |

## RETURN VALUE

The *zmq\_ctx\_get\_ext()* function returns a value of 0 or greater if successful. Otherwise it returns -1 and sets *errno* to one of the values defined below.

## ERRORS

**EINVAL**

The requested option *option\_name* is unknown.

**EFAULT**

The provided *context* is invalid.

## EXAMPLE

**Setting a prefix on internal ZMQ thread names:**.

```
void *context = zmq_ctx_new ();
const char prefix[] = "MyApp";
size_t prefixLen = sizeof(prefix);
zmq_ctx_set (context, ZMQ_THREAD_NAME_PREFIX, &prefix, &prefixLen);
char buff[256];
size_t buffLen = sizeof(buff);
int rc = zmq_ctx_get (context, ZMQ_THREAD_NAME_PREFIX, &buff, &buffLen);
assert (rc == 0);
assert (buffLen == prefixLen);
```

## SEE ALSO

[**zmq\_ctx\_get**(3)](/zmq_ctx_get/3.md) [**zmq**(7)](/zmq/7.md)

## AUTHORS

This page was written by the 0MQ community. To make a change please read the 0MQ Contribution Policy at **http://www.zeromq.org/docs:contributing**.
