This file is indexed.

/usr/include/smpi/smpi_cocci.h is in libsimgrid-dev 3.11.1-10ubuntu1.

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
/* Copyright (c) 2011-2014. The SimGrid Team.
 * All rights reserved.                                                     */

/* This program is free software; you can redistribute it and/or modify it
 * under the terms of the license (GNU LGPL) which comes with this package. */

#ifndef SMPI_COCCI_H
#define SMPI_COCCI_H

#include <xbt/misc.h>

/* Macros used by coccinelle-generated code */

#define SMPI_VARINIT_GLOBAL(name,type)                          \
type *name = NULL;                                              \
static void __attribute__((constructor)) __preinit_##name(void) { \
   if(!name)                                                    \
      name = (type*)calloc(smpi_global_size(), sizeof(type));   \
}                                                               \
static void __attribute__((destructor)) __postfini_##name(void) { \
   free(name);                                                  \
   name = NULL;                                                 \
}

#define SMPI_VARINIT_GLOBAL_AND_SET(name,type,expr)             \
type *name = NULL;                                              \
static void __attribute__((constructor)) __preinit_##name(void) { \
   size_t size = smpi_global_size();                            \
   size_t i;                                                    \
   type value = expr;                                           \
   if(!name) {                                                  \
      name = (type*)malloc(size * sizeof(type));                \
      for(i = 0; i < size; i++) {                               \
         name[i] = value;                                       \
      }                                                         \
   }                                                            \
}                                                               \
static void __attribute__((destructor)) __postfini_##name(void) { \
   free(name);                                                  \
   name = NULL;                                                 \
}

#define SMPI_VARGET_GLOBAL(name) name[smpi_process_index()]

/* The following handle local static variables */
/** @brief Make sure that the passed pointer is freed on process exit.
 *
 * This function is rather internal, mainly used for the
 * privatization of global variables through coccinelle.
 */
XBT_PUBLIC(void) smpi_register_static(void* arg, void_f_pvoid_t free_fn);

XBT_PUBLIC(void) smpi_free_static(void);

#define SMPI_VARINIT_STATIC(name,type)                      \
static type *name = NULL;                                   \
if(!name) {                                                 \
   name = (type*)calloc(smpi_global_size(), sizeof(type));  \
   smpi_register_static(name, xbt_free);                    \
}

#define SMPI_VARINIT_STATIC_AND_SET(name,type,expr) \
static type *name = NULL;                           \
if(!name) {                                         \
   size_t size = smpi_global_size();                \
   size_t i;                                        \
   type value = expr;                               \
   name = (type*)malloc(size * sizeof(type));       \
   for(i = 0; i < size; i++) {                      \
      name[i] = value;                              \
   }                                                \
   smpi_register_static(name, xbt_free);            \
}

#define SMPI_VARGET_STATIC(name) name[smpi_process_index()]

#endif