This file is indexed.

/usr/include/oclgrind/Queue.h is in liboclgrind-dev 16.10-3.

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
// Queue.h (Oclgrind)
// Copyright (c) 2013-2016, James Price and Simon McIntosh-Smith,
// University of Bristol. All rights reserved.
//
// This program is provided under a three-clause BSD license. For full
// license terms please see the LICENSE file distributed with this
// source code.

#pragma once
#include "common.h"

namespace oclgrind
{
  class Context;
  class Kernel;

  struct Event
  {
    int state;
    double queueTime, startTime, endTime;
    Event();
  };

  class Queue
  {
  public:
    enum CommandType {EMPTY, COPY, COPY_RECT, FILL_BUFFER, FILL_IMAGE, KERNEL,
                      MAP, NATIVE_KERNEL, READ, READ_RECT, UNMAP, WRITE,
                      WRITE_RECT};
    struct Command
    {
      CommandType type;
      std::list<Event*> waitList;
      Command()
      {
        type = EMPTY;
      }
    private:
      Event *event;
      friend class Queue;
    };
    struct BufferCommand : Command
    {
      unsigned char *ptr;
      size_t address, size;
      BufferCommand(CommandType t)
      {
        type = t;
      }
    };
    struct BufferRectCommand : Command
    {
      unsigned char *ptr;
      size_t address;
      size_t region[3];
      size_t host_offset[3];
      size_t buffer_offset[3];
      BufferRectCommand(CommandType t)
      {
        type = t;
      }
    };
    struct CopyCommand : Command
    {
      size_t src, dst, size;
      CopyCommand()
      {
        type = COPY;
      }
    };
    struct CopyRectCommand : Command
    {
      size_t src, dst;
      size_t region[3];
      size_t src_offset[3];
      size_t dst_offset[3];
      CopyRectCommand()
      {
        type = COPY_RECT;
      }
    };
    struct FillBufferCommand : Command
    {
      size_t address, size;
      size_t pattern_size;
      unsigned char *pattern;
      FillBufferCommand(const unsigned char *p, size_t sz)
      {
        type = FILL_BUFFER;
        pattern = new unsigned char[sz];
        pattern_size = sz;
        memcpy(pattern, p, sz);
      }
      ~FillBufferCommand()
      {
        delete[] pattern;
      }
    };
    struct FillImageCommand : Command
    {
      size_t base;
      size_t origin[3], region[3];
      size_t rowPitch, slicePitch;
      size_t pixelSize;
      unsigned char color[16];
      FillImageCommand(size_t b, const size_t o[3], const size_t r[3],
                       size_t rp, size_t sp,
                       size_t ps, const unsigned char *col)
      {
        type = FILL_IMAGE;
        base = b;
        memcpy(origin, o, sizeof(size_t)*3);
        memcpy(region, r, sizeof(size_t)*3);
        rowPitch = rp;
        slicePitch = sp;
        pixelSize = ps;
        memcpy(color, col, 16);
      }
    };
    struct KernelCommand : Command
    {
      Kernel *kernel;
      unsigned int work_dim;
      Size3 globalOffset;
      Size3 globalSize;
      Size3 localSize;
      KernelCommand()
      {
        type = KERNEL;
      }
    };
    struct NativeKernelCommand : Command
    {
      void (CL_CALLBACK *func)(void *);
      void *args;
      NativeKernelCommand(void (CL_CALLBACK *f)(void *),
                          void *a, size_t sz)
      {
        type = NATIVE_KERNEL;
        func = f;
        if (a)
        {
          args = malloc(sz);
          memcpy(args, a, sz);
        }
        else
        {
          args = NULL;
        }
      }
      ~NativeKernelCommand()
      {
        if (args)
        {
          free(args);
        }
      }
    };
    struct MapCommand : Command
    {
      void *ptr;
      size_t address;
      size_t offset;
      size_t size;
      cl_map_flags flags;
      MapCommand()
      {
        type = MAP;
      }
    };
    struct UnmapCommand : Command
    {
      const void *ptr;
      size_t address;
      UnmapCommand()
      {
        type = UNMAP;
      }
    };

  public:
    Queue(const Context *context);
    virtual ~Queue();

    Event* enqueue(Command *command);

    void executeCopyBuffer(CopyCommand *cmd);
    void executeCopyBufferRect(CopyRectCommand *cmd);
    void executeFillBuffer(FillBufferCommand *cmd);
    void executeFillImage(FillImageCommand *cmd);
    void executeKernel(KernelCommand *cmd);
    void executeMap(MapCommand *cmd);
    void executeNativeKernel(NativeKernelCommand *cmd);
    void executeReadBuffer(BufferCommand *cmd);
    void executeReadBufferRect(BufferRectCommand *cmd);
    void executeUnmap(UnmapCommand *cmd);
    void executeWriteBuffer(BufferCommand *cmd);
    void executeWriteBufferRect(BufferRectCommand *cmd);

    bool isEmpty() const;
    Command* update();

  private:
    const Context *m_context;
    std::queue<Command*> m_queue;
  };
}