Thermodynamics of current in superconductors and superfluids