pxfstat

Date:

10-20-2011

NAME

PXFSTAT - Retrieves the file status

SYNOPSIS

INTEGER jstat, ilen, ierror
CALL PXFSTAT(path, ilen, jstat, ierror)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

IEEE Std 1003.9-1992 standard interface for FORTRAN 77

DESCRIPTION

The PXFSTAT routine uses the stat system call to get the file status.

All arguments must be of default kind unless documented otherwise. Default kind is KIND=4 for integer, real, complex, and logical arguments.

The following is a list of arguments for this routine:

path

An input character variable or array element containing the name of a file.

ilen

An input integer variable containing the length of path in characters. If ilen is zero, all trailing blanks are removed before calling stat().

jstat

An input integer variable or array element containing a handle for a stat structure. This handle should have been created by a call to the PXFSTRUCTCREATE(3F) routine.

ierror

An output integer variable that contains the status:

0

PXFSTAT returned the status information.

Nonzero

PXFSTAT was unable to return the status.

In addition to errors returned by the stat(2) system call, the following errors may occur:

EINVAL

If ilen < 0 or ilen > LEN(path).

ENOMEM

If PXFSTAT is unable to obtain memory to copy path.

The stat structure contains the following components:

st_mode

File mode.

st_ino

File serial number.

st_dev

ID of device containing the file.

st_nlink

Number of links.

st_uid

User id of the owner of the file.

st_gid

Group id of the owner of the file.

st_size

File size in bytes for regular files. Unspecified for other files.

st_atime

Last time that data within the file was accessed.

st_mtime

Last time that data in the file was modified.

st_ctime

Last time that file status was changed.

EXAMPLES

program test
character*10 path
integer ilen, jstat, ierror,imode, istino
path = 'stt.f'
call pxfstructcreate('stat',jstat,ierror)
   print *,'structcreate error = ',ierror
ilen=0
call pxfstat(path, ilen, jstat, ierror)
if (ierror.ne.0) then
   print *,'FAIL: error from pxfstat = ',ierror
else
   print *,'PASS: No error from pxfstat = '
endif
call pxfintget(jstat,'st_ino',istino,ierror)
call pxfintget(jstat,'mode',imode,ierror)
print *,'st_ino = ',istino
print *,'mode = ',imode
call pxfstructfree(stat,ierror)
end