This file is indexed.

/usr/include/sipxtapi/os/linux/OsRWMutexLinux.h is in libsipxtapi-dev 3.3.0~test17-1.

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
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp.  All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////


#ifndef _OsRWMutexLinux_h_
#define _OsRWMutexLinux_h_

// SYSTEM INCLUDES
#include <pthread.h>
#include <assert.h>

// APPLICATION INCLUDES
#include "os/OsRWMutex.h"

// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
#ifdef ANDROID // [
// Bionic's pthreads implementation does not provide support for RW-locks.
// As a first attempt we simply replaced RW-locks with usual mutexes.
// I think this way is good way to go, because RW-locks for ARM-based device
// is an overkill. But if we discover any problems with this solution, we can
// switch to our own RW-locks implementation in sipXportLib/src/shared/OsRWMutexShared.cpp.
   typedef pthread_mutex_t pthread_rwlock_t;
#  define pthread_rwlock_init      pthread_mutex_init
#  define pthread_rwlock_destroy   pthread_mutex_destroy
#  define pthread_rwlock_rdlock    pthread_mutex_lock
#  define pthread_rwlock_wrlock    pthread_mutex_lock
#  define pthread_rwlock_tryrdlock pthread_mutex_trylock
#  define pthread_rwlock_trywrlock pthread_mutex_trylock
#  define pthread_rwlock_unlock    pthread_mutex_unlock
#endif // ANDROID ]

// FORWARD DECLARATIONS

//:Mutual exclusion semaphore handling multiple readers and writers
// Two kinds of concurrent tasks, called "readers" and "writers", share a
// single resource. The readers can use the resource simultaneously, but each
// writer must have exclusive access to it. When a writer is ready to use the
// resource, it should be enabled to do so as soon as possible.
class OsRWMutexLinux
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

   enum QueueOptions
   {
      Q_FIFO     = 0x0, // queue blocked tasks on a first-in, first-out basis
      Q_PRIORITY = 0x1  // queue blocked tasks based on their priority
   };

/* ============================ CREATORS ================================== */

     /// Default constructor
   OsRWMutexLinux(const int queueOptions);

     /// Destructor
   ~OsRWMutexLinux();

/* ============================ MANIPULATORS ============================== */

   OsStatus acquireRead();
     //:Block (if necessary) until the task acquires the resource for reading
     // Multiple simultaneous readers are allowed.

   OsStatus acquireWrite();
     //:Block (if necessary) until the task acquires the resource for writing
     // Only one writer at a time is allowed (and no readers).

   OsStatus tryAcquireRead();
     //:Conditionally acquire the resource for reading (i.e., don't block)
     // Multiple simultaneous readers are allowed.
     // Return OS_BUSY if the resource is held for writing by some other task

   OsStatus tryAcquireWrite();
     //:Conditionally acquire the resource for writing (i.e., don't block).
     // Only one writer at a time is allowed (and no readers).
     // Return OS_BUSY if the resource is held for writing by some other task
     // or if there are running readers.

   OsStatus releaseRead();
     //:Release the resource for reading

   OsStatus releaseWrite();
     //:Release the resource for writing

/* ============================ ACCESSORS ================================= */

/* ============================ INQUIRY =================================== */

/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:

/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:

   pthread_rwlock_t mLockImp;

     /// Copy constructor (not implemented for this class)
   OsRWMutexLinux(const OsRWMutexLinux& rhs);

     /// Assignment operator (not implemented for this class)
   OsRWMutexLinux& operator=(const OsRWMutexLinux& rhs);

};

/* ============================ INLINE METHODS ============================ */

#endif  // _OsRWMutexLinux_h_