FAT | RFS | XFS | ZFS

fpathconf()

PROTOTYPE

#include <posix.h>

long fpathconf(int fid, int limit);

DESCRIPTION

fpathconf() retrieves the value of a file system limit for the volume holding the open file referenced by fid. limit is one of the following symbols, which specifies the requested value:

  • _PC_NAME_MAX - the maximum file name length
  • _PC_LINK_MAX - the maximum number of file links

For TargetXFS, the _PC_NAME_MAX return value is the cluster size minus 15. For TargetFAT, it is 255 if VFAT support is enabled or 8 if it is not (this excludes the optional ‘.’ and three character extension).

The configuration value FILENAME_MAX is a limit shared by all file systems. It is the buffer size, including an ending NULL, required to hold the longest supported file name. The effective maximum file name length is the minimum of FILENAME_MAX - 1 and the specific file system limit.

If successful, fpathconf() returns the requested value, which is -1 if no limit is defined. Otherwise it sets errno and returns -1. Set errno to zero before the call to differentiate between an error and an undefined limit.

ERROR CODES

EBADF fid is not the descriptor of an open file.
EINVAL The specified limit value is unsupported.

EXAMPLE

  /*-------------------------------------------------------------------*/
  /* Determine value of _PC_LINK_MAX configuration variable.           */
  /*-------------------------------------------------------------------*/
  printf("_PC_LINK_MAX limit for CWD's file system is ");
  errno = 0;
  result = fpathconf(fid, _PC_LINK_MAX);
  if (result != -1)
    printf("%ld\n", result);
  else if (errno == 0)
    puts("no limit");
  else
    perror("fpathconf() failed");