move tcgetattr to shared bsd code