finfo or ffinfo Subroutine

Purpose

Returns file information.

Library

Standard C library (libc.a)

Syntax

#include <sys/finfo.h>
int finfo(Path1, cmd, buffer, length)
const char *Path1;
int cmd;
void  *buffer;
int length;
int ffinfo (fd, cmd, buffer, length)
int fd;
int cmd;
void  *buffer;
int length;

Description

The finfo and ffinfo subroutines return specific file information for the specified file.

Parameters

Item Description
Path1 Path name of a file system object to query.
fd File descriptor for an open file to query.
cmd Specifies the type of file information to be returned.
buffer User supplied buffer which contains the file information upon successful return. /usr/include/sys/finfo.h describes the buffer.
length Length of the query buffer.

Commands

Item Description
FI_PATHCONF When the FI_PATHCONF command is specified, a file's implementation information is returned.
Note: The operating system provides another subroutine that retrieves file implementation characteristics, pathconf (pathconf or fpathconf Subroutine) command. While the finfo and ffinfo subroutines can be used to retrieve file information, it is preferred that programs use the pathconf interface.
FI_DIOCAP When the FI_DIOCAP command is specified, the file's direct 1/0 capability information is returned. The buffer supplied by the application is of type struct diocapbuf  *.

Return Values

Upon successful completion, the finfo and ffinfo subroutines return a value of 0 and the user supplied buffer is correctly filled in with the file information requested. If the finfo or ffinfo subroutines were unsuccessful, a value of -1 is returned and the global errno variable is set to indicate the error.

Error Codes

Item Description
EACCES Search permission is denied for a component of the path prefix.
EINVAL If the length specified for the user buffer is greater than MAX_FINFO_BUF.

If the command argument is not supported. If FI_DIOCAP command is specified and the file object does not support Direct I/O.

ENAMETOOLONG The length of the Path parameter string exceeds the PATH_MAX value.
ENOENT The named file does not exist or the Path parameter points to an empty string.
ENOTDIR A component of the path prefix is not a directory.
EBADF File descriptor provided is not valid.