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 aims at solving 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. To solve this problem, 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 - they are blocking APIs (not asynchronous). For performance reasons, you should not directly use these APIs on a Traffic Server thread (when being called back on an HTTP hook); it is better to use a separate thread for doing the blocking IO. The INKfopen family is intended for reading and writing configuration information when corresponding usage of the fopen family of functions is inappropriate due to file descriptor and portability limitations. The INKfopen family of functions consists of the following: