---
name: "cpg_iteration_next"
section: "3"
platform: "linux"
package: "libcpg-dev"
version: "3.1.9-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/cpg_iteration_next"
---

# cpg\_iteration\_next(3)

Return next item in iteration of CPG

## NAME

cpg\_iteration\_next - Return next item in iteration of CPG

## SYNOPSIS

**#include \<corosync/cpg.h\>**

**cs\_error\_t** **cpg\_iteration\_next (cpg\_iteration\_handle\_t** *handle***, struct cpg\_iteration\_description\_t \****description***);**

## DESCRIPTION

The **cpg\_iter\_next** function is used to get next value in iteration. The *handle* argument is iterator handle obtained by **cpg\_iteration\_initalize(3)** function. *description* is pointer to structure with following definition:

-

  ```

  ```

  struct cpg\_iteration\_description\_t {\
       struct cpg\_name group;\
       uint32\_t nodeid;\
       uint32\_t pid; };

-

  where **group** is name of group, **nodeid** is ID of connected node and **pid** is pid of connected process. If iteration was initialized with **CPG\_ITERATION\_NAME\_ONLY** iteration type, both **nodeid** and **pid** are 0.

## RETURN VALUE

This call returns the CS\_OK value if successful. If there are no more items to iterate, CS\_NO\_SECTION error code is returned.

## SEE ALSO

[**cpg\_iteration\_initialize**(3)](/cpg_iteration_initialize/3.md), [**cpg\_overview**(3)](/cpg_overview/3.md)

**CS\_ERR\_TRY\_AGAIN** Resource temporarily unavailable

**CS\_ERR\_INVALID\_PARAM** Invalid argument

**CS\_ERR\_ACCESS** Permission denied

**CS\_ERR\_LIBRARY** The connection failed

**CS\_ERR\_INTERRUPT** System call interrupted by a signal

**CS\_ERR\_NOT\_SUPPORTED** The requested protocol/functionality not supported

**CS\_ERR\_MESSAGE\_ERROR** Incorrect auth message received

**CS\_ERR\_NO\_MEMORY** Not enough memory to complete the requested task
