Thanks to Ramzi Zabaneh for Solaris 2.6 port and bug fixes.