As for your SML hint, I leave here "Unix system programming in OCaml" :)
https://ocaml.github.io/ocamlunix/