gtpc2mjdC/C++ Language Support User's Guide

TPF_FSDD_CLOSE-Close a File

This type of function is specified as part of the file system device driver interface and is called by the close, fclose, and freopen functions to close a special file. Open files are also closed when a process ends.

Format

typedef int TPF_FSDD_CLOSE(const TPF_FSDD_FILEDATA *filedata);

filedata
The address of the file data object returned by the TPF_FSDD_OPEN-type device driver function for the special file being closed.

Normal Return

0
The special file has been closed as requested.

Error Return

-1
The special file could not be closed as requested. The device driver should set errno to an appropriate error code.

Programming Considerations

Examples

The following example is the close device driver interface function for the null file (/dev/null).

#include <c$spif.h> /* Device driver interface */
 
/**********************************************************************/
/* The null_close() function is a NOP.                                */
/**********************************************************************/
void null_close(const TPF_FSDD_FILEDATA *filedata) {}

Related Information