(pid, name, cmdline, exe, cfg)
return False
Decides whether a process matches with a given process descriptor

    :param pid: process pid
    :param exe: process executable
    :param name: process name
    :param cmdline: process cmdline
    :param cfg: the dictionary from processes that describes with the
        process group we're testing for
    :return: True if it matches
    :rtype: bool
Decides whether a process matches with a given process descriptor
Decides whether a process matches with a given process descriptor
def match_process(pid, name, cmdline, exe, cfg):
    """
    Decides whether a process matches with a given process descriptor

    :param pid: process pid
    :param exe: process executable
    :param name: process name
    :param cmdline: process cmdline
    :param cfg: the dictionary from processes that describes with the
        process group we're testing for
    :return: True if it matches
    :rtype: bool
    """
    if cfg['selfmon'] and pid == os.getpid():
        return True
    for exe_re in cfg['exe']:
        if exe_re.search(exe):
            return True
    for name_re in cfg['name']:
        if name_re.search(name):
            return True
    for cmdline_re in cfg['cmdline']:
        if cmdline_re.search(' '.join(cmdline)):
            return True
    return False
def match_process ( pid , name , cmdline , exe , cfg ) : if cfg [ 'selfmon' ] and pid == os . getpid ( ) : return True for exe_re in cfg [ 'exe' ] : if exe_re . search ( exe ) : return True for name_re in cfg [ 'name' ] : if name_re . search ( name ) : return True for cmdline_re in cfg [ 'cmdline' ] : if cmdline_re . search ( ' ' . join ( cmdline ) ) : return True return False