Nonequilibrium Thermodynamics of Mesoscopic Systems