use int instead of long for ioctl. fixes #21