---
name: "pmem2_badblock_next"
section: "3"
platform: "linux"
package: "libpmem2-dev"
version: "1.13.1-1.1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pmem2_badblock_next"
---

# pmem2\_badblock\_next(3)

read the next bad block for the given bad block context \*bbctx.

## NAME

**pmem2\_badblock\_next**() - read the next bad block for the given bad block context *\*bbctx*.

## SYNOPSIS

-

  ```
  #include <libpmem2.h>
  struct pmem2_badblock;
  struct pmem2_badblock_context;
  int pmem2_badblock_next(
          struct pmem2_badblock_context *bbctx,
          struct pmem2_badblock *bb);
  ```

## DESCRIPTION

The **pmem2\_badblock\_next**() function reads the next bad block for the given bad block context *\*bbctx*.

It is not supported on Windows.

## RETURN VALUE

The **pmem2\_badblock\_next**() function returns 0 and stores the next bad block in *\*bb* on success or it returns a negative error code when there are no more bad blocks for the given bad block context *\*bbctx*.

## ERRORS

**pmem2\_badblock\_next**() can fail with the following error:

- •

  **PMEM2\_E\_NO\_BAD\_BLOCK\_FOUND** - there are no more bad blocks for the given bad block context *\*bbctx*, *\*bb* is undefined in this case.

- •

  **PMEM2\_E\_NOSUPP** - on Windows or when the OS does not support this functionality

## SEE ALSO

[**pmem2\_badblock\_context\_new**(3)](/pmem2_badblock_context_new/3.md), [**pmem2\_badblock\_clear**(3)](/pmem2_badblock_clear/3.md), [**libpmem2**(7)](/libpmem2/7.md) and **\<https://pmem.io\>**
