Diffusion of ideal gases in capillaries and porous solids