Test file open status

ss_file_isopen is a function defined in ssfile.c.

Synopsis:

hid_t ss_file_isopen(ss_file_t *file, const char *name)

Formal Arguments:

  • file: Optional handle to a persistent File object.
  • name: Optional real name of file to test for open status.

Description: Determines whether a file named name (names normalized with ss_file_fixname before being compared) is open, or whether the persistent file object file corresponds to an open file, or whether file is currently mapped to name depending on whether only name is specified, only file is specified, or both name and file are specified, respectively.

Return Value: Returns true (a positive HDF5 file handle) if the file is currently open (explicitly or implicitly); false if the file is not currently open; negative otherwise. The HDF5 file handle is not duplicated and the client should not invoke H5Fclose on the return value.

Parallel Notes: Independent. However, since the underlying HDF5 file was opened collectively, many operations on that file must necessarily be collective and therefore if the return value is to be used as a file (instead of a logic value) then this function will most likely be called collectively across the file’s communicator.

Issues: The returned HDF5 file handle is not duplicated before being returned for three reasons: (1) the H5Freopen function returns a handle which does not participate in the same file mount structure as the original and thus we cannot guarantee that SSlib’s file view would be consistent with that of the returned handle, (2) the H5Freopen function is collective which would preclude this function from being usable as an independent test of file availability, and (3) requiring the caller to H5Fclose the return value gets in the way of using this function as a predicate.

Since transient files are not supported by HDF5 there can be no HDF5 file handle for a file created with the H5F_ACC_TRANSIENT bit set. This function returns the integer 1 for such files, which is a positive true value but which is not a valid HDF5 file handle (or any valid handle for that matter).

See Also:

  • Files: Introduction for current chapter