This file is indexed.

/usr/include/sphde/sphthread.h is in libsphde-dev 1.3.0-1+b1.

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
/*
 * Copyright (c) 2007-2014 IBM Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation, Steven Munroe - initial API and implementation
 * sjm 2010-09-05       Added externs for proc/thread ID 
 *                      Added fast inline PID/TID get functions *
 *     IBM Corporation, Adhemerval Zanella - documentation
 */

#ifndef __SPHTHREAD_H
#define __SPHTHREAD_H

#include <unistd.h>

/*!
 * \file  sphthread.h
 * \brief Thread utility functions
 *
 * The process pid can be obtained using ::sphdeGetPID, thread id by
 * ::sphdeGetTID, and command line string by ::sphdeGetCmdLine. Fast versions
 * that access static variables and avoid syscall where possible are
 * provided: ::sphFastGetPID for process id and ::sphFastGetTID for thread id.
 *
 * For instance, to provide a fast event log header:
 *
 * \code
 *
 * struct eventHeader
 * {
 *   unsigned int eventID;
 *   unsigned short pid;
 *   unsigned short tid;
 *   unsigned sphtimer_t timestamp;
 * } evh;
 *
 * evh.eventID = 0;
 * evh.pid = sphFastGetPID ();
 * evh.tid = sphFastGetTID ();
 * evh.timestamp = sphgettimer ();
 *
 * \endcode
 */

#ifdef __cplusplus
#define __C__ "C"
#else
#define __C__
#endif

/*!
 * \brief Return the process identification.
 *
 * The function issues a syscall when needed and it also update its internal
 * command line value (so a subsequent call to ::sphdeGetCmdLine will just
 * return the already available command line value).
 *
 * @return The process id or 0 if an error occurs.
 */
extern __C__ pid_t
sphdeGetPID (void);

/*!
 * \brief Return the thread identification.
 *
 * The function issues a syscall when needed. The thread identification value
 * is a per-thread variable so a subsequent call to ::sphFastGetTID will just
 * need to return a variable value (no syscall needed).
 *
 * @return The thread identification or -1 if an error occurs.
 */
extern __C__ pid_t
sphdeGetTID (void);

/*!
 * \brief Return the command line string.
 *
 * The command line is obtained from '/proc/pid/cmdline' and maintained in
 * an internal static variable.
 *
 * @return A null-terminated string with the process command line.
 */
extern __C__ char *
sphdeGetCmdLine (void);

/*!
 * Process identification variable. Should not be accessed directly, instead
 * the function ::sphFastGetPID should be used.
 */
extern pid_t procID;

/*!
 * \brief Return the process identification.
 *
 * Fast version of ::sphdeGetPID.
 *
 * @return The process id or 0 if an error occurs.
 */
static inline int
sphFastGetPID (void)
{
  int pid = procID;
  if (__builtin_expect ((!pid), 0))
    {
      pid = sphdeGetPID ();
    }
  return pid;
}

/*!
 * Per-thread thread identification variable. Should not be accessed directly,
 * instead the function ::sphFastGetTID should be used.
 */
extern __thread pid_t threadID __attribute__ ((tls_model ("initial-exec")));

/*!
 * \brief Return the thread identification.
 *
 * Fast version of ::sphdeGetTID.
 *
 * @return The thread identification or -1 if an error occurs.
 */
static inline int
sphFastGetTID (void)
{
  int tid = threadID;
  if (__builtin_expect ((!tid), 0))
    {
      tid = sphdeGetTID ();
    }
  return tid;
}

#endif