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

# lfc\_access(3)

check existence/accessibility of a file/directory

## NAME

lfc\_access - check existence/accessibility of a file/directory

## SYNOPSIS

Under Unix:\
 **#include \<sys/types.h\>**\
 **#include \<unistd.h\>**\
 **#include "lfc\_api.h"**

Under Windows/NT:\
 **#include \<sys/types.h\>**\
 **#define R\_OK 4**\
 **#define W\_OK 2**\
 **#define X\_OK 1**\
 **#define F\_OK 0**\
 **#include "lfc\_api.h"**

**int lfc\_access (const char \****path***,** **int** *amode***);**

## DESCRIPTION

**lfc\_access** checks in the name server database the existence or the accessibility of the file/directory *path* according to the bit pattern in *amode* using the real user ID.

- *path*

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

- *amode*

  the bit pattern is built by an OR of the constants defined in \<**unistd.h**\> under Unix or to be explicitly defined under Windows/NT:

  - **R\_OK**

    test for read permission

  - **W\_OK**

    test for write permission

  - **X\_OK**

    test for search/execute permission

  - **F\_OK**

    test for existence of the directory/file.

## 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.

## ERRORS

- **ENOENT**

  The named file/directory does not exist or is a dangling symbolic link.

- **EACCES**

  Search permission is denied on a component of the *path* prefix or specified access to the file itself is denied.

- **EFAULT**

  *path* is a NULL pointer.

- **ENOTDIR**

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

- **EINVAL**

  *amode* is invalid.

- **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.

- **ENSNACT**

  Name server is not running or is being shutdown.

## SEE ALSO

**[Castor\_limits(4)](/Castor_limits/4.md)**, **[lfc\_chdir(3)](/lfc_chdir/3.md)**, **[lfc\_chmod(3)](/lfc_chmod/3.md)**, **[lfc\_statg(3)](/lfc_statg/3.md)**

## AUTHOR

**LCG Grid Deployment** Team
