linux port of SamCommon