예제 #1
0
static int SelectProcTimeAbsRangeMatch(char *name1, char *name2, time_t min, time_t max, char **names, char **line)
{
    int i;
    time_t value;

    if ((min == CF_NOINT) || (max == CF_NOINT))
    {
        return false;
    }

    if ((i = GetProcColumnIndex(name1, name2, names)) != -1)
    {
        value = (time_t) TimeAbs2Int(line[i]);

        if (value == CF_NOINT)
        {
            Log(LOG_LEVEL_INFO, "Failed to extract a valid integer from %c => '%s' in process list", name1[i],
                  line[i]);
            return false;
        }

        if ((min <= value) && (value <= max))
        {
            Log(LOG_LEVEL_VERBOSE, "Selection filter matched absolute '%s/%s' = '%s(%jd)' in [%jd,%jd]", name1, name2, line[i], (intmax_t)value,
                  (intmax_t)min, (intmax_t)max);
            return true;
        }
        else
        {
            return false;
        }
    }

    return false;
}
예제 #2
0
static int SelectProcTimeAbsRangeMatch(char *name1, char *name2, time_t min, time_t max, char **names, char **line)
{
    int i;
    time_t value;

    if (min == CF_NOINT || max == CF_NOINT)
    {
        return false;
    }

    if ((i = GetProcColumnIndex(name1, name2, names)) != -1)
    {
        value = (time_t) TimeAbs2Int(line[i]);

        if (value == CF_NOINT)
        {
            CfOut(cf_inform, "", "Failed to extract a valid integer from %c => \"%s\" in process list\n", name1[i],
                  line[i]);
            return false;
        }

        if (min <= value && value <= max)
        {
            CfOut(cf_verbose, "", "Selection filter matched absolute %s/%s = %s in [%ld,%ld]\n", name1, name2, line[i],
                  min, max);
            return true;
        }
        else
        {
            return false;
        }
    }

    return false;
}