move portable file io func from sys_ to common