Home

Traffic Server Software Developers Kit

The INKfopen Family

The fopen family of functions in C is normally used for reading configuration files, since fgets is an easy way to parse files on a line-by-line basis. The INKfopen family of functions is intended to solve the same problem of buffered IO and line at a time IO, in a platform-independent manner. The fopen family of C library functions can only open a file if a file descriptor less than 256 is available. Since Traffic Server often has more than 2000 file descriptors open at once, however, the likelihood of an available file descriptor less than 256 very small. The INKfopen family can open files with descriptors greater than 256.

The INKfopen family of routines is not intended for high speed IO or flexibility. These routines are intended for reading and writing configuration information when corresponding usage of the fopen family of functions is inappropriate because of file descriptor and portability limitations. The INKfopen family of functions consists of the functions below.

INKfclose

Closes a file.

Prototype

void INKfclose (INKFile filep)

Arguments

filep is the file to close.

Description

Closes the file pointed to by filep and frees the data structures & buffers associated with it. If the file was opened for writing, then any pending data is flushed.

Example

See the example for INKfopen