Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

CtreeFlushFile

Force FairCom DB and system file buffers to disk.

Short Name

CTFLUSH()

Type

Low-Level function

Declaration

COUNT CtreeFlushFile(FILNO filno)

Description

In V12 the file number typedef was formally changed from COUNT, a two-byte value to FILNO, a four-byte value. Refer to this link for compatibility details. Four Byte File Numbering

CtreeFlushFile() writes cache to disk. If filno is -1, the buffers for all open files are flushed. Otherwise, the buffers for the file number specified are flushed. CtreeFlushFile() attempts to flush the system’s file buffers after the FairCom DB buffers are flushed.

CtreeFlushFile() does not guarantee that the data on disk is consistent because other users could be updating the file at the time of the flush. Cache pages that are in the middle of an update, signified by an inability of CtreeFlushFile() to acquire the update semaphore for the cache, are not flushed. The contents of the cache remain valid so subsequent I/O requests do NOT need to repopulate the cache pages.

Superfiles must be flushed as a unit. Individual members cannot be flushed separately. To flush a member of a superfile, you must flush the superfile host, which flushes ALL members. A call to CtreeFlushFile() for a member of a superfile returns FMOD_ERR (48).

A call to CtreeFlushFile() for an index member, instead of the host index, returns KMEM_ERR (23). That is, if an index file is opened with file number keyno, and if the index file contains two additional members, CtreeFlushFile() should only be called with keyno as the argument. This will flush all the index members.

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

No error occurred.

23

KMEM_ERR

Attempt to flush an index member. Flush the host index.

48

FMOD_ERR

Attempt to flush a superfile member. Flush the host.

See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.

Limitations

Superfiles and index host/member files must be flushed as a unit. Individual members cannot be flushed separately. Flush the host file to flush all hosted files.

TOCIndex