~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
*   Header Files                                                               *
34
34
*******************************************************************************/
35
35
#include "the-solaris-kernel.h"
36
 
 
 
36
#include "internal/iprt.h"
37
37
#include <iprt/semaphore.h>
 
38
 
 
39
#include <iprt/asm.h>
 
40
#include <iprt/assert.h>
38
41
#include <iprt/err.h>
39
 
#include <iprt/alloc.h>
40
 
#include <iprt/assert.h>
41
 
#include <iprt/asm.h>
42
 
 
 
42
#include <iprt/mem.h>
 
43
#include <iprt/thread.h>
43
44
#include "internal/magics.h"
44
45
 
45
46
 
58
59
} RTSEMFASTMUTEXINTERNAL, *PRTSEMFASTMUTEXINTERNAL;
59
60
 
60
61
 
 
62
 
61
63
RTDECL(int)  RTSemFastMutexCreate(PRTSEMFASTMUTEX pMutexSem)
62
64
{
63
65
    AssertCompile(sizeof(RTSEMFASTMUTEXINTERNAL) > sizeof(void *));
64
66
    AssertPtrReturn(pMutexSem, VERR_INVALID_POINTER);
 
67
    RT_ASSERT_PREEMPTIBLE();
65
68
 
66
69
    PRTSEMFASTMUTEXINTERNAL pFastInt = (PRTSEMFASTMUTEXINTERNAL)RTMemAlloc(sizeof(*pFastInt));
67
70
    if (pFastInt)
84
87
    AssertMsgReturn(pFastInt->u32Magic == RTSEMFASTMUTEX_MAGIC,
85
88
                    ("pFastInt->u32Magic=%RX32 pFastInt=%p\n", pFastInt->u32Magic, pFastInt),
86
89
                    VERR_INVALID_PARAMETER);
 
90
    RT_ASSERT_INTS_ON();
87
91
 
88
92
    ASMAtomicXchgU32(&pFastInt->u32Magic, RTSEMFASTMUTEX_MAGIC_DEAD);
89
93
    rw_destroy(&pFastInt->Mtx);
100
104
    AssertMsgReturn(pFastInt->u32Magic == RTSEMFASTMUTEX_MAGIC,
101
105
                    ("pFastInt->u32Magic=%RX32 pFastInt=%p\n", pFastInt->u32Magic, pFastInt),
102
106
                    VERR_INVALID_PARAMETER);
 
107
    RT_ASSERT_PREEMPTIBLE();
103
108
 
104
109
    rw_enter(&pFastInt->Mtx, RW_WRITER);
105
110
    return VINF_SUCCESS;
113
118
    AssertMsgReturn(pFastInt->u32Magic == RTSEMFASTMUTEX_MAGIC,
114
119
                    ("pFastInt->u32Magic=%RX32 pFastInt=%p\n", pFastInt->u32Magic, pFastInt),
115
120
                    VERR_INVALID_PARAMETER);
 
121
    RT_ASSERT_INTS_ON();
116
122
 
117
123
    rw_exit(&pFastInt->Mtx);
118
124
    return VINF_SUCCESS;