starting to replace posix code to llvm api