This file is indexed.

/usr/include/arc/data/DataStatus.h is in nordugrid-arc-dev 4.2.0-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
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
// -*- indent-tabs-mode: nil -*-

#ifndef __ARC_DATASTATUS_H__
#define __ARC_DATASTATUS_H__

#include <iostream>
#include <string>
#include <errno.h>

#include <arc/StringConv.h>
#include <arc/Utils.h>

namespace Arc {
  
#define DataStatusRetryableBase (100)

#define DataStatusErrnoBase 1000
#define EARCTRANSFERTIMEOUT  (DataStatusErrnoBase + 1) // Transfer timed out
#define EARCCHECKSUM         (DataStatusErrnoBase + 2) // Checksum mismatch
#define EARCLOGIC            (DataStatusErrnoBase + 3) // Bad logic, eg calling StartWriting on a
                                                       // DataPoint currently reading
#define EARCRESINVAL         (DataStatusErrnoBase + 4) // All results obtained from a service are invalid
#define EARCSVCTMP           (DataStatusErrnoBase + 5) // Temporary service error
#define EARCSVCPERM          (DataStatusErrnoBase + 6) // Permanent service error
#define EARCUIDSWITCH        (DataStatusErrnoBase + 7) // Error switching uid
#define EARCREQUESTTIMEOUT   (DataStatusErrnoBase + 8) // Request made to remote service timed out
#define EARCOTHER            (DataStatusErrnoBase + 9) // Other / unknown error

#define DataStatusErrnoMax EARCOTHER

  /// Status code returned by many DataPoint methods.
  /**
   * A class to be used for return types of all major data handling methods.
   * It describes the outcome of the method and contains three fields:
   * DataStatusType describes in which operation the error occurred, Errno
   * describes why the error occurred and desc gives more detail if available.
   * Errno is an integer corresponding to error codes defined in errno.h plus
   * additional ARC-specific error codes defined here.
   *
   * For those DataPoints which natively support errno, it is safe to use code
   * like
   * @code
   * DataStatus s = someMethod();
   * if (!s) {
   *   logger.msg(ERROR, "someMethod failed: %s", StrError(errno));
   *   return DataStatus(DataStatus::ReadError, errno);
   * }
   * @endcode
   * since logger.msg() does not call any system calls that modify errno.
   *
   * \ingroup data
   * \headerfile DataStatus.h arc/data/DataStatus.h
   */
  class DataStatus {

  public:

    /// Status codes
    /**
     * These codes describe in which operation an error occurred. Retryable
     * error codes are deprecated - the corresponding non-retryable error code
     * should be used with errno set to a retryable value.
     */
    enum DataStatusType {
      // Order is important! Must be kept synchronised with status_string[]

      /// Operation completed successfully
      Success,

      /// Source is bad URL or can't be used due to some reason
      ReadAcquireError,

      /// Destination is bad URL or can't be used due to some reason
      WriteAcquireError,

      /// Resolving of index service URL for source failed
      ReadResolveError,

      /// Resolving of index service URL for destination failed
      WriteResolveError,

      /// Can't read from source
      ReadStartError,

      /// Can't write to destination
      WriteStartError,

      /// Failed while reading from source
      ReadError,

      /// Failed while writing to destination
      WriteError,

      /// Failed while transfering data (mostly timeout)
      TransferError,

      /// Failed while finishing reading from source
      ReadStopError,

      /// Failed while finishing writing to destination
      WriteStopError,

      /// First stage of registration of index service URL failed
      PreRegisterError,

      /// Last stage of registration of index service URL failed
      PostRegisterError,

      /// Unregistration of index service URL failed
      UnregisterError,

      /// Error in caching procedure
      CacheError,

      /// Error due to provided credentials are expired
      CredentialsExpiredError,

      /// Error deleting location or URL
      DeleteError,

      /// No valid location available
      NoLocationError,

      /// No valid location available
      LocationAlreadyExistsError,

      /// Operation has no sense for this kind of URL
      NotSupportedForDirectDataPointsError,

      /// Feature is unimplemented
      UnimplementedError,

      /// DataPoint is already reading
      IsReadingError,

      /// DataPoint is already writing
      IsWritingError,

      /// Access check failed
      CheckError,

      /// Directory listing failed
      ListError,
      /// @deprecated ListError with errno set to ENOTDIR should be used instead
      ListNonDirError,

      /// File/dir stating failed
      StatError,
      /// @deprecated StatError with errno set to ENOENT should be used instead
      StatNotPresentError,

      /// Object initialization failed
      NotInitializedError,

      /// Error in OS
      SystemError,
    
      /// Staging error
      StageError,
      
      /// Inconsistent metadata
      InconsistentMetadataError,
 
      /// Can't prepare source
      ReadPrepareError,

      /// Wait for source to be prepared
      ReadPrepareWait,

      /// Can't prepare destination
      WritePrepareError,

      /// Wait for destination to be prepared
      WritePrepareWait,

      /// Can't finish source
      ReadFinishError,

      /// Can't finish destination
      WriteFinishError,

      /// Can't create directory
      CreateDirectoryError,

      /// Can't rename URL
      RenameError,

      /// Data was already cached
      SuccessCached,
      
      /// Operation was cancelled successfully
      SuccessCancelled,

      /// General error which doesn't fit any other error
      GenericError,

      /// Undefined
      UnknownError,

      // These Retryable error codes are deprecated but kept for backwards
      // compatibility. They will be removed in a future major release.
      // Instead of these codes the corresponding non-retryable code should be
      // used with an errno, and this is used to determine whether the error is
      // retryable.
      ReadAcquireErrorRetryable = DataStatusRetryableBase+ReadAcquireError, ///< @deprecated
      WriteAcquireErrorRetryable = DataStatusRetryableBase+WriteAcquireError, ///< @deprecated
      ReadResolveErrorRetryable = DataStatusRetryableBase+ReadResolveError, ///< @deprecated
      WriteResolveErrorRetryable = DataStatusRetryableBase+WriteResolveError, ///< @deprecated
      ReadStartErrorRetryable = DataStatusRetryableBase+ReadStartError, ///< @deprecated
      WriteStartErrorRetryable = DataStatusRetryableBase+WriteStartError, ///< @deprecated
      ReadErrorRetryable = DataStatusRetryableBase+ReadError, ///< @deprecated
      WriteErrorRetryable = DataStatusRetryableBase+WriteError, ///< @deprecated
      TransferErrorRetryable = DataStatusRetryableBase+TransferError, ///< @deprecated
      ReadStopErrorRetryable = DataStatusRetryableBase+ReadStopError, ///< @deprecated
      WriteStopErrorRetryable = DataStatusRetryableBase+WriteStopError, ///< @deprecated
      PreRegisterErrorRetryable = DataStatusRetryableBase+PreRegisterError, ///< @deprecated
      PostRegisterErrorRetryable = DataStatusRetryableBase+PostRegisterError, ///< @deprecated
      UnregisterErrorRetryable = DataStatusRetryableBase+UnregisterError, ///< @deprecated
      CacheErrorRetryable = DataStatusRetryableBase+CacheError, ///< @deprecated
      DeleteErrorRetryable = DataStatusRetryableBase+DeleteError, ///< @deprecated
      CheckErrorRetryable = DataStatusRetryableBase+CheckError, ///< @deprecated
      ListErrorRetryable = DataStatusRetryableBase+ListError, ///< @deprecated
      StatErrorRetryable = DataStatusRetryableBase+StatError, ///< @deprecated
      StageErrorRetryable = DataStatusRetryableBase+StageError, ///< @deprecated
      ReadPrepareErrorRetryable = DataStatusRetryableBase+ReadPrepareError, ///< @deprecated
      WritePrepareErrorRetryable = DataStatusRetryableBase+WritePrepareError, ///< @deprecated
      ReadFinishErrorRetryable = DataStatusRetryableBase+ReadFinishError, ///< @deprecated
      WriteFinishErrorRetryable = DataStatusRetryableBase+WriteFinishError, ///< @deprecated
      CreateDirectoryErrorRetryable = DataStatusRetryableBase+CreateDirectoryError, ///< @deprecated
      RenameErrorRetryable = DataStatusRetryableBase+RenameError, ///< @deprecated
      GenericErrorRetryable = DataStatusRetryableBase+GenericError ///< @deprecated
   };

    /// Constructor to use when errno-like information is not available.
    /**
     * \param status error location
     * \param desc error description
     */
    DataStatus(const DataStatusType& status, std::string desc="")
      : status(status), Errno(0), desc(desc) {
      if (!Passed()) Errno = EARCOTHER;
    }

    /// Construct a new DataStatus with errno and optional text description.
    /**
     * If the status is an error condition then error_no must be set to a
     * non-zero value.
     * \param status error location
     * \param error_no errno
     * \param desc error description
     */
    DataStatus(const DataStatusType& status, int error_no, const std::string& desc="")
      : status(status), Errno(error_no), desc(desc) {}

    /// Construct a new DataStatus with fields initialised to success states.
    DataStatus()
      : status(Success), Errno(0), desc("") {}

    /// Returns true if this status type matches s.
    bool operator==(const DataStatusType& s) {
      return status == s;
    }
    /// Returns true if this status type matches the status type of s.
    bool operator==(const DataStatus& s) {
      return status == s.status;
    }
  
    /// Returns true if this status type does not match s.
    bool operator!=(const DataStatusType& s) {
      return status != s;
    }
    /// Returns true if this status type does not match the status type of s.
    bool operator!=(const DataStatus& s) {
      return status != s.status;
    }

    /// Assignment operator.
    /**
     * Sets status type to s and errno to EARCOTHER if s is an error state.
     */
    DataStatus operator=(const DataStatusType& s) {
      status = s;
      Errno = 0;
      if (!Passed()) Errno = EARCOTHER;
      return *this;
    }

    /// Returns true if status type is not a success value.
    bool operator!() const {
      return (status != Success) && (status != SuccessCached);
    }
    /// Returns true if status type is a success value.
    operator bool() const {
      return (status == Success) || (status == SuccessCached);
    }

    /// Returns true if no error occurred
    bool Passed() const {
      return ((status == Success) || (status == NotSupportedForDirectDataPointsError) ||
              (status == ReadPrepareWait) || (status == WritePrepareWait) ||
              (status == SuccessCached) || (status == SuccessCancelled));
    }
  
    /// Returns true if the error was temporary and could be retried.
    /**
     * Retryable error numbers are EAGAIN, EBUSY, ETIMEDOUT, EARCSVCTMP,
     * EARCTRANSFERTIMEOUT, EARCCHECKSUM and EARCOTHER.
     */
    bool Retryable() const;

    /// Set the error number.
    void SetErrno(int error_no) {
      Errno = error_no;
    }
  
    /// Get the error number.
    int GetErrno() const {
      return Errno;
    }

    /// Get text description of the error number.
    std::string GetStrErrno() const;

    /// Set a detailed description of the status, removing trailing new line if present.
    void SetDesc(const std::string& d) {
      desc = trim(d);
    }
    
    /// Get a detailed description of the status.
    std::string GetDesc() const {
      return desc;
    }

    /// Returns a human-friendly readable string with all error information.
    operator std::string(void) const;

  private:
  
    /// status code
    DataStatusType status;
    /// error number (values defined in errno.h)
    int Errno;
    /// description of failure
    std::string desc;

  };

  /// Write a human-friendly readable string with all error information to o.
  /** \ingroup data */
  inline std::ostream& operator<<(std::ostream& o, const DataStatus& d) {
    return (o << ((std::string)d));
  }
} // namespace Arc


#endif // __ARC_DATASTATUS_H__