---
name: "pmGetContextFD"
section: "3"
platform: "linux"
package: "libpcp3-dev"
version: "3.3.3-squeeze3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/pmGetContextFD"
---

# pmGetContextFD(3)

get file descriptor associated with a PMAPI context

## NAME

**pmGetContextFD**, **pmGetContextTimeout** - get file descriptor associated with a  PMAPI context

## C SYNOPSIS

**#include \<pcp/pmapi.h\>**

```
int pmGetContextFD(int handle)
int pmGetContextTimeout(int handle)
```

**cc ... -lpcp**

## DESCRIPTION

An application using the Performance Metrics Application Programming Interface (PMAPI) may manipulate several concurrent contexts to connect to  [**pmcd**(1)](/pmcd/1.md).

**pmGetContextFD** allows application to retrieve file descriptor used to communicate to [**pmcd**(1)](/pmcd/1.md) and use it to implement some sort of input/output multiplexing scheme.

**pmGetContextTimeout** allows application to retrive a time in milliseconds which an application must wait for the reply from [**pmcd**(1)](/pmcd/1.md). Value -1 means that there is no timeout and application must be prepared to wait as long as it takes to receive a reply.

## SEE ALSO

[**PMAPI**(3)](/PMAPI/3.md), **pmLoop**(3), [**pmDestroyContext**(3)](/pmDestroyContext/3.md), [**pmDupContext**(3)](/pmDupContext/3.md), [**pmNewContext**(3)](/pmNewContext/3.md), [**pmContextConnectTo**(3)](/pmContextConnectTo/3.md) and [**pmWhichContext**(3)](/pmWhichContext/3.md).

## DIAGNOSTICS

- **PM\_ERR\_NOCONTEXT**

  *handle* does not identify a valid PMAPI context.

- **PM\_ERR\_NOTHOST**

  The context is not associated with PMCD.

- **PM\_ERR\_NOTCONN**

  The connection to PMCD is not yet established.
