The function of a truss is to maintain a reduced hernia and help relieve any pain or discomfort by applying pressure.