Haiku: Work around the lack of the FIOCLEX ioctl
Haiku: Work around the lack of the FIOCLEX ioctl

* Hand rebased from Niels original work on 1.9.0

GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,aidancully/rust,GBGamer/rust