HPlogo MPE/iX Developer's Kit Reference Manual Volume I: HP 3000 MPE/iX Computer Systems > Chapter 4  POSIX/iX Library Function Descriptions

fstat

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Returns open file status information.

Syntax

   #include <sys/types.h>

   #include <sys/stat.h>

   int fstat (int fildes, struct stat *buffer);

Parameters

fildes

An open file descriptor.

buffer

A pointer to a buffer of type struct stat (defined in <sys/stat.h>) where file information is returned.

Return Values

0

Success.

-1

An error occurred. File status information is not returned and errno is set to indicate the error condition.

Description

The fstat() function returns status information on the open file specified by fildes. In order to use fstat() on an open directory stream, the directory stream associated with the open directory must be converted to a file descriptor by calling the ANSI C function fileno().

The fstat() function updates to the current time all time fields that have been previously marked for update. All update marks are removed.

Implementation Considerations

Refer to the EFAULT, EPERM, and ESYSERR error descriptions below.

Errors

If an error occurs, errno is set to one of the following values:

EBADFCAUSEThe fildes parameter is not a valid open file descriptor.
 ACTIONPass a valid open file descriptor.
EFAULTCAUSEThe system detected a NULL or bad address in attempting to use the buffer parameter.
 ACTIONMake sure that the pointer is correctly initialized.
EPERMCAUSE

One of the following:

  • The calling process does not have the MPE/iX process handling (PH) capability.

  • The calling process is not executing a program file whose MPE/iX file code is NMPRG.

  • The calling process has outstanding switches to CM code, has set critical mode, has outstanding NOWAITIO, or is holding an operating system internal resource.

 ACTION

One of the following:

  • Make sure that the calling process has the MPE/iX PH capability.

  • Make sure that the calling process is executing a program file whose file code is NMPRG.

  • Do not execute fork() when the calling process has outstanding switches to CM code, has set critical mode, has outstanding NOWAITIO, or is holding an operating system internal resource.

ESYSERRCAUSEAccess denied. Unable to map UID and GID to owner of the file or directory designated by fildes, either because user database is corrupted or file is invalid for the POSIX/iX environment.
 ACTIONCheck user database or if access to the file is valid in the POSIX/iX environment.

See Also

creat(), dup(), open(), <sys/stat.h>, POSIX.1 (Section 5.6.2)

Feedback to webmaster