This file is indexed.

/usr/include/litl_read.h is in liblitl-dev 0.1.1+dfsg-3ubuntu1.

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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
/* -*- c-file-style: "GNU" -*- */
/*
 * Copyright © Télécom SudParis.
 * See COPYING in top-level directory.
 */

#ifndef LITL_READ_H_
#define LITL_READ_H_

/**
 *  \file litl_read.h
 *  \brief litl_read Provides a set of functions for reading events from a
 *  regular trace file or an archive of traces
 *
 *  \authors
 *    Developers are: \n
 *        Roman Iakymchuk   -- roman.iakymchuk@telecom-sudparis.eu \n
 *        Francois Trahay   -- francois.trahay@telecom-sudparis.eu \n
 */

#include "litl_types.h"

/**
 * \defgroup litl_read LiTL Reading Functions
 */

/**
 * \defgroup litl_read_init Initialization Functions
 * \ingroup litl_read
 */

/**
 * \defgroup litl_read_main Functions for Reading Events
 * \ingroup litl_read
 */

/**
 * \defgroup litl_read_process Functions for Processing Events
 * \ingroup litl_read
 */

/**
 * \ingroup litl_read_init
 * \brief Opens a trace and reads the first portion of data (trace header) to the buffer
 * \param filename A filename
 * \return A pointer to the trace object. NULL in case of failure
 */
litl_read_trace_t* litl_read_open_trace(const char* filename);

/**
 * \ingroup litl_read_init
 * \brief Initializes the event reading structure
 * \param trace A pointer to the trace object
 */
void litl_read_init_processes(litl_read_trace_t* trace);

/**
 * \ingroup litl_read_init
 * \brief Returns a pointer to the trace header
 * \param trace A pointer to the trace object
 * \return A pointer to the trace header
 */
litl_general_header_t* litl_read_get_trace_header(litl_read_trace_t* trace);

/**
 * \ingroup litl_read_init
 * \brief Returns a pointer to the process header
 * \param process A pointer to the process object
 * \return A pointer to the trace header
 */
litl_process_header_t* litl_read_get_process_header(
    litl_read_process_t* process);

/**
 * \ingroup litl_read_init
 * \brief Sets the buffer size
 * \param trace A pointer to the trace object
 * \param buf_size A buffer size (in Byte)
 */
void litl_read_set_buffer_size(litl_read_trace_t* trace,
                               const litl_size_t buf_size);

/**
 * \ingroup litl_read_init
 * \brief Returns the buffer size
 * \param trace A pointer to the trace object
 * \return A buffer size (in Byte)
 */
litl_size_t litl_read_get_buffer_size(litl_read_trace_t* trace);

/**
 * \ingroup litl_read_main
 * \brief Resets the trace pointer
 * \param process A pointer to the process object
 */
void litl_read_reset_process(litl_read_process_t* process);

/**
 * \ingroup litl_read_main
 * \brief Reads the next event from a trace
 * \param trace A pointer to the trace object
 * \param process A pointer to the process object
 */
litl_read_event_t* litl_read_next_process_event(litl_read_trace_t* trace,
                                                litl_read_process_t* process);

/**
 * \ingroup litl_read_main
 * \brief Reads the next event from a trace file
 * \param trace A pointer to the trace object
 */
litl_read_event_t* litl_read_next_event(litl_read_trace_t* trace);

/**
 * \ingroup litl_read_main
 * \brief Closes the trace and frees the allocated memory
 * \param trace A pointer to the trace object
 */
void litl_read_finalize_trace(litl_read_trace_t* trace);

/*** Internal-use macros ***/

/*
 * For internal use only
 * Initializes a pointer for browsing the parameters of an event
 */
#define __LITL_READ_INIT_PTR(evt, _ptr_)		\
  do {							\
    if(LITL_READ_GET_TYPE(evt) == LITL_TYPE_REGULAR)	\
      _ptr_ = &LITL_READ_REGULAR(evt)->param[0];	\
    else						\
      _ptr_ = &LITL_READ_PACKED(evt)->param[0];		\
  } while(0)

/*
 * For internal use only
 * Returns the next parameter in an event
 */
#define __LITL_READ_GET_ARG(evt, _ptr_, arg)		\
  do {							\
    if(LITL_READ_GET_TYPE(evt) == LITL_TYPE_REGULAR)	\
      __LITL_READ_GET_ARG_REGULAR(_ptr_, arg);		\
    else						\
      __LITL_READ_GET_ARG_PACKED(_ptr_, arg);		\
  } while(0)

/*
 * For internal use only
 * Returns the next parameter in a regular event
 */
#define __LITL_READ_GET_ARG_REGULAR(_ptr_, arg) do {	\
    arg = (typeof(arg)) *(litl_param_t*)_ptr_;		\
    (litl_param_t*)_ptr_++;				\
  } while(0)

/*
 * For internal use only
 * Returns the next parameter in a packed event
 */
#define __LITL_READ_GET_ARG_PACKED(_ptr_, arg) do {	\
    memcpy(&arg, _ptr_, sizeof(arg));			\
    _ptr_ = ((char*)_ptr_)+sizeof(arg);			\
  } while(0)

/*** functions for reading events ***/

/**
 * \ingroup litl_read_process
 * \brief Returns a current event of a given thread
 * \param process An event reading object
 * \param thread_index An index of a given thread
 */
#define LITL_READ_GET_CUR_EVENT_PER_THREAD(process, thread_index) \
  (&(process)->threads[(thread_index)]->cur_event)
/**
 * \ingroup litl_read_process
 * \brief Returns a current event of a given trace
 * \param process An event reading object
 */
#define LITL_READ_GET_CUR_EVENT(process) \
  LITL_READ_GET_CUR_EVENT_PER_THREAD(process, (process)->cur_index)

/**
 * \ingroup litl_read_process
 * \brief Returns a thread id of a given event
 * \param read_event An event
 */
#define LITL_READ_GET_TID(read_event) (read_event)->tid
/**
 * \ingroup litl_read_process
 * \brief Returns a time stamp of a given event
 * \param read_event An event
 */
#define LITL_READ_GET_TIME(read_event) (read_event)->event->time
/**
 * \ingroup litl_read_process
 * \brief Returns a type of a given event
 * \param read_event An event
 */
#define LITL_READ_GET_TYPE(read_event) (read_event)->event->type
/**
 * \ingroup litl_read_process
 * \brief Returns a code of a given event
 * \param read_event An event
 */
#define LITL_READ_GET_CODE(read_event) (read_event)->event->code

/**
 * \ingroup litl_read_process
 * \brief Returns a size and parameters in the string format of a raw event
 * \param read_event An event
 */
#define LITL_READ_RAW(read_event) (&(read_event)->event->parameters.raw)
/**
 * \ingroup litl_read_process
 * \brief Returns a size and a list of parameters of a regular event
 * \param read_event An event
 */
#define LITL_READ_REGULAR(read_event) (&(read_event)->event->parameters.regular)
/**
 * \ingroup litl_read_process
 * \brief Returns a size and a list of parameters of a packed event
 * \param read_event An event
 */
#define LITL_READ_PACKED(read_event) (&(read_event)->event->parameters.packed)
/**
 * \ingroup litl_read_process
 * \brief Returns a size and an offset of an event of type offset
 * \param read_event An event
 */
#define LITL_READ_OFFSET(read_event) (&(read_event)->event->parameters.offset)

/**
 * \ingroup litl_read_process
 * \brief Assigns the first parameter of p_evt to param1
 * \param p_evt A pointer to an event
 * \param param1 1st parameter for this event
 */
#define litl_read_get_param_1(p_evt,		\
			      param1)		\
  do {						\
    void* _ptr_;				\
    __LITL_READ_INIT_PTR(p_evt, _ptr_);		\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param1);	\
  } while(0)

/**
 * \ingroup litl_read_process
 * \brief Assigns the first 2 parameters of p_evt to param1 and param2
 * \param p_evt A pointer to an event
 * \param param1 1st parameter for this event
 * \param param2 2nd parameter for this event
 */
#define litl_read_get_param_2(p_evt,		\
			      param1,		\
			      param2)		\
  do {						\
    void* _ptr_;				\
    __LITL_READ_INIT_PTR(p_evt, _ptr_);		\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param1);	\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param2);	\
  } while(0)

/**
 * \ingroup litl_read_process
 * \brief Assigns the first 3 parameters of p_evt to param1, ..., param3
 * \param p_evt A pointer to an event
 * \param param1 1st parameter for this event
 * \param param2 2nd parameter for this event
 * \param param3 3rd parameter for this event
 */
#define litl_read_get_param_3(p_evt,				\
			      param1,				\
			      param2,				\
			      param3)				\
  do {								\
    void* _ptr_;						\
    __LITL_READ_INIT_PTR(p_evt, _ptr_);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param1);			\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param2);			\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param3);			\
  } while(0)

/**
 * \ingroup litl_read_process
 * \brief Assigns the first 4 parameters of p_evt to param1, ..., param4
 * \param p_evt A pointer to an event
 * \param param1 1st parameter for this event
 * \param param2 2nd parameter for this event
 * \param param3 3rd parameter for this event
 * \param param4 4th parameter for this event
 */
#define litl_read_get_param_4(p_evt,					\
			      param1,					\
			      param2,					\
			      param3,					\
			      param4)					\
  do {									\
    void* _ptr_;							\
    __LITL_READ_INIT_PTR(p_evt, _ptr_);					\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param1);			        \
    __LITL_READ_GET_ARG(p_evt, _ptr_, param2);			        \
    __LITL_READ_GET_ARG(p_evt, _ptr_, param3);			        \
    __LITL_READ_GET_ARG(p_evt, _ptr_, param4);			        \
  } while(0)

/**
 * \ingroup litl_read_process
 * \brief Assigns the first 5 parameters of p_evt to param1, ..., param5
 * \param p_evt A pointer to an event
 * \param param1 1st parameter for this event
 * \param param2 2nd parameter for this event
 * \param param3 3rd parameter for this event
 * \param param4 4th parameter for this event
 * \param param5 5th parameter for this event
 */
#define litl_read_get_param_5(p_evt,					\
			      param1,					\
			      param2,					\
			      param3,					\
			      param4,					\
			      param5)					\
  do {									\
    void* _ptr_;							\
    __LITL_READ_INIT_PTR(p_evt, _ptr_);					\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param1);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param2);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param3);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param4);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param5);				\
  } while(0)

/**
 * \ingroup litl_read_process
 * \brief Assigns the first 6 parameters of p_evt to param1, ..., param6
 * \param p_evt A pointer to an event
 * \param param1 1st parameter for this event
 * \param param2 2nd parameter for this event
 * \param param3 3rd parameter for this event
 * \param param4 4th parameter for this event
 * \param param5 5th parameter for this event
 * \param param6 6th parameter for this event
 */
#define litl_read_get_param_6(p_evt,					\
			      param1,					\
			      param2,					\
			      param3,					\
			      param4,					\
			      param5,					\
			      param6)					\
  do {									\
    void* _ptr_;							\
    __LITL_READ_INIT_PTR(p_evt, _ptr_);					\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param1);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param2);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param3);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param4);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param5);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param6);				\
  } while(0)

/**
 * \ingroup litl_read_process
 * \brief Assigns the first 7 parameters of p_evt to param1, ..., param7
 * \param p_evt A pointer to an event
 * \param param1 1st parameter for this event
 * \param param2 2nd parameter for this event
 * \param param3 3rd parameter for this event
 * \param param4 4th parameter for this event
 * \param param5 5th parameter for this event
 * \param param6 6th parameter for this event
 * \param param7 7th parameter for this event
 */
#define litl_read_get_param_7(p_evt,					\
			      param1,					\
			      param2,					\
			      param3,					\
			      param4,					\
			      param5,					\
			      param6,					\
			      param7)					\
  do {									\
    void* _ptr_;							\
    __LITL_READ_INIT_PTR(p_evt, _ptr_);					\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param1);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param2);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param3);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param4);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param5);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param6);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param7);				\
  } while(0)

/**
 * \ingroup litl_read_process
 * \brief Assigns the first 8 parameters of p_evt to param1, ..., param8
 * \param p_evt A pointer to an event
 * \param param1 1st parameter for this event
 * \param param2 2nd parameter for this event
 * \param param3 3rd parameter for this event
 * \param param4 4th parameter for this event
 * \param param5 5th parameter for this event
 * \param param6 6th parameter for this event
 * \param param7 7th parameter for this event
 * \param param8 8th parameter for this event
 */
#define litl_read_get_param_8(p_evt,		\
			      param1,		\
			      param2,		\
			      param3,		\
			      param4,		\
			      param5,		\
			      param6,		\
			      param7,		\
			      param8)		\
  do {						\
    void* _ptr_;				\
    __LITL_READ_INIT_PTR(p_evt, _ptr_);		\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param1);	\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param2);	\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param3);	\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param4);	\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param5);	\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param6);	\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param7);	\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param8);	\
  } while(0)

/**
 * \ingroup litl_read_process
 * \brief Assigns the first 9 parameters of p_evt to param1, ..., param9
 * \param p_evt A pointer to an event
 * \param param1 1st parameter for this event
 * \param param2 2nd parameter for this event
 * \param param3 3rd parameter for this event
 * \param param4 4th parameter for this event
 * \param param5 5th parameter for this event
 * \param param6 6th parameter for this event
 * \param param7 7th parameter for this event
 * \param param8 8th parameter for this event
 * \param param9 9th parameter for this event
 */
#define litl_read_get_param_9(p_evt,					\
			      param1,					\
			      param2,					\
			      param3,					\
			      param4,					\
			      param5,					\
			      param6,					\
			      param7,					\
			      param8,					\
			      param9)					\
  do {									\
    void* _ptr_;							\
    __LITL_READ_INIT_PTR(p_evt, _ptr_);					\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param1);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param2);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param3);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param4);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param5);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param6);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param7);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param8);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param9);				\
  } while(0)

/**
 * \ingroup litl_read_process
 * \brief Assigns the first 10 parameters of p_evt to param1, ..., param10
 * \param p_evt A pointer to an event
 * \param param1 1st parameter for this event
 * \param param2 2nd parameter for this event
 * \param param3 3rd parameter for this event
 * \param param4 4th parameter for this event
 * \param param5 5th parameter for this event
 * \param param6 6th parameter for this event
 * \param param7 7th parameter for this event
 * \param param8 8th parameter for this event
 * \param param9 9th parameter for this event
 * \param param10 10th parameter for this event
 */
#define litl_read_get_param_10(p_evt,					\
			       param1,					\
			       param2,					\
			       param3,					\
			       param4,					\
			       param5,					\
			       param6,					\
			       param7,					\
			       param8,					\
			       param9,					\
			       param10)					\
  do {									\
    void* _ptr_;							\
    __LITL_READ_INIT_PTR(p_evt, _ptr_);					\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param1);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param2);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param3);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param4);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param5);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param6);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param7);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param8);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param9);				\
    __LITL_READ_GET_ARG(p_evt, _ptr_, param10);				\
  } while(0)

#endif /* LITL_READ_H_ */