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

# rfio\_lstat(3)

get information about a file or directory

## NAME

rfio\_stat - get information about a file or directory

## SYNOPSIS

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

**int rfio\_stat (const char \****path***, struct stat \****statbuf***);**\
 **int rfio\_fstat (int** *s***, struct stat \****statbuf***);**\
 **int rfio\_lstat (const char \****path***, struct stat \****statbuf***);**\
 **int rfio\_mstat (const char \****path***, struct stat \****statbuf***);**\
 **int rfio\_mstat\_reset ();**\
 **int rfio\_end ();**\
\

Under Linux, for large files:\
 **#define \_LARGEFILE64\_SOURCE**\
 **#include \<sys/types.h\>**\
 **#include "rfio\_api.h"**

**int rfio\_stat64 (const char \****path***, struct stat64 \****statbuf***);**\
 **int rfio\_fstat64 (int** *s***, struct stat64 \****statbuf***);**\
 **int rfio\_lstat64 (const char \****path***, struct stat64 \****statbuf***);**\
 **int rfio\_mstat64 (const char \****path***, struct stat64 \****statbuf***);**

For large files, under other systems:\
 **#include \<sys/types.h\>**\
 **#include "rfio\_api.h"**

**int rfio\_stat64 (const char \****path***, struct stat64 \****statbuf***);**\
 **int rfio\_fstat64 (int** *s***, struct stat64 \****statbuf***);**\
 **int rfio\_lstat64 (const char \****path***, struct stat64 \****statbuf***);**\
 **int rfio\_mstat64 (const char \****path***, struct stat64 \****statbuf***);**

## DESCRIPTION

**rfio\_stat** gets information about a file or directory.

**rfio\_lstat** is identical to **rfio\_stat** except for symbolic links. In this case, the link itself is statted and not followed.

**rfio\_fstat** is identical to **rfio\_stat** but works on the file descriptor **s** returned by **rfio\_open**.

**rfio\_mstat** is identical to **rfio\_stat** but keeps the connection open to the server unless there are more than MAXMCON connections already opened. This is useful when issuing a series of stat calls. The last **rfio\_mstat** call should be followed by a call to **rfio\_end**.

**rfio\_mstat\_reset** is to be used when your program is forking. In such a case the permanent connections opened with **rfio\_mstat** become shared between the parent and the child. Use **rfio\_mstat\_reset** to perform the necessary reset and close of the socket file descriptor in the parent or the child in order to be sure that only of them will receice an answer from the RFIO daemon.

See NOTES section below.

- *path*

  specifies the logical pathname relative to the current directory or the full pathname.

- *statbuf*

  is a pointer to a **stat** structure, receiving result of your query.

The 64 bits functions must be used for large files. They have the same syntax as the normal stat functions except that they use a  **stat64** structure.

## RETURN VALUE

This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, **serrno** is set appropriately.

## NOTES

Multiple connections using rfio\_mstat are thread-safe but not process-wide, therefore a forked child can share file descriptors opened with rfio\_mstat by its parent. Use **rfio\_mstat\_reset** in such case.

Multiple connections behaviour is undefined if you work in a multi-threaded environment and with threads **not** created using the LCG's **Cthread** interface.

## ERRORS

- **ENOENT**

  The named file/directory does not exist or is a null pathname.

- **EBADF**

  *s* is not a valid file descriptor.

- **EACCES**

  Search permission is denied on a component of the *path* prefix.

- **EFAULT**

  *path* or *statbuf* is a NULL pointer.

- **ENOTDIR**

  A component of *path* prefix is not a directory.

- **ENAMETOOLONG**

  The length of *path* exceeds **CA\_MAXPATHLEN** or the length of a *path* component exceeds **CA\_MAXNAMELEN**.

- **SENOSHOST**

  Host unknown.

- **SENOSSERV**

  Service unknown.

- **SECOMERR**

  Communication error.

## SEE ALSO

**[Castor\_limits(4)](/Castor_limits/4.md)**, **[rfio\_chmod(3)](/rfio_chmod/3.md)**, **[rfio\_chown(3)](/rfio_chown/3.md)**, **[Cthread(3)](/Cthread/3.md)**

## AUTHOR

**LCG Grid Deployment** Team
