dgfileinfo(2)
_________________________________________________________________
dgfileinfo System Call
Returns file usage information for a process.
_________________________________________________________________
SYNTAX
#include <dg_file_info.h>
int dg_file_info (process_key,
descriptor_ptr,
file_info_buffer_size_ptr,
file_info_buffer_ptr,
version)
long process_key;
long * descriptor_ptr;
long * file_info_buffer_size_ptr;
struct dg_file_info_type * file_info_buffer_ptr;
long version;
PARAMETERS
process_key The key obtained from a previous dg_process_info()
call. It is used to identify the process of
interest.
descriptor_ptr Indicates the type of file usage information to
return.
file_info_buffer_size_ptr
On input, specifies the maximum number of "file
info" structures to be returned. On output,
specifies the number of "file info" structures
returned.
file_info_buffer_ptr
A pointer to an area of least
<*file_info_buffer_size_ptr> * sizeof (struct
dg_file_info_type) bytes. The area you pass a
pointer to can be as large as you want.
Information about files is put here.
version Set to DG_FILE_INFO_VERSION. If version is not
this, no information will be returned.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
dgfileinfo(2)
DESCRIPTION
<Version> specifies the version of information the user is
interested in. DG_FILE_INFO_VERSION always means the "current
version". <Process_key> indicates a process whose file
information is to be returned. <*Descriptor_ptr> 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 <*file_info_buffer_size_ptr> entities is
returned in the area indicated by <file_info_buffer_ptr>.
<*file_info_buffer_size_ptr> is set to indicate the number of
entities for which information is returned.
Always, information about the first <*file_info_buffer_size_ptr>
active entities is returned.
The data is put into the buffer as a series of dg_file_info_type
structures. The "file_info" structure is defined as:
struct dg_file_info_type {
int version;
int descriptor;
struct stat stat_pkt;
};
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
<process_key>. Only the first <*file_buffer_size_ptr> entries
contain valid information.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
dgfileinfo(2)
Upon return, the actual number of file_info structures put into
the area pointed to by <file_info_buffer_ptr> is returned in
<*file_info_buffer_size_ptr>. <*Descriptor_ptr> is set to the
starting point for the next dg_file_info_call. If
<*descriptor_ptr> 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.
EXCEPTIONS
Errno may be set to one of the following error codes:
EFAULT Either <file_info_buffer_size_ptr>,
<descriptor_ptr> or <file_info_buffer_ptr> points
to an invalid address.
EINVAL <version> requested is not supported.
EINVAL <*descriptor_ptr> 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
The related manual section: dg_process_info(2).
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)