more robust error checking for cgroups and support for writing proc files on the fly