impl writf and pwritf for linux