Tell cgrulesengd daemon to not move the given process into other cgroups,
    if libcgroup is available.

def _register_process_with_cgrulesengd(pid):
    """Tell cgrulesengd daemon to not move the given process into other cgroups,
    if libcgroup is available.
    """
    # Logging/printing from inside preexec_fn would end up in the output file,
    # not in the correct logger, thus it is disabled here.
    from ctypes import cdll
    try:
        libcgroup = cdll.LoadLibrary('libcgroup.so.1')
        failure = libcgroup.cgroup_init()
        if failure:
            pass
            #print('Could not initialize libcgroup, error {}'.format(success))
        else:
            CGROUP_DAEMON_UNCHANGE_CHILDREN = 0x1
            failure = libcgroup.cgroup_register_unchanged_process(pid, CGROUP_DAEMON_UNCHANGE_CHILDREN)
            if failure:
                pass
                #print('Could not register process to cgrulesndg, error {}. '
                #      'Probably the daemon will mess up our cgroups.'.format(success))
    except OSError:
        pass