Tcl_GetFile, Tcl_FreeFile, Tcl_GetFileInfo - procedures to manipulate generic file handles
Tcl_SetNotifierData(handle, freeProc, clientData)
Tcl_FileFreeProc **freeProcPtr (in/out) Pointer to location in which to store address of current free procedure for file handle. Ignored if NULL.
Tcl_GetFile locates the file handle corresponding to a particular osHandle and a type. If a file handle already existed for the given file, then that handle will be returned. If this is the first time that the file handle for a particular file is being retrieved, then a new file handle will be allocated and returned.
When a file handle is no longer in use, it should be deallocated with a call to Tcl_FreeFile. A call to this function will invoke the notifier free procedure proc, if there is one. After the notifier has cleaned up, any resources used by the file handle will be deallocated. Tcl_FreeFile will not close the platform-specific osHandle.
Tcl_GetFileInfo may be used to retrieve the platformspecific osHandle and type associated with a file handle. If typePtr is not NULL, then the word at *typePtr is set to the type of the file handle. The return value of the function is the associated platform-specific osHandle. Note that this function may be used to extract the platformspecific file handle from a Tcl_File so that it may be used in external interfaces. However, programs written using this interface will be platform-specific.
The Tcl_SetNotifierData and Tcl_GetNotifierData procedures are intended to be used only by notifier writers. See the Tcl_CreateEventSource(3) manual entry for more information on the notifier.
Tcl_SetNotifierData may be used by notifier writers to associate notifier-specific information with a Tcl_File. The data argument specifies a word that may be retrieved with a later call to Tcl_GetNotifierData. If the freeProc argument is non-NULL it specifies the address of a procedure to invoke when the Tcl_File is deleted. freeProc should have arguments and result that match the type Tcl_FileFreeProc: typedef void Tcl_FileFreeProc(
When freeProc is invoked the clientData argument will be the same as the corresponding argument passed to Tcl_SetNotifierData.
Tcl_GetNotifierData returns the clientData associated with the given Tcl_File, and if the freeProcPtr field is nonNULL, the address indicated by it gets the address of the free procedure stored with this file.
generic file handle, file type, file descriptor, notifier
Table of Contents