add some codes for FreeBSD (but can't compile yet)