---
name: "rpma_cq_get_fd"
section: "3"
platform: "linux"
package: "librpma-dev"
version: "1.3.0-2+b3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rpma_cq_get_fd"
---

# rpma\_cq\_get\_fd(3)

get the completion queue's file descriptor

## NAME

**rpma\_cq\_get\_fd** - get the completion queue's file descriptor

## SYNOPSIS

```
      #include <librpma.h>
      struct rpma_cq;
      int rpma_cq_get_fd(const struct rpma_cq *cq, int *fd);
```

## DESCRIPTION

**rpma\_cq\_get\_fd**() gets the file descriptor of the completion queue (CQ in short). When a next completion in the CQ is ready to be consumed by [**rpma\_cq\_get\_wc**(3)](/rpma_cq_get_wc/3.md), the notification is delivered via the file descriptor. The default mode of the file descriptor is blocking but it can be changed to non-blocking mode using [**fcntl**(2)](/fcntl/2.md). The CQ is either the connection's main CQ or the receive CQ or CQ of shared RQ, please see [**rpma\_conn\_get\_cq**(3)](/rpma_conn_get_cq/3.md), [**rpma\_conn\_get\_rcq**(3)](/rpma_conn_get_rcq/3.md) or **rpma\_srq\_get\_rcq**() for details.

Note after spotting the notification using the provided file descriptor you do not have to call [**rpma\_cq\_wait**(3)](/rpma_cq_wait/3.md) before consuming the completion but it may cause that the next call to [**rpma\_cq\_wait**(3)](/rpma_cq_wait/3.md) will notify you of already consumed completion.

## RETURN VALUE

The **rpma\_cq\_get\_fd**() function returns 0 on success or a negative error code on failure. **rpma\_cq\_get\_fd**() does not set \*fd value on failure.

## ERRORS

**rpma\_cq\_get\_fd**() can fail with the following error:

- •

  RPMA\_E\_INVAL - cq or fd is NULL

## SEE ALSO

[**fcntl**(2)](/fcntl/2.md), [**rpma\_conn\_get\_cq**(3)](/rpma_conn_get_cq/3.md), [**rpma\_conn\_get\_rcq**(3)](/rpma_conn_get_rcq/3.md), [**rpma\_srq\_get\_rcq**(3)](/rpma_srq_get_rcq/3.md), [**rpma\_cq\_wait**(3)](/rpma_cq_wait/3.md), [**rpma\_cq\_get\_wc**(3)](/rpma_cq_get_wc/3.md), [**librpma**(7)](/librpma/7.md) and https://pmem.io/rpma/
