Implement for POSIX OSes.
(But not tested well yet.)