FAT | RFS | XFS | ZFS
is_open()
PROTOTYPE
#include <posix.h>
int is_open(const char *path);
DESCRIPTION
is_open() checks if the file specified by path is currently open. Paths starting with ‘/’ are absolute. Otherwise they are relative to the CWD.
The caller needs execute access to every directory in the path prefix.
is_open() returns TRUE if the file is open, FALSE if the file is closed, else -1 for error.
ERROR CODES
| EACCES | No execute access to a directory in the path prefix. |
| EFAULT | path equals NULL. |
| ENAMETOOLONG | A name in path exceeds the effective maximum file name length. |
| ENOENT | path is the empty string or includes a file that was not found. |
| ENOTDIR | One of the non-leaf path components is not a directory. |
EXAMPLE
/*-------------------------------------------------------------------*/
/* Loop through every file in the directory. */
/*-------------------------------------------------------------------*/
while (entry = readdir(cur_dir))
{
/*-----------------------------------------------------------------*/
/* Skip if error or file is currently open. */
/*-----------------------------------------------------------------*/
if (is_open(entry->d_name) != 0)
continue;