This file is indexed.

/usr/include/c_icap/stats.h is in libicapapi-dev 1:0.4.2-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
/*
 *  Copyright (C) 2004-2008 Christos Tsantilas
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *  MA  02110-1301  USA.
 */

#ifndef __STATS_H
#define __STATS_H

#include "c-icap.h"
#include "ci_threads.h"

#ifdef __cplusplus
extern "C"
{
#endif

typedef struct kbs{
    uint64_t kb;
    unsigned int bytes;
} kbs_t;

#define MEMBLOCK_SIG 0xFAFA
struct stat_memblock {
    unsigned int sig;
    int counters64_size;
    int counterskbs_size;
    uint64_t *counters64;
    kbs_t *counterskbs;
};

struct stat_area {
   ci_thread_mutex_t mtx;
   void (*release_mem)(void *);
   struct stat_memblock *mem_block;
};


struct stat_entry {
     char *label;
     int type;
     int gid;
};

struct stat_entry_list {
    struct stat_entry *entries;
    int size;
    int entries_num;
};

struct stat_groups_list {
    char **groups;
    int size;
    int entries_num;
};

CI_DECLARE_DATA extern struct stat_entry_list STAT_INT64;
CI_DECLARE_DATA extern struct stat_entry_list STAT_KBS;
CI_DECLARE_DATA extern struct stat_groups_list STAT_GROUPS;

enum ci_stat_type {STAT_INT64_T, STAT_KBS_T};
CI_DECLARE_DATA extern struct stat_area *STATS;

CI_DECLARE_FUNC(int) ci_stat_memblock_size(void);
CI_DECLARE_FUNC(int) ci_stat_entry_register(char *label, int type, char *group);
CI_DECLARE_FUNC(void) ci_stat_entry_release_lists();

CI_DECLARE_FUNC(void) ci_stat_attach_mem(void *mem_block,
                                         int size,void (*release_mem)(void *));
CI_DECLARE_FUNC(void) ci_stat_release();
CI_DECLARE_FUNC(void) ci_stat_uint64_inc(int ID, int count);
CI_DECLARE_FUNC(void) ci_stat_kbs_inc(int ID, int count);

/*Low level functions */
CI_DECLARE_FUNC(struct stat_area *) ci_stat_area_construct(void *mem_block, int size, void (*release_mem)(void *));
CI_DECLARE_FUNC(void) ci_stat_area_destroy(struct stat_area  *area);
CI_DECLARE_FUNC(void) ci_stat_area_reset(struct stat_area *area);
CI_DECLARE_FUNC(void) ci_stat_area_merge(struct stat_area *dest, struct stat_area *src);

/*Stats memblocks low level functions*/
CI_DECLARE_FUNC(void) ci_stat_memblock_merge(struct stat_memblock *dest_block, struct stat_memblock *mem_block);
CI_DECLARE_FUNC(void) ci_stat_memblock_reset(struct stat_memblock *block);
/*DO NOT USE the folllowings are only for internal c-icap server use!*/
CI_DECLARE_FUNC(void) stat_memblock_fix(struct stat_memblock *mem_block);
CI_DECLARE_FUNC(void) stat_memblock_reconstruct(struct stat_memblock *mem_block);

/*Private defines and functions*/
#define STATS_LOCK() ci_thread_mutex_lock(&STATS->mtx)
#define STATS_UNLOCK() ci_thread_mutex_unlock(&STATS->mtx)
#define STATS_INT64_INC(ID, count) (STATS->mem_block->counters64[ID] += count)
#define STATS_KBS_INC(ID, count) (STATS->mem_block->counterskbs[ID].bytes += count, STATS->mem_block->counterskbs[ID].kb += (STATS->mem_block->counterskbs[ID].bytes >> 10), STATS->mem_block->counterskbs[ID].bytes &= 0x3FF)

#ifdef __cplusplus
}
#endif

#endif