moved the posix function into a lib