Even better emulate POSIX file functions (reduced)

This is reduced version of #5694.
Only obvious fixes.
there is no point in special casing here. if this is required always give a dummy pointer (can be a single byte).