The Hackerlab at regexps.com

Virtual Null File Descriptors

up: libhackerlab
next: Formatted Printing With printfmt
prev: Reserved File Descriptors and Pseudo-Descriptors

These VU functions define a trivial file system implementation in which all functions act like the file is /dev/null but no actual system calls are performed.

Virtual /dev/null is considered a universally readable/writable, permanently 0-length file whose permissions bits and ownerships can not be changed by anyone (including root). It's access, modification and change times are permanently 0 .

The closure for opened files is the access flags cast to (void *).

Function vu_make_virtual_null_fd

int vu_make_virtual_null_fd (int * errn, int flags);

Return a new (pseudo) descriptor opened for virtual /dev/null .



Function vu_make_virtual_null_fd_ge_n

int vu_make_virtual_null_fd_ge_n (int * errn, int n, int flags);

Return a new (pseudo) descriptor opened for virtual /dev/null .

The new descriptor is greater than or equal to n .



libhackerlab: The Hackerlab C Library
The Hackerlab at regexps.com