---
name: "dpns_readdir"
section: "3"
platform: "linux"
package: "libdpm-dev"
version: "1.10.0-2+b3"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/dpns_readdir"
---

# dpns\_readdir(3)

read DPNS directory opened by dpns\_opendir in the name server

## NAME

dpns\_readdir - read DPNS directory opened by **dpns\_opendir** in the name server

## SYNOPSIS

**#include \<sys/types.h\>**\
 **#include \<dirent.h\>**\
 **#include "dpns\_api.h"**

**struct dirent \*dpns\_readdir (dpns\_DIR \****dirp***)**

## DESCRIPTION

**dpns\_readdir** reads the DPNS directory opened by **dpns\_opendir** in the name server. This routine returns a pointer to a structure containing the current directory entry. **dpns\_readdir** caches a variable number of such entries, depending on the filename size, to minimize the number of requests to the name server.

- *dirp*

  specifies the pointer value returned by **dpns\_opendir**.

## NOTE

Only the fields d\_name, d\_reclen and on some platforms d\_namlen are filled.

## RETURN VALUE

This routine returns a pointer to a structure containing the current directory entry if the operation was successful or NULL if the end of the directory was reached or if the operation failed. When the end of the directory is encountered, serrno is not changed. If the operation failed, **serrno** is set appropriately.

As dpns\_readdir returns a null pointer both at the end of the directory and on error, an application wishing to check for error situations should set **serrno** to 0, then call dpns\_readdir, then check **serrno** and if it is non-zero, assume an error has occurred.

## ERRORS

- **EBADF**

  File descriptor in DIR structure is invalid.

- **EFAULT**

  *dirp* is a NULL pointer.

- **SECOMERR**

  Communication error.

- **ENSNACT**

  Name server is not running or is being shutdown.

## SEE ALSO

**[dpns\_closedir(3)](/dpns_closedir/3.md)**, **[dpns\_opendir(3)](/dpns_opendir/3.md)**, **[dpns\_rewinddir(3)](/dpns_rewinddir/3.md)**, **dirent**

## AUTHOR

**LCG Grid Deployment** Team
