C version of docFS