dg_file_info(2) DG/UX R4.11MU05 dg_file_info(2)
NAME
dgfileinfo - get file usage information for process identified by
process key
SYNOPSIS
#include </sys/dgfileinfo.h>
int dgfileinfo (processkey,
descriptorptr,
fileinfobuffersizeptr,
fileinfobufferptr,
version)
long processkey;
long * descriptorptr;
long * fileinfobuffersizeptr;
struct dgfileinfo * fileinfobufferptr;
long version;
where:
processkey The key obtained from a previous
dgprocessinfo call; used to identify the
process of interest
descriptorptr The type of file usage information to
return
fileinfobuffersizeptr On input, the maximum number of "file info"
structures to be returned; on output, the
number of "file info" structures returned
fileinfobufferptr A pointer to an area of at least
*fileinfobuffersizeptr *sizeof (struct
dgfileinfo) bytes. The area you pass a
pointer to can be as large as you want.
Information about files is put here.
version DG_FILE_INFO_VERSION. If version is not
this, no information will be returned.
DESCRIPTION
Version specifies the version of information the user is interested
in. DG_FILE_INFO_VERSION always means the "current version".
Processkey indicates a process whose file information is to be
returned. *descriptorptr indicates the starting point for a linear
search through the following objects:
· Process's descriptor table
· Process's current working directory
· Process's current root directory
· File currently being executed by the process.
Information about up to *fileinfobuffersizeptr entities is
returned in the area indicated by fileinfobufferptr.
*fileinfobuffersizeptr is set to indicate the number of entities
for which information is returned.
Always, information about the first *fileinfobuffersizeptr active
entities is returned.
The data is put into the buffer as a series of dgfileinfo
structures. The "file_info" structure is defined as:
struct dgfileinfo {
int version;
int descriptor;
struct stat statpkt;
};
The version field indicates the version and, therefore, the format of
the information that follows. The descriptor field indicates the
object the stat information refers to. If descriptor is
DG_FILE_INFO_CWD, the stat information refers to the process's
current working directory. If descriptor is DG_FILE_INFO_ROOT_DIR,
the stat information refers to the process's current root directory.
If descriptor is DG_FILE_INFO_COMMAND, the stat information refers to
the file currently being executed by the process. Otherwise,
descriptor is a descriptor currently active in the process indicated
by processkey. Only the first *filebuffersizeptr entries contain
valid information.
Upon return, the actual number of file_info structures put into the
area pointed to by fileinfobufferptr is returned in
*fileinfobuffersizeptr. *descriptorptr is set to the starting
point for the next dgfileinfo call. If *descriptorptr is -1,
there are no more entities for which information can be returned.
ACCESS CONTROL
No access control is provided.
RETURN VALUE
0 Successful completion.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EFAULT Either fileinfobuffersizeptr, descriptorptr or
fileinfobufferptr points to an invalid address.
EINVAL version requested is not supported.
EINVAL *descriptorptr is not one of the following:
DG_FILE_INFO_CWD, DG_FILE_INFO_ROOT_DIR,
DG_FILE_INFO_COMMAND, or 0 through NOFILE-1 inclusive.
SEE ALSO
dgprocessinfo(2).
Licensed material--property of copyright holder(s)