summaryrefslogtreecommitdiff
path: root/src/VBox/Runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Runtime')
-rw-r--r--src/VBox/Runtime/.scm-settings2
-rw-r--r--src/VBox/Runtime/Doxyfile2
-rw-r--r--src/VBox/Runtime/Makefile.kmk214
-rw-r--r--src/VBox/Runtime/VBox/RTAssertShouldPanic-vbox.cpp35
-rw-r--r--src/VBox/Runtime/VBox/VBoxRTDeps.cpp10
-rw-r--r--src/VBox/Runtime/VBox/VBoxRTImp.def2
-rw-r--r--src/VBox/Runtime/VBox/log-vbox.cpp7
-rw-r--r--src/VBox/Runtime/VBox/logbackdoor-redirect.cpp2
-rw-r--r--src/VBox/Runtime/VBox/logbackdoor.cpp2
-rw-r--r--src/VBox/Runtime/common/alloc/alloc.cpp6
-rw-r--r--src/VBox/Runtime/common/alloc/heapoffset.cpp2
-rw-r--r--src/VBox/Runtime/common/alloc/heapsimple.cpp2
-rw-r--r--src/VBox/Runtime/common/alloc/memcache.cpp2
-rw-r--r--src/VBox/Runtime/common/alloc/memtracker.cpp1306
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicCmpXchgExU64.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicUoReadU64.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMAtomicXchgU64.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm2
-rw-r--r--src/VBox/Runtime/common/asm/ASMNopPause.asm2
-rw-r--r--src/VBox/Runtime/common/asm/asm-fake.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/RTSha1Digest.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/adler32.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/crc32-zlib.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/crc32.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/crc64.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/ipv4.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/ipv6.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/manifest-file.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/manifest.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/manifest2.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/manifest3.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/md5.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/md5str.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/sha1.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/sha1str.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/sha256.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/sha256str.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/sha512.cpp2
-rw-r--r--src/VBox/Runtime/common/checksum/sha512str.cpp2
-rw-r--r--src/VBox/Runtime/common/dbg/dbg.cpp2
-rw-r--r--src/VBox/Runtime/common/dbg/dbgas.cpp2
-rw-r--r--src/VBox/Runtime/common/dbg/dbgmod.cpp2
-rw-r--r--src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp2
-rw-r--r--src/VBox/Runtime/common/dbg/dbgmodnm.cpp4
-rw-r--r--src/VBox/Runtime/common/dvm/Makefile.kup0
-rw-r--r--src/VBox/Runtime/common/dvm/dvm.cpp481
-rw-r--r--src/VBox/Runtime/common/dvm/dvmbsdlabel.cpp517
-rw-r--r--src/VBox/Runtime/common/dvm/dvmgpt.cpp536
-rw-r--r--src/VBox/Runtime/common/dvm/dvmmbr.cpp406
-rw-r--r--src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp2
-rw-r--r--src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp3
-rw-r--r--src/VBox/Runtime/common/err/errinfo.cpp2
-rw-r--r--src/VBox/Runtime/common/err/errmsg.cpp2
-rw-r--r--src/VBox/Runtime/common/err/errmsg.sed10
-rw-r--r--src/VBox/Runtime/common/err/errmsgcom.sed2
-rw-r--r--src/VBox/Runtime/common/err/errmsgxpcom.cpp2
-rw-r--r--src/VBox/Runtime/common/ldr/ldr.cpp21
-rw-r--r--src/VBox/Runtime/common/ldr/ldrELF.cpp2
-rw-r--r--src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h2
-rw-r--r--src/VBox/Runtime/common/ldr/ldrEx.cpp2
-rw-r--r--src/VBox/Runtime/common/ldr/ldrFile.cpp21
-rw-r--r--src/VBox/Runtime/common/ldr/ldrNative.cpp2
-rw-r--r--src/VBox/Runtime/common/ldr/ldrPE.cpp2
-rw-r--r--src/VBox/Runtime/common/ldr/ldrkStuff.cpp2
-rw-r--r--src/VBox/Runtime/common/log/log.cpp728
-rw-r--r--src/VBox/Runtime/common/log/logcom.cpp2
-rw-r--r--src/VBox/Runtime/common/log/logellipsis.cpp2
-rw-r--r--src/VBox/Runtime/common/log/logformat.cpp2
-rw-r--r--src/VBox/Runtime/common/log/logrel.cpp2
-rw-r--r--src/VBox/Runtime/common/log/logrelellipsis.cpp2
-rw-r--r--src/VBox/Runtime/common/log/tracebuf.cpp662
-rw-r--r--src/VBox/Runtime/common/log/tracedefault.cpp57
-rw-r--r--src/VBox/Runtime/common/math/ceill.asm2
-rw-r--r--src/VBox/Runtime/common/math/cosl.asm2
-rw-r--r--src/VBox/Runtime/common/math/fabs.asm2
-rw-r--r--src/VBox/Runtime/common/math/fabsf.asm2
-rw-r--r--src/VBox/Runtime/common/math/fabsl.asm2
-rw-r--r--src/VBox/Runtime/common/math/floor.asm2
-rw-r--r--src/VBox/Runtime/common/math/floorf.asm2
-rw-r--r--src/VBox/Runtime/common/math/floorl.asm2
-rw-r--r--src/VBox/Runtime/common/math/ldexpl.asm2
-rw-r--r--src/VBox/Runtime/common/math/llrint.asm2
-rw-r--r--src/VBox/Runtime/common/math/llrintf.asm2
-rw-r--r--src/VBox/Runtime/common/math/llrintl.asm2
-rw-r--r--src/VBox/Runtime/common/math/logl.asm2
-rw-r--r--src/VBox/Runtime/common/math/lrint.asm2
-rw-r--r--src/VBox/Runtime/common/math/lrintf.asm2
-rw-r--r--src/VBox/Runtime/common/math/lrintl.asm2
-rw-r--r--src/VBox/Runtime/common/math/remainder.asm2
-rw-r--r--src/VBox/Runtime/common/math/remainderf.asm2
-rw-r--r--src/VBox/Runtime/common/math/remainderl.asm2
-rw-r--r--src/VBox/Runtime/common/math/sinl.asm2
-rw-r--r--src/VBox/Runtime/common/math/tanl.asm2
-rw-r--r--src/VBox/Runtime/common/math/trunc.asm2
-rw-r--r--src/VBox/Runtime/common/math/truncf.asm2
-rw-r--r--src/VBox/Runtime/common/math/truncl.asm2
-rw-r--r--src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/RTAssertMsg2.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/RTAssertMsg2Add.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/RTAssertMsg2AddWeak.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/RTAssertMsg2AddWeakV.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/RTAssertMsg2Weak.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/RTAssertMsg2WeakV.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/RTFileOpenF.cpp4
-rw-r--r--src/VBox/Runtime/common/misc/RTFileOpenV.cpp4
-rw-r--r--src/VBox/Runtime/common/misc/RTMemWipeThoroughly.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/assert.cpp16
-rw-r--r--src/VBox/Runtime/common/misc/buildconfig.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/cidr.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/circbuf.cpp121
-rw-r--r--src/VBox/Runtime/common/misc/getopt.cpp20
-rw-r--r--src/VBox/Runtime/common/misc/getoptargv.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/handle.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/handletable.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/handletable.h2
-rw-r--r--src/VBox/Runtime/common/misc/handletablectx.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/handletablesimple.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/lockvalidator.cpp30
-rw-r--r--src/VBox/Runtime/common/misc/message.cpp37
-rw-r--r--src/VBox/Runtime/common/misc/once.cpp6
-rw-r--r--src/VBox/Runtime/common/misc/req.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/s3.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/sanity-c.c2
-rw-r--r--src/VBox/Runtime/common/misc/sanity-cpp.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/sanity.h2
-rw-r--r--src/VBox/Runtime/common/misc/semspingpong.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/setjmp.asm2
-rw-r--r--src/VBox/Runtime/common/misc/sg.cpp9
-rw-r--r--src/VBox/Runtime/common/misc/term.cpp2
-rw-r--r--src/VBox/Runtime/common/misc/thread.cpp203
-rw-r--r--src/VBox/Runtime/common/path/RTPathAbsDup.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathAbsEx.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathAbsExDup.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathAppend.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathAppendEx.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathChangeToDosSlashes.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathChangeToUnixSlashes.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathCopyComponents.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathCountComponents.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathExt.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathFilename.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathHaveExt.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathHavePath.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathJoin.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathJoinA.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathJoinEx.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathParse.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathRealDup.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathStartsWithRoot.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathStripExt.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathStripFilename.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathStripTrailingSlash.cpp2
-rw-r--r--src/VBox/Runtime/common/path/RTPathTraverseList.cpp2
-rw-r--r--src/VBox/Runtime/common/path/comparepaths.cpp2
-rw-r--r--src/VBox/Runtime/common/path/rtPathRootSpecLen.cpp2
-rw-r--r--src/VBox/Runtime/common/path/rtPathVolumeSpecLen.cpp2
-rw-r--r--src/VBox/Runtime/common/rand/rand.cpp2
-rw-r--r--src/VBox/Runtime/common/rand/randadv.cpp22
-rw-r--r--src/VBox/Runtime/common/rand/randparkmiller.cpp2
-rw-r--r--src/VBox/Runtime/common/sort/RTSortApvIsSorted.cpp2
-rw-r--r--src/VBox/Runtime/common/sort/RTSortIsSorted.cpp2
-rw-r--r--src/VBox/Runtime/common/sort/shellsort.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrCat.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrCatEx.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrCatP.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrCatPEx.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrCmp.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrConvertHexBytes.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrCopy.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrCopyEx.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrCopyP.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrCopyPEx.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrNCmp.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrNLen.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrNLenEx.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrPrintHexBytes.cpp2
-rw-r--r--src/VBox/Runtime/common/string/RTStrStr.cpp2
-rw-r--r--src/VBox/Runtime/common/string/base64.cpp2
-rw-r--r--src/VBox/Runtime/common/string/memchr.asm2
-rw-r--r--src/VBox/Runtime/common/string/memchr.cpp2
-rw-r--r--src/VBox/Runtime/common/string/memchr_alias.c2
-rw-r--r--src/VBox/Runtime/common/string/memcmp.asm2
-rw-r--r--src/VBox/Runtime/common/string/memcmp.cpp2
-rw-r--r--src/VBox/Runtime/common/string/memcmp_alias.c2
-rw-r--r--src/VBox/Runtime/common/string/memcpy.asm2
-rw-r--r--src/VBox/Runtime/common/string/memcpy.cpp2
-rw-r--r--src/VBox/Runtime/common/string/memcpy_alias.c2
-rw-r--r--src/VBox/Runtime/common/string/memmove.asm2
-rw-r--r--src/VBox/Runtime/common/string/memmove_alias.c2
-rw-r--r--src/VBox/Runtime/common/string/mempcpy.asm2
-rw-r--r--src/VBox/Runtime/common/string/memset.asm2
-rw-r--r--src/VBox/Runtime/common/string/memset.cpp2
-rw-r--r--src/VBox/Runtime/common/string/memset_alias.c2
-rw-r--r--src/VBox/Runtime/common/string/ministring.cpp140
-rw-r--r--src/VBox/Runtime/common/string/simplepattern.cpp2
-rw-r--r--src/VBox/Runtime/common/string/straprintf.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strcache.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strchr.asm2
-rw-r--r--src/VBox/Runtime/common/string/strchr_alias.c2
-rw-r--r--src/VBox/Runtime/common/string/strcmp.asm2
-rw-r--r--src/VBox/Runtime/common/string/strcmp_alias.c2
-rw-r--r--src/VBox/Runtime/common/string/strcpy.asm2
-rw-r--r--src/VBox/Runtime/common/string/strcpy.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strcpy_alias.c2
-rw-r--r--src/VBox/Runtime/common/string/strformat.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strformatnum.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strformatrt.cpp140
-rw-r--r--src/VBox/Runtime/common/string/strformattype.cpp5
-rw-r--r--src/VBox/Runtime/common/string/stringalloc.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strlen.asm2
-rw-r--r--src/VBox/Runtime/common/string/strlen.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strlen_alias.c2
-rw-r--r--src/VBox/Runtime/common/string/strncmp.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strpbrk.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strprintf.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strspace.cpp42
-rw-r--r--src/VBox/Runtime/common/string/strstrip.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strtonum.cpp2
-rw-r--r--src/VBox/Runtime/common/string/strversion.cpp2
-rw-r--r--src/VBox/Runtime/common/string/uni.cpp2
-rw-r--r--src/VBox/Runtime/common/string/unidata.cpp2
-rw-r--r--src/VBox/Runtime/common/string/uniread.cpp2
-rw-r--r--src/VBox/Runtime/common/string/utf-16.cpp2
-rw-r--r--src/VBox/Runtime/common/string/utf-8-case.cpp2
-rw-r--r--src/VBox/Runtime/common/string/utf-8.cpp4
-rw-r--r--src/VBox/Runtime/common/table/avl_Base.cpp.h14
-rw-r--r--src/VBox/Runtime/common/table/avl_Destroy.cpp.h4
-rw-r--r--src/VBox/Runtime/common/table/avl_DoWithAll.cpp.h4
-rw-r--r--src/VBox/Runtime/common/table/avl_Enum.cpp.h10
-rw-r--r--src/VBox/Runtime/common/table/avl_Get.cpp.h4
-rw-r--r--src/VBox/Runtime/common/table/avl_GetBestFit.cpp.h4
-rw-r--r--src/VBox/Runtime/common/table/avl_Range.cpp.h4
-rw-r--r--src/VBox/Runtime/common/table/avl_RemoveBestFit.cpp.h4
-rw-r--r--src/VBox/Runtime/common/table/avlgcphys.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlgcptr.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlhcphys.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avllu32.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlogcphys.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlogcptr.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlohcphys.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avloioport.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlou32.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlpv.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlrfoff.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlrgcptr.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlrogcphys.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlrogcptr.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlroioport.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlroogcptr.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlrpv.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlru64.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlruintptr.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlu32.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avluintptr.cpp2
-rw-r--r--src/VBox/Runtime/common/table/avlul.cpp2
-rw-r--r--src/VBox/Runtime/common/table/table.cpp2
-rw-r--r--src/VBox/Runtime/common/time/time.cpp4
-rw-r--r--src/VBox/Runtime/common/time/timeprog.cpp2
-rw-r--r--src/VBox/Runtime/common/time/timesup.cpp4
-rw-r--r--src/VBox/Runtime/common/time/timesupA.asm2
-rw-r--r--src/VBox/Runtime/common/time/timesupA.mac2
-rw-r--r--src/VBox/Runtime/common/time/timesupref.cpp2
-rw-r--r--src/VBox/Runtime/common/time/timesupref.h2
-rw-r--r--src/VBox/Runtime/common/time/timesysalias.cpp2
-rw-r--r--src/VBox/Runtime/common/vfs/vfsbase.cpp4
-rw-r--r--src/VBox/Runtime/common/vfs/vfschain.cpp6
-rw-r--r--src/VBox/Runtime/common/vfs/vfsiosmisc.cpp2
-rw-r--r--src/VBox/Runtime/common/vfs/vfsmemory.cpp4
-rw-r--r--src/VBox/Runtime/common/vfs/vfsmisc.cpp4
-rw-r--r--src/VBox/Runtime/common/vfs/vfsstdfile.cpp8
-rw-r--r--src/VBox/Runtime/common/zip/gzipvfs.cpp2
-rw-r--r--src/VBox/Runtime/common/zip/tar.cpp2
-rw-r--r--src/VBox/Runtime/common/zip/tar.h2
-rw-r--r--src/VBox/Runtime/common/zip/tarcmd.cpp2
-rw-r--r--src/VBox/Runtime/common/zip/tarvfs.cpp2
-rw-r--r--src/VBox/Runtime/common/zip/zip.cpp2
-rw-r--r--src/VBox/Runtime/darwin/RTErrConvertFromDarwin.cpp2
-rw-r--r--src/VBox/Runtime/darwin/RTErrConvertFromDarwinCOM.cpp2
-rw-r--r--src/VBox/Runtime/darwin/RTErrConvertFromDarwinIO.cpp2
-rw-r--r--src/VBox/Runtime/darwin/RTErrConvertFromDarwinKern.cpp2
-rw-r--r--src/VBox/Runtime/gc/initterm-gc.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTDirCreateTemp-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTDirCreateUniqueNumbered-generic.cpp102
-rw-r--r--src/VBox/Runtime/generic/RTDirExists-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTDirQueryInfo-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTDirSetTimes-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTEnvDupEx-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTFileCopy-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTFileExists-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTFileMove-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTFileQuerySize-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTFileReadAll-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTFileReadAllByHandle-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTFileReadAllByHandleEx-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTFileReadAllEx-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTFileReadAllFree-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTLogDefaultInit-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTLogWriteDebugger-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTLogWriteStdErr-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTLogWriteStdOut-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTLogWriteUser-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpCpuId-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpGetArraySize-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpGetCount-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpGetCurFrequency-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpGetDescription-generic-stub.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpGetDescription-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpGetMaxFrequency-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpGetSet-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTProcDaemonize-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTProcIsRunningByName-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTRandAdvCreateSystemFaster-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTRandAdvCreateSystemTruer-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTSemEventMultiWait-2-ex-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTSemEventMultiWait-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTSemEventWait-2-ex-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTSemEventWait-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTSemEventWaitNoResume-2-ex-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTSemMutexRequest-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTSemMutexRequestDebug-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTSystemQueryDmiString-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTSystemQueryOSInfo-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTThreadGetAffinity-stub-generic.cpp44
-rw-r--r--src/VBox/Runtime/generic/RTThreadGetNativeState-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTThreadSetAffinity-stub-generic.cpp46
-rw-r--r--src/VBox/Runtime/generic/RTThreadSetAffinityToCpu-generic.cpp59
-rw-r--r--src/VBox/Runtime/generic/RTTimeLocalDeltaNano-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTTimeLocalExplode-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTTimerCreate-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTTimerLRCreate-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/RTUuidCreate-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/critsect-generic.cpp56
-rw-r--r--src/VBox/Runtime/generic/env-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/errvars-generic.cpp66
-rw-r--r--src/VBox/Runtime/generic/fs-stubs-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/mempool-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/mppresent-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/pathhost-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/sched-generic.cpp8
-rw-r--r--src/VBox/Runtime/generic/semfastmutex-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/semrw-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/semrw-lockless-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/semxroads-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/spinlock-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/strcache-stubs-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/timer-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/timerlr-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/tls-generic.cpp4
-rw-r--r--src/VBox/Runtime/generic/utf16locale-generic.cpp2
-rw-r--r--src/VBox/Runtime/generic/uuid-generic.cpp2
-rw-r--r--src/VBox/Runtime/include/internal/alignmentchecks.h2
-rw-r--r--src/VBox/Runtime/include/internal/assert.h6
-rw-r--r--src/VBox/Runtime/include/internal/dbgmod.h2
-rw-r--r--src/VBox/Runtime/include/internal/dir.h2
-rw-r--r--src/VBox/Runtime/include/internal/dvm.h286
-rw-r--r--src/VBox/Runtime/include/internal/file.h16
-rw-r--r--src/VBox/Runtime/include/internal/fileaio.h2
-rw-r--r--src/VBox/Runtime/include/internal/fs.h2
-rw-r--r--src/VBox/Runtime/include/internal/initterm.h6
-rw-r--r--src/VBox/Runtime/include/internal/iprt.h2
-rw-r--r--src/VBox/Runtime/include/internal/ldr.h2
-rw-r--r--src/VBox/Runtime/include/internal/ldrELF.h2
-rw-r--r--src/VBox/Runtime/include/internal/ldrELF32.h2
-rw-r--r--src/VBox/Runtime/include/internal/ldrELF64.h2
-rw-r--r--src/VBox/Runtime/include/internal/ldrMZ.h2
-rw-r--r--src/VBox/Runtime/include/internal/ldrMach-O.h2
-rw-r--r--src/VBox/Runtime/include/internal/ldrPE.h2
-rw-r--r--src/VBox/Runtime/include/internal/lockvalidator.h2
-rw-r--r--src/VBox/Runtime/include/internal/magics.h46
-rw-r--r--src/VBox/Runtime/include/internal/mem.h2
-rw-r--r--src/VBox/Runtime/include/internal/memobj.h40
-rw-r--r--src/VBox/Runtime/include/internal/path.h2
-rw-r--r--src/VBox/Runtime/include/internal/pipe.h2
-rw-r--r--src/VBox/Runtime/include/internal/process.h17
-rw-r--r--src/VBox/Runtime/include/internal/rand.h42
-rw-r--r--src/VBox/Runtime/include/internal/sched.h4
-rw-r--r--src/VBox/Runtime/include/internal/socket.h2
-rw-r--r--src/VBox/Runtime/include/internal/strhash.h94
-rw-r--r--src/VBox/Runtime/include/internal/strict.h2
-rw-r--r--src/VBox/Runtime/include/internal/string.h24
-rw-r--r--src/VBox/Runtime/include/internal/thread.h39
-rw-r--r--src/VBox/Runtime/include/internal/time.h10
-rw-r--r--src/VBox/Runtime/nt/NtProcessStartup-stub.cpp2
-rw-r--r--src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp2
-rw-r--r--src/VBox/Runtime/os2/RTErrConvertFromOS2.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/alloc-r0drv.cpp97
-rw-r--r--src/VBox/Runtime/r0drv/alloc-r0drv.h6
-rw-r--r--src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp6
-rw-r--r--src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp6
-rw-r--r--src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp6
-rw-r--r--src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp27
-rw-r--r--src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp36
-rw-r--r--src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp3
-rw-r--r--src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/semfastmutex-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp12
-rw-r--r--src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c6
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c6
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c6
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c45
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c32
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c12
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c2
-rw-r--r--src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c2
-rw-r--r--src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp6
-rw-r--r--src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c2
-rw-r--r--src/VBox/Runtime/r0drv/initterm-r0drv.cpp8
-rw-r--r--src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c2
-rw-r--r--src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c24
-rw-r--r--src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c6
-rw-r--r--src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c8
-rw-r--r--src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c54
-rw-r--r--src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c2
-rw-r--r--src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c34
-rw-r--r--src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c79
-rw-r--r--src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c2
-rw-r--r--src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c2
-rw-r--r--src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c2
-rw-r--r--src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c14
-rw-r--r--src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c2
-rw-r--r--src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c2
-rw-r--r--src/VBox/Runtime/r0drv/linux/string.h2
-rw-r--r--src/VBox/Runtime/r0drv/linux/the-linux-kernel.h8
-rw-r--r--src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c2
-rw-r--r--src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c109
-rw-r--r--src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c2
-rw-r--r--src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c2
-rw-r--r--src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h2
-rw-r--r--src/VBox/Runtime/r0drv/memobj-r0drv.cpp15
-rw-r--r--src/VBox/Runtime/r0drv/mp-r0drv.h12
-rw-r--r--src/VBox/Runtime/r0drv/mpnotification-r0drv.c10
-rw-r--r--src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp6
-rw-r--r--src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp6
-rw-r--r--src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp6
-rw-r--r--src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h2
-rw-r--r--src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp34
-rw-r--r--src/VBox/Runtime/r0drv/nt/memuserkernel-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp10
-rw-r--r--src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp10
-rw-r--r--src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/the-nt-kernel.h2
-rw-r--r--src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp12
-rw-r--r--src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm2
-rw-r--r--src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm2
-rw-r--r--src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm2
-rw-r--r--src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp6
-rw-r--r--src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp6
-rw-r--r--src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm2
-rw-r--r--src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp6
-rw-r--r--src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp36
-rw-r--r--src/VBox/Runtime/r0drv/os2/memuserkernel-r0drv-os2.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/os2/the-os2-kernel.h2
-rw-r--r--src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp12
-rw-r--r--src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp2
-rw-r--r--src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm2
-rw-r--r--src/VBox/Runtime/r0drv/power-r0drv.h6
-rw-r--r--src/VBox/Runtime/r0drv/powernotification-r0drv.c8
-rw-r--r--src/VBox/Runtime/r0drv/solaris/RTLogWriteDebugger-r0drv-solaris.c2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c6
-rw-r--r--src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c6
-rw-r--r--src/VBox/Runtime/r0drv/solaris/memuserkernel-r0drv-solaris.c2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c55
-rw-r--r--src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c3
-rw-r--r--src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c3
-rw-r--r--src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/semmutex-r0drv-solaris.c2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c6
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c299
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h19
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c331
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c12
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c56
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c12
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c2
-rw-r--r--src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c4
-rw-r--r--src/VBox/Runtime/r3/alloc-ef-cpp.cpp2
-rw-r--r--src/VBox/Runtime/r3/alloc-ef.cpp2
-rw-r--r--src/VBox/Runtime/r3/alloc-ef.h2
-rw-r--r--src/VBox/Runtime/r3/alloc.cpp33
-rw-r--r--src/VBox/Runtime/r3/darwin/RTPathUserDocuments-darwin.cpp55
-rw-r--r--src/VBox/Runtime/r3/darwin/RTSystemQueryDmiString-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r3/darwin/filelock-darwin.cpp20
-rw-r--r--src/VBox/Runtime/r3/darwin/mp-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r3/darwin/pathhost-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r3/darwin/rtProcInitExePath-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r3/darwin/sched-darwin.cpp8
-rw-r--r--src/VBox/Runtime/r3/darwin/time-darwin.cpp2
-rw-r--r--src/VBox/Runtime/r3/dir.cpp2
-rw-r--r--src/VBox/Runtime/r3/dir2.cpp2
-rw-r--r--src/VBox/Runtime/r3/fileio.cpp20
-rw-r--r--src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp6
-rw-r--r--src/VBox/Runtime/r3/freebsd/mp-freebsd.cpp2
-rw-r--r--src/VBox/Runtime/r3/freebsd/rtProcInitExePath-freebsd.cpp2
-rw-r--r--src/VBox/Runtime/r3/fs.cpp2
-rw-r--r--src/VBox/Runtime/r3/generic/semspinmutex-r3-generic.cpp2
-rw-r--r--src/VBox/Runtime/r3/init.cpp32
-rw-r--r--src/VBox/Runtime/r3/isofs.cpp2
-rw-r--r--src/VBox/Runtime/r3/linux/RTProcIsRunningByName-linux.cpp2
-rw-r--r--src/VBox/Runtime/r3/linux/RTSystemQueryDmiString-linux.cpp2
-rw-r--r--src/VBox/Runtime/r3/linux/RTThreadGetNativeState-linux.cpp2
-rw-r--r--src/VBox/Runtime/r3/linux/fileaio-linux.cpp6
-rw-r--r--src/VBox/Runtime/r3/linux/mp-linux.cpp2
-rw-r--r--src/VBox/Runtime/r3/linux/rtProcInitExePath-linux.cpp2
-rw-r--r--src/VBox/Runtime/r3/linux/sched-linux.cpp8
-rw-r--r--src/VBox/Runtime/r3/linux/semevent-linux.cpp2
-rw-r--r--src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp4
-rw-r--r--src/VBox/Runtime/r3/linux/semmutex-linux.cpp2
-rw-r--r--src/VBox/Runtime/r3/linux/sysfs.cpp2
-rw-r--r--src/VBox/Runtime/r3/linux/thread-affinity-linux.cpp95
-rw-r--r--src/VBox/Runtime/r3/linux/time-linux.cpp2
-rw-r--r--src/VBox/Runtime/r3/os2/filelock-os2.cpp2
-rw-r--r--src/VBox/Runtime/r3/os2/mp-os2.cpp2
-rw-r--r--src/VBox/Runtime/r3/os2/pipe-os2.cpp2
-rw-r--r--src/VBox/Runtime/r3/os2/poll-os2.cpp2
-rw-r--r--src/VBox/Runtime/r3/os2/rtProcInitExePath-os2.cpp2
-rw-r--r--src/VBox/Runtime/r3/os2/sched-os2.cpp8
-rw-r--r--src/VBox/Runtime/r3/os2/sems-os2.cpp2
-rw-r--r--src/VBox/Runtime/r3/os2/thread-os2.cpp32
-rw-r--r--src/VBox/Runtime/r3/os2/time-os2.cpp2
-rw-r--r--src/VBox/Runtime/r3/path.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/RTFileQueryFsSizes-posix.cpp4
-rw-r--r--src/VBox/Runtime/r3/posix/RTHandleGetStandard-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/RTMemProtect-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/RTMpGetCount-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/RTPathUserDocuments-posix.cpp52
-rw-r--r--src/VBox/Runtime/r3/posix/RTPathUserHome-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/RTSystemQueryOSInfo-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/RTSystemQueryTotalRam-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/RTTimeSet-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/dir-posix.cpp31
-rw-r--r--src/VBox/Runtime/r3/posix/env-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/errvars-posix.cpp78
-rw-r--r--src/VBox/Runtime/r3/posix/fileaio-posix.cpp8
-rw-r--r--src/VBox/Runtime/r3/posix/fileio-posix.cpp115
-rw-r--r--src/VBox/Runtime/r3/posix/fileio2-posix.cpp32
-rw-r--r--src/VBox/Runtime/r3/posix/filelock-posix.cpp16
-rw-r--r--src/VBox/Runtime/r3/posix/fs-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/fs2-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/fs3-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/ldrNative-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/path-posix.cpp14
-rw-r--r--src/VBox/Runtime/r3/posix/path2-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/pathhost-posix.cpp3
-rw-r--r--src/VBox/Runtime/r3/posix/pipe-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/poll-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/process-creation-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/process-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/rand-posix.cpp4
-rw-r--r--src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/sched-posix.cpp8
-rw-r--r--src/VBox/Runtime/r3/posix/semevent-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/semmutex-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/semrw-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/symlink-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/thread-posix.cpp99
-rw-r--r--src/VBox/Runtime/r3/posix/thread2-posix.cpp116
-rw-r--r--src/VBox/Runtime/r3/posix/time-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/timer-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/tls-posix.cpp2
-rw-r--r--src/VBox/Runtime/r3/posix/utf8-posix.cpp14
-rw-r--r--src/VBox/Runtime/r3/process.cpp2
-rw-r--r--src/VBox/Runtime/r3/socket.cpp292
-rw-r--r--src/VBox/Runtime/r3/solaris/RTSystemQueryDmiString-solaris.cpp2
-rw-r--r--src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp941
-rw-r--r--src/VBox/Runtime/r3/solaris/coredumper-solaris.h144
-rw-r--r--src/VBox/Runtime/r3/solaris/fileaio-solaris.cpp2
-rw-r--r--src/VBox/Runtime/r3/solaris/mp-solaris.cpp2
-rw-r--r--src/VBox/Runtime/r3/solaris/rtProcInitExePath-solaris.cpp2
-rw-r--r--src/VBox/Runtime/r3/solaris/thread-affinity-solaris.cpp94
-rw-r--r--src/VBox/Runtime/r3/stream.cpp2
-rw-r--r--src/VBox/Runtime/r3/tcp.cpp2
-rw-r--r--src/VBox/Runtime/r3/test.cpp2
-rw-r--r--src/VBox/Runtime/r3/testi.cpp2
-rw-r--r--src/VBox/Runtime/r3/udp.cpp726
-rw-r--r--src/VBox/Runtime/r3/win/RTHandleGetStandard-win.cpp4
-rw-r--r--src/VBox/Runtime/r3/win/RTLogWriteDebugger-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/RTSystemQueryDmiString-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/RTSystemQueryTotalRam-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/VBoxRT-openssl-ose.def56
-rw-r--r--src/VBox/Runtime/r3/win/VBoxRT-openssl.def897
-rw-r--r--src/VBox/Runtime/r3/win/VBoxRT-win32.def2
-rw-r--r--src/VBox/Runtime/r3/win/VBoxRT-win64.def2
-rw-r--r--src/VBox/Runtime/r3/win/alloc-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/dir-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/dllmain-win.cpp21
-rw-r--r--src/VBox/Runtime/r3/win/errvars-win.cpp83
-rw-r--r--src/VBox/Runtime/r3/win/fileaio-win.cpp8
-rw-r--r--src/VBox/Runtime/r3/win/fileio-win.cpp190
-rw-r--r--src/VBox/Runtime/r3/win/fs-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/ldrNative-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/localipc-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/mp-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/ntdll-mini-implib.c2
-rw-r--r--src/VBox/Runtime/r3/win/ntdll-mini-implib.def2
-rw-r--r--src/VBox/Runtime/r3/win/path-win.cpp41
-rw-r--r--src/VBox/Runtime/r3/win/pipe-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/poll-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/process-win.cpp3
-rw-r--r--src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp4
-rw-r--r--src/VBox/Runtime/r3/win/rtProcInitExePath-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/sched-win.cpp10
-rw-r--r--src/VBox/Runtime/r3/win/semevent-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/semeventmulti-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/semmutex-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/symlink-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/thread-win.cpp73
-rw-r--r--src/VBox/Runtime/r3/win/thread2-win.cpp (renamed from src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c)63
-rw-r--r--src/VBox/Runtime/r3/win/time-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/timer-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/tls-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/utf16locale-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/utf8-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/win/uuid-win.cpp2
-rw-r--r--src/VBox/Runtime/r3/xml.cpp37
-rw-r--r--src/VBox/Runtime/testcase/Makefile.kmk19
-rw-r--r--src/VBox/Runtime/testcase/ioctl.h2
-rw-r--r--src/VBox/Runtime/testcase/ntGetTimerResolution.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstDir-2.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstDir-3.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstDir.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstEnv.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstErrUnique.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstFile.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstFileAppendWin-1.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstFileLock.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstFork.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstHandleTable.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstIoCtl.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstIprtList.cpp612
-rw-r--r--src/VBox/Runtime/testcase/tstIprtMiniString.cpp174
-rw-r--r--src/VBox/Runtime/testcase/tstLdr-2.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstLdr-3.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstLdr-4.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstLdr.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstLdrLoad.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstLdrObj.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstLdrObjR0.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstLog.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstMemAutoPtr.cpp32
-rw-r--r--src/VBox/Runtime/testcase/tstMove.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstMp-1.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstNoCrt-1.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstOnce.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstPrfRT.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstR0ThreadPreemption.h2
-rw-r--r--src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTAssertCompile.cpp6
-rw-r--r--src/VBox/Runtime/testcase/tstRTAvl.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTBase64.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTBitOperations.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTCidr.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTCircBuf.cpp14
-rw-r--r--src/VBox/Runtime/testcase/tstRTCoreDump.cpp70
-rw-r--r--src/VBox/Runtime/testcase/tstRTCoreDump.h2
-rw-r--r--src/VBox/Runtime/testcase/tstRTCritSect.cpp7
-rw-r--r--src/VBox/Runtime/testcase/tstRTDarwinMachKernel.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTDigest.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTDirCreateUniqueNumbered.cpp129
-rw-r--r--src/VBox/Runtime/testcase/tstRTDvm.cpp221
-rw-r--r--src/VBox/Runtime/testcase/tstRTFileAio.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTFileAppend-1.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTFsQueries.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTGetOpt.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTGetOptArgv.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTHeapOffset.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTHeapSimple.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTInlineAsm.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTList.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTLockValidator.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTManifest.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTMemCache.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTMemEf.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTMemPool.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTPath.cpp15
-rw-r--r--src/VBox/Runtime/testcase/tstRTPipe.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTPoll.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTPrfIO.cpp4
-rw-r--r--src/VBox/Runtime/testcase/tstRTProcCreateEx.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTProcIsRunningByName.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTProcWait.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0Common.h2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0CommonDriver.h2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0CommonReq.h2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0MemUserKernel.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0MemUserKernel.h2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0MemUserKernelDriver.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0SemMutex.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0SemMutex.h2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0SemMutexDriver.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0Timer.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0Timer.h2
-rw-r--r--src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTS3.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTSemEventMulti.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTSemRW.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTSemXRoads.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTSort.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTStrAlloc.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTStrCache.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTStrCatCopy.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTStrFormat.cpp13
-rw-r--r--src/VBox/Runtime/testcase/tstRTStrVersion.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTSymlink.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTSystemQueryDmi.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTSystemQueryOsInfo.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTTemp.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTThreadExecutionTime.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTThreadPoke.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTTimeSpec.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRTUuid.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstRand.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstSemMutex.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstSemPingPong.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstStrSimplePattern.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstStrToNum.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstTSC.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstTermCallbacks.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstThread-1.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstTime-2.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstTime-3.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstTime-4.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstTime.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstTimer.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstTimerLR.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstUtf8.cpp2
-rw-r--r--src/VBox/Runtime/testcase/tstVector.cpp234
-rw-r--r--src/VBox/Runtime/tools/Makefile.kmk2
-rw-r--r--src/VBox/Runtime/tools/RTGzip.cpp2
-rw-r--r--src/VBox/Runtime/tools/RTLdrFlt.cpp4
-rw-r--r--src/VBox/Runtime/tools/RTManifest.cpp2
-rw-r--r--src/VBox/Runtime/tools/RTTar.cpp2
-rw-r--r--src/VBox/Runtime/win/RTErrConvertFromWin32.cpp2
-rw-r--r--src/VBox/Runtime/win/errmsgwin.cpp2
806 files changed, 12750 insertions, 3239 deletions
diff --git a/src/VBox/Runtime/.scm-settings b/src/VBox/Runtime/.scm-settings
index 8c5b4f8d4..4d597df34 100644
--- a/src/VBox/Runtime/.scm-settings
+++ b/src/VBox/Runtime/.scm-settings
@@ -1,4 +1,4 @@
-# $Id: .scm-settings $
+# $Id: .scm-settings 32394 2010-09-10 12:13:11Z vboxsync $
## @file
# Source code massager settings for Runtime.
#
diff --git a/src/VBox/Runtime/Doxyfile b/src/VBox/Runtime/Doxyfile
index 2a14b2f10..eb0c1ae46 100644
--- a/src/VBox/Runtime/Doxyfile
+++ b/src/VBox/Runtime/Doxyfile
@@ -192,6 +192,7 @@ ALIASES = \
# Interface method implementation macros.
ALIASES += \
interface_method_impl{2}="Implements \1 method \link \1::\2 \2 \endlink @copydoc \1::\2 "
+ALIASES += \
interface_method_impl{3}="\3. \
\
Implements \1 method \link \1::\2 \2 \endlink @copydoc \1::\2 "
@@ -199,6 +200,7 @@ Implements \1 method \link \1::\2 \2 \endlink @copydoc \1::\2 "
# Callback method implementation macros.
ALIASES += \
callback_method_impl{1}="Implements the callback \link \1 \1 \endlink @copydoc \1 "
+ALIASES += \
callback_method_impl{2}="\2. \
\
Implements the callback \link \1 \1 "
diff --git a/src/VBox/Runtime/Makefile.kmk b/src/VBox/Runtime/Makefile.kmk
index 20fd05443..0bb1ccbe8 100644
--- a/src/VBox/Runtime/Makefile.kmk
+++ b/src/VBox/Runtime/Makefile.kmk
@@ -1,4 +1,4 @@
-# $Id: Makefile.kmk $
+# $Id: Makefile.kmk 38037 2011-07-18 17:31:38Z vboxsync $
## @file
# Sub-Makefile for the IPRT (IPRT).
#
@@ -44,6 +44,7 @@ else ifdef VBOX_ONLY_TESTSUITE
# Only build the testsuite.
#
LIBRARIES += RuntimeGuestR3 RuntimeGuestR3Shared RuntimeR3 RuntimeR0
+ LIBRARIES.solaris += RuntimeR0Stub
LIBRARIES.win += RuntimeR0Stub
else ifdef VBOX_ONLY_DOCS
@@ -58,7 +59,7 @@ else ifdef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
# Build docs only - need just regular R3 runtime.
#
LIBRARIES += RuntimeBldProg
- IMPORT_LIBS += VBoxRTImp
+ LIBRARIES.solaris += RuntimeR0Stub
LIBRARIES.win += RuntimeR0Stub RuntimeRCStub
include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
@@ -73,8 +74,8 @@ else # !VBOX_ONLY_ADDITIONS && !VBOX_ONLY_TESTSUITE && !VBOX_ONLY_DOCS
include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
BLDPROGS += uniread
- IMPORT_LIBS += VBoxRTImp
LIBRARIES += RuntimeR3 RuntimeBldProg RuntimeR0 RuntimeEFCPP RuntimeR3NoCRTGCC
+ LIBRARIES.solaris += RuntimeR0Stub
LIBRARIES.win += RuntimeR0Stub
ifdef VBOX_WITH_RAW_MODE
LIBRARIES += RuntimeRC
@@ -104,6 +105,10 @@ if1of (amd64, $(KBUILD_TARGET_ARCH) $(KBUILD_HOST_ARCH))
endif
+# Always build the import library.
+IMPORT_LIBS += VBoxRTImp
+
+
# Where the generated stuff goes.
IPRT_OUT_DIR := $(PATH_TARGET)/Runtime
BLDDIRS += $(IPRT_OUT_DIR)
@@ -213,9 +218,6 @@ RuntimeR3_DEFS = IN_RT_R3 IN_SUP_R3 LDR_WITH_NATIVE LDR_WITH_ELF32 LDR_
ifdef IPRT_WITH_KSTUFF
RuntimeR3_DEFS += LDR_WITH_KLDR
endif
-ifdef VBOX_MAIN_RELEASE_LOG ## @todo (dmik): temporary, until RTThreadSelf/RTThreadAdopt are properly updated
- RuntimeR3_DEFS += RTCRITSECT_STRICT
-endif
ifdef IPRT_WITH_LZJB
RuntimeR3_DEFS += RTZIP_USE_LZJB
endif
@@ -248,6 +250,7 @@ RuntimeR3_SOURCES = \
common/alloc/heapsimple.cpp \
common/alloc/heapoffset.cpp \
common/alloc/memcache.cpp \
+ common/alloc/memtracker.cpp \
common/checksum/adler32.cpp \
common/checksum/crc32.cpp \
common/checksum/crc64.cpp \
@@ -271,6 +274,10 @@ RuntimeR3_SOURCES = \
common/dbg/dbgmod.cpp \
common/dbg/dbgmodcontainer.cpp \
common/dbg/dbgmodnm.cpp \
+ common/dvm/dvm.cpp \
+ common/dvm/dvmbsdlabel.cpp \
+ common/dvm/dvmgpt.cpp \
+ common/dvm/dvmmbr.cpp \
common/err/errinfo.cpp \
common/err/errmsg.cpp \
common/err/RTErrConvertFromErrno.cpp \
@@ -287,6 +294,8 @@ RuntimeR3_SOURCES = \
common/log/logrelellipsis.cpp \
common/log/logcom.cpp \
common/log/logformat.cpp \
+ common/log/tracebuf.cpp \
+ common/log/tracedefault.cpp \
common/misc/RTAssertMsg1Weak.cpp \
common/misc/RTAssertMsg2.cpp \
common/misc/RTAssertMsg2Add.cpp \
@@ -423,6 +432,7 @@ RuntimeR3_SOURCES = \
generic/critsect-generic.cpp \
generic/env-generic.cpp \
generic/RTDirCreateTemp-generic.cpp \
+ generic/RTDirCreateUniqueNumbered-generic.cpp \
generic/RTEnvDupEx-generic.cpp \
generic/RTFileCopy-generic.cpp \
generic/RTFileQuerySize-generic.cpp \
@@ -456,6 +466,7 @@ RuntimeR3_SOURCES = \
r3/test.cpp \
r3/testi.cpp \
r3/tcp.cpp \
+ r3/udp.cpp \
r3/generic/semspinmutex-r3-generic.cpp
#if1of ($(KBUILD_TARGET_ARCH),amd64 x86)
@@ -519,6 +530,7 @@ RuntimeR3_SOURCES.win = \
generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp \
generic/RTSemMutexRequest-generic.cpp \
generic/RTSemMutexRequestDebug-generic.cpp \
+ generic/RTThreadSetAffinityToCpu-generic.cpp \
generic/mppresent-generic.cpp \
generic/semrw-$(if-expr defined(VBOX_WITH_LOCKLESS_SEMRW),lockless-,)generic.cpp \
generic/uuid-generic.cpp \
@@ -533,6 +545,7 @@ RuntimeR3_SOURCES.win = \
r3/win/RTSystemQueryTotalRam-win.cpp \
r3/win/alloc-win.cpp \
r3/win/dir-win.cpp \
+ r3/win/errvars-win.cpp \
r3/win/fileio-win.cpp \
r3/win/fs-win.cpp \
r3/win/ldrNative-win.cpp \
@@ -551,6 +564,7 @@ RuntimeR3_SOURCES.win = \
r3/win/symlink-win.cpp \
r3/win/rtFileNativeSetAttributes-win.cpp \
r3/win/thread-win.cpp \
+ r3/win/thread2-win.cpp \
r3/win/time-win.cpp \
r3/win/timer-win.cpp \
r3/win/tls-win.cpp \
@@ -573,6 +587,7 @@ RuntimeR3_SOURCES.linux = \
generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp \
generic/RTTimeLocalNow-generic.cpp \
generic/RTTimerCreate-generic.cpp \
+ generic/RTThreadSetAffinityToCpu-generic.cpp \
generic/RTUuidCreate-generic.cpp \
generic/mppresent-generic.cpp \
generic/utf16locale-generic.cpp \
@@ -583,6 +598,7 @@ RuntimeR3_SOURCES.linux = \
r3/linux/sched-linux.cpp \
r3/linux/sysfs.cpp \
r3/linux/time-linux.cpp \
+ r3/linux/thread-affinity-linux.cpp \
r3/linux/RTProcIsRunningByName-linux.cpp \
r3/linux/RTSystemQueryDmiString-linux.cpp \
r3/posix/RTFileQueryFsSizes-posix.cpp \
@@ -596,6 +612,7 @@ RuntimeR3_SOURCES.linux = \
r3/posix/rtmempage-exec-mmap-heap-posix.cpp \
r3/posix/dir-posix.cpp \
r3/posix/env-posix.cpp \
+ r3/posix/errvars-posix.cpp \
r3/posix/fileio-posix.cpp \
r3/posix/fileio2-posix.cpp \
r3/posix/filelock-posix.cpp \
@@ -606,6 +623,7 @@ RuntimeR3_SOURCES.linux = \
r3/posix/path-posix.cpp \
r3/posix/path2-posix.cpp \
r3/posix/pathhost-posix.cpp \
+ r3/posix/RTPathUserDocuments-posix.cpp \
r3/posix/pipe-posix.cpp \
r3/posix/poll-posix.cpp \
r3/posix/process-posix.cpp \
@@ -614,6 +632,7 @@ RuntimeR3_SOURCES.linux = \
r3/posix/semrw-posix.cpp \
r3/posix/symlink-posix.cpp \
r3/posix/thread-posix.cpp \
+ r3/posix/thread2-posix.cpp \
r3/posix/timelocal-posix.cpp \
r3/posix/timer-posix.cpp \
r3/posix/tls-posix.cpp \
@@ -651,6 +670,7 @@ RuntimeR3_SOURCES.os2 = \
generic/RTSystemQueryDmiString-generic.cpp \
generic/RTTimeLocalNow-generic.cpp \
generic/RTTimerCreate-generic.cpp \
+ generic/RTThreadSetAffinityToCpu-generic.cpp \
generic/RTUuidCreate-generic.cpp \
generic/mppresent-generic.cpp \
generic/RTSemEventWait-generic.cpp \
@@ -685,6 +705,7 @@ RuntimeR3_SOURCES.os2 = \
r3/posix/rtmempage-exec-mmap-heap-posix.cpp \
r3/posix/dir-posix.cpp \
r3/posix/env-posix.cpp \
+ r3/posix/errvars-posix.cpp \
r3/posix/fileio-posix.cpp \
r3/posix/fileio2-posix.cpp \
r3/posix/fs-posix.cpp \
@@ -694,6 +715,7 @@ RuntimeR3_SOURCES.os2 = \
r3/posix/path-posix.cpp \
r3/posix/path2-posix.cpp \
r3/posix/pathhost-posix.cpp \
+ r3/posix/RTPathUserDocuments-posix.cpp \
r3/posix/process-posix.cpp \
r3/posix/process-creation-posix.cpp \
r3/posix/symlink-posix.cpp \
@@ -710,6 +732,9 @@ RuntimeR3_SOURCES.darwin = \
generic/RTFileMove-generic.cpp \
generic/RTLogWriteDebugger-generic.cpp \
generic/RTProcDaemonize-generic.cpp \
+ generic/RTThreadGetAffinity-stub-generic.cpp \
+ generic/RTThreadSetAffinity-stub-generic.cpp \
+ generic/RTThreadSetAffinityToCpu-generic.cpp \
generic/RTTimeLocalNow-generic.cpp \
generic/RTTimerCreate-generic.cpp \
generic/RTUuidCreate-generic.cpp \
@@ -729,6 +754,7 @@ RuntimeR3_SOURCES.darwin = \
r3/darwin/RTSystemQueryDmiString-darwin.cpp \
r3/darwin/sched-darwin.cpp \
r3/darwin/time-darwin.cpp \
+ r3/darwin/RTPathUserDocuments-darwin.cpp \
r3/posix/RTFileQueryFsSizes-posix.cpp \
r3/posix/RTHandleGetStandard-posix.cpp \
r3/posix/RTMemProtect-posix.cpp \
@@ -738,6 +764,7 @@ RuntimeR3_SOURCES.darwin = \
r3/posix/RTTimeSet-posix.cpp \
r3/posix/dir-posix.cpp \
r3/posix/env-posix.cpp \
+ r3/posix/errvars-posix.cpp \
r3/posix/fileio-posix.cpp \
r3/posix/fileio2-posix.cpp \
r3/posix/fs-posix.cpp \
@@ -757,6 +784,7 @@ RuntimeR3_SOURCES.darwin = \
r3/posix/semmutex-posix.cpp \
r3/posix/symlink-posix.cpp \
r3/posix/thread-posix.cpp \
+ r3/posix/thread2-posix.cpp \
r3/posix/timelocal-posix.cpp \
r3/posix/tls-posix.cpp \
r3/posix/utf8-posix.cpp
@@ -770,6 +798,9 @@ RuntimeR3_SOURCES.freebsd = \
generic/RTSemEventMultiWait-2-ex-generic.cpp \
generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp \
generic/RTSystemQueryDmiString-generic.cpp \
+ generic/RTThreadGetAffinity-stub-generic.cpp \
+ generic/RTThreadSetAffinity-stub-generic.cpp \
+ generic/RTThreadSetAffinityToCpu-generic.cpp \
generic/RTTimeLocalNow-generic.cpp \
generic/RTTimerCreate-generic.cpp \
generic/RTUuidCreate-generic.cpp \
@@ -793,6 +824,7 @@ RuntimeR3_SOURCES.freebsd = \
r3/posix/RTTimeSet-posix.cpp \
r3/posix/dir-posix.cpp \
r3/posix/env-posix.cpp \
+ r3/posix/errvars-posix.cpp \
r3/posix/fileio-posix.cpp \
r3/posix/fileio2-posix.cpp \
r3/posix/filelock-posix.cpp \
@@ -804,6 +836,7 @@ RuntimeR3_SOURCES.freebsd = \
r3/posix/path-posix.cpp \
r3/posix/path2-posix.cpp \
r3/posix/pathhost-posix.cpp \
+ r3/posix/RTPathUserDocuments-posix.cpp \
r3/posix/pipe-posix.cpp \
r3/posix/poll-posix.cpp \
r3/posix/process-posix.cpp \
@@ -815,6 +848,7 @@ RuntimeR3_SOURCES.freebsd = \
r3/posix/semrw-posix.cpp \
r3/posix/symlink-posix.cpp \
r3/posix/thread-posix.cpp \
+ r3/posix/thread2-posix.cpp \
r3/posix/time-posix.cpp \
r3/posix/timelocal-posix.cpp \
r3/posix/timer-posix.cpp \
@@ -830,6 +864,7 @@ RuntimeR3_SOURCES.solaris = \
generic/RTProcIsRunningByName-generic.cpp \
generic/RTSemEventMultiWait-2-ex-generic.cpp \
generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp \
+ generic/RTThreadSetAffinityToCpu-generic.cpp \
generic/RTTimeLocalNow-generic.cpp \
generic/RTTimerCreate-generic.cpp \
generic/RTUuidCreate-generic.cpp \
@@ -847,6 +882,7 @@ RuntimeR3_SOURCES.solaris = \
r3/posix/RTTimeSet-posix.cpp \
r3/posix/dir-posix.cpp \
r3/posix/env-posix.cpp \
+ r3/posix/errvars-posix.cpp \
r3/posix/fileio-posix.cpp \
r3/posix/fileio2-posix.cpp \
r3/posix/filelock-posix.cpp \
@@ -858,6 +894,7 @@ RuntimeR3_SOURCES.solaris = \
r3/posix/path-posix.cpp \
r3/posix/path2-posix.cpp \
r3/posix/pathhost-posix.cpp \
+ r3/posix/RTPathUserDocuments-posix.cpp \
r3/posix/pipe-posix.cpp \
r3/posix/poll-posix.cpp \
r3/posix/process-posix.cpp \
@@ -869,13 +906,15 @@ RuntimeR3_SOURCES.solaris = \
r3/posix/semrw-posix.cpp \
r3/posix/symlink-posix.cpp \
r3/posix/thread-posix.cpp \
+ r3/posix/thread2-posix.cpp \
r3/posix/time-posix.cpp \
r3/posix/timelocal-posix.cpp \
r3/posix/timer-posix.cpp \
r3/posix/tls-posix.cpp \
r3/posix/utf8-posix.cpp \
r3/solaris/mp-solaris.cpp \
- r3/solaris/rtProcInitExePath-solaris.cpp
+ r3/solaris/rtProcInitExePath-solaris.cpp \
+ r3/solaris/thread-affinity-solaris.cpp
RuntimeR3_SOURCES.solaris.amd64 = \
r3/solaris/coredumper-solaris.cpp \
r3/solaris/RTSystemQueryDmiString-solaris.cpp
@@ -903,6 +942,7 @@ RuntimeR3L4_INCS = \
$(L4_INCDIR)
RuntimeR3L4_SOURCES = \
+ generic/errvars-generic.cpp \
generic/fs-stubs-generic.cpp \
generic/pathhost-generic.cpp \
generic/RTDirQueryInfo-generic.cpp \
@@ -912,6 +952,9 @@ RuntimeR3L4_SOURCES = \
generic/RTProcDaemonize-generic.cpp \
generic/RTSystemQueryOSInfo-generic.cpp \
generic/RTSystemQueryDmiString-generic.cpp \
+ generic/RTThreadGetAffinity-stub-generic.cpp \
+ generic/RTThreadSetAffinity-stub-generic.cpp \
+ generic/RTThreadSetAffinityToCpu-generic.cpp \
generic/RTTimeLocalNow-generic.cpp \
generic/RTUuidCreate-generic.cpp \
generic/mppresent-generic.cpp \
@@ -946,6 +989,7 @@ RuntimeR3L4_SOURCES = \
r3/posix/ldrNative-posix.cpp \
r3/posix/path-posix.cpp \
r3/posix/path2-posix.cpp \
+ r3/posix/RTPathUserDocuments-posix.cpp \
r3/posix/rand-posix.cpp \
r3/posix/time-posix.cpp \
r3/posix/timelocal-posix.cpp
@@ -1033,7 +1077,7 @@ RuntimeGuestR3Mini_INST := $(INST_ADDITIONS_LIB)
RuntimeGuestR3Mini_SDKS.win := $(RuntimeR3_SDKS.win)
RuntimeGuestR3Mini_DEFS := \
$(filter-out RTCRITSECT_STRICT RT_NO_GIP RT_WITH_ICONV_CACHE, $(RuntimeR3_DEFS)) \
- RT_MINI
+ RT_MINI IN_RT_STATIC RTMEM_NO_WRAP_TO_EF_APIS
RuntimeGuestR3Mini_DEFS.$(KBUILD_TARGET) := $(RuntimeR3_DEFS.$(KBUILD_TARGET))
RuntimeGuestR3Mini_DEFS.$(KBUILD_HOST) := $(RuntimeR3_DEFS.$(KBUILD_HOST))
RuntimeGuestR3Mini_INCS := $(RuntimeR3_INCS)
@@ -1042,7 +1086,6 @@ RuntimeGuestR3Mini_INCS.$(KBUILD_HOST) := $(RuntimeR3_INCS.$(KBUILD_HOST))
RuntimeGuestR3Mini_SOURCES = \
common/alloc/alloc.cpp \
common/err/errmsg.cpp \
- common/err/errmsgxpcom.cpp \
common/err/RTErrConvertFromErrno.cpp \
common/log/logformat.cpp \
common/misc/RTAssertMsg1Weak.cpp \
@@ -1102,6 +1145,7 @@ RuntimeGuestR3Mini_SOURCES = \
generic/critsect-generic.cpp \
generic/pathhost-generic.cpp \
generic/RTAssertShouldPanic-generic.cpp \
+ generic/errvars-generic.cpp \
r3/alloc.cpp \
r3/alloc-ef.cpp \
r3/fileio.cpp \
@@ -1115,7 +1159,9 @@ RuntimeGuestR3Mini_SOURCES.freebsd = \
r3/posix/fileio2-posix.cpp \
r3/posix/path-posix.cpp \
r3/posix/path2-posix.cpp \
- r3/posix/utf8-posix.cpp
+ r3/posix/utf8-posix.cpp \
+ r3/posix/thread2-posix.cpp \
+ common/err/errmsgxpcom.cpp
RuntimeGuestR3Mini_SOURCES.linux = \
r3/posix/RTMemProtect-posix.cpp \
r3/posix/rtmempage-exec-mmap-posix.cpp \
@@ -1125,7 +1171,9 @@ RuntimeGuestR3Mini_SOURCES.linux = \
r3/posix/fileio2-posix.cpp \
r3/posix/path-posix.cpp \
r3/posix/path2-posix.cpp \
- r3/posix/utf8-posix.cpp
+ r3/posix/utf8-posix.cpp \
+ r3/posix/thread2-posix.cpp \
+ common/err/errmsgxpcom.cpp
RuntimeGuestR3Mini_SOURCES.solaris = \
r3/posix/RTMemProtect-posix.cpp \
r3/posix/rtmempage-exec-mmap-posix.cpp \
@@ -1135,12 +1183,15 @@ RuntimeGuestR3Mini_SOURCES.solaris = \
r3/posix/fileio2-posix.cpp \
r3/posix/path-posix.cpp \
r3/posix/path2-posix.cpp \
- r3/posix/utf8-posix.cpp
+ r3/posix/utf8-posix.cpp \
+ r3/posix/thread2-posix.cpp \
+ common/err/errmsgxpcom.cpp
RuntimeGuestR3Mini_SOURCES.win = \
r3/win/alloc-win.cpp \
r3/win/fileio-win.cpp \
r3/win/path-win.cpp \
r3/win/utf8-win.cpp \
+ r3/win/thread2-win.cpp \
win/errmsgwin.cpp \
win/RTErrConvertFromWin32.cpp
@@ -1226,7 +1277,8 @@ ifndef SDK_VBOX_LIBXML2_LIBS
endif
ifndef SDK_VBOX_OPENSSL_LIBS
VBoxRT_LIBS += \
- $(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB)
+ $(PATH_LIB)/VBox-libcrypto$(VBOX_SUFF_LIB) \
+ $(PATH_LIB)/VBox-libssl$(VBOX_SUFF_LIB)
endif
ifdef IPRT_WITH_LZO
VBoxRT_LIBS += lzo2
@@ -1248,7 +1300,7 @@ endif
VBoxRT_LIBS.win = \
$(PATH_SDK_$(VBOX_WINDDK)_LIB)/vccomsup.lib \
$(PATH_SDK_$(VBOX_WINDDK)_LIB)/wbemuuid.lib
-VBoxRT_LDFLAGS.darwin = -framework IOKit -framework CoreFoundation -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxRT.dylib
+VBoxRT_LDFLAGS.darwin = -framework IOKit -framework CoreFoundation -framework CoreServices -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxRT.dylib
ifdef VBOX_USE_VCC80
VBoxRT_LDFLAGS.win = /MANIFEST
endif
@@ -1299,6 +1351,7 @@ VBoxRT:: VBoxRTDummy
endif # building VBoxRT
endif # linux
+
#
# VBoxRTImp - Import library/hack.
#
@@ -1404,6 +1457,8 @@ RuntimeR0_SOURCES = \
common/log/logrelellipsis.cpp \
common/log/logcom.cpp \
common/log/logformat.cpp \
+ common/log/tracebuf.cpp \
+ common/log/tracedefault.cpp \
common/misc/RTAssertMsg1Weak.cpp \
common/misc/RTAssertMsg2.cpp \
common/misc/RTAssertMsg2Add.cpp \
@@ -1416,6 +1471,7 @@ RuntimeR0_SOURCES = \
common/misc/sanity-c.c \
common/misc/sanity-cpp.cpp \
common/misc/term.cpp \
+ common/path/RTPathFilename.cpp \
common/string/strncmp.cpp \
common/string/strpbrk.cpp \
common/string/RTStrCat.cpp \
@@ -1486,11 +1542,13 @@ RuntimeR0_SOURCES.os2 = \
#
-# RuntimeR0Stub - Ring-0 context startup stub for Windows.
+# RuntimeR0Stub - Ring-0 context startup stub for Windows and Solaris.
#
-RuntimeR0Stub_TEMPLATE = VBoxR0
+RuntimeR0Stub_TEMPLATE = $(if-expr "$(KBUILD_TARGET)" == "solaris",VBOXR0DRV,VBoxR0)
RuntimeR0Stub_SOURCES.win = \
nt/NtProcessStartup-stub.cpp
+RuntimeR0Stub_SOURCES.solaris = \
+ r0drv/solaris/modulestub-r0drv-solaris.c
#
@@ -1526,6 +1584,8 @@ RuntimeR0Drv_SOURCES = \
common/log/logrelellipsis.cpp \
common/log/logcom.cpp \
common/log/logformat.cpp \
+ common/log/tracebuf.cpp \
+ common/log/tracedefault.cpp \
common/misc/RTAssertMsg1Weak.cpp \
common/misc/RTAssertMsg2.cpp \
common/misc/RTAssertMsg2Add.cpp \
@@ -1572,6 +1632,7 @@ RuntimeR0Drv_SOURCES = \
common/string/RTStrNCmp.cpp \
common/string/RTStrNLen.cpp \
common/string/RTStrNLenEx.cpp \
+ common/string/straprintf.cpp \
common/string/strformat.cpp \
common/string/strformatnum.cpp \
common/string/strformatrt.cpp \
@@ -1591,24 +1652,15 @@ RuntimeR0Drv_SOURCES = \
generic/RTSemEventWaitNoResume-2-ex-generic.cpp \
generic/RTSemEventMultiWait-2-ex-generic.cpp \
generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp \
+ generic/errvars-generic.cpp \
generic/uuid-generic.cpp \
r0drv/alloc-r0drv.cpp \
r0drv/initterm-r0drv.cpp \
r0drv/generic/semspinmutex-r0drv-generic.c \
VBox/log-vbox.cpp \
-## @todo: Linking against RuntimeR0Drv on Linux will result in unresolved external
-## references to several string functions (e.g. strlen). We could include the
-## missing functions here but our own implementations conflict with declarations
-## of some Linux kernels (inline versus not inline, size_t versus unsigned int).
-##
-## The prototypes for the unresolved externals are declared in <linux/string.h>.
-## This file is not included with extern "C" { ... } and therefore the function
-## prototypes are mangled during C++ compilation. That's why we have to provide
-## implementations with mangled function names.
-##
-## bird: Why don't we just extern "C" {} that file then?
RuntimeR0Drv_SOURCES.linux = \
+ common/misc/thread.cpp \
common/string/strpbrk.cpp \
common/err/RTErrConvertToErrno.cpp \
common/err/RTErrConvertFromErrno.cpp \
@@ -1889,6 +1941,8 @@ ifdef VBOX_WITH_RAW_MODE
common/log/logrelellipsis.cpp \
common/log/logcom.cpp \
common/log/logformat.cpp \
+ common/log/tracebuf.cpp \
+ common/log/tracedefault.cpp \
common/misc/RTAssertMsg1Weak.cpp \
common/misc/RTAssertMsg2.cpp \
common/misc/RTAssertMsg2Add.cpp \
@@ -1900,6 +1954,7 @@ ifdef VBOX_WITH_RAW_MODE
common/misc/buildconfig.cpp \
common/misc/sanity-c.c \
common/misc/sanity-cpp.cpp \
+ common/path/RTPathFilename.cpp \
common/string/strformat.cpp \
common/string/strformatnum.cpp \
common/string/strformatrt.cpp \
@@ -1907,6 +1962,8 @@ ifdef VBOX_WITH_RAW_MODE
common/string/strncmp.cpp \
common/string/strpbrk.cpp \
common/string/strprintf.cpp \
+ common/string/RTStrCopy.cpp \
+ common/string/RTStrCopyEx.cpp \
common/table/avllu32.cpp \
common/table/avlou32.cpp \
common/table/avlogcphys.cpp \
@@ -1922,6 +1979,7 @@ ifdef VBOX_WITH_RAW_MODE
common/time/timesup.cpp \
gc/initterm-gc.cpp \
generic/RTAssertShouldPanic-generic.cpp \
+ generic/errvars-generic.cpp \
\
$(RuntimeNoCrt_SOURCES)
@@ -2207,6 +2265,108 @@ test-doxygen::
@echo $(DOXYGEN_OUTPUT_PREV)
@echo $(IPRT_DOXYFILE_INPUT)
+
+#
+# Test mangling.
+#
+if1of ($(LIBRARIES),RuntimeR3 RuntimeR0 RuntimeR0Drv RuntimeRC)
+ test-mangling:: $(IPRT_OUT_DIR)/mangling.run
+ OTHERS += $(IPRT_OUT_DIR)/mangling.run
+ CLEANS += $(IPRT_OUT_DIR)/mangling.run
+ $(IPRT_OUT_DIR)/mangling.run: \
+ $$(RuntimeR3_1_TARGET) \
+ $$(RuntimeR0_1_TARGET) \
+ $$(RuntimeR0Drv_1_TARGET) \
+ $$(RuntimeRC_1_TARGET)
+ if1of ($(KBUILD_TARGET), win os2)
+ $(call MSG_L1,IPRT: skipped mangling test.)
+ else if $(intersects $(KBUILD_TARGET), linux) && "$(VBOX_GCC_fvisibility-hidden)"
+ $(call MSG_L1,IPRT: Testing mangling and visiblity...)
+ rcExit=0; \
+ for fn in ` readelf -Ws $^ \
+ | $(SED) \
+ -e '/^ *[[:digit:]]\+:/!d' \
+ -e 's/^ \+[[:digit:]]\+: \+[[:xdigit:]]\+ \+[[:digit:]]\+ \+//' \
+ -e '/^SECTION/d' \
+ -e '/^FILE/d' \
+ -e 's/^[[:alpha:]]\+ \+//' \
+ -e '/LOCAL/d' \
+ -e 's/^[[:alpha:]]\+ \+//' \
+ -e '/^HIDDEN/d' \
+ -e 's/^[[:alpha:]]\+ \+//' \
+ -e '/^UND/d' \
+ -e 's/^[[:digit:]]\+ \+//' \
+ \
+ -e '/^nocrt_/d' \
+ -e '/^memchr/d' \
+ -e '/^memcmp/d' \
+ -e '/^memcpy/d' \
+ -e '/^mempcpy/d' \
+ -e '/^memmove/d' \
+ -e '/^memset/d' \
+ -e '/^strchr/d' \
+ -e '/^strpbrk/d' \
+ -e '/^_Z7strpbrk/d' \
+ -e '/^strcmp/d' \
+ -e '/^strcpy/d' \
+ -e '/^strlen/d' \
+ -e '/^_Z[[:alpha:]]*[[:digit:]]\+RTC/d' \
+ \
+ -e '/^_ZNSt9bad_allocC1Ev/d' \
+ -e '/^_ZNSt9exceptionC2Ev/d' \
+ \
+ -e '/^_Z[[:digit:]]\+dbus/d' \
+ -e '/^_Z13RTDBusLoadLibv/d' \
+ \
+ -e '/^VBoxHost_/d'\
+ -e '/^VBoxGuest_/d'\
+ | sort -u \
+ `; \
+ do \
+ if $(SED) -ne '/\# *define '"$${fn}"' /q 1' $(PATH_ROOT)/include/iprt/mangling.h; then \
+ echo "mangling.h: Missing # define "$${fn}" RT_MANGLER("$${fn}")"; \
+ rcExit=1;\
+ fi \
+ done; \
+ exit $${rcExit}
+ else
+ $(call MSG_L1,IPRT: Testing mangling...)
+ rcExit=0; \
+ for fn in ` nm $^ \
+ | $(SED) -n \
+ -e 's/^[0-9a-f][0-9a-f]* //' \
+ -e '/^[TUDB] /!d' \
+ -e 's/^. //' \
+ \
+ -e '/^g_cchrt/d'\
+ -e '/^g_frt/d'\
+ -e '/^g_offrt/d'\
+ -e '/^g_pfnrt/d'\
+ -e '/^g_rt/d'\
+ -e '/^g_szrt/d'\
+ -e '/^g_ProcessSelf/d'\
+ -e '/^g_u64ProgramStart/d'\
+ -e '/^g_enmProcessPriority/d'\
+ -e '/^g_hDbgModStrCache/d'\
+ \
+ -e '/^RTDBusLoadLib/d' \
+ \
+ -e '/^RT/p' \
+ -e '/^g_/p' \
+ | sort -u \
+ `; \
+ do \
+ if $(SED) -ne '/\# *define '"$${fn}"' /q 1' $(PATH_ROOT)/include/iprt/mangling.h; then \
+ echo "mangling.h: Missing # define "$${fn}" RT_MANGLER("$${fn}")"; \
+ rcExit=1;\
+ fi \
+ done; \
+ exit $${rcExit}
+ endif
+endif
+ $(QUIET)$(APPEND) -t $@
+
+
#
# Generate the rules (we're the to sub-makefile).
#
diff --git a/src/VBox/Runtime/VBox/RTAssertShouldPanic-vbox.cpp b/src/VBox/Runtime/VBox/RTAssertShouldPanic-vbox.cpp
index 0f4124bd8..603d26d82 100644
--- a/src/VBox/Runtime/VBox/RTAssertShouldPanic-vbox.cpp
+++ b/src/VBox/Runtime/VBox/RTAssertShouldPanic-vbox.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTAssertShouldPanic-vbox.cpp $ */
+/* $Id: RTAssertShouldPanic-vbox.cpp 37233 2011-05-27 13:31:57Z vboxsync $ */
/** @file
* IPRT - Assertions, generic RTAssertShouldPanic.
*/
@@ -30,6 +30,7 @@
*******************************************************************************/
#include <iprt/assert.h>
#include <iprt/env.h>
+#include <iprt/err.h>
#include <iprt/string.h>
/** @def VBOX_RTASSERT_WITH_GDB
@@ -51,15 +52,12 @@
#endif
-RTDECL(bool) RTAssertShouldPanic(void)
+/**
+ * Worker that we can wrap with error variable saving and restoring.
+ */
+static bool rtAssertShouldPanicWorker(void)
{
/*
- * Check if panicing is excluded by the the RTAssert settings first.
- */
- if (!RTAssertMayPanic())
- return false;
-
- /*
* Check for the VBOX_ASSERT variable.
*/
const char *psz = RTEnvGet("VBOX_ASSERT");
@@ -142,3 +140,24 @@ RTDECL(bool) RTAssertShouldPanic(void)
return false;
}
+
+RTDECL(bool) RTAssertShouldPanic(void)
+{
+ /*
+ * Check if panicing is excluded by the the RTAssert settings first.
+ */
+ if (!RTAssertMayPanic())
+ return false;
+
+ /*
+ * Preserve error state variables.
+ */
+ RTERRVARS SavedErrVars;
+ RTErrVarsSave(&SavedErrVars);
+
+ bool fRc = rtAssertShouldPanicWorker();
+
+ RTErrVarsRestore(&SavedErrVars);
+ return fRc;
+}
+
diff --git a/src/VBox/Runtime/VBox/VBoxRTDeps.cpp b/src/VBox/Runtime/VBox/VBoxRTDeps.cpp
index 9437c91b2..d9488dc25 100644
--- a/src/VBox/Runtime/VBox/VBoxRTDeps.cpp
+++ b/src/VBox/Runtime/VBox/VBoxRTDeps.cpp
@@ -1,10 +1,10 @@
-/* $Id: VBoxRTDeps.cpp $ */
+/* $Id: VBoxRTDeps.cpp 37277 2011-05-31 14:38:12Z vboxsync $ */
/** @file
* IPRT - VBoxRT.dll/so dependencies.
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -42,6 +42,7 @@
#include <openssl/pem.h>
#include <openssl/x509.h>
#include <openssl/rsa.h>
+#include <openssl/ssl.h>
/*******************************************************************************
@@ -67,6 +68,11 @@ PFNRT g_VBoxRTDeps[] =
(PFNRT)ASMAtomicReadU64,
(PFNRT)ASMAtomicCmpXchgU64,
(PFNRT)RTBldCfgRevision,
+ (PFNRT)SSL_free,
+ (PFNRT)SSL_library_init,
+ (PFNRT)SSL_CTX_free,
+ (PFNRT)SSL_CTX_use_certificate_file,
+ (PFNRT)TLSv1_server_method,
NULL
};
diff --git a/src/VBox/Runtime/VBox/VBoxRTImp.def b/src/VBox/Runtime/VBox/VBoxRTImp.def
index 3b672a047..0630d9651 100644
--- a/src/VBox/Runtime/VBox/VBoxRTImp.def
+++ b/src/VBox/Runtime/VBox/VBoxRTImp.def
@@ -1,4 +1,4 @@
-; $Id: VBoxRTImp.def $
+; $Id: VBoxRTImp.def 35185 2010-12-16 14:10:38Z vboxsync $
;; @file
; VirtualBox Runtime DLL - Stable Interface Definition file.
diff --git a/src/VBox/Runtime/VBox/log-vbox.cpp b/src/VBox/Runtime/VBox/log-vbox.cpp
index ab9007023..039e43e4d 100644
--- a/src/VBox/Runtime/VBox/log-vbox.cpp
+++ b/src/VBox/Runtime/VBox/log-vbox.cpp
@@ -1,4 +1,4 @@
-/* $Id: log-vbox.cpp $ */
+/* $Id: log-vbox.cpp 37217 2011-05-26 08:54:27Z vboxsync $ */
/** @file
* VirtualBox Runtime - Logging configuration.
*/
@@ -461,6 +461,11 @@ RTDECL(PRTLOGGER) RTLogDefaultInit(void)
RTLogFlags(pLogger, "enabled unbuffered");
pLogger->fDestFlags |= RTLOGDEST_DEBUGGER;
# endif
+# if defined(DEBUG_leo) /* Guest ring-0 as well */
+ RTLogGroupSettings(pLogger, "+drv_mouse.e.l.f+drv_miniport.e.l.f+drv_display.e.l.f");
+ RTLogFlags(pLogger, "enabled unbuffered");
+ pLogger->fDestFlags |= RTLOGDEST_DEBUGGER;
+# endif
# if 0 /* vboxdrv logging - ATTENTION: this is what we're referring to guys! Change to '# if 1'. */
RTLogGroupSettings(pLogger, "all=~0 -default.l6.l5.l4.l3");
RTLogFlags(pLogger, "enabled unbuffered tid");
diff --git a/src/VBox/Runtime/VBox/logbackdoor-redirect.cpp b/src/VBox/Runtime/VBox/logbackdoor-redirect.cpp
index 637c4005d..87bbde2bc 100644
--- a/src/VBox/Runtime/VBox/logbackdoor-redirect.cpp
+++ b/src/VBox/Runtime/VBox/logbackdoor-redirect.cpp
@@ -1,4 +1,4 @@
-/* $Id: logbackdoor-redirect.cpp $ */
+/* $Id: logbackdoor-redirect.cpp 36408 2011-03-24 16:25:47Z vboxsync $ */
/** @file
* VirtualBox Runtime - RTLog stubs for the stripped down IPRT used by
* RuntimeGuestR3Shared (X11), output is redirected
diff --git a/src/VBox/Runtime/VBox/logbackdoor.cpp b/src/VBox/Runtime/VBox/logbackdoor.cpp
index 99d4485db..37bb57cbd 100644
--- a/src/VBox/Runtime/VBox/logbackdoor.cpp
+++ b/src/VBox/Runtime/VBox/logbackdoor.cpp
@@ -1,4 +1,4 @@
-/* $Id: logbackdoor.cpp $ */
+/* $Id: logbackdoor.cpp 29250 2010-05-09 17:53:58Z vboxsync $ */
/** @file
* VirtualBox Runtime - Guest Backdoor Logging.
*/
diff --git a/src/VBox/Runtime/common/alloc/alloc.cpp b/src/VBox/Runtime/common/alloc/alloc.cpp
index e4e52c311..ffaff343f 100644
--- a/src/VBox/Runtime/common/alloc/alloc.cpp
+++ b/src/VBox/Runtime/common/alloc/alloc.cpp
@@ -1,4 +1,4 @@
-/* $Id: alloc.cpp $ */
+/* $Id: alloc.cpp 37808 2011-07-07 07:45:50Z vboxsync $ */
/** @file
* IPRT - Memory Allocation.
*/
@@ -28,7 +28,9 @@
/*******************************************************************************
* Header Files *
*******************************************************************************/
-#define RTMEM_NO_WRAP_TO_EF_APIS
+#ifndef RTMEM_NO_WRAP_TO_EF_APIS
+# define RTMEM_NO_WRAP_TO_EF_APIS
+#endif
#include <iprt/mem.h>
#include "internal/iprt.h"
diff --git a/src/VBox/Runtime/common/alloc/heapoffset.cpp b/src/VBox/Runtime/common/alloc/heapoffset.cpp
index 2cd8697a9..fd5d0e96d 100644
--- a/src/VBox/Runtime/common/alloc/heapoffset.cpp
+++ b/src/VBox/Runtime/common/alloc/heapoffset.cpp
@@ -1,4 +1,4 @@
-/* $Id: heapoffset.cpp $ */
+/* $Id: heapoffset.cpp 35525 2011-01-13 14:00:37Z vboxsync $ */
/** @file
* IPRT - An Offset Based Heap.
*/
diff --git a/src/VBox/Runtime/common/alloc/heapsimple.cpp b/src/VBox/Runtime/common/alloc/heapsimple.cpp
index 7e680132d..3377e6597 100644
--- a/src/VBox/Runtime/common/alloc/heapsimple.cpp
+++ b/src/VBox/Runtime/common/alloc/heapsimple.cpp
@@ -1,4 +1,4 @@
-/* $Id: heapsimple.cpp $ */
+/* $Id: heapsimple.cpp 35525 2011-01-13 14:00:37Z vboxsync $ */
/** @file
* IPRT - A Simple Heap.
*/
diff --git a/src/VBox/Runtime/common/alloc/memcache.cpp b/src/VBox/Runtime/common/alloc/memcache.cpp
index f7f41ff65..72349f353 100644
--- a/src/VBox/Runtime/common/alloc/memcache.cpp
+++ b/src/VBox/Runtime/common/alloc/memcache.cpp
@@ -1,4 +1,4 @@
-/* $Id: memcache.cpp $ */
+/* $Id: memcache.cpp 34507 2010-11-30 13:14:14Z vboxsync $ */
/** @file
* IPRT - Memory Object Allocation Cache.
*/
diff --git a/src/VBox/Runtime/common/alloc/memtracker.cpp b/src/VBox/Runtime/common/alloc/memtracker.cpp
index 3abae12b2..61346d98c 100644
--- a/src/VBox/Runtime/common/alloc/memtracker.cpp
+++ b/src/VBox/Runtime/common/alloc/memtracker.cpp
@@ -1,10 +1,10 @@
-/* $Id: memtracker.cpp $ */
+/* $Id: memtracker.cpp 36674 2011-04-14 16:03:06Z vboxsync $ */
/** @file
* IPRT - Memory Tracker & Leak Detector.
*/
/*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -28,12 +28,1310 @@
/*******************************************************************************
* Header Files *
*******************************************************************************/
-#include <iprt/memcache.h>
+#include <iprt/memtracker.h>
#include "internal/iprt.h"
+#include <iprt/asm.h>
#include <iprt/assert.h>
+#include <iprt/avl.h>
+#include <iprt/critsect.h>
+#ifdef IN_RING3
+# include <iprt/file.h>
+#endif
+#include <iprt/err.h>
+#include <iprt/list.h>
+#include <iprt/log.h>
#include <iprt/mem.h>
-#include <iprt/param.h>
+#include <iprt/semaphore.h>
+#include <iprt/string.h>
+#include <iprt/thread.h>
+#include "internal/file.h"
#include "internal/magics.h"
+#include "internal/strhash.h"
+
+
+/*******************************************************************************
+* Structures and Typedefs *
+*******************************************************************************/
+/** Pointer to a memory tracker instance */
+typedef struct RTMEMTRACKERINT *PRTMEMTRACKERINT;
+
+/**
+ * Memory tracker statistics.
+ */
+typedef struct RTMEMTRACKERSTATS
+{
+ /** Array of method calls. */
+ uint64_t volatile acMethodCalls[RTMEMTRACKERMETHOD_END];
+ /** The number of times this user freed or reallocated a memory block
+ * orignally allocated by someone else. */
+ uint64_t volatile cUserChanges;
+ /** The total number of bytes allocated ever. */
+ uint64_t volatile cbTotalAllocated;
+ /** The total number of blocks allocated ever. */
+ uint64_t volatile cTotalAllocatedBlocks;
+ /** The number of bytes currently allocated. */
+ size_t volatile cbAllocated;
+ /** The number of blocks currently allocated. */
+ size_t volatile cAllocatedBlocks;
+} RTMEMTRACKERSTATS;
+/** Pointer to memory tracker statistics. */
+typedef RTMEMTRACKERSTATS *PRTMEMTRACKERSTATS;
+
+
+/**
+ * Memory tracker user data.
+ */
+typedef struct RTMEMTRACKERUSER
+{
+ /** Entry in the user list (RTMEMTRACKERINT::UserList). */
+ RTLISTNODE ListEntry;
+ /** Pointer to the tracker. */
+ PRTMEMTRACKERINT pTracker;
+ /** Critical section protecting the memory list. */
+ RTCRITSECT CritSect;
+ /** The list of memory allocated by this user. */
+ RTLISTNODE MemoryList;
+ /** Positive numbers indicates recursion.
+ * Negative numbers are used for the global user since that is shared by
+ * more than one thread. */
+ int32_t volatile cInTracker;
+ /** The user identifier. */
+ uint32_t idUser;
+ /** The statistics for this user. */
+ RTMEMTRACKERSTATS Stats;
+ /** The user (thread) name. */
+ char szName[32];
+} RTMEMTRACKERUSER;
+/** Pointer to memory tracker per user data. */
+typedef RTMEMTRACKERUSER *PRTMEMTRACKERUSER;
+
+
+/**
+ * Memory tracker per tag statistics.
+ */
+typedef struct RTMEMTRACKERTAG
+{
+ /** AVL node core for lookup by hash. */
+ AVLU32NODECORE Core;
+ /** Tag list entry for flat traversal while dumping. */
+ RTLISTNODE ListEntry;
+ /** Pointer to the next tag with the same hash (collisions). */
+ PRTMEMTRACKERTAG pNext;
+ /** The tag statistics. */
+ RTMEMTRACKERSTATS Stats;
+ /** The tag name length. */
+ size_t cchTag;
+ /** The tag string. */
+ char szTag[1];
+} RTMEMTRACKERTAG;
+
+
+/**
+ * The memory tracker instance.
+ */
+typedef struct RTMEMTRACKERINT
+{
+ /** Cross roads semaphore separating dumping and normal operation.
+ * - NS - normal tracking.
+ * - EW - dumping tracking data. */
+ RTSEMXROADS hXRoads;
+
+ /** Critical section protecting the user list and tag database. */
+ RTCRITSECT CritSect;
+ /** List of RTMEMTRACKERUSER records. */
+ RTLISTNODE UserList;
+ /** The next user identifier number. */
+ uint32_t idUserNext;
+ /** The TLS index used for the per thread user records. */
+ RTTLS iTls;
+ /** Cross roads semaphore used to protect the tag database.
+ * - NS - lookup.
+ * - EW + critsect - insertion.
+ * @todo Replaced this by a read-write semaphore. */
+ RTSEMXROADS hXRoadsTagDb;
+ /** The root of the tag lookup database. */
+ AVLU32TREE TagDbRoot;
+ /** List of RTMEMTRACKERTAG records. */
+ RTLISTNODE TagList;
+#if ARCH_BITS == 32
+ /** Alignment padding. */
+ uint32_t u32Alignment;
+#endif
+ /** The global user record (fallback). */
+ RTMEMTRACKERUSER FallbackUser;
+ /** The global statistics. */
+ RTMEMTRACKERSTATS GlobalStats;
+ /** The number of busy (recursive) allocations. */
+ uint64_t volatile cBusyAllocs;
+ /** The number of busy (recursive) frees. */
+ uint64_t volatile cBusyFrees;
+ /** The number of tags. */
+ uint32_t cTags;
+ /** The number of users. */
+ uint32_t cUsers;
+} RTMEMTRACKERINT;
+AssertCompileMemberAlignment(RTMEMTRACKERINT, FallbackUser, 8);
+
+
+/**
+ * Output callback structure.
+ */
+typedef struct RTMEMTRACKEROUTPUT
+{
+ /** The printf like callback. */
+ DECLCALLBACKMEMBER(void, pfnPrintf)(struct RTMEMTRACKEROUTPUT *pThis, const char *pszFormat, ...);
+
+ /** The data. */
+ union
+ {
+ RTFILE hFile;
+ } uData;
+} RTMEMTRACKEROUTPUT;
+/** Pointer to a memory tracker output callback structure. */
+typedef RTMEMTRACKEROUTPUT *PRTMEMTRACKEROUTPUT;
+
+
+/*******************************************************************************
+* Global Variables *
+*******************************************************************************/
+/** Pointer to the default memory tracker. */
+static PRTMEMTRACKERINT g_pDefaultTracker = NULL;
+
+
+/**
+ * Creates a memory tracker.
+ *
+ * @returns IRPT status code.
+ * @param ppTracker Where to return the tracker instance.
+ */
+static int rtMemTrackerCreate(PRTMEMTRACKERINT *ppTracker)
+{
+ PRTMEMTRACKERINT pTracker = (PRTMEMTRACKERINT)RTMemAllocZ(sizeof(*pTracker));
+ if (!pTracker)
+ return VERR_NO_MEMORY;
+
+ /*
+ * Create locks and stuff.
+ */
+ int rc = RTCritSectInitEx(&pTracker->CritSect,
+ RTCRITSECT_FLAGS_NO_LOCK_VAL | RTCRITSECT_FLAGS_NO_NESTING | RTCRITSECT_FLAGS_BOOTSTRAP_HACK,
+ NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, NULL);
+ if (RT_SUCCESS(rc))
+ {
+ rc = RTSemXRoadsCreate(&pTracker->hXRoads);
+ if (RT_SUCCESS(rc))
+ {
+ rc = RTSemXRoadsCreate(&pTracker->hXRoadsTagDb);
+ if (RT_SUCCESS(rc))
+ {
+ rc = RTTlsAllocEx(&pTracker->iTls, NULL);
+ if (RT_SUCCESS(rc))
+ {
+ rc = RTCritSectInitEx(&pTracker->FallbackUser.CritSect,
+ RTCRITSECT_FLAGS_NO_LOCK_VAL | RTCRITSECT_FLAGS_NO_NESTING | RTCRITSECT_FLAGS_BOOTSTRAP_HACK,
+ NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, NULL);
+ if (RT_SUCCESS(rc))
+ {
+ /*
+ * Initialize the rest of the structure.
+ */
+ RTListInit(&pTracker->UserList);
+ RTListInit(&pTracker->TagList);
+ RTListInit(&pTracker->FallbackUser.ListEntry);
+ RTListInit(&pTracker->FallbackUser.MemoryList);
+ pTracker->FallbackUser.pTracker = pTracker;
+ pTracker->FallbackUser.cInTracker = INT32_MIN / 2;
+ pTracker->FallbackUser.idUser = pTracker->idUserNext++;
+ strcpy(pTracker->FallbackUser.szName, "fallback");
+
+ *ppTracker = pTracker;
+ return VINF_SUCCESS;
+ }
+
+ RTTlsFree(pTracker->iTls);
+ }
+ RTSemXRoadsDestroy(pTracker->hXRoadsTagDb);
+ }
+ RTSemXRoadsDestroy(pTracker->hXRoads);
+ }
+ RTCritSectDelete(&pTracker->CritSect);
+ }
+ return rc;
+}
+
+
+/**
+ * Gets the user record to use.
+ *
+ * @returns Pointer to a user record.
+ * @param pTracker The tracker instance.
+ */
+static PRTMEMTRACKERUSER rtMemTrackerGetUser(PRTMEMTRACKERINT pTracker)
+{
+ /* ASSUMES that RTTlsGet and RTTlsSet will not reenter. */
+ PRTMEMTRACKERUSER pUser = (PRTMEMTRACKERUSER)RTTlsGet(pTracker->iTls);
+ if (RT_UNLIKELY(!pUser))
+ {
+ /*
+ * Is the thread currently initializing or terminating?
+ * If so, don't try add any user record for it as RTThread may barf or
+ * we might not get the thread name.
+ */
+ if (!RTThreadIsSelfAlive())
+ return &pTracker->FallbackUser;
+
+ /*
+ * Allocate and initialize a new user record for this thread.
+ *
+ * We install the fallback user record while doing the allocation and
+ * locking so that we can deal with recursions.
+ */
+ int rc = RTTlsSet(pTracker->iTls, &pTracker->FallbackUser);
+ if (RT_SUCCESS(rc))
+ {
+ pUser = (PRTMEMTRACKERUSER)RTMemAllocZ(sizeof(*pUser));
+ if (pUser)
+ {
+ rc = RTCritSectInitEx(&pUser->CritSect,
+ RTCRITSECT_FLAGS_NO_LOCK_VAL | RTCRITSECT_FLAGS_NO_NESTING | RTCRITSECT_FLAGS_BOOTSTRAP_HACK,
+ NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, NULL);
+ if (RT_SUCCESS(rc))
+ {
+ RTListInit(&pUser->ListEntry);
+ RTListInit(&pUser->MemoryList);
+ pUser->pTracker = pTracker;
+ pUser->cInTracker = 1;
+
+ const char *pszName = RTThreadSelfName();
+ if (pszName)
+ RTStrCopy(pUser->szName, sizeof(pUser->szName), pszName);
+
+ /*
+ * Register the new user record.
+ */
+ rc = RTTlsSet(pTracker->iTls, pUser);
+ if (RT_SUCCESS(rc))
+ {
+ RTCritSectEnter(&pTracker->CritSect);
+
+ pUser->idUser = pTracker->idUserNext++;
+ RTListAppend(&pTracker->UserList, &pUser->ListEntry);
+ pTracker->cUsers++;
+
+ RTCritSectLeave(&pTracker->CritSect);
+ return pUser;
+ }
+
+ RTCritSectDelete(&pUser->CritSect);
+ }
+ RTMemFree(pUser);
+ }
+ else
+ rc = VERR_NO_MEMORY;
+ }
+
+ /* Failed, user the fallback. */
+ pUser = &pTracker->FallbackUser;
+ }
+
+ ASMAtomicIncS32(&pUser->cInTracker);
+ return pUser;
+}
+
+
+/**
+ * Counterpart to rtMemTrackerGetUser.
+ *
+ * @param pUser The user record to 'put' back.
+ */
+DECLINLINE(void) rtMemTrackerPutUser(PRTMEMTRACKERUSER pUser)
+{
+ ASMAtomicDecS32(&pUser->cInTracker);
+}
+
+
+/**
+ * Get the tag record corresponding to @a pszTag.
+ *
+ * @returns The tag record. This may be NULL if we're out of memory or
+ * if something goes wrong.
+ *
+ * @param pTracker The tracker instance.
+ * @param pUser The user record of the caller. Must NOT be
+ * NULL. This is used to prevent infinite
+ * recursions when allocating a new tag record.
+ * @param pszTag The tag string. Can be NULL.
+ */
+DECLINLINE(PRTMEMTRACKERTAG) rtMemTrackerGetTag(PRTMEMTRACKERINT pTracker, PRTMEMTRACKERUSER pUser, const char *pszTag)
+{
+ AssertPtr(pTracker);
+ AssertPtr(pUser);
+ if (pUser->cInTracker <= 0)
+ return NULL;
+
+ /*
+ * Hash tag string.
+ */
+ size_t cchTag;
+ uint32_t uHash;
+ if (pszTag)
+ uHash = sdbmN(pszTag, 260, &cchTag);
+ else
+ {
+ pszTag = "";
+ cchTag = 0;
+ uHash = 0;
+ }
+
+ /*
+ * Look up the tag.
+ */
+ RTSemXRoadsNSEnter(pTracker->hXRoadsTagDb);
+ PRTMEMTRACKERTAG pTag = (PRTMEMTRACKERTAG)RTAvlU32Get(&pTracker->TagDbRoot, uHash);
+ while ( pTag
+ && ( pTag->cchTag != cchTag
+ || memcmp(pTag->szTag, pszTag, cchTag)) )
+ pTag = pTag->pNext;
+ RTSemXRoadsNSLeave(pTracker->hXRoadsTagDb);
+
+ /*
+ * Create a new tag record if not found.
+ */
+ if (RT_UNLIKELY(!pTag))
+ {
+ pTag = (PRTMEMTRACKERTAG)RTMemAllocZVar(RT_OFFSETOF(RTMEMTRACKERTAG, szTag[cchTag + 1]));
+ if (pTag)
+ {
+ pTag->Core.Key = uHash;
+ pTag->cchTag = cchTag;
+ memcpy(pTag->szTag, pszTag, cchTag + 1);
+
+ RTSemXRoadsEWEnter(pTracker->hXRoadsTagDb);
+ RTCritSectEnter(&pTracker->CritSect);
+
+ void *pvFreeMe = NULL;
+ PRTMEMTRACKERTAG pHeadTag = (PRTMEMTRACKERTAG)RTAvlU32Get(&pTracker->TagDbRoot, uHash);
+ if (!pHeadTag)
+ {
+ RTAvlU32Insert(&pTracker->TagDbRoot, &pTag->Core);
+ RTListAppend(&pTracker->TagList, &pTag->ListEntry);
+ pTracker->cTags++;
+ }
+ else
+ {
+ PRTMEMTRACKERTAG pTag2 = pHeadTag;
+ while ( pTag2
+ && ( pTag2->cchTag != cchTag
+ || memcmp(pTag2->szTag, pszTag, cchTag)) )
+ pTag2 = pTag2->pNext;
+ if (RT_LIKELY(!pTag2))
+ {
+ pTag->pNext = pHeadTag->pNext;
+ pHeadTag->pNext = pTag;
+ RTListAppend(&pTracker->TagList, &pTag->ListEntry);
+ pTracker->cTags++;
+ }
+ else
+ {
+ pvFreeMe = pTag;
+ pTag = pTag2;
+ }
+ }
+
+ RTCritSectLeave(&pTracker->CritSect);
+ RTSemXRoadsEWLeave(pTracker->hXRoadsTagDb);
+
+ if (RT_LIKELY(pvFreeMe))
+ RTMemFree(pvFreeMe);
+ }
+ }
+
+ return pTag;
+}
+
+
+/**
+ * Counterpart to rtMemTrackerGetTag.
+ *
+ * @param pTag The tag record to 'put' back.
+ */
+DECLINLINE(void) rtMemTrackerPutTag(PRTMEMTRACKERTAG pTag)
+{
+ NOREF(pTag);
+}
+
+
+/**
+ * Record an allocation call.
+ *
+ * @param pStats The statistics record.
+ * @param cbUser The size of the allocation.
+ * @param enmMethod The allocation method.
+ */
+DECLINLINE(void) rtMemTrackerStateRecordAlloc(PRTMEMTRACKERSTATS pStats, size_t cbUser, RTMEMTRACKERMETHOD enmMethod)
+{
+ ASMAtomicAddU64(&pStats->cbTotalAllocated, cbUser);
+ ASMAtomicIncU64(&pStats->cTotalAllocatedBlocks);
+ ASMAtomicAddZ(&pStats->cbAllocated, cbUser);
+ ASMAtomicIncZ(&pStats->cAllocatedBlocks);
+ ASMAtomicIncU64(&pStats->acMethodCalls[enmMethod]);
+}
+
+
+/**
+ * Record a free call.
+ *
+ * @param pStats The statistics record.
+ * @param cbUser The size of the allocation.
+ * @param enmMethod The free method.
+ */
+DECLINLINE(void) rtMemTrackerStateRecordFree(PRTMEMTRACKERSTATS pStats, size_t cbUser, RTMEMTRACKERMETHOD enmMethod)
+{
+ ASMAtomicSubZ(&pStats->cbAllocated, cbUser);
+ ASMAtomicDecZ(&pStats->cAllocatedBlocks);
+ ASMAtomicIncU64(&pStats->acMethodCalls[enmMethod]);
+}
+
+
+/**
+ * Internal RTMemTrackerHdrAlloc and RTMemTrackerHdrAllocEx worker.
+ *
+ * @returns Pointer to the user data allocation.
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param pv The pointer to the allocated memory. This
+ * includes room for the header.
+ * @param cbUser The size requested by the user.
+ * @param pszTag The tag string.
+ * @param enmMethod The allocation method.
+ */
+static void *rtMemTrackerHdrAllocEx(PRTMEMTRACKERINT pTracker, void *pv, size_t cbUser,
+ const char *pszTag, RTMEMTRACKERMETHOD enmMethod)
+{
+ /*
+ * Check input.
+ */
+ if (!pv)
+ return NULL;
+ AssertReturn(enmMethod > RTMEMTRACKERMETHOD_INVALID && enmMethod < RTMEMTRACKERMETHOD_END, NULL);
+
+ /*
+ * Initialize the header.
+ */
+ PRTMEMTRACKERHDR pHdr = (PRTMEMTRACKERHDR)pv;
+
+ pHdr->uMagic = RTMEMTRACKERHDR_MAGIC;
+ pHdr->cbUser = cbUser;
+ RTListInit(&pHdr->ListEntry);
+ pHdr->pUser = NULL;
+ pHdr->pszTag = pszTag;
+ pHdr->pTag = NULL;
+ pHdr->pvUser = pHdr + 1;
+
+ /*
+ * Add it to the tracker if we've got one.
+ */
+ if (pTracker)
+ {
+ PRTMEMTRACKERUSER pUser = rtMemTrackerGetUser(pTracker);
+ if (pUser->cInTracker == 1)
+ {
+ RTSemXRoadsNSEnter(pTracker->hXRoads);
+
+ /* Get the tag and update it's statistics. */
+ PRTMEMTRACKERTAG pTag = rtMemTrackerGetTag(pTracker, pUser, pszTag);
+ if (pTag)
+ {
+ pHdr->pTag = pTag;
+ rtMemTrackerStateRecordAlloc(&pTag->Stats, cbUser, enmMethod);
+ rtMemTrackerPutTag(pTag);
+ }
+
+ /* Link the header and update the user statistics. */
+ RTCritSectEnter(&pUser->CritSect);
+ RTListAppend(&pUser->MemoryList, &pHdr->ListEntry);
+ RTCritSectLeave(&pUser->CritSect);
+
+ pHdr->pUser = pUser;
+ rtMemTrackerStateRecordAlloc(&pUser->Stats, cbUser, enmMethod);
+
+ /* Update the global statistics. */
+ rtMemTrackerStateRecordAlloc(&pTracker->GlobalStats, cbUser, enmMethod);
+
+ RTSemXRoadsNSLeave(pTracker->hXRoads);
+ }
+ else
+ ASMAtomicIncU64(&pTracker->cBusyAllocs);
+ rtMemTrackerPutUser(pUser);
+ }
+
+ return pHdr + 1;
+}
+
+
+/**
+ * Internal worker for rtMemTrackerHdrFreeEx and rtMemTrackerHdrReallocPrep.
+ *
+ * @returns Pointer to the original block.
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param pvUser Pointer to the user memory.
+ * @param cbUser The size of the user memory or 0.
+ * @param pszTag The tag to associate the free with.
+ * @param enmMethod The free method.
+ * @param uDeadMagic The dead magic value to use.
+ */
+static void *rtMemTrackerHdrFreeCommon(PRTMEMTRACKERINT pTracker, void *pvUser, size_t cbUser,
+ const char *pszTag, RTMEMTRACKERMETHOD enmMethod,
+ size_t uDeadMagic)
+{
+ PRTMEMTRACKERHDR pHdr = (PRTMEMTRACKERHDR)pvUser - 1;
+ AssertReturn(pHdr->uMagic == RTMEMTRACKERHDR_MAGIC, NULL);
+ Assert(pHdr->cbUser == cbUser || !cbUser); NOREF(cbUser);
+ Assert(pHdr->pvUser == pvUser);
+
+ AssertReturn(enmMethod > RTMEMTRACKERMETHOD_INVALID && enmMethod < RTMEMTRACKERMETHOD_END, NULL);
+
+ /*
+ * First mark it as free.
+ */
+ pHdr->uMagic = uDeadMagic;
+
+ /*
+ * If there is a association with a user, we need to unlink it and update
+ * the statistics.
+ *
+ * A note on the locking here. We don't take the crossroads semaphore when
+ * reentering the memory tracker on the same thread because we may be
+ * holding it in a different direction and would therefore deadlock.
+ */
+ PRTMEMTRACKERUSER pMemUser = pHdr->pUser;
+ if (pMemUser)
+ {
+ Assert(pMemUser->pTracker == pTracker); Assert(pTracker);
+ PRTMEMTRACKERUSER pCallingUser = rtMemTrackerGetUser(pTracker);
+ bool const fTakeXRoadsLock = pCallingUser->cInTracker <= 1;
+ if (fTakeXRoadsLock)
+ RTSemXRoadsNSEnter(pTracker->hXRoads);
+
+ RTCritSectEnter(&pMemUser->CritSect);
+ RTListNodeRemove(&pHdr->ListEntry);
+ RTCritSectLeave(&pMemUser->CritSect);
+
+ if (pCallingUser == pMemUser)
+ rtMemTrackerStateRecordFree(&pCallingUser->Stats, pHdr->cbUser, enmMethod);
+ else
+ {
+ ASMAtomicIncU64(&pCallingUser->Stats.cUserChanges);
+ ASMAtomicIncU64(&pCallingUser->Stats.acMethodCalls[enmMethod]);
+
+ ASMAtomicSubU64(&pMemUser->Stats.cbTotalAllocated, cbUser);
+ ASMAtomicSubZ(&pMemUser->Stats.cbAllocated, cbUser);
+ }
+
+ rtMemTrackerStateRecordFree(&pTracker->GlobalStats, pHdr->cbUser, enmMethod);
+
+ /** @todo we're currently ignoring pszTag, consider how to correctly
+ * attribute the free operation if the tags differ - it
+ * makes sense at all... */
+ if (pHdr->pTag)
+ rtMemTrackerStateRecordFree(&pHdr->pTag->Stats, pHdr->cbUser, enmMethod);
+
+
+ if (fTakeXRoadsLock)
+ RTSemXRoadsNSLeave(pTracker->hXRoads);
+ rtMemTrackerPutUser(pCallingUser);
+ }
+ else
+ {
+ /*
+ * No tracked. This may happen even when pTracker != NULL when the same
+ * thread reenters the tracker when allocating tracker structures or memory
+ * in some subroutine like threading and locking.
+ */
+ Assert(!pHdr->pTag);
+ if (pTracker)
+ ASMAtomicIncU64(&pTracker->cBusyFrees);
+ }
+
+ return pHdr;
+}
+
+
+/**
+ * Internal worker for RTMemTrackerHdrReallocPrep and
+ * RTMemTrackerHdrReallocPrepEx.
+ *
+ * @returns Pointer to the actual allocation.
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param pvOldUser The user memory.
+ * @param cbOldUser The size of the user memory, 0 if unknown.
+ * @param pszTag The tag string.
+ */
+static void *rtMemTrackerHdrReallocPrepEx(PRTMEMTRACKERINT pTracker, void *pvOldUser, size_t cbOldUser, const char *pszTag)
+{
+ if (!pvOldUser)
+ return NULL;
+ return rtMemTrackerHdrFreeCommon(pTracker, pvOldUser, cbOldUser, pszTag,
+ RTMEMTRACKERMETHOD_REALLOC_PREP, RTMEMTRACKERHDR_MAGIC_REALLOC);
+}
+
+
+/**
+ * Internal worker for RTMemTrackerHdrReallocDone and
+ * RTMemTrackerHdrReallocDoneEx.
+ *
+ * @returns Pointer to the actual allocation.
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param pvNew The new memory chunk. Can be NULL.
+ * @param cbNewUser The size of the new memory chunk.
+ * @param pvOldUser Pointer to the old user memory.
+ * @param pszTag The tag string.
+ */
+static void *rtMemTrackerHdrReallocDoneEx(PRTMEMTRACKERINT pTracker, void *pvNew, size_t cbNewUser,
+ void *pvOldUser, const char *pszTag)
+{
+ /* Succeeded? */
+ if (pvNew)
+ return rtMemTrackerHdrAllocEx(pTracker, pvNew, cbNewUser, pszTag, RTMEMTRACKERMETHOD_REALLOC_DONE);
+
+ /* Failed or just realloc to zero? */
+ if (cbNewUser)
+ {
+ PRTMEMTRACKERHDR pHdr = (PRTMEMTRACKERHDR)pvOldUser - 1;
+ AssertReturn(pHdr->uMagic == RTMEMTRACKERHDR_MAGIC_REALLOC, NULL);
+
+ return rtMemTrackerHdrAllocEx(pTracker, pHdr, pHdr->cbUser, pszTag, RTMEMTRACKERMETHOD_REALLOC_FAILED);
+ }
+
+ /* Tealloc to zero bytes, i.e. free. */
+ return NULL;
+}
+
+
+/**
+ * Internal worker for RTMemTrackerHdrFree and RTMemTrackerHdrFreeEx.
+ *
+ * @returns Pointer to the actual allocation.
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param pvUser The user memory.
+ * @param cbUser The size of the user memory, 0 if unknown.
+ * @param pszTag The tag string.
+ * @param enmMethod The free method.
+ */
+static void *rtMemTrackerHdrFreeEx(PRTMEMTRACKERINT pTracker, void *pvUser, size_t cbUser,
+ const char *pszTag, RTMEMTRACKERMETHOD enmMethod)
+{
+ if (!pvUser)
+ return NULL;
+ return rtMemTrackerHdrFreeCommon(pTracker, pvUser, cbUser, pszTag, enmMethod, RTMEMTRACKERHDR_MAGIC_FREE);
+}
+
+
+/**
+ * Prints a statistics record.
+ *
+ * @param pStats The record.
+ * @param pOutput The output callback table.
+ * @param fVerbose Whether to print in terse or verbose form.
+ */
+DECLINLINE(void) rtMemTrackerDumpOneStatRecord(PRTMEMTRACKERSTATS pStats, PRTMEMTRACKEROUTPUT pOutput, bool fVerbose)
+{
+ if (fVerbose)
+ {
+ pOutput->pfnPrintf(pOutput,
+ " Currently allocated: %7zu blocks, %8zu bytes\n"
+ " Total allocation sum: %7RU64 blocks, %8RU64 bytes\n"
+ ,
+ pStats->cAllocatedBlocks,
+ pStats->cbAllocated,
+ pStats->cTotalAllocatedBlocks,
+ pStats->cbTotalAllocated);
+ pOutput->pfnPrintf(pOutput,
+ " Alloc: %7RU64 AllocZ: %7RU64 Free: %7RU64 User Chg: %7RU64\n"
+ " RPrep: %7RU64 RDone: %7RU64 RFail: %7RU64\n"
+ " New: %7RU64 New[]: %7RU64 Delete: %7RU64 Delete[]: %7RU64\n"
+ ,
+ pStats->acMethodCalls[RTMEMTRACKERMETHOD_ALLOC],
+ pStats->acMethodCalls[RTMEMTRACKERMETHOD_ALLOCZ],
+ pStats->acMethodCalls[RTMEMTRACKERMETHOD_FREE],
+ pStats->cUserChanges,
+ pStats->acMethodCalls[RTMEMTRACKERMETHOD_REALLOC_PREP],
+ pStats->acMethodCalls[RTMEMTRACKERMETHOD_REALLOC_DONE],
+ pStats->acMethodCalls[RTMEMTRACKERMETHOD_REALLOC_FAILED],
+ pStats->acMethodCalls[RTMEMTRACKERMETHOD_NEW],
+ pStats->acMethodCalls[RTMEMTRACKERMETHOD_NEW_ARRAY],
+ pStats->acMethodCalls[RTMEMTRACKERMETHOD_DELETE],
+ pStats->acMethodCalls[RTMEMTRACKERMETHOD_DELETE_ARRAY]);
+ }
+ else
+ {
+ pOutput->pfnPrintf(pOutput, " %zu bytes in %zu blocks\n",
+ pStats->cbAllocated, pStats->cAllocatedBlocks);
+ }
+}
+
+
+/**
+ * Internal worker that dumps all the memory tracking data.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param pOutput The output callback table.
+ */
+static void rtMemTrackerDumpAllWorker(PRTMEMTRACKERINT pTracker, PRTMEMTRACKEROUTPUT pOutput)
+{
+ if (!pTracker)
+ return;
+
+ /*
+ * We use the EW direction to make sure the lists, trees and statistics
+ * does not change while we're working.
+ */
+ PRTMEMTRACKERUSER pUser = rtMemTrackerGetUser(pTracker);
+ RTSemXRoadsEWEnter(pTracker->hXRoads);
+
+ /* Global statistics.*/
+ pOutput->pfnPrintf(pOutput, "*** Global statistics ***\n");
+ rtMemTrackerDumpOneStatRecord(&pTracker->GlobalStats, pOutput, true);
+ pOutput->pfnPrintf(pOutput, " Busy Allocs: %4RU64 Busy Frees: %4RU64 Tags: %3u Users: %3u\n",
+ pTracker->cBusyAllocs, pTracker->cBusyFrees, pTracker->cTags, pTracker->cUsers);
+
+ /* Per tag statistics. */
+ pOutput->pfnPrintf(pOutput, "\n*** Tag statistics ***\n");
+ PRTMEMTRACKERTAG pTag, pNextTag;
+ RTListForEachSafe(&pTracker->TagList, pTag, pNextTag, RTMEMTRACKERTAG, ListEntry)
+ {
+ pOutput->pfnPrintf(pOutput, "Tag: %s\n", pTag->szTag);
+ rtMemTrackerDumpOneStatRecord(&pTag->Stats, pOutput, true);
+ pOutput->pfnPrintf(pOutput, "\n", pTag->szTag);
+ }
+
+ /* Per user statistics & blocks. */
+ pOutput->pfnPrintf(pOutput, "\n*** User statistics ***\n");
+ PRTMEMTRACKERUSER pCurUser, pNextUser;
+ RTListForEachSafe(&pTracker->UserList, pCurUser, pNextUser, RTMEMTRACKERUSER, ListEntry)
+ {
+ pOutput->pfnPrintf(pOutput, "User #%u: %s%s (cInTracker=%d)\n",
+ pCurUser->idUser,
+ pCurUser->szName,
+ pUser == pCurUser ? " (me)" : "",
+ pCurUser->cInTracker);
+ rtMemTrackerDumpOneStatRecord(&pCurUser->Stats, pOutput, true);
+
+ PRTMEMTRACKERHDR pCurHdr, pNextHdr;
+ RTListForEachSafe(&pCurUser->MemoryList, pCurHdr, pNextHdr, RTMEMTRACKERHDR, ListEntry)
+ {
+ if (pCurHdr->pTag)
+ pOutput->pfnPrintf(pOutput,
+ " %zu bytes at %p with tag %s\n"
+ " %.*Rhxd\n"
+ "\n",
+ pCurHdr->cbUser, pCurHdr->pvUser, pCurHdr->pTag->szTag,
+ RT_MIN(pCurHdr->cbUser, 16*3), pCurHdr->pvUser);
+ else
+ pOutput->pfnPrintf(pOutput,
+ " %zu bytes at %p without a tag\n"
+ " %.*Rhxd\n"
+ "\n",
+ pCurHdr->cbUser, pCurHdr->pvUser,
+ RT_MIN(pCurHdr->cbUser, 16*3), pCurHdr->pvUser);
+ }
+ pOutput->pfnPrintf(pOutput, "\n", pTag->szTag);
+ }
+
+ /* Repeat the global statistics. */
+ pOutput->pfnPrintf(pOutput, "*** Global statistics (reprise) ***\n");
+ rtMemTrackerDumpOneStatRecord(&pTracker->GlobalStats, pOutput, true);
+ pOutput->pfnPrintf(pOutput, " Busy Allocs: %4RU64 Busy Frees: %4RU64 Tags: %3u Users: %3u\n",
+ pTracker->cBusyAllocs, pTracker->cBusyFrees, pTracker->cTags, pTracker->cUsers);
+
+ RTSemXRoadsEWLeave(pTracker->hXRoads);
+ rtMemTrackerPutUser(pUser);
+}
+
+
+/**
+ * Internal worker that dumps the memory tracking statistics.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param pOutput The output callback table.
+ * @param fVerbose Whether to the verbose or quiet.
+ */
+static void rtMemTrackerDumpStatsWorker(PRTMEMTRACKERINT pTracker, PRTMEMTRACKEROUTPUT pOutput, bool fVerbose)
+{
+ if (!pTracker)
+ return;
+
+ /*
+ * We use the EW direction to make sure the lists, trees and statistics
+ * does not change while we're working.
+ */
+ PRTMEMTRACKERUSER pUser = rtMemTrackerGetUser(pTracker);
+ RTSemXRoadsEWEnter(pTracker->hXRoads);
+
+ /* Global statistics.*/
+ pOutput->pfnPrintf(pOutput, "*** Global statistics ***\n");
+ rtMemTrackerDumpOneStatRecord(&pTracker->GlobalStats, pOutput, fVerbose);
+ if (fVerbose)
+ pOutput->pfnPrintf(pOutput, " Busy Allocs: %4RU64 Busy Frees: %4RU64 Tags: %3u Users: %3u\n",
+ pTracker->cBusyAllocs, pTracker->cBusyFrees, pTracker->cTags, pTracker->cUsers);
+
+ /* Per tag statistics. */
+ pOutput->pfnPrintf(pOutput, "\n*** Tag statistics ***\n");
+ PRTMEMTRACKERTAG pTag, pNextTag;
+ RTListForEachSafe(&pTracker->TagList, pTag, pNextTag, RTMEMTRACKERTAG, ListEntry)
+ {
+ if ( fVerbose
+ || pTag->Stats.cbAllocated)
+ {
+ pOutput->pfnPrintf(pOutput, "Tag: %s\n", pTag->szTag);
+ rtMemTrackerDumpOneStatRecord(&pTag->Stats, pOutput, fVerbose);
+ if (fVerbose)
+ pOutput->pfnPrintf(pOutput, "\n", pTag->szTag);
+ }
+ }
+
+ /* Per user statistics. */
+ pOutput->pfnPrintf(pOutput, "\n*** User statistics ***\n");
+ PRTMEMTRACKERUSER pCurUser, pNextUser;
+ RTListForEachSafe(&pTracker->UserList, pCurUser, pNextUser, RTMEMTRACKERUSER, ListEntry)
+ {
+ if ( fVerbose
+ || pCurUser->Stats.cbAllocated
+ || pCurUser == pUser)
+ {
+ pOutput->pfnPrintf(pOutput, "User #%u: %s%s (cInTracker=%d)\n",
+ pCurUser->idUser,
+ pCurUser->szName,
+ pUser == pCurUser ? " (me)" : "",
+ pCurUser->cInTracker);
+ rtMemTrackerDumpOneStatRecord(&pCurUser->Stats, pOutput, fVerbose);
+ if (fVerbose)
+ pOutput->pfnPrintf(pOutput, "\n", pTag->szTag);
+ }
+ }
+
+ if (fVerbose)
+ {
+ /* Repeat the global statistics. */
+ pOutput->pfnPrintf(pOutput, "*** Global statistics (reprise) ***\n");
+ rtMemTrackerDumpOneStatRecord(&pTracker->GlobalStats, pOutput, fVerbose);
+ pOutput->pfnPrintf(pOutput, " Busy Allocs: %4RU64 Busy Frees: %4RU64 Tags: %3u Users: %3u\n",
+ pTracker->cBusyAllocs, pTracker->cBusyFrees, pTracker->cTags, pTracker->cUsers);
+ }
+
+ RTSemXRoadsEWLeave(pTracker->hXRoads);
+ rtMemTrackerPutUser(pUser);
+}
+
+
+/**
+ * @callback_method_impl{RTMEMTRACKEROUTPUT::pfnPrintf, Outputting to the release log}
+ */
+static DECLCALLBACK(void) rtMemTrackerDumpLogOutput(PRTMEMTRACKEROUTPUT pThis, const char *pszFormat, ...)
+{
+ va_list va;
+ va_start(va, pszFormat);
+ RTLogPrintfV(pszFormat, va);
+ va_end(va);
+}
+
+
+/**
+ * Internal worker for RTMemTrackerDumpAllToLog and RTMemTrackerDumpAllToLogEx.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ */
+static void rtMemTrackerDumpAllToLogEx(PRTMEMTRACKERINT pTracker)
+{
+ RTMEMTRACKEROUTPUT Output;
+ Output.pfnPrintf = rtMemTrackerDumpLogOutput;
+ rtMemTrackerDumpAllWorker(pTracker, &Output);
+}
+
+
+/**
+ * Internal worker for RTMemTrackerDumpStatsToLog and
+ * RTMemTrackerDumpStatsToLogEx.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param fVerbose Whether to print all the stats or just the ones
+ * relevant to hunting leaks.
+ */
+static void rtMemTrackerDumpStatsToLogEx(PRTMEMTRACKERINT pTracker, bool fVerbose)
+{
+ RTMEMTRACKEROUTPUT Output;
+ Output.pfnPrintf = rtMemTrackerDumpLogOutput;
+ rtMemTrackerDumpStatsWorker(pTracker, &Output, fVerbose);
+}
+
+
+/**
+ * @callback_method_impl{RTMEMTRACKEROUTPUT::pfnPrintf, Outputting to the release log}
+ */
+static DECLCALLBACK(void) rtMemTrackerDumpLogRelOutput(PRTMEMTRACKEROUTPUT pThis, const char *pszFormat, ...)
+{
+ va_list va;
+ va_start(va, pszFormat);
+ RTLogRelPrintfV(pszFormat, va);
+ va_end(va);
+}
+
+
+/**
+ * Internal worker for RTMemTrackerDumpStatsToLog and
+ * RTMemTrackerDumpStatsToLogEx.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ */
+static void rtMemTrackerDumpAllToLogRelEx(PRTMEMTRACKERINT pTracker)
+{
+ RTMEMTRACKEROUTPUT Output;
+ Output.pfnPrintf = rtMemTrackerDumpLogRelOutput;
+ rtMemTrackerDumpAllWorker(pTracker, &Output);
+}
+
+
+/**
+ * Internal worker for RTMemTrackerDumpStatsToLogRel and
+ * RTMemTrackerDumpStatsToLogRelEx.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param fVerbose Whether to print all the stats or just the ones
+ * relevant to hunting leaks.
+ */
+static void rtMemTrackerDumpStatsToLogRelEx(PRTMEMTRACKERINT pTracker, bool fVerbose)
+{
+ RTMEMTRACKEROUTPUT Output;
+ Output.pfnPrintf = rtMemTrackerDumpLogRelOutput;
+ rtMemTrackerDumpStatsWorker(pTracker, &Output, fVerbose);
+}
+
+#ifdef IN_RING3
+
+/**
+ * @callback_method_impl{RTMEMTRACKEROUTPUT::pfnPrintf, Outputting to file}
+ */
+static DECLCALLBACK(void) rtMemTrackerDumpFileOutput(PRTMEMTRACKEROUTPUT pThis, const char *pszFormat, ...)
+{
+ va_list va;
+ va_start(va, pszFormat);
+ char szOutput[_4K];
+ size_t cchOutput = RTStrPrintfV(szOutput, sizeof(szOutput), pszFormat, va);
+ va_end(va);
+ RTFileWrite(pThis->uData.hFile, szOutput, cchOutput, NULL);
+}
+
+
+/**
+ * Internal work that dumps the memory tracking statistics to a file handle.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param fVerbose Whether to print all the stats or just the ones
+ * relevant to hunting leaks.
+ * @param hFile The file handle. Can be NIL_RTFILE.
+ */
+static void rtMemTrackerDumpStatsToFileHandle(PRTMEMTRACKERINT pTracker, bool fVerbose, RTFILE hFile)
+{
+ if (hFile == NIL_RTFILE)
+ return;
+ RTMEMTRACKEROUTPUT Output;
+ Output.pfnPrintf = rtMemTrackerDumpFileOutput;
+ Output.uData.hFile = hFile;
+ rtMemTrackerDumpStatsWorker(pTracker, &Output, fVerbose);
+}
+
+
+/**
+ * Internal work that dumps all the memory tracking information to a file
+ * handle.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param hFile The file handle. Can be NIL_RTFILE.
+ */
+static void rtMemTrackerDumpAllToFileHandle(PRTMEMTRACKERINT pTracker, RTFILE hFile)
+{
+ if (hFile == NIL_RTFILE)
+ return;
+ RTMEMTRACKEROUTPUT Output;
+ Output.pfnPrintf = rtMemTrackerDumpFileOutput;
+ Output.uData.hFile = hFile;
+ rtMemTrackerDumpAllWorker(pTracker, &Output);
+}
+
+
+/**
+ * Internal worker for RTMemTrackerDumpStatsToStdOut and
+ * RTMemTrackerDumpStatsToStdOutEx.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param fVerbose Whether to print all the stats or just the ones
+ * relevant to hunting leaks.
+ */
+static void rtMemTrackerDumpStatsToStdOutEx(PRTMEMTRACKERINT pTracker, bool fVerbose)
+{
+ rtMemTrackerDumpStatsToFileHandle(pTracker, fVerbose, rtFileGetStandard(RTHANDLESTD_OUTPUT));
+}
+
+
+/**
+ * Internal worker for RTMemTrackerDumpAllToStdOut and
+ * RTMemTrackerDumpAllToStdOutEx.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ */
+static void rtMemTrackerDumpAllToStdOutEx(PRTMEMTRACKERINT pTracker)
+{
+ rtMemTrackerDumpAllToFileHandle(pTracker, rtFileGetStandard(RTHANDLESTD_OUTPUT));
+}
+
+
+/**
+ * Internal worker for RTMemTrackerDumpStatsToStdErr and
+ * RTMemTrackerDumpStatsToStdErrEx.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param fVerbose Whether to print all the stats or just the ones
+ * relevant to hunting leaks.
+ */
+static void rtMemTrackerDumpStatsToStdErrEx(PRTMEMTRACKERINT pTracker, bool fVerbose)
+{
+ rtMemTrackerDumpStatsToFileHandle(pTracker, fVerbose, rtFileGetStandard(RTHANDLESTD_ERROR));
+}
+
+
+/**
+ * Internal worker for RTMemTrackerDumpAllToStdErr and
+ * RTMemTrackerDumpAllToStdErrEx.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ */
+static void rtMemTrackerDumpAllToStdErrEx(PRTMEMTRACKERINT pTracker)
+{
+ rtMemTrackerDumpAllToFileHandle(pTracker, rtFileGetStandard(RTHANDLESTD_ERROR));
+}
+
+
+/**
+ * Internal worker for RTMemTrackerDumpStatsToFile and
+ * RTMemTrackerDumpStatsToFileEx.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param fVerbose Whether to print all the stats or just the ones
+ * relevant to hunting leaks.
+ * @param pszFilename The name of the output file.
+ */
+static void rtMemTrackerDumpStatsToFileEx(PRTMEMTRACKERINT pTracker, bool fVerbose, const char *pszFilename)
+{
+ if (!pTracker)
+ return;
+
+ /** @todo this is borked. */
+ RTFILE hFile;
+ int rc = RTFileOpen(&hFile, pszFilename,
+ RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE
+ | (0600 << RTFILE_O_CREATE_MODE_SHIFT));
+ if (RT_FAILURE(rc))
+ return;
+ rtMemTrackerDumpStatsToFileHandle(pTracker, fVerbose, hFile);
+ RTFileClose(hFile);
+}
+
+
+/**
+ * Internal worker for RTMemTrackerDumpAllToFile and
+ * RTMemTrackerDumpAllToFileEx.
+ *
+ * @param pTracker The tracker instance. Can be NULL.
+ * @param pszFilename The name of the output file.
+ */
+static void rtMemTrackerDumpAllToFileEx(PRTMEMTRACKERINT pTracker, const char *pszFilename)
+{
+ if (!pTracker)
+ return;
+
+ RTFILE hFile;
+ int rc = RTFileOpen(&hFile, pszFilename,
+ RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE
+ | (0600 << RTFILE_O_CREATE_MODE_SHIFT));
+ if (RT_FAILURE(rc))
+ return;
+ rtMemTrackerDumpAllToFileHandle(pTracker, hFile);
+ RTFileClose(hFile);
+}
+
+#endif /* IN_RING3 */
+
+
+
+/*
+ *
+ *
+ * Default tracker.
+ * Default tracker.
+ * Default tracker.
+ * Default tracker.
+ * Default tracker.
+ *
+ *
+ */
+
+
+/**
+ * Handles the lazy initialization when g_pDefaultTracker is NULL.
+ *
+ * @returns The newly created default tracker or NULL.
+ */
+static PRTMEMTRACKERINT rtMemTrackerLazyInitDefaultTracker(void)
+{
+ /*
+ * Don't attempt initialize before RTThread has been initialized.
+ */
+ if (!RTThreadIsInitialized())
+ return NULL;
+
+ /*
+ * Only one initialization at a time. For now we'll ASSUME that there
+ * won't be thread ending up here at the same time, only the same
+ * reentering from the allocator when creating the tracker.
+ */
+ static volatile bool s_fInitialized = false;
+ if (ASMAtomicXchgBool(&s_fInitialized, true))
+ return g_pDefaultTracker;
+
+ PRTMEMTRACKERINT pTracker = NULL; /* gcc sucks. */
+ int rc = rtMemTrackerCreate(&pTracker);
+ if (RT_FAILURE(rc))
+ return NULL;
+
+ g_pDefaultTracker = pTracker;
+ return pTracker;
+}
+
+
+
+RTDECL(void *) RTMemTrackerHdrAlloc(void *pv, size_t cb, const char *pszTag, RTMEMTRACKERMETHOD enmMethod)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerHdrAllocEx(pTracker, pv, cb, pszTag, enmMethod);
+}
+
+
+RTDECL(void *) RTMemTrackerHdrReallocPrep(void *pvOldUser, size_t cbOldUser, const char *pszTag)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerHdrReallocPrepEx(pTracker, pvOldUser, cbOldUser, pszTag);
+}
+
+
+RTDECL(void *) RTMemTrackerHdrReallocDone(void *pvNew, size_t cbNewUser, void *pvOld, const char *pszTag)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerHdrReallocDoneEx(pTracker, pvNew, cbNewUser, pvOld, pszTag);
+}
+
+
+RTDECL(void *) RTMemTrackerHdrFree(void *pvUser, size_t cbUser, const char *pszTag, RTMEMTRACKERMETHOD enmMethod)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerHdrFreeEx(pTracker, pvUser, cbUser, pszTag, enmMethod);
+}
+
+
+RTDECL(void) RTMemTrackerDumpAllToLog(void)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerDumpAllToLogEx(pTracker);
+}
+
+
+RTDECL(void) RTMemTrackerDumpAllToLogRel(void)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerDumpAllToLogRelEx(pTracker);
+}
+
+
+RTDECL(void) RTMemTrackerDumpAllToStdOut(void)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerDumpAllToStdOutEx(pTracker);
+}
+
+
+RTDECL(void) RTMemTrackerDumpAllToStdErr(void)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerDumpAllToStdErrEx(pTracker);
+}
+
+
+RTDECL(void) RTMemTrackerDumpAllToFile(const char *pszFilename)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerDumpAllToFileEx(pTracker, pszFilename);
+}
+
+
+RTDECL(void) RTMemTrackerDumpStatsToLog(bool fVerbose)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerDumpStatsToLogEx(pTracker, fVerbose);
+}
+
+
+RTDECL(void) RTMemTrackerDumpStatsToLogRel(bool fVerbose)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerDumpStatsToLogRelEx(pTracker, fVerbose);
+}
+
+
+RTDECL(void) RTMemTrackerDumpStatsToStdOut(bool fVerbose)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerDumpStatsToStdOutEx(pTracker, fVerbose);
+}
+
+
+RTDECL(void) RTMemTrackerDumpStatsToStdErr(bool fVerbose)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerDumpStatsToStdErrEx(pTracker, fVerbose);
+}
+
+
+RTDECL(void) RTMemTrackerDumpStatsToFile(bool fVerbose, const char *pszFilename)
+{
+ PRTMEMTRACKERINT pTracker = g_pDefaultTracker;
+ if (RT_UNLIKELY(!pTracker))
+ pTracker = rtMemTrackerLazyInitDefaultTracker();
+ return rtMemTrackerDumpStatsToFileEx(pTracker, fVerbose, pszFilename);
+}
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgExU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgExU64.asm
index da71254ef..1e0974623 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgExU64.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgExU64.asm
@@ -1,4 +1,4 @@
-; $Id: ASMAtomicCmpXchgExU64.asm $
+; $Id: ASMAtomicCmpXchgExU64.asm 33540 2010-10-28 09:27:05Z vboxsync $
;; @file
; IPRT - ASMAtomicCmpXchgExU64().
;
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm
index d6ee4d69c..e0f96d47d 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU64.asm
@@ -1,4 +1,4 @@
-; $Id: ASMAtomicCmpXchgU64.asm $
+; $Id: ASMAtomicCmpXchgU64.asm 33540 2010-10-28 09:27:05Z vboxsync $
;; @file
; IPRT - ASMAtomicCmpXchgU64().
;
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm
index 0c57b29d3..86f1af833 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm
@@ -1,4 +1,4 @@
-; $Id: ASMAtomicCmpXchgU8.asm $
+; $Id: ASMAtomicCmpXchgU8.asm 33540 2010-10-28 09:27:05Z vboxsync $
;; @file
; IPRT - ASMAtomicCmpXchgU8().
;
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm
index 60d01e32a..cf8298e47 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicReadU64.asm
@@ -1,4 +1,4 @@
-; $Id: ASMAtomicReadU64.asm $
+; $Id: ASMAtomicReadU64.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - ASMAtomicReadU64().
;
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoReadU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoReadU64.asm
index 8e83ebe7e..0751ba001 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicUoReadU64.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoReadU64.asm
@@ -1,4 +1,4 @@
-; $Id: ASMAtomicUoReadU64.asm $
+; $Id: ASMAtomicUoReadU64.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - ASMAtomicUoReadU64().
;
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicXchgU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicXchgU64.asm
index 2530060ec..0545fcc92 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicXchgU64.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicXchgU64.asm
@@ -1,4 +1,4 @@
-; $Id: ASMAtomicXchgU64.asm $
+; $Id: ASMAtomicXchgU64.asm 33540 2010-10-28 09:27:05Z vboxsync $
;; @file
; IPRT - ASMAtomicXchgU64().
;
diff --git a/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm b/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm
index 6155e869a..f5e92a5bc 100644
--- a/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm
+++ b/src/VBox/Runtime/common/asm/ASMMultU64ByU32DivByU32.asm
@@ -1,4 +1,4 @@
-; $Id: ASMMultU64ByU32DivByU32.asm $
+; $Id: ASMMultU64ByU32DivByU32.asm 33540 2010-10-28 09:27:05Z vboxsync $
;; @file
; IPRT - Assembly Functions, ASMMultU64ByU32DivByU32.
;
diff --git a/src/VBox/Runtime/common/asm/ASMNopPause.asm b/src/VBox/Runtime/common/asm/ASMNopPause.asm
index 455bd14d0..25b50a9e6 100644
--- a/src/VBox/Runtime/common/asm/ASMNopPause.asm
+++ b/src/VBox/Runtime/common/asm/ASMNopPause.asm
@@ -1,4 +1,4 @@
-; $Id: ASMNopPause.asm $
+; $Id: ASMNopPause.asm 33540 2010-10-28 09:27:05Z vboxsync $
;; @file
; IPRT - ASMNopPause().
;
diff --git a/src/VBox/Runtime/common/asm/asm-fake.cpp b/src/VBox/Runtime/common/asm/asm-fake.cpp
index 73478a86e..263ad3e22 100644
--- a/src/VBox/Runtime/common/asm/asm-fake.cpp
+++ b/src/VBox/Runtime/common/asm/asm-fake.cpp
@@ -1,4 +1,4 @@
-/* $Id: asm-fake.cpp $ */
+/* $Id: asm-fake.cpp 29278 2010-05-09 23:28:27Z vboxsync $ */
/** @file
* IPRT - Fake asm.h routines for use early in a new port.
*/
diff --git a/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp b/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp
index 70b158be2..4caac022e 100644
--- a/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp
+++ b/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSha1Digest.cpp $ */
+/* $Id: RTSha1Digest.cpp 32569 2010-09-16 15:42:51Z vboxsync $ */
/** @file
* IPRT - SHA1 digest creation
*/
diff --git a/src/VBox/Runtime/common/checksum/adler32.cpp b/src/VBox/Runtime/common/checksum/adler32.cpp
index d9e54985b..05fa27736 100644
--- a/src/VBox/Runtime/common/checksum/adler32.cpp
+++ b/src/VBox/Runtime/common/checksum/adler32.cpp
@@ -1,4 +1,4 @@
-/* $Id: adler32.cpp $ */
+/* $Id: adler32.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Adler-32
*/
diff --git a/src/VBox/Runtime/common/checksum/crc32-zlib.cpp b/src/VBox/Runtime/common/checksum/crc32-zlib.cpp
index 650a959b2..6320688b7 100644
--- a/src/VBox/Runtime/common/checksum/crc32-zlib.cpp
+++ b/src/VBox/Runtime/common/checksum/crc32-zlib.cpp
@@ -1,4 +1,4 @@
-/* $Id: crc32-zlib.cpp $ */
+/* $Id: crc32-zlib.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - CRC-32 on top of zlib (very fast).
*/
diff --git a/src/VBox/Runtime/common/checksum/crc32.cpp b/src/VBox/Runtime/common/checksum/crc32.cpp
index c43b2cbbd..998c8f455 100644
--- a/src/VBox/Runtime/common/checksum/crc32.cpp
+++ b/src/VBox/Runtime/common/checksum/crc32.cpp
@@ -1,4 +1,4 @@
-/* $Id: crc32.cpp $ */
+/* $Id: crc32.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - CRC32.
*/
diff --git a/src/VBox/Runtime/common/checksum/crc64.cpp b/src/VBox/Runtime/common/checksum/crc64.cpp
index 74c60070d..586b5c8b4 100644
--- a/src/VBox/Runtime/common/checksum/crc64.cpp
+++ b/src/VBox/Runtime/common/checksum/crc64.cpp
@@ -1,4 +1,4 @@
-/* $Id: crc64.cpp $ */
+/* $Id: crc64.cpp 31847 2010-08-21 20:33:07Z vboxsync $ */
/** @file
* IPRT - CRC64.
*
diff --git a/src/VBox/Runtime/common/checksum/ipv4.cpp b/src/VBox/Runtime/common/checksum/ipv4.cpp
index 4b10b4b00..1dd1ee363 100644
--- a/src/VBox/Runtime/common/checksum/ipv4.cpp
+++ b/src/VBox/Runtime/common/checksum/ipv4.cpp
@@ -1,4 +1,4 @@
-/* $Id: ipv4.cpp $ */
+/* $Id: ipv4.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - IPv4 Checksum calculation and validation.
*/
diff --git a/src/VBox/Runtime/common/checksum/ipv6.cpp b/src/VBox/Runtime/common/checksum/ipv6.cpp
index d33438a0f..c9baf477a 100644
--- a/src/VBox/Runtime/common/checksum/ipv6.cpp
+++ b/src/VBox/Runtime/common/checksum/ipv6.cpp
@@ -1,4 +1,4 @@
-/* $Id: ipv6.cpp $ */
+/* $Id: ipv6.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - IPv6 Checksum calculation and validation.
*/
diff --git a/src/VBox/Runtime/common/checksum/manifest-file.cpp b/src/VBox/Runtime/common/checksum/manifest-file.cpp
index d686022e6..602c99d49 100644
--- a/src/VBox/Runtime/common/checksum/manifest-file.cpp
+++ b/src/VBox/Runtime/common/checksum/manifest-file.cpp
@@ -1,4 +1,4 @@
-/* $Id: manifest-file.cpp $ */
+/* $Id: manifest-file.cpp 35351 2010-12-27 17:04:17Z vboxsync $ */
/** @file
* IPRT - Manifest, the bits with file dependencies
*/
diff --git a/src/VBox/Runtime/common/checksum/manifest.cpp b/src/VBox/Runtime/common/checksum/manifest.cpp
index b1e1152be..69a52ee42 100644
--- a/src/VBox/Runtime/common/checksum/manifest.cpp
+++ b/src/VBox/Runtime/common/checksum/manifest.cpp
@@ -1,4 +1,4 @@
-/* $Id: manifest.cpp $ */
+/* $Id: manifest.cpp 33289 2010-10-21 10:00:15Z vboxsync $ */
/** @file
* IPRT - Manifest file handling.
*/
diff --git a/src/VBox/Runtime/common/checksum/manifest2.cpp b/src/VBox/Runtime/common/checksum/manifest2.cpp
index 534d08d9b..918b67eb8 100644
--- a/src/VBox/Runtime/common/checksum/manifest2.cpp
+++ b/src/VBox/Runtime/common/checksum/manifest2.cpp
@@ -1,4 +1,4 @@
-/* $Id: manifest2.cpp $ */
+/* $Id: manifest2.cpp 34941 2010-12-10 10:58:06Z vboxsync $ */
/** @file
* IPRT - Manifest, the core.
*/
diff --git a/src/VBox/Runtime/common/checksum/manifest3.cpp b/src/VBox/Runtime/common/checksum/manifest3.cpp
index 393c130e6..cf06cd064 100644
--- a/src/VBox/Runtime/common/checksum/manifest3.cpp
+++ b/src/VBox/Runtime/common/checksum/manifest3.cpp
@@ -1,4 +1,4 @@
-/* $Id: manifest3.cpp $ */
+/* $Id: manifest3.cpp 35351 2010-12-27 17:04:17Z vboxsync $ */
/** @file
* IPRT - Manifest, the bits with the most dependencies.
*/
diff --git a/src/VBox/Runtime/common/checksum/md5.cpp b/src/VBox/Runtime/common/checksum/md5.cpp
index 1bc5f97b4..f312d1763 100644
--- a/src/VBox/Runtime/common/checksum/md5.cpp
+++ b/src/VBox/Runtime/common/checksum/md5.cpp
@@ -1,4 +1,4 @@
-/* $Id: md5.cpp $ */
+/* $Id: md5.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - MD5 message digest functions.
*/
diff --git a/src/VBox/Runtime/common/checksum/md5str.cpp b/src/VBox/Runtime/common/checksum/md5str.cpp
index 40dbb8ba9..f85c11783 100644
--- a/src/VBox/Runtime/common/checksum/md5str.cpp
+++ b/src/VBox/Runtime/common/checksum/md5str.cpp
@@ -1,4 +1,4 @@
-/* $Id: md5str.cpp $ */
+/* $Id: md5str.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - MD5 string functions.
*/
diff --git a/src/VBox/Runtime/common/checksum/sha1.cpp b/src/VBox/Runtime/common/checksum/sha1.cpp
index e448a479b..624ce03d2 100644
--- a/src/VBox/Runtime/common/checksum/sha1.cpp
+++ b/src/VBox/Runtime/common/checksum/sha1.cpp
@@ -1,4 +1,4 @@
-/* $Id: sha1.cpp $ */
+/* $Id: sha1.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - SHA-1 hash functions.
*/
diff --git a/src/VBox/Runtime/common/checksum/sha1str.cpp b/src/VBox/Runtime/common/checksum/sha1str.cpp
index 730d0bee9..d50b57cd4 100644
--- a/src/VBox/Runtime/common/checksum/sha1str.cpp
+++ b/src/VBox/Runtime/common/checksum/sha1str.cpp
@@ -1,4 +1,4 @@
-/* $Id: sha1str.cpp $ */
+/* $Id: sha1str.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - SHA-1 string functions.
*/
diff --git a/src/VBox/Runtime/common/checksum/sha256.cpp b/src/VBox/Runtime/common/checksum/sha256.cpp
index c78e22e22..ad1c831af 100644
--- a/src/VBox/Runtime/common/checksum/sha256.cpp
+++ b/src/VBox/Runtime/common/checksum/sha256.cpp
@@ -1,4 +1,4 @@
-/* $Id: sha256.cpp $ */
+/* $Id: sha256.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - SHA-256 hash functions.
*/
diff --git a/src/VBox/Runtime/common/checksum/sha256str.cpp b/src/VBox/Runtime/common/checksum/sha256str.cpp
index 43e668e18..4c683db9a 100644
--- a/src/VBox/Runtime/common/checksum/sha256str.cpp
+++ b/src/VBox/Runtime/common/checksum/sha256str.cpp
@@ -1,4 +1,4 @@
-/* $Id: sha256str.cpp $ */
+/* $Id: sha256str.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - SHA-256 string functions.
*/
diff --git a/src/VBox/Runtime/common/checksum/sha512.cpp b/src/VBox/Runtime/common/checksum/sha512.cpp
index ee38f3686..0befcf7f6 100644
--- a/src/VBox/Runtime/common/checksum/sha512.cpp
+++ b/src/VBox/Runtime/common/checksum/sha512.cpp
@@ -1,4 +1,4 @@
-/* $Id: sha512.cpp $ */
+/* $Id: sha512.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - SHA-512 hash functions.
*/
diff --git a/src/VBox/Runtime/common/checksum/sha512str.cpp b/src/VBox/Runtime/common/checksum/sha512str.cpp
index 133734217..eed48abad 100644
--- a/src/VBox/Runtime/common/checksum/sha512str.cpp
+++ b/src/VBox/Runtime/common/checksum/sha512str.cpp
@@ -1,4 +1,4 @@
-/* $Id: sha512str.cpp $ */
+/* $Id: sha512str.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - SHA-512 string functions.
*/
diff --git a/src/VBox/Runtime/common/dbg/dbg.cpp b/src/VBox/Runtime/common/dbg/dbg.cpp
index 4198ddafe..e17bdcb76 100644
--- a/src/VBox/Runtime/common/dbg/dbg.cpp
+++ b/src/VBox/Runtime/common/dbg/dbg.cpp
@@ -1,4 +1,4 @@
-/* $Id: dbg.cpp $ */
+/* $Id: dbg.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Debug Misc.
*/
diff --git a/src/VBox/Runtime/common/dbg/dbgas.cpp b/src/VBox/Runtime/common/dbg/dbgas.cpp
index dac5ae97e..a5f7c355b 100644
--- a/src/VBox/Runtime/common/dbg/dbgas.cpp
+++ b/src/VBox/Runtime/common/dbg/dbgas.cpp
@@ -1,4 +1,4 @@
-/* $Id: dbgas.cpp $ */
+/* $Id: dbgas.cpp 33663 2010-11-01 15:58:06Z vboxsync $ */
/** @file
* IPRT - Debug Address Space.
*/
diff --git a/src/VBox/Runtime/common/dbg/dbgmod.cpp b/src/VBox/Runtime/common/dbg/dbgmod.cpp
index fc94ffbf7..ecfc58793 100644
--- a/src/VBox/Runtime/common/dbg/dbgmod.cpp
+++ b/src/VBox/Runtime/common/dbg/dbgmod.cpp
@@ -1,4 +1,4 @@
-/* $Id: dbgmod.cpp $ */
+/* $Id: dbgmod.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Debug Module Interpreter.
*/
diff --git a/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp b/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp
index 476a39aa5..ed220cba9 100644
--- a/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp
+++ b/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp
@@ -1,4 +1,4 @@
-/* $Id: dbgmodcontainer.cpp $ */
+/* $Id: dbgmodcontainer.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Debug Info Container.
*/
diff --git a/src/VBox/Runtime/common/dbg/dbgmodnm.cpp b/src/VBox/Runtime/common/dbg/dbgmodnm.cpp
index f403157ae..ed10ad0de 100644
--- a/src/VBox/Runtime/common/dbg/dbgmodnm.cpp
+++ b/src/VBox/Runtime/common/dbg/dbgmodnm.cpp
@@ -1,4 +1,4 @@
-/* $Id: dbgmodnm.cpp $ */
+/* $Id: dbgmodnm.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Debug Map Reader For NM Like Mapfiles.
*/
@@ -503,7 +503,7 @@ static DECLCALLBACK(int) rtDbgModNm_TryOpen(PRTDBGMODINT pMod)
/** Virtual function table for the NM-like map file reader. */
-DECLHIDDEN(RTDBGMODVTDBG const) g_rtDbgModVtDbgNm =
+DECL_HIDDEN_CONST(RTDBGMODVTDBG) const g_rtDbgModVtDbgNm =
{
/*.u32Magic = */ RTDBGMODVTDBG_MAGIC,
/*.fSupports = */ RT_DBGTYPE_MAP,
diff --git a/src/VBox/Runtime/common/dvm/Makefile.kup b/src/VBox/Runtime/common/dvm/Makefile.kup
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/VBox/Runtime/common/dvm/Makefile.kup
diff --git a/src/VBox/Runtime/common/dvm/dvm.cpp b/src/VBox/Runtime/common/dvm/dvm.cpp
new file mode 100644
index 000000000..eb9fe7021
--- /dev/null
+++ b/src/VBox/Runtime/common/dvm/dvm.cpp
@@ -0,0 +1,481 @@
+/* $Id: dvm.cpp 37270 2011-05-30 21:25:42Z vboxsync $ */
+/** @file
+ * IPRT Disk Volume Management API (DVM) - generic code.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/types.h>
+#include <iprt/assert.h>
+#include <iprt/mem.h>
+#include <iprt/dvm.h>
+#include <iprt/err.h>
+#include <iprt/asm.h>
+#include <iprt/string.h>
+#include "internal/dvm.h"
+
+/*******************************************************************************
+* Structures and Typedefs *
+*******************************************************************************/
+
+/**
+ * The internal volume manager structure.
+ */
+typedef struct RTDVMINTERNAL
+{
+ /** The DVM magic (RTDVM_MAGIC). */
+ uint32_t u32Magic;
+ /** The disk descriptor. */
+ RTDVMDISK DvmDisk;
+ /** Pointer to the backend operations table after a successful probe. */
+ PCRTDVMFMTOPS pDvmFmtOps;
+ /** The format specific volume manager data. */
+ RTDVMFMT hVolMgrFmt;
+ /** Reference counter. */
+ uint32_t volatile cRefs;
+} RTDVMINTERNAL;
+/** Pointer to an internal volume manager. */
+typedef RTDVMINTERNAL *PRTDVMINTERNAL;
+
+/**
+ * The internal volume structure.
+ */
+typedef struct RTDVMVOLUMEINTERNAL
+{
+ /** The DVM volume magic (RTDVMVOLUME_MAGIC). */
+ uint32_t u32Magic;
+ /** Pointer to the owning volume manager. */
+ PRTDVMINTERNAL pVolMgr;
+ /** Format specific volume data. */
+ RTDVMVOLUMEFMT hVolFmt;
+ /** Reference counter. */
+ uint32_t volatile cRefs;
+} RTDVMVOLUMEINTERNAL;
+/** Pointer to an internal volume. */
+typedef RTDVMVOLUMEINTERNAL *PRTDVMVOLUMEINTERNAL;
+
+/*******************************************************************************
+* Global variables *
+*******************************************************************************/
+extern RTDVMFMTOPS g_rtDvmFmtMbr;
+extern RTDVMFMTOPS g_rtDvmFmtGpt;
+extern RTDVMFMTOPS g_rtDvmFmtBsdLbl;
+
+/**
+ * Supported volume formats.
+ */
+static PCRTDVMFMTOPS g_aDvmFmts[] =
+{
+ &g_rtDvmFmtMbr,
+ &g_rtDvmFmtGpt,
+ &g_rtDvmFmtBsdLbl
+};
+
+/**
+ * Descriptions of the volume types.
+ *
+ * This is indexed by RTDVMVOLTYPE.
+ */
+static const char * g_apcszDvmVolTypes[] =
+{
+ "Invalid",
+ "Unknown",
+ "NTFS",
+ "FAT16",
+ "FAT32",
+ "Linux swap",
+ "Linux native",
+ "Linux LVM",
+ "Linux SoftRaid",
+ "FreeBSD",
+ "NetBSD",
+ "OpenBSD",
+ "Mac OS X HFS or HFS+",
+ "Solaris"
+};
+
+RTDECL(int) RTDvmCreate(PRTDVM phVolMgr, PFNDVMREAD pfnRead,
+ PFNDVMWRITE pfnWrite, uint64_t cbDisk,
+ uint64_t cbSector, void *pvUser)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMINTERNAL pThis;
+
+ pThis = (PRTDVMINTERNAL)RTMemAllocZ(sizeof(RTDVMINTERNAL));
+ if (VALID_PTR(pThis))
+ {
+ pThis->u32Magic = RTDVM_MAGIC;
+ pThis->DvmDisk.cbDisk = cbDisk;
+ pThis->DvmDisk.cbSector = cbSector;
+ pThis->DvmDisk.pvUser = pvUser;
+ pThis->DvmDisk.pfnRead = pfnRead;
+ pThis->DvmDisk.pfnWrite = pfnWrite;
+ pThis->pDvmFmtOps = NULL;
+ pThis->hVolMgrFmt = NIL_RTDVMFMT;
+ pThis->cRefs = 1;
+ *phVolMgr = pThis;
+ }
+ else
+ rc = VERR_NO_MEMORY;
+
+ return rc;
+}
+
+RTDECL(uint32_t) RTDvmRetain(RTDVM hVolMgr)
+{
+ PRTDVMINTERNAL pThis = hVolMgr;
+ AssertPtrReturn(pThis, UINT32_MAX);
+ AssertReturn(pThis->u32Magic == RTDVM_MAGIC, UINT32_MAX);
+
+ uint32_t cRefs = ASMAtomicIncU32(&pThis->cRefs);
+ AssertMsg(cRefs > 1 && cRefs < _1M, ("%#x %p\n", cRefs, pThis));
+ return cRefs;
+}
+
+/**
+ * Destroys a volume manager handle.
+ *
+ * @param pThis The volume manager to destroy.
+ */
+static void rtDvmDestroy(PRTDVMINTERNAL pThis)
+{
+ if (pThis->hVolMgrFmt != NIL_RTDVMFMT)
+ {
+ AssertPtr(pThis->pDvmFmtOps);
+
+ /* Let the backend do it's own cleanup first. */
+ pThis->pDvmFmtOps->pfnClose(pThis->hVolMgrFmt);
+ pThis->hVolMgrFmt = NIL_RTDVMFMT;
+ }
+
+ pThis->DvmDisk.cbDisk = 0;
+ pThis->DvmDisk.pvUser = NULL;
+ pThis->DvmDisk.pfnRead = NULL;
+ pThis->DvmDisk.pfnWrite = NULL;
+ pThis->u32Magic = RTDVM_MAGIC_DEAD;
+ RTMemFree(pThis);
+}
+
+RTDECL(uint32_t) RTDvmRelease(RTDVM hVolMgr)
+{
+ PRTDVMINTERNAL pThis = hVolMgr;
+ if (pThis == NIL_RTDVM)
+ return 0;
+ AssertPtrReturn(pThis, UINT32_MAX);
+ AssertReturn(pThis->u32Magic == RTDVM_MAGIC, UINT32_MAX);
+
+ uint32_t cRefs = ASMAtomicDecU32(&pThis->cRefs);
+ AssertMsg(cRefs < _1M, ("%#x %p\n", cRefs, pThis));
+ if (cRefs == 0)
+ rtDvmDestroy(pThis);
+ return cRefs;
+}
+
+RTDECL(int) RTDvmMapOpen(RTDVM hVolMgr)
+{
+ int rc = VINF_SUCCESS;
+ uint32_t uScoreMax = RTDVM_MATCH_SCORE_UNSUPPORTED;
+ PCRTDVMFMTOPS pDvmFmtOpsMatch = NULL;
+ PRTDVMINTERNAL pThis = hVolMgr;
+ AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->u32Magic == RTDVM_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->hVolMgrFmt == NIL_RTDVMFMT, VERR_INVALID_HANDLE);
+
+ Assert(!pThis->pDvmFmtOps);
+
+ for (unsigned i = 0; i < RT_ELEMENTS(g_aDvmFmts); i++)
+ {
+ uint32_t uScore;
+ PCRTDVMFMTOPS pDvmFmtOps = g_aDvmFmts[i];
+
+ rc = pDvmFmtOps->pfnProbe(&pThis->DvmDisk, &uScore);
+ if ( RT_SUCCESS(rc)
+ && uScore > uScoreMax)
+ {
+ pDvmFmtOpsMatch = pDvmFmtOps;
+ uScoreMax = uScore;
+ }
+ else if (RT_FAILURE(rc))
+ break;
+ }
+
+ if (RT_SUCCESS(rc))
+ {
+ if (uScoreMax > RTDVM_MATCH_SCORE_UNSUPPORTED)
+ {
+ AssertPtr(pDvmFmtOpsMatch);
+
+ /* Open the format. */
+ rc = pDvmFmtOpsMatch->pfnOpen(&pThis->DvmDisk, &pThis->hVolMgrFmt);
+ if (RT_SUCCESS(rc))
+ pThis->pDvmFmtOps = pDvmFmtOpsMatch;
+ }
+ else
+ rc = VERR_NOT_SUPPORTED;
+ }
+
+ return rc;
+}
+
+RTDECL(int) RTDvmMapInitialize(RTDVM hVolMgr, const char *pszFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMINTERNAL pThis = hVolMgr;
+ AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
+ AssertPtrReturn(pszFmt, VERR_INVALID_POINTER);
+ AssertReturn(pThis->u32Magic == RTDVM_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->hVolMgrFmt == NIL_RTDVMFMT, VERR_INVALID_HANDLE);
+
+ for (unsigned i = 0; i < RT_ELEMENTS(g_aDvmFmts); i++)
+ {
+ PCRTDVMFMTOPS pDvmFmtOps = g_aDvmFmts[i];
+
+ if (!RTStrCmp(pDvmFmtOps->pcszFmt, pszFmt))
+ {
+ rc = pDvmFmtOps->pfnInitialize(&pThis->DvmDisk, &pThis->hVolMgrFmt);
+ if (RT_SUCCESS(rc))
+ pThis->pDvmFmtOps = pDvmFmtOps;
+
+ break;
+ }
+ }
+
+ return rc;
+}
+
+RTDECL(const char *) RTDvmMapGetFormat(RTDVM hVolMgr)
+{
+ PRTDVMINTERNAL pThis = hVolMgr;
+ AssertPtrReturn(pThis, NULL);
+ AssertReturn(pThis->u32Magic == RTDVM_MAGIC, NULL);
+ AssertReturn(pThis->hVolMgrFmt != NIL_RTDVMFMT, NULL);
+
+ return pThis->pDvmFmtOps->pcszFmt;
+}
+
+RTDECL(uint32_t) RTDvmMapGetValidVolumes(RTDVM hVolMgr)
+{
+ PRTDVMINTERNAL pThis = hVolMgr;
+ AssertPtrReturn(pThis, UINT32_MAX);
+ AssertReturn(pThis->u32Magic == RTDVM_MAGIC, UINT32_MAX);
+ AssertReturn(pThis->hVolMgrFmt != NIL_RTDVMFMT, UINT32_MAX);
+
+ return pThis->pDvmFmtOps->pfnGetValidVolumes(pThis->hVolMgrFmt);
+}
+
+RTDECL(uint32_t) RTDvmMapGetMaxVolumes(RTDVM hVolMgr)
+{
+ PRTDVMINTERNAL pThis = hVolMgr;
+ AssertPtrReturn(pThis, UINT32_MAX);
+ AssertReturn(pThis->u32Magic == RTDVM_MAGIC, UINT32_MAX);
+ AssertReturn(pThis->hVolMgrFmt != NIL_RTDVMFMT, UINT32_MAX);
+
+ return pThis->pDvmFmtOps->pfnGetMaxVolumes(pThis->hVolMgrFmt);
+}
+
+static int rtDvmVolumeCreate(PRTDVMINTERNAL pThis, RTDVMVOLUMEFMT hVolFmt,
+ PRTDVMVOLUME phVol)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMVOLUMEINTERNAL pVol = NULL;
+
+ pVol = (PRTDVMVOLUMEINTERNAL)RTMemAllocZ(sizeof(RTDVMVOLUMEINTERNAL));
+ if (VALID_PTR(pVol))
+ {
+ pVol->u32Magic = RTDVMVOLUME_MAGIC;
+ pVol->cRefs = 1;
+ pVol->pVolMgr = pThis;
+ pVol->hVolFmt = hVolFmt;
+
+ /* Reference the volume manager. */
+ RTDvmRetain(pThis);
+ *phVol = pVol;
+ }
+ else
+ rc = VERR_NO_MEMORY;
+
+ return rc;
+}
+
+RTDECL(int) RTDvmMapQueryFirstVolume(RTDVM hVolMgr, PRTDVMVOLUME phVol)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMINTERNAL pThis = hVolMgr;
+ AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->u32Magic == RTDVM_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->hVolMgrFmt != NIL_RTDVMFMT, VERR_INVALID_HANDLE);
+ AssertPtrReturn(phVol, VERR_INVALID_POINTER);
+
+ RTDVMVOLUMEFMT hVolFmt = NIL_RTDVMVOLUMEFMT;
+ rc = pThis->pDvmFmtOps->pfnQueryFirstVolume(pThis->hVolMgrFmt, &hVolFmt);
+ if (RT_SUCCESS(rc))
+ {
+ rc = rtDvmVolumeCreate(pThis, hVolFmt, phVol);
+ if (RT_FAILURE(rc))
+ pThis->pDvmFmtOps->pfnVolumeClose(hVolFmt);
+ }
+
+ return rc;
+}
+
+RTDECL(int) RTDvmMapQueryNextVolume(RTDVM hVolMgr, RTDVMVOLUME hVol, PRTDVMVOLUME phVolNext)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMINTERNAL pThis = hVolMgr;
+ PRTDVMVOLUMEINTERNAL pVol = hVol;
+ AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->u32Magic == RTDVM_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->hVolMgrFmt != NIL_RTDVMFMT, VERR_INVALID_HANDLE);
+ AssertPtrReturn(pVol, VERR_INVALID_HANDLE);
+ AssertReturn(pVol->u32Magic == RTDVMVOLUME_MAGIC, VERR_INVALID_HANDLE);
+ AssertPtrReturn(phVolNext, VERR_INVALID_POINTER);
+
+ RTDVMVOLUMEFMT hVolFmtNext = NIL_RTDVMVOLUMEFMT;
+ rc = pThis->pDvmFmtOps->pfnQueryNextVolume(pThis->hVolMgrFmt, pVol->hVolFmt, &hVolFmtNext);
+ if (RT_SUCCESS(rc))
+ {
+ rc = rtDvmVolumeCreate(pThis, hVolFmtNext, phVolNext);
+ if (RT_FAILURE(rc))
+ pThis->pDvmFmtOps->pfnVolumeClose(hVolFmtNext);
+ }
+
+ return rc;
+}
+
+RTDECL(uint32_t) RTDvmVolumeRetain(RTDVMVOLUME hVol)
+{
+ PRTDVMVOLUMEINTERNAL pThis = hVol;
+ AssertPtrReturn(pThis, UINT32_MAX);
+ AssertReturn(pThis->u32Magic == RTDVMVOLUME_MAGIC, UINT32_MAX);
+
+ uint32_t cRefs = ASMAtomicIncU32(&pThis->cRefs);
+ AssertMsg(cRefs > 1 && cRefs < _1M, ("%#x %p\n", cRefs, pThis));
+ return cRefs;
+}
+
+/**
+ * Destroys a volume handle.
+ *
+ * @param pThis The volume to destroy.
+ */
+static void rtDvmVolumeDestroy(PRTDVMVOLUMEINTERNAL pThis)
+{
+ PRTDVMINTERNAL pVolMgr = pThis->pVolMgr;
+
+ AssertPtr(pVolMgr);
+
+ /* Close the volume. */
+ pVolMgr->pDvmFmtOps->pfnVolumeClose(pThis->hVolFmt);
+
+ pThis->u32Magic = RTDVMVOLUME_MAGIC_DEAD;
+ pThis->pVolMgr = NULL;
+ pThis->hVolFmt = NIL_RTDVMVOLUMEFMT;
+ RTMemFree(pThis);
+
+ /* Release the reference of the volume manager. */
+ RTDvmRelease(pVolMgr);
+}
+
+RTDECL(uint32_t) RTDvmVolumeRelease(RTDVMVOLUME hVol)
+{
+ PRTDVMVOLUMEINTERNAL pThis = hVol;
+ if (pThis == NIL_RTDVMVOLUME)
+ return 0;
+ AssertPtrReturn(pThis, UINT32_MAX);
+ AssertReturn(pThis->u32Magic == RTDVMVOLUME_MAGIC, UINT32_MAX);
+
+ uint32_t cRefs = ASMAtomicDecU32(&pThis->cRefs);
+ AssertMsg(cRefs < _1M, ("%#x %p\n", cRefs, pThis));
+ if (cRefs == 0)
+ rtDvmVolumeDestroy(pThis);
+ return cRefs;
+}
+
+RTDECL(uint64_t) RTDvmVolumeGetSize(RTDVMVOLUME hVol)
+{
+ PRTDVMVOLUMEINTERNAL pThis = hVol;
+ AssertPtrReturn(pThis, 0);
+ AssertReturn(pThis->u32Magic == RTDVMVOLUME_MAGIC, 0);
+
+ return pThis->pVolMgr->pDvmFmtOps->pfnVolumeGetSize(pThis->hVolFmt);
+}
+
+RTDECL(int) RTDvmVolumeQueryName(RTDVMVOLUME hVol, char **ppszVolName)
+{
+ PRTDVMVOLUMEINTERNAL pThis = hVol;
+ AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->u32Magic == RTDVMVOLUME_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(ppszVolName, VERR_INVALID_POINTER);
+
+ return pThis->pVolMgr->pDvmFmtOps->pfnVolumeQueryName(pThis->hVolFmt, ppszVolName);
+}
+
+RTDECL(RTDVMVOLTYPE) RTDvmVolumeGetType(RTDVMVOLUME hVol)
+{
+ PRTDVMVOLUMEINTERNAL pThis = hVol;
+ AssertPtrReturn(pThis, RTDVMVOLTYPE_INVALID);
+ AssertReturn(pThis->u32Magic == RTDVMVOLUME_MAGIC, RTDVMVOLTYPE_INVALID);
+
+ return pThis->pVolMgr->pDvmFmtOps->pfnVolumeGetType(pThis->hVolFmt);
+}
+
+RTDECL(uint64_t) RTDvmVolumeGetFlags(RTDVMVOLUME hVol)
+{
+ PRTDVMVOLUMEINTERNAL pThis = hVol;
+ AssertPtrReturn(pThis, UINT64_MAX);
+ AssertReturn(pThis->u32Magic == RTDVMVOLUME_MAGIC, UINT64_MAX);
+
+ return pThis->pVolMgr->pDvmFmtOps->pfnVolumeGetFlags(pThis->hVolFmt);
+}
+
+RTDECL(int) RTDvmVolumeRead(RTDVMVOLUME hVol, uint64_t off, void *pvBuf, size_t cbRead)
+{
+ PRTDVMVOLUMEINTERNAL pThis = hVol;
+ AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->u32Magic == RTDVMVOLUME_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(pvBuf, VERR_INVALID_POINTER);
+ AssertReturn(cbRead > 0, VERR_INVALID_PARAMETER);
+
+ return pThis->pVolMgr->pDvmFmtOps->pfnVolumeRead(pThis->hVolFmt, off, pvBuf, cbRead);
+}
+
+RTDECL(int) RTDvmVolumeWrite(RTDVMVOLUME hVol, uint64_t off, const void *pvBuf, size_t cbWrite)
+{
+ PRTDVMVOLUMEINTERNAL pThis = hVol;
+ AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->u32Magic == RTDVMVOLUME_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(pvBuf, VERR_INVALID_POINTER);
+ AssertReturn(cbWrite > 0, VERR_INVALID_PARAMETER);
+
+ return pThis->pVolMgr->pDvmFmtOps->pfnVolumeWrite(pThis->hVolFmt, off, pvBuf, cbWrite);
+}
+
+RTDECL(const char *) RTDvmVolumeTypeGetDescr(RTDVMVOLTYPE enmVolType)
+{
+ AssertReturn(enmVolType >= RTDVMVOLTYPE_INVALID && enmVolType < RTDVMVOLTYPE_END, NULL);
+
+ return g_apcszDvmVolTypes[enmVolType];
+}
diff --git a/src/VBox/Runtime/common/dvm/dvmbsdlabel.cpp b/src/VBox/Runtime/common/dvm/dvmbsdlabel.cpp
new file mode 100644
index 000000000..e874178df
--- /dev/null
+++ b/src/VBox/Runtime/common/dvm/dvmbsdlabel.cpp
@@ -0,0 +1,517 @@
+/* $Id: dvmbsdlabel.cpp 37423 2011-06-12 18:37:56Z vboxsync $ */
+/** @file
+ * IPRT Disk Volume Management API (DVM) - BSD disklabel format backend.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#include <iprt/types.h>
+#include <iprt/assert.h>
+#include <iprt/mem.h>
+#include <iprt/dvm.h>
+#include <iprt/string.h>
+#include "internal/dvm.h"
+
+/*******************************************************************************
+* Structures and Typedefs *
+*******************************************************************************/
+
+/*
+ * Below are the on disk structures of a bsd disklabel as found in
+ * /usr/include/sys/disklabel.h from a FreeBSD system.
+ *
+ * Everything is stored in little endian on the disk.
+ */
+
+/** BSD disklabel magic. */
+#define RTDVM_BSDLBL_MAGIC UINT32_C(0x82564557)
+/** Maximum number of partitions in the label. */
+#define RTDVM_BSDLBL_MAX_PARTITIONS 8
+
+/**
+ * A BSD disk label partition.
+ */
+#pragma pack(1)
+typedef struct BsdLabelPartition
+{
+ /** Number of sectors in the partition. */
+ uint32_t cSectors;
+ /** Start sector. */
+ uint32_t offSectorStart;
+ /** Filesystem fragment size. */
+ uint32_t cbFsFragment;
+ /** Filesystem type. */
+ uint8_t bFsType;
+ /** Filesystem fragments per block. */
+ uint8_t cFsFragmentsPerBlock;
+ /** Filesystem cylinders per group. */
+ uint16_t cFsCylPerGroup;
+} BsdLabelPartition;
+#pragma pack()
+AssertCompileSize(BsdLabelPartition, 16);
+/** Pointer to a BSD disklabel partition structure. */
+typedef BsdLabelPartition *PBsdLabelPartition;
+
+/**
+ * On disk BSD label structure.
+ */
+#pragma pack(1)
+typedef struct BsdLabel
+{
+ /** Magic identifying the BSD disk label. */
+ uint32_t u32Magic;
+ /** Drive type */
+ uint16_t u16DriveType;
+ /** Subtype depending on the drive type above. */
+ uint16_t u16SubType;
+ /** Type name. */
+ uint8_t abTypeName[16];
+ /** Pack identifier. */
+ uint8_t abPackName[16];
+ /** Number of bytes per sector. */
+ uint32_t cbSector;
+ /** Number of sectors per track. */
+ uint32_t cSectorsPerTrack;
+ /** Number of tracks per cylinder. */
+ uint32_t cTracksPerCylinder;
+ /** Number of data cylinders pre unit. */
+ uint32_t cDataCylindersPerUnit;
+ /** Number of data sectors per cylinder. */
+ uint32_t cDataSectorsPerCylinder;
+ /** Number of data sectors per unit (unit as in disk drive?). */
+ uint32_t cSectorsPerUnit;
+ /** Number of spare sectors per track. */
+ uint16_t cSpareSectorsPerTrack;
+ /** Number of spare sectors per cylinder. */
+ uint16_t cSpareSectorsPerCylinder;
+ /** Number of alternate cylinders per unit. */
+ uint32_t cSpareCylindersPerUnit;
+ /** Rotational speed of the disk drive in rotations per minute. */
+ uint16_t cRotationsPerMinute;
+ /** Sector interleave. */
+ uint16_t uSectorInterleave;
+ /** Sector 0 skew, per track. */
+ uint16_t uSectorSkewPerTrack;
+ /** Sector 0 skew, per cylinder. */
+ uint16_t uSectorSkewPerCylinder;
+ /** Head switch time in us. */
+ uint32_t usHeadSwitch;
+ /** Time of a track-to-track seek in us. */
+ uint32_t usTrackSeek;
+ /** Flags. */
+ uint32_t fFlags;
+ /** Drive type sepcific information. */
+ uint32_t au32DriveData[5];
+ /** Reserved. */
+ uint32_t au32Reserved[5];
+ /** The magic number again. */
+ uint32_t u32Magic2;
+ /** Checksum (xor of the whole structure). */
+ uint16_t u16ChkSum;
+ /** Number of partitions in the array. */
+ uint16_t cPartitions;
+ /** Boot area size in bytes. */
+ uint32_t cbBootArea;
+ /** Maximum size of the filesystem super block. */
+ uint32_t cbFsSuperBlock;
+ /** The partition array. */
+ BsdLabelPartition aPartitions[RTDVM_BSDLBL_MAX_PARTITIONS];
+} BsdLabel;
+#pragma pack()
+AssertCompileSize(BsdLabel, 148 + RTDVM_BSDLBL_MAX_PARTITIONS * 16);
+/** Pointer to a BSD disklabel structure. */
+typedef BsdLabel *PBsdLabel;
+
+/**
+ * BSD disk label volume manager data.
+ */
+typedef struct RTDVMFMTINTERNAL
+{
+ /** Pointer to the underlying disk. */
+ PCRTDVMDISK pDisk;
+ /** Number of used partitions. */
+ uint32_t cPartitions;
+ /** Saved BSD disklabel structure. */
+ BsdLabel DiskLabel;
+} RTDVMFMTINTERNAL;
+/** Pointer to the MBR volume manager. */
+typedef RTDVMFMTINTERNAL *PRTDVMFMTINTERNAL;
+
+/**
+ * MBR volume data.
+ */
+typedef struct RTDVMVOLUMEFMTINTERNAL
+{
+ /** Pointer to the volume manager. */
+ PRTDVMFMTINTERNAL pVolMgr;
+ /** Partition table entry index. */
+ uint32_t idxEntry;
+ /** Start offset of the volume. */
+ uint64_t offStart;
+ /** Size of the volume. */
+ uint64_t cbVolume;
+ /** Pointer to the raw partition table entry. */
+ PBsdLabelPartition pBsdPartitionEntry;
+} RTDVMVOLUMEFMTINTERNAL;
+/** Pointer to an MBR volume. */
+typedef RTDVMVOLUMEFMTINTERNAL *PRTDVMVOLUMEFMTINTERNAL;
+
+/** Converts a LBA number to the byte offset. */
+#define RTDVM_BSDLBL_LBA2BYTE(lba, disk) ((lba) * (disk)->cbSector)
+/** Converts a Byte offset to the LBA number. */
+#define RTDVM_BSDLBL_BYTE2LBA(lba, disk) ((lba) / (disk)->cbSector)
+
+/**
+ * Calculates the checksum of the entire bsd disklabel structure.
+ *
+ * @returns The checksum.
+ * @param pBsdLabel BSD disklabel to get teh checksum for.
+ */
+static uint16_t rtDvmFmtBsdLblDiskLabelChkSum(PBsdLabel pBsdLabel)
+{
+ uint16_t uChkSum = 0;
+ uint16_t *pCurr = (uint16_t *)pBsdLabel;
+ uint16_t *pEnd = (uint16_t *)&pBsdLabel->aPartitions[pBsdLabel->cPartitions];
+
+ while (pCurr < pEnd)
+ uChkSum ^= *pCurr++;
+
+ return uChkSum;
+}
+
+/**
+ * Converts a partition entry to the host endianness.
+ *
+ * @returns nothing.
+ * @param pPartition The partition to decode.
+ */
+static void rtDvmFmtBsdLblDiskLabelDecodePartition(PBsdLabelPartition pPartition)
+{
+ pPartition->cSectors = RT_LE2H_U32(pPartition->cSectors);
+ pPartition->offSectorStart = RT_LE2H_U32(pPartition->offSectorStart);
+ pPartition->cbFsFragment = RT_LE2H_U32(pPartition->cbFsFragment);
+ pPartition->cFsCylPerGroup = RT_LE2H_U16(pPartition->cFsCylPerGroup);
+}
+
+/**
+ * Converts the on disk BSD label to the host endianness.
+ *
+ * @returns Whether the given label structure is a valid BSD disklabel.
+ * @param pBsdLabel Pointer to the BSD disklabel to decode.
+ */
+static bool rtDvmFmtBsdLblDiskLabelDecode(PBsdLabel pBsdLabel)
+{
+ pBsdLabel->u32Magic = RT_LE2H_U32(pBsdLabel->u32Magic);
+ pBsdLabel->u16DriveType = RT_LE2H_U16(pBsdLabel->u16DriveType);
+ pBsdLabel->u16SubType = RT_LE2H_U16(pBsdLabel->u16SubType);
+ pBsdLabel->cbSector = RT_LE2H_U32(pBsdLabel->cbSector);
+ pBsdLabel->cSectorsPerTrack = RT_LE2H_U32(pBsdLabel->cSectorsPerTrack);
+ pBsdLabel->cTracksPerCylinder = RT_LE2H_U32(pBsdLabel->cTracksPerCylinder);
+ pBsdLabel->cDataCylindersPerUnit = RT_LE2H_U32(pBsdLabel->cDataCylindersPerUnit);
+ pBsdLabel->cDataSectorsPerCylinder = RT_LE2H_U32(pBsdLabel->cDataSectorsPerCylinder);
+ pBsdLabel->cSectorsPerUnit = RT_LE2H_U32(pBsdLabel->cSectorsPerUnit);
+ pBsdLabel->cSpareSectorsPerTrack = RT_LE2H_U16(pBsdLabel->cSpareSectorsPerTrack);
+ pBsdLabel->cSpareSectorsPerCylinder = RT_LE2H_U16(pBsdLabel->cSpareSectorsPerCylinder);
+ pBsdLabel->cSpareCylindersPerUnit = RT_LE2H_U32(pBsdLabel->cSpareCylindersPerUnit);
+ pBsdLabel->cRotationsPerMinute = RT_LE2H_U16(pBsdLabel->cRotationsPerMinute);
+ pBsdLabel->uSectorInterleave = RT_LE2H_U16(pBsdLabel->uSectorInterleave);
+ pBsdLabel->uSectorSkewPerTrack = RT_LE2H_U16(pBsdLabel->uSectorSkewPerTrack);
+ pBsdLabel->uSectorSkewPerCylinder = RT_LE2H_U16(pBsdLabel->uSectorSkewPerCylinder);
+ pBsdLabel->usHeadSwitch = RT_LE2H_U16(pBsdLabel->usHeadSwitch);
+ pBsdLabel->usTrackSeek = RT_LE2H_U16(pBsdLabel->usTrackSeek);
+ pBsdLabel->fFlags = RT_LE2H_U32(pBsdLabel->fFlags);
+
+ for (unsigned i = 0; i < RT_ELEMENTS(pBsdLabel->au32DriveData); i++)
+ pBsdLabel->au32DriveData[i] = RT_LE2H_U32(pBsdLabel->au32DriveData[i]);
+ for (unsigned i = 0; i < RT_ELEMENTS(pBsdLabel->au32Reserved); i++)
+ pBsdLabel->au32Reserved[i] = RT_LE2H_U32(pBsdLabel->au32Reserved[i]);
+
+ pBsdLabel->u32Magic2 = RT_LE2H_U32(pBsdLabel->u32Magic2);
+ pBsdLabel->u16ChkSum = RT_LE2H_U16(pBsdLabel->u16ChkSum);
+ pBsdLabel->cPartitions = RT_LE2H_U16(pBsdLabel->cPartitions);
+ pBsdLabel->cbBootArea = RT_LE2H_U32(pBsdLabel->cbBootArea);
+ pBsdLabel->cbFsSuperBlock = RT_LE2H_U32(pBsdLabel->cbFsSuperBlock);
+
+ /* Check the magics now. */
+ if ( pBsdLabel->u32Magic != RTDVM_BSDLBL_MAGIC
+ || pBsdLabel->u32Magic2 != RTDVM_BSDLBL_MAGIC
+ || pBsdLabel->cPartitions != RTDVM_BSDLBL_MAX_PARTITIONS)
+ return false;
+
+ /* Convert the partitions array. */
+ for (unsigned i = 0; i < RT_ELEMENTS(pBsdLabel->aPartitions); i++)
+ rtDvmFmtBsdLblDiskLabelDecodePartition(&pBsdLabel->aPartitions[i]);
+
+ /* Check the checksum now. */
+ uint16_t u16ChkSumSaved = pBsdLabel->u16ChkSum;
+
+ pBsdLabel->u16ChkSum = 0;
+ if (u16ChkSumSaved != rtDvmFmtBsdLblDiskLabelChkSum(pBsdLabel))
+ return false;
+
+ pBsdLabel->u16ChkSum = u16ChkSumSaved;
+ return true;
+}
+
+DECLCALLBACK(int) rtDvmFmtBsdLblProbe(PCRTDVMDISK pDisk, uint32_t *puScore)
+{
+ BsdLabel DiskLabel;
+ int rc = VINF_SUCCESS;
+
+ *puScore = RTDVM_MATCH_SCORE_UNSUPPORTED;
+
+ if (pDisk->cbDisk >= sizeof(BsdLabel))
+ {
+ /* Read from the disk and check for the disk label structure. */
+ rc = rtDvmDiskRead(pDisk, RTDVM_BSDLBL_LBA2BYTE(1, pDisk), &DiskLabel, sizeof(BsdLabel));
+ if ( RT_SUCCESS(rc)
+ && rtDvmFmtBsdLblDiskLabelDecode(&DiskLabel))
+ *puScore = RTDVM_MATCH_SCORE_PERFECT;
+ }
+ return rc;
+}
+
+DECLCALLBACK(int) rtDvmFmtBsdLblOpen(PCRTDVMDISK pDisk, PRTDVMFMT phVolMgrFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMFMTINTERNAL pThis = NULL;
+
+ pThis = (PRTDVMFMTINTERNAL)RTMemAllocZ(sizeof(RTDVMFMTINTERNAL));
+ if (VALID_PTR(pThis))
+ {
+ pThis->pDisk = pDisk;
+ pThis->cPartitions = 0;
+
+ /* Read from the disk and check for the disk label structure. */
+ rc = rtDvmDiskRead(pDisk, RTDVM_BSDLBL_LBA2BYTE(1, pDisk), &pThis->DiskLabel, sizeof(BsdLabel));
+ if ( RT_SUCCESS(rc)
+ && rtDvmFmtBsdLblDiskLabelDecode(&pThis->DiskLabel))
+ {
+ /* Count number of used entries. */
+ for (unsigned i = 0; i < pThis->DiskLabel.cPartitions; i++)
+ if (pThis->DiskLabel.aPartitions[i].cSectors)
+ pThis->cPartitions++;
+
+ *phVolMgrFmt = pThis;
+ }
+ else
+ {
+ RTMemFree(pThis);
+ rc = VERR_INVALID_MAGIC;
+ }
+ }
+ else
+ rc = VERR_NO_MEMORY;
+
+ return rc;
+}
+
+DECLCALLBACK(int) rtDvmFmtBsdLblInitialize(PCRTDVMDISK pDisk, PRTDVMFMT phVolMgrFmt)
+{
+ return VERR_NOT_IMPLEMENTED;
+}
+
+DECLCALLBACK(void) rtDvmFmtBsdLblClose(RTDVMFMT hVolMgrFmt)
+{
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+
+ pThis->pDisk = NULL;
+ pThis->cPartitions = 0;
+ memset(&pThis->DiskLabel, 0, sizeof(BsdLabel));
+ RTMemFree(pThis);
+}
+
+DECLCALLBACK(uint32_t) rtDvmFmtBsdLblGetValidVolumes(RTDVMFMT hVolMgrFmt)
+{
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+ return pThis->cPartitions;
+}
+
+DECLCALLBACK(uint32_t) rtDvmFmtBsdLblGetMaxVolumes(RTDVMFMT hVolMgrFmt)
+{
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+ return pThis->DiskLabel.cPartitions;
+}
+
+/**
+ * Creates a new volume.
+ *
+ * @returns IPRT status code.
+ * @param pThis The MBR volume manager data.
+ * @param pbBsdLblEntry The raw MBR entry data.
+ * @param idx The index in the partition table.
+ * @param phVolFmt Where to store the volume data on success.
+ */
+static int rtDvmFmtBsdLblVolumeCreate(PRTDVMFMTINTERNAL pThis, PBsdLabelPartition pBsdPartitionEntry,
+ uint32_t idx, PRTDVMVOLUMEFMT phVolFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMVOLUMEFMTINTERNAL pVol = (PRTDVMVOLUMEFMTINTERNAL)RTMemAllocZ(sizeof(RTDVMVOLUMEFMTINTERNAL));
+
+ if (VALID_PTR(pVol))
+ {
+ pVol->pVolMgr = pThis;
+ pVol->idxEntry = idx;
+ pVol->pBsdPartitionEntry = pBsdPartitionEntry;
+ pVol->offStart = pBsdPartitionEntry->offSectorStart * pThis->DiskLabel.cbSector;
+ pVol->cbVolume = pBsdPartitionEntry->cSectors * pThis->DiskLabel.cbSector;
+
+ *phVolFmt = pVol;
+ }
+ else
+ rc = VERR_NO_MEMORY;
+
+ return rc;
+}
+
+DECLCALLBACK(int) rtDvmFmtBsdLblQueryFirstVolume(RTDVMFMT hVolMgrFmt, PRTDVMVOLUMEFMT phVolFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+
+ if (pThis->cPartitions != 0)
+ {
+ /* Search for the first non empty entry. */
+ for (unsigned i = 0; i < pThis->DiskLabel.cPartitions; i++)
+ {
+ if (pThis->DiskLabel.aPartitions[i].cSectors)
+ {
+ rc = rtDvmFmtBsdLblVolumeCreate(pThis, &pThis->DiskLabel.aPartitions[i],
+ i, phVolFmt);
+ break;
+ }
+ }
+ }
+ else
+ rc = VERR_DVM_MAP_EMPTY;
+
+ return rc;
+}
+
+DECLCALLBACK(int) rtDvmFmtBsdLblQueryNextVolume(RTDVMFMT hVolMgrFmt, RTDVMVOLUMEFMT hVolFmt, PRTDVMVOLUMEFMT phVolFmtNext)
+{
+ int rc = VERR_DVM_MAP_NO_VOLUME;
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+ PBsdLabelPartition pBsdPartitionEntry = pVol->pBsdPartitionEntry + 1;
+
+ for (unsigned i = pVol->idxEntry + 1; i < pThis->DiskLabel.cPartitions; i++)
+ {
+ if (pBsdPartitionEntry->cSectors)
+ {
+ rc = rtDvmFmtBsdLblVolumeCreate(pThis, pBsdPartitionEntry, i, phVolFmtNext);
+ break;
+ }
+ pBsdPartitionEntry++;
+ }
+
+ return rc;
+}
+
+DECLCALLBACK(void) rtDvmFmtBsdLblVolumeClose(RTDVMVOLUMEFMT hVolFmt)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+
+ pVol->pVolMgr = NULL;
+ pVol->offStart = 0;
+ pVol->cbVolume = 0;
+ pVol->pBsdPartitionEntry = NULL;
+
+ RTMemFree(pVol);
+}
+
+DECLCALLBACK(uint64_t) rtDvmFmtBsdLblVolumeGetSize(RTDVMVOLUMEFMT hVolFmt)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+
+ return pVol->cbVolume;
+}
+
+DECLCALLBACK(int) rtDvmFmtBsdLblVolumeQueryName(RTDVMVOLUMEFMT hVolFmt, char **ppszVolName)
+{
+ NOREF(hVolFmt);
+ return VERR_NOT_SUPPORTED;
+}
+
+DECLCALLBACK(RTDVMVOLTYPE) rtDvmFmtBsdLblVolumeGetType(RTDVMVOLUMEFMT hVolFmt)
+{
+ return RTDVMVOLTYPE_UNKNOWN;
+}
+
+DECLCALLBACK(uint64_t) rtDvmFmtBsdLblVolumeGetFlags(RTDVMVOLUMEFMT hVolFmt)
+{
+ NOREF(hVolFmt);
+ return 0;
+}
+
+DECLCALLBACK(int) rtDvmFmtBsdLblVolumeRead(RTDVMVOLUMEFMT hVolFmt, uint64_t off, void *pvBuf, size_t cbRead)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+ AssertReturn(off + cbRead <= pVol->cbVolume, VERR_INVALID_PARAMETER);
+
+ return rtDvmDiskRead(pVol->pVolMgr->pDisk, pVol->offStart + off, pvBuf, cbRead);
+}
+
+DECLCALLBACK(int) rtDvmFmtBsdLblVolumeWrite(RTDVMVOLUMEFMT hVolFmt, uint64_t off, const void *pvBuf, size_t cbWrite)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+ AssertReturn(off + cbWrite <= pVol->cbVolume, VERR_INVALID_PARAMETER);
+
+ return rtDvmDiskWrite(pVol->pVolMgr->pDisk, pVol->offStart + off, pvBuf, cbWrite);
+}
+
+DECLHIDDEN(RTDVMFMTOPS) g_rtDvmFmtBsdLbl =
+{
+ /* pcszFmt */
+ "BsdLabel",
+ /* pfnProbe */
+ rtDvmFmtBsdLblProbe,
+ /* pfnOpen */
+ rtDvmFmtBsdLblOpen,
+ /* pfnInitialize */
+ rtDvmFmtBsdLblInitialize,
+ /* pfnClose */
+ rtDvmFmtBsdLblClose,
+ /* pfnGetValidVolumes */
+ rtDvmFmtBsdLblGetValidVolumes,
+ /* pfnGetMaxVolumes */
+ rtDvmFmtBsdLblGetMaxVolumes,
+ /* pfnQueryFirstVolume */
+ rtDvmFmtBsdLblQueryFirstVolume,
+ /* pfnQueryNextVolume */
+ rtDvmFmtBsdLblQueryNextVolume,
+ /* pfnVolumeClose */
+ rtDvmFmtBsdLblVolumeClose,
+ /* pfnVolumeGetSize */
+ rtDvmFmtBsdLblVolumeGetSize,
+ /* pfnVolumeQueryName */
+ rtDvmFmtBsdLblVolumeQueryName,
+ /* pfnVolumeGetType */
+ rtDvmFmtBsdLblVolumeGetType,
+ /* pfnVolumeGetFlags */
+ rtDvmFmtBsdLblVolumeGetFlags,
+ /* pfnVolumeRead */
+ rtDvmFmtBsdLblVolumeRead,
+ /* pfnVolumeWrite */
+ rtDvmFmtBsdLblVolumeWrite
+};
+
diff --git a/src/VBox/Runtime/common/dvm/dvmgpt.cpp b/src/VBox/Runtime/common/dvm/dvmgpt.cpp
new file mode 100644
index 000000000..e478343de
--- /dev/null
+++ b/src/VBox/Runtime/common/dvm/dvmgpt.cpp
@@ -0,0 +1,536 @@
+/* $Id: dvmgpt.cpp 37024 2011-05-10 11:23:44Z vboxsync $ */
+/** @file
+ * IPRT Disk Volume Management API (DVM) - GPT format backend.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/types.h>
+#include <iprt/assert.h>
+#include <iprt/mem.h>
+#include <iprt/dvm.h>
+#include <iprt/string.h>
+#include <iprt/uuid.h>
+#include "internal/dvm.h"
+
+
+/*******************************************************************************
+* Structures and Typedefs *
+*******************************************************************************/
+/** The GPT signature. */
+#define RTDVM_GPT_SIGNATURE "EFI PART"
+
+/**
+ * GPT on disk header.
+ */
+#pragma pack(1)
+typedef struct GptHdr
+{
+ /** Signature ("EFI PART"). */
+ char abSignature[8];
+ /** Revision. */
+ uint32_t u32Revision;
+ /** Header size. */
+ uint32_t cbHeader;
+ /** CRC of header. */
+ uint32_t u32Crc;
+} GptHdr;
+/** Pointer to a GPT header. */
+typedef struct GptHdr *PGptHdr;
+#pragma pack()
+AssertCompileSize(GptHdr, 20);
+
+/**
+ * Complete GPT table header for revision 1.0.
+ */
+#pragma pack(1)
+typedef struct GptHdrRev1
+{
+ /** Header. */
+ GptHdr Hdr;
+ /** Reserved. */
+ uint32_t u32Reserved;
+ /** Current LBA. */
+ uint64_t u64LbaCurrent;
+ /** Backup LBA. */
+ uint64_t u64LbaBackup;
+ /** First usable LBA for partitions. */
+ uint64_t u64LbaFirstPartition;
+ /** Last usable LBA for partitions. */
+ uint64_t u64LbaLastPartition;
+ /** Disk UUID. */
+ RTUUID DiskUuid;
+ /** LBA of first partition entry. */
+ uint64_t u64LbaPartitionEntries;
+ /** Number of partition entries. */
+ uint32_t cPartitionEntries;
+ /** Partition entry size. */
+ uint32_t cbPartitionEntry;
+ /** CRC of partition entries. */
+ uint32_t u32CrcPartitionEntries;
+} GptHdrRev1;
+/** Pointer to a revision 1.0 GPT header. */
+typedef GptHdrRev1 *PGptHdrRev1;
+#pragma pack()
+AssertCompileSize(GptHdrRev1, 92);
+
+/**
+ * GPT partition table entry.
+ */
+#pragma pack(1)
+typedef struct GptEntry
+{
+ /** Partition type UUID. */
+ RTUUID UuidType;
+ /** Partition UUID. */
+ RTUUID UuidPartition;
+ /** First LBA. */
+ uint64_t u64LbaFirst;
+ /** Last LBA. */
+ uint64_t u64LbaLast;
+ /** Attribute flags. */
+ uint64_t u64Flags;
+ /** Partition name (UTF-16LE code units). */
+ RTUTF16 aPartitionName[36];
+} GptEntry;
+/** Pointer to a GPT entry. */
+typedef struct GptEntry *PGptEntry;
+#pragma pack()
+AssertCompileSize(GptEntry, 128);
+
+/** Partition flags - System partition. */
+#define RTDVM_GPT_ENTRY_SYSTEM RT_BIT_64(0)
+/** Partition flags - Partition is readonly. */
+#define RTDVM_GPT_ENTRY_READONLY RT_BIT_64(60)
+/** Partition flags - Partition is hidden. */
+#define RTDVM_GPT_ENTRY_HIDDEN RT_BIT_64(62)
+/** Partition flags - Don't automount this partition. */
+#define RTDVM_GPT_ENTRY_NO_AUTOMOUNT RT_BIT_64(63)
+
+/**
+ * GPT volume manager data.
+ */
+typedef struct RTDVMFMTINTERNAL
+{
+ /** Pointer to the underlying disk. */
+ PCRTDVMDISK pDisk;
+ /** GPT header. */
+ GptHdrRev1 HdrRev1;
+ /** GPT array. */
+ PGptEntry paGptEntries;
+ /** Number of occupied partition entries. */
+ uint32_t cPartitions;
+} RTDVMFMTINTERNAL;
+/** Pointer to the MBR volume manager. */
+typedef RTDVMFMTINTERNAL *PRTDVMFMTINTERNAL;
+
+/**
+ * GPT volume data.
+ */
+typedef struct RTDVMVOLUMEFMTINTERNAL
+{
+ /** Pointer to the volume manager. */
+ PRTDVMFMTINTERNAL pVolMgr;
+ /** Partition table entry index. */
+ uint32_t idxEntry;
+ /** Start offset of the volume. */
+ uint64_t offStart;
+ /** Size of the volume. */
+ uint64_t cbVolume;
+ /** Pointer to the GPT entry in the array. */
+ PGptEntry pGptEntry;
+} RTDVMVOLUMEFMTINTERNAL;
+/** Pointer to an MBR volume. */
+typedef RTDVMVOLUMEFMTINTERNAL *PRTDVMVOLUMEFMTINTERNAL;
+
+/**
+ * GPT partition type to DVM volume type mapping entry.
+ */
+
+typedef struct RTDVMGPTPARTTYPE2VOLTYPE
+{
+ /** Type UUID. */
+ const char *pcszUuid;
+ /** DVM volume type. */
+ RTDVMVOLTYPE enmVolType;
+} RTDVMGPTPARTTYPE2VOLTYPE;
+/** Pointer to a MBR FS Type to volume type mapping entry. */
+typedef RTDVMGPTPARTTYPE2VOLTYPE *PRTDVMGPTPARTTYPE2VOLTYPE;
+
+/** Converts a LBA number to the byte offset. */
+#define RTDVM_GPT_LBA2BYTE(lba, disk) ((lba) * (disk)->cbSector)
+/** Converts a Byte offset to the LBA number. */
+#define RTDVM_GPT_BYTE2LBA(lba, disk) ((lba) / (disk)->cbSector)
+
+
+/*******************************************************************************
+* Global Variables *
+*******************************************************************************/
+/**
+ * Mapping of partition types to DVM volume types.
+ *
+ * From http://en.wikipedia.org/wiki/GUID_Partition_Table
+ */
+static const RTDVMGPTPARTTYPE2VOLTYPE g_aPartType2DvmVolTypes[] =
+{
+ {"0657FD6D-A4AB-43C4-84E5-0933C84B4F4F", RTDVMVOLTYPE_LINUX_SWAP},
+ {"EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", RTDVMVOLTYPE_LINUX_NATIVE},
+ {"E6D6D379-F507-44C2-A23C-238F2A3DF928", RTDVMVOLTYPE_LINUX_LVM},
+ {"A19D880F-05FC-4D3B-A006-743F0F84911E", RTDVMVOLTYPE_LINUX_SOFTRAID},
+
+ {"83BD6B9D-7F41-11DC-BE0B-001560B84F0F", RTDVMVOLTYPE_FREEBSD}, /* Boot */
+ {"516E7CB4-6ECF-11D6-8FF8-00022D09712B", RTDVMVOLTYPE_FREEBSD}, /* Data */
+ {"516E7CB5-6ECF-11D6-8FF8-00022D09712B", RTDVMVOLTYPE_FREEBSD}, /* Swap */
+ {"516E7CB6-6ECF-11D6-8FF8-00022D09712B", RTDVMVOLTYPE_FREEBSD}, /* UFS */
+ {"516E7CB8-6ECF-11D6-8FF8-00022D09712B", RTDVMVOLTYPE_FREEBSD}, /* Vinum */
+ {"516E7CBA-6ECF-11D6-8FF8-00022D09712B", RTDVMVOLTYPE_FREEBSD}, /* ZFS */
+
+ {"49F48D32-B10E-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* Swap */
+ {"49F48D5A-B10E-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* FFS */
+ {"49F48D82-B10E-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* LFS */
+ {"49F48DAA-B10E-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* Raid */
+ {"2DB519C4-B10F-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* Concatenated */
+ {"2DB519EC-B10F-11DC-B99B-0019D1879648", RTDVMVOLTYPE_NETBSD}, /* Encrypted */
+
+ {"48465300-0000-11AA-AA11-00306543ECAC", RTDVMVOLTYPE_MAC_OSX_HFS},
+
+ {"6A82CB45-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* Boot */
+ {"6A85CF4D-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* Root */
+ {"6A87C46F-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* Swap */
+ {"6A8B642B-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* Backup */
+ {"6A898CC3-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* /usr */
+ {"6A8EF2E9-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* /var */
+ {"6A90BA39-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* /home */
+ {"6A9283A5-1DD2-11B2-99A6-080020736631", RTDVMVOLTYPE_SOLARIS}, /* Alternate sector */
+};
+
+static DECLCALLBACK(int) rtDvmFmtGptProbe(PCRTDVMDISK pDisk, uint32_t *puScore)
+{
+ int rc = VINF_SUCCESS;
+ GptHdr Hdr;
+
+ *puScore = RTDVM_MATCH_SCORE_UNSUPPORTED;
+
+ if (rtDvmDiskGetSectors(pDisk) >= 2)
+ {
+ /* Read from the disk and check for the signature. */
+ rc = rtDvmDiskRead(pDisk, RTDVM_GPT_LBA2BYTE(1, pDisk), &Hdr, sizeof(GptHdr));
+ if ( RT_SUCCESS(rc)
+ && !strncmp(&Hdr.abSignature[0], RTDVM_GPT_SIGNATURE, RT_ELEMENTS(Hdr.abSignature))
+ && RT_LE2H_U32(Hdr.u32Revision) == 0x00010000
+ && RT_LE2H_U32(Hdr.cbHeader) == sizeof(GptHdrRev1))
+ *puScore = RTDVM_MATCH_SCORE_PERFECT;
+ }
+
+ return rc;
+}
+
+static DECLCALLBACK(int) rtDvmFmtGptOpen(PCRTDVMDISK pDisk, PRTDVMFMT phVolMgrFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMFMTINTERNAL pThis = NULL;
+
+ pThis = (PRTDVMFMTINTERNAL)RTMemAllocZ(sizeof(RTDVMFMTINTERNAL));
+ if (VALID_PTR(pThis))
+ {
+ pThis->pDisk = pDisk;
+ pThis->cPartitions = 0;
+
+ /* Read the complete GPT header and convert to host endianess. */
+ rc = rtDvmDiskRead(pDisk, RTDVM_GPT_LBA2BYTE(1, pDisk), &pThis->HdrRev1, sizeof(pThis->HdrRev1));
+ if (RT_SUCCESS(rc))
+ {
+ pThis->HdrRev1.Hdr.u32Revision = RT_LE2H_U32(pThis->HdrRev1.Hdr.u32Revision);
+ pThis->HdrRev1.Hdr.cbHeader = RT_LE2H_U32(pThis->HdrRev1.Hdr.cbHeader);
+ pThis->HdrRev1.Hdr.u32Crc = RT_LE2H_U32(pThis->HdrRev1.Hdr.u32Crc);
+ pThis->HdrRev1.u64LbaCurrent = RT_LE2H_U64(pThis->HdrRev1.u64LbaCurrent);
+ pThis->HdrRev1.u64LbaBackup = RT_LE2H_U64(pThis->HdrRev1.u64LbaBackup);
+ pThis->HdrRev1.u64LbaFirstPartition = RT_LE2H_U64(pThis->HdrRev1.u64LbaFirstPartition);
+ pThis->HdrRev1.u64LbaLastPartition = RT_LE2H_U64(pThis->HdrRev1.u64LbaLastPartition);
+ /** @todo: Disk UUID */
+ pThis->HdrRev1.u64LbaPartitionEntries = RT_LE2H_U64(pThis->HdrRev1.u64LbaPartitionEntries);
+ pThis->HdrRev1.cPartitionEntries = RT_LE2H_U32(pThis->HdrRev1.cPartitionEntries);
+ pThis->HdrRev1.cbPartitionEntry = RT_LE2H_U32(pThis->HdrRev1.cbPartitionEntry);
+ pThis->HdrRev1.u32CrcPartitionEntries = RT_LE2H_U32(pThis->HdrRev1.u32CrcPartitionEntries);
+
+ if (pThis->HdrRev1.cbPartitionEntry == sizeof(GptEntry))
+ {
+ pThis->paGptEntries = (PGptEntry)RTMemAllocZ(pThis->HdrRev1.cPartitionEntries * pThis->HdrRev1.cbPartitionEntry);
+ if (VALID_PTR(pThis->paGptEntries))
+ {
+ rc = rtDvmDiskRead(pDisk, RTDVM_GPT_LBA2BYTE(pThis->HdrRev1.u64LbaPartitionEntries, pDisk),
+ pThis->paGptEntries, pThis->HdrRev1.cPartitionEntries * pThis->HdrRev1.cbPartitionEntry);
+ if (RT_SUCCESS(rc))
+ {
+ /* Count the occupied entries. */
+ for (unsigned i = 0; i < pThis->HdrRev1.cPartitionEntries; i++)
+ if (!RTUuidIsNull(&pThis->paGptEntries[i].UuidType))
+ {
+ /* Convert to host endianess. */
+ /** @todo: Uuids */
+ pThis->paGptEntries[i].u64LbaFirst = RT_LE2H_U64(pThis->paGptEntries[i].u64LbaFirst);
+ pThis->paGptEntries[i].u64LbaLast = RT_LE2H_U64(pThis->paGptEntries[i].u64LbaLast);
+ pThis->paGptEntries[i].u64Flags = RT_LE2H_U64(pThis->paGptEntries[i].u64Flags);
+ for (unsigned cwc = 0; cwc < RT_ELEMENTS(pThis->paGptEntries[i].aPartitionName); cwc++)
+ pThis->paGptEntries[i].aPartitionName[cwc] = RT_LE2H_U16(pThis->paGptEntries[i].aPartitionName[cwc]);
+
+ pThis->cPartitions++;
+ }
+ }
+
+ if (RT_FAILURE(rc))
+ RTMemFree(pThis->paGptEntries);
+ }
+ else
+ rc = VERR_NO_MEMORY;
+ }
+ else
+ rc = VERR_NOT_SUPPORTED;
+
+ if (RT_SUCCESS(rc))
+ *phVolMgrFmt = pThis;
+ else
+ RTMemFree(pThis);
+ }
+ }
+ else
+ rc = VERR_NO_MEMORY;
+
+ return rc;
+}
+
+static DECLCALLBACK(int) rtDvmFmtGptInitialize(PCRTDVMDISK pDisk, PRTDVMFMT phVolMgrFmt)
+{
+ return VERR_NOT_IMPLEMENTED;
+}
+
+static DECLCALLBACK(void) rtDvmFmtGptClose(RTDVMFMT hVolMgrFmt)
+{
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+
+ pThis->pDisk = NULL;
+ memset(&pThis->HdrRev1, 0, sizeof(pThis->HdrRev1));
+ RTMemFree(pThis->paGptEntries);
+
+ pThis->paGptEntries = NULL;
+ RTMemFree(pThis);
+}
+
+static DECLCALLBACK(uint32_t) rtDvmFmtGptGetValidVolumes(RTDVMFMT hVolMgrFmt)
+{
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+
+ return pThis->cPartitions;
+}
+
+static DECLCALLBACK(uint32_t) rtDvmFmtGptGetMaxVolumes(RTDVMFMT hVolMgrFmt)
+{
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+
+ return pThis->HdrRev1.cPartitionEntries;
+}
+
+/**
+ * Creates a new volume.
+ *
+ * @returns IPRT status code.
+ * @param pThis The MBR volume manager data.
+ * @param pGptEntry The GPT entry.
+ * @param idx The index in the partition array.
+ * @param phVolFmt Where to store the volume data on success.
+ */
+static int rtDvmFmtMbrVolumeCreate(PRTDVMFMTINTERNAL pThis, PGptEntry pGptEntry,
+ uint32_t idx, PRTDVMVOLUMEFMT phVolFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMVOLUMEFMTINTERNAL pVol = (PRTDVMVOLUMEFMTINTERNAL)RTMemAllocZ(sizeof(RTDVMVOLUMEFMTINTERNAL));
+
+ if (VALID_PTR(pVol))
+ {
+ pVol->pVolMgr = pThis;
+ pVol->idxEntry = idx;
+ pVol->pGptEntry = pGptEntry;
+ pVol->offStart = RTDVM_GPT_LBA2BYTE(pGptEntry->u64LbaFirst, pThis->pDisk);
+ pVol->cbVolume = RTDVM_GPT_LBA2BYTE(pGptEntry->u64LbaLast - pGptEntry->u64LbaFirst + 1, pThis->pDisk);
+
+ *phVolFmt = pVol;
+ }
+ else
+ rc = VERR_NO_MEMORY;
+
+ return rc;
+}
+
+static DECLCALLBACK(int) rtDvmFmtGptQueryFirstVolume(RTDVMFMT hVolMgrFmt, PRTDVMVOLUMEFMT phVolFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+
+ if (pThis->cPartitions != 0)
+ {
+ PGptEntry pGptEntry = &pThis->paGptEntries[0];
+
+ /* Search for the first non empty entry. */
+ for (unsigned i = 0; i < pThis->HdrRev1.cPartitionEntries; i++)
+ {
+ if (!RTUuidIsNull(&pGptEntry->UuidType))
+ {
+ rc = rtDvmFmtMbrVolumeCreate(pThis, pGptEntry, i, phVolFmt);
+ break;
+ }
+ pGptEntry++;
+ }
+ }
+ else
+ rc = VERR_DVM_MAP_EMPTY;
+
+ return rc;
+}
+
+static DECLCALLBACK(int) rtDvmFmtGptQueryNextVolume(RTDVMFMT hVolMgrFmt, RTDVMVOLUMEFMT hVolFmt, PRTDVMVOLUMEFMT phVolFmtNext)
+{
+ int rc = VERR_DVM_MAP_NO_VOLUME;
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+ PGptEntry pGptEntry = pVol->pGptEntry + 1;
+
+ for (unsigned i = pVol->idxEntry + 1; i < pThis->HdrRev1.cPartitionEntries; i++)
+ {
+ if (!RTUuidIsNull(&pGptEntry->UuidType))
+ {
+ rc = rtDvmFmtMbrVolumeCreate(pThis, pGptEntry, i, phVolFmtNext);
+ break;
+ }
+ pGptEntry++;
+ }
+
+ return rc;
+}
+
+static DECLCALLBACK(void) rtDvmFmtGptVolumeClose(RTDVMVOLUMEFMT hVolFmt)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+
+ pVol->pVolMgr = NULL;
+ pVol->offStart = 0;
+ pVol->cbVolume = 0;
+ pVol->pGptEntry = NULL;
+
+ RTMemFree(pVol);
+}
+
+static DECLCALLBACK(uint64_t) rtDvmFmtGptVolumeGetSize(RTDVMVOLUMEFMT hVolFmt)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+
+ return pVol->cbVolume;
+}
+
+static DECLCALLBACK(int) rtDvmFmtGptVolumeQueryName(RTDVMVOLUMEFMT hVolFmt, char **ppszVolName)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+ int rc = VINF_SUCCESS;
+
+ *ppszVolName = NULL;
+ rc = RTUtf16ToUtf8Ex(&pVol->pGptEntry->aPartitionName[0], RT_ELEMENTS(pVol->pGptEntry->aPartitionName),
+ ppszVolName, 0, NULL);
+
+ return rc;
+}
+
+static DECLCALLBACK(RTDVMVOLTYPE) rtDvmFmtGptVolumeGetType(RTDVMVOLUMEFMT hVolFmt)
+{
+ RTDVMVOLTYPE enmVolType = RTDVMVOLTYPE_UNKNOWN;
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+
+ for (unsigned i = 0; i < RT_ELEMENTS(g_aPartType2DvmVolTypes); i++)
+ if (!RTUuidCompareStr(&pVol->pGptEntry->UuidType, g_aPartType2DvmVolTypes[i].pcszUuid))
+ {
+ enmVolType = g_aPartType2DvmVolTypes[i].enmVolType;
+ break;
+ }
+
+ return enmVolType;
+}
+
+static DECLCALLBACK(uint64_t) rtDvmFmtGptVolumeGetFlags(RTDVMVOLUMEFMT hVolFmt)
+{
+ NOREF(hVolFmt); /* No supported flags for now. */
+ return 0;
+}
+
+static DECLCALLBACK(int) rtDvmFmtGptVolumeRead(RTDVMVOLUMEFMT hVolFmt, uint64_t off, void *pvBuf, size_t cbRead)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+ AssertReturn(off + cbRead <= pVol->cbVolume, VERR_INVALID_PARAMETER);
+
+ return rtDvmDiskRead(pVol->pVolMgr->pDisk, pVol->offStart + off, pvBuf, cbRead);
+}
+
+static DECLCALLBACK(int) rtDvmFmtGptVolumeWrite(RTDVMVOLUMEFMT hVolFmt, uint64_t off, const void *pvBuf, size_t cbWrite)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+ AssertReturn(off + cbWrite <= pVol->cbVolume, VERR_INVALID_PARAMETER);
+
+ return rtDvmDiskWrite(pVol->pVolMgr->pDisk, pVol->offStart + off, pvBuf, cbWrite);
+}
+
+RTDVMFMTOPS g_rtDvmFmtGpt =
+{
+ /* pcszFmt */
+ "GPT",
+ /* pfnProbe */
+ rtDvmFmtGptProbe,
+ /* pfnOpen */
+ rtDvmFmtGptOpen,
+ /* pfnInitialize */
+ rtDvmFmtGptInitialize,
+ /* pfnClose */
+ rtDvmFmtGptClose,
+ /* pfnGetValidVolumes */
+ rtDvmFmtGptGetValidVolumes,
+ /* pfnGetMaxVolumes */
+ rtDvmFmtGptGetMaxVolumes,
+ /* pfnQueryFirstVolume */
+ rtDvmFmtGptQueryFirstVolume,
+ /* pfnQueryNextVolume */
+ rtDvmFmtGptQueryNextVolume,
+ /* pfnVolumeClose */
+ rtDvmFmtGptVolumeClose,
+ /* pfnVolumeGetSize */
+ rtDvmFmtGptVolumeGetSize,
+ /* pfnVolumeQueryName */
+ rtDvmFmtGptVolumeQueryName,
+ /* pfnVolumeGetType */
+ rtDvmFmtGptVolumeGetType,
+ /* pfnVolumeGetFlags */
+ rtDvmFmtGptVolumeGetFlags,
+ /* pfnVolumeRead */
+ rtDvmFmtGptVolumeRead,
+ /* pfnVolumeWrite */
+ rtDvmFmtGptVolumeWrite
+};
+
diff --git a/src/VBox/Runtime/common/dvm/dvmmbr.cpp b/src/VBox/Runtime/common/dvm/dvmmbr.cpp
new file mode 100644
index 000000000..38700ad3b
--- /dev/null
+++ b/src/VBox/Runtime/common/dvm/dvmmbr.cpp
@@ -0,0 +1,406 @@
+/* $Id: dvmmbr.cpp 37024 2011-05-10 11:23:44Z vboxsync $ */
+/** @file
+ * IPRT Disk Volume Management API (DVM) - MBR format backend.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/types.h>
+#include <iprt/assert.h>
+#include <iprt/mem.h>
+#include <iprt/dvm.h>
+#include <iprt/string.h>
+#include "internal/dvm.h"
+
+
+/*******************************************************************************
+* Structures and Typedefs *
+*******************************************************************************/
+
+/**
+ * MBR volume manager data.
+ */
+typedef struct RTDVMFMTINTERNAL
+{
+ /** Pointer to the underlying disk. */
+ PCRTDVMDISK pDisk;
+ /** Number of initialized partitions. */
+ uint32_t cPartitions;
+ /** The raw MBR data. */
+ uint8_t abMbr[512];
+} RTDVMFMTINTERNAL;
+/** Pointer to the MBR volume manager. */
+typedef RTDVMFMTINTERNAL *PRTDVMFMTINTERNAL;
+
+/**
+ * MBR volume data.
+ */
+typedef struct RTDVMVOLUMEFMTINTERNAL
+{
+ /** Pointer to the volume manager. */
+ PRTDVMFMTINTERNAL pVolMgr;
+ /** Partition table entry index. */
+ uint32_t idxEntry;
+ /** Start offset of the volume. */
+ uint64_t offStart;
+ /** Size of the volume. */
+ uint64_t cbVolume;
+ /** Pointer to the raw partition table entry. */
+ uint8_t *pbMbrEntry;
+} RTDVMVOLUMEFMTINTERNAL;
+/** Pointer to an MBR volume. */
+typedef RTDVMVOLUMEFMTINTERNAL *PRTDVMVOLUMEFMTINTERNAL;
+
+/**
+ * MBR FS type to DVM volume type mapping entry.
+ */
+
+typedef struct RTDVMMBRFS2VOLTYPE
+{
+ /** MBR FS Id. */
+ uint8_t bFsId;
+ /** DVM volume type. */
+ RTDVMVOLTYPE enmVolType;
+} RTDVMMBRFS2VOLTYPE;
+/** Pointer to a MBR FS Type to volume type mapping entry. */
+typedef RTDVMMBRFS2VOLTYPE *PRTDVMMBRFS2VOLTYPE;
+
+
+/*******************************************************************************
+* Global Variables *
+*******************************************************************************/
+/**
+ * Mapping of FS types to DVM volume types.
+ *
+ * From http://www.win.tue.nl/~aeb/partitions/partition_types-1.html
+ */
+static const RTDVMMBRFS2VOLTYPE g_aFs2DvmVolTypes[] =
+{
+ { 0x06, RTDVMVOLTYPE_FAT16 },
+ { 0x07, RTDVMVOLTYPE_NTFS }, /* Simplification: Used for HPFS, exFAT, ++, too but NTFS is the more common one. */
+ { 0x0b, RTDVMVOLTYPE_FAT32 },
+ { 0x0c, RTDVMVOLTYPE_FAT32 },
+ { 0x82, RTDVMVOLTYPE_LINUX_SWAP },
+ { 0x83, RTDVMVOLTYPE_LINUX_NATIVE },
+ { 0x8e, RTDVMVOLTYPE_LINUX_LVM },
+ { 0xa5, RTDVMVOLTYPE_FREEBSD },
+ { 0xa9, RTDVMVOLTYPE_NETBSD },
+ { 0xa6, RTDVMVOLTYPE_OPENBSD },
+ { 0xaf, RTDVMVOLTYPE_MAC_OSX_HFS },
+ { 0xbf, RTDVMVOLTYPE_SOLARIS },
+ { 0xfd, RTDVMVOLTYPE_LINUX_SOFTRAID }
+};
+
+static DECLCALLBACK(int) rtDvmFmtMbrProbe(PCRTDVMDISK pDisk, uint32_t *puScore)
+{
+ int rc = VINF_SUCCESS;
+ uint8_t abMbr[512];
+
+ *puScore = RTDVM_MATCH_SCORE_UNSUPPORTED;
+
+ if (pDisk->cbDisk >= 512)
+ {
+ /* Read from the disk and check for the 0x55aa signature at the end. */
+ rc = rtDvmDiskRead(pDisk, 0, &abMbr[0], sizeof(abMbr));
+ if ( RT_SUCCESS(rc)
+ && abMbr[510] == 0x55
+ && abMbr[511] == 0xaa)
+ *puScore = RTDVM_MATCH_SCORE_SUPPORTED; /* Not perfect because GPTs have a protective MBR. */
+ }
+
+ return rc;
+}
+
+static DECLCALLBACK(int) rtDvmFmtMbrOpen(PCRTDVMDISK pDisk, PRTDVMFMT phVolMgrFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMFMTINTERNAL pThis = NULL;
+
+ pThis = (PRTDVMFMTINTERNAL)RTMemAllocZ(sizeof(RTDVMFMTINTERNAL));
+ if (VALID_PTR(pThis))
+ {
+ pThis->pDisk = pDisk;
+ pThis->cPartitions = 0;
+
+ /* Read the MBR and count the valid partition entries. */
+ rc = rtDvmDiskRead(pDisk, 0, &pThis->abMbr[0], sizeof(pThis->abMbr));
+ if (RT_SUCCESS(rc))
+ {
+ uint8_t *pbMbrEntry = &pThis->abMbr[446];
+
+ Assert(pThis->abMbr[510] == 0x55 && pThis->abMbr[511] == 0xaa);
+
+ for (unsigned i = 0; i < 4; i++)
+ {
+ /* The entry is unused if the type contains 0x00. */
+ if (pbMbrEntry[4] != 0x00)
+ pThis->cPartitions++;
+
+ pbMbrEntry += 16;
+ }
+
+ *phVolMgrFmt = pThis;
+ }
+ }
+ else
+ rc = VERR_NO_MEMORY;
+
+ return rc;
+}
+
+static DECLCALLBACK(int) rtDvmFmtMbrInitialize(PCRTDVMDISK pDisk, PRTDVMFMT phVolMgrFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMFMTINTERNAL pThis = NULL;
+
+ pThis = (PRTDVMFMTINTERNAL)RTMemAllocZ(sizeof(RTDVMFMTINTERNAL));
+ if (VALID_PTR(pThis))
+ {
+ /* Setup a new MBR and write it to the disk. */
+ memset(&pThis->abMbr[0], 0, sizeof(pThis->abMbr));
+ pThis->abMbr[510] = 0x55;
+ pThis->abMbr[511] = 0xaa;
+
+ rc = rtDvmDiskWrite(pDisk, 0, &pThis->abMbr[0], sizeof(pThis->abMbr));
+
+ if (RT_SUCCESS(rc))
+ {
+ pThis->pDisk = pDisk;
+ pThis->cPartitions = 0;
+ *phVolMgrFmt = pThis;
+ }
+ else
+ RTMemFree(pThis);
+ }
+ else
+ rc = VERR_NO_MEMORY;
+
+ return rc;
+}
+
+static DECLCALLBACK(void) rtDvmFmtMbrClose(RTDVMFMT hVolMgrFmt)
+{
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+
+ pThis->pDisk = NULL;
+ pThis->cPartitions = 0;
+ memset(&pThis->abMbr[0], 0, sizeof(pThis->abMbr));
+ RTMemFree(pThis);
+}
+
+static DECLCALLBACK(uint32_t) rtDvmFmtMbrGetValidVolumes(RTDVMFMT hVolMgrFmt)
+{
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+
+ return pThis->cPartitions;
+}
+
+static DECLCALLBACK(uint32_t) rtDvmFmtMbrGetMaxVolumes(RTDVMFMT hVolMgrFmt)
+{
+ NOREF(hVolMgrFmt);
+ return 4; /** @todo: Add support for EBR? */
+}
+
+/**
+ * Creates a new volume.
+ *
+ * @returns IPRT status code.
+ * @param pThis The MBR volume manager data.
+ * @param pbMbrEntry The raw MBR entry data.
+ * @param idx The index in the partition table.
+ * @param phVolFmt Where to store the volume data on success.
+ */
+static int rtDvmFmtMbrVolumeCreate(PRTDVMFMTINTERNAL pThis, uint8_t *pbMbrEntry,
+ uint32_t idx, PRTDVMVOLUMEFMT phVolFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMVOLUMEFMTINTERNAL pVol = (PRTDVMVOLUMEFMTINTERNAL)RTMemAllocZ(sizeof(RTDVMVOLUMEFMTINTERNAL));
+
+ if (VALID_PTR(pVol))
+ {
+ pVol->pVolMgr = pThis;
+ pVol->idxEntry = idx;
+ pVol->pbMbrEntry = pbMbrEntry;
+ pVol->offStart = *(uint32_t *)&pbMbrEntry[0x08] * pThis->pDisk->cbSector;
+ pVol->cbVolume = *(uint32_t *)&pbMbrEntry[0x0c] * pThis->pDisk->cbSector;
+
+ *phVolFmt = pVol;
+ }
+ else
+ rc = VERR_NO_MEMORY;
+
+ return rc;
+}
+
+static DECLCALLBACK(int) rtDvmFmtMbrQueryFirstVolume(RTDVMFMT hVolMgrFmt, PRTDVMVOLUMEFMT phVolFmt)
+{
+ int rc = VINF_SUCCESS;
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+
+ if (pThis->cPartitions != 0)
+ {
+ uint8_t *pbMbrEntry = &pThis->abMbr[446];
+
+ /* Search for the first non empty entry. */
+ for (unsigned i = 0; i < 4; i++)
+ {
+ if (pbMbrEntry[0x04] != 0x00)
+ {
+ rc = rtDvmFmtMbrVolumeCreate(pThis, pbMbrEntry, i, phVolFmt);
+ break;
+ }
+ pbMbrEntry += 16;
+ }
+ }
+ else
+ rc = VERR_DVM_MAP_EMPTY;
+
+ return rc;
+}
+
+static DECLCALLBACK(int) rtDvmFmtMbrQueryNextVolume(RTDVMFMT hVolMgrFmt, RTDVMVOLUMEFMT hVolFmt, PRTDVMVOLUMEFMT phVolFmtNext)
+{
+ int rc = VERR_DVM_MAP_NO_VOLUME;
+ PRTDVMFMTINTERNAL pThis = hVolMgrFmt;
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+ uint8_t *pbMbrEntry = pVol->pbMbrEntry + 16;
+
+ for (unsigned i = pVol->idxEntry + 1; i < 4; i++)
+ {
+ if (pbMbrEntry[0x04] != 0x00)
+ {
+ rc = rtDvmFmtMbrVolumeCreate(pThis, pbMbrEntry, i, phVolFmtNext);
+ break;
+ }
+ pbMbrEntry += 16;
+ }
+
+ return rc;
+}
+
+static DECLCALLBACK(void) rtDvmFmtMbrVolumeClose(RTDVMVOLUMEFMT hVolFmt)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+
+ pVol->pVolMgr = NULL;
+ pVol->offStart = 0;
+ pVol->cbVolume = 0;
+ pVol->pbMbrEntry = NULL;
+
+ RTMemFree(pVol);
+}
+
+static DECLCALLBACK(uint64_t) rtDvmFmtMbrVolumeGetSize(RTDVMVOLUMEFMT hVolFmt)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+
+ return pVol->cbVolume;
+}
+
+static DECLCALLBACK(int) rtDvmFmtMbrVolumeQueryName(RTDVMVOLUMEFMT hVolFmt, char **ppszVolName)
+{
+ NOREF(hVolFmt);
+ return VERR_NOT_SUPPORTED;
+}
+
+static DECLCALLBACK(RTDVMVOLTYPE) rtDvmFmtMbrVolumeGetType(RTDVMVOLUMEFMT hVolFmt)
+{
+ RTDVMVOLTYPE enmVolType = RTDVMVOLTYPE_UNKNOWN;
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+
+ for (unsigned i = 0; i < RT_ELEMENTS(g_aFs2DvmVolTypes); i++)
+ if (pVol->pbMbrEntry[0x04] == g_aFs2DvmVolTypes[i].bFsId)
+ {
+ enmVolType = g_aFs2DvmVolTypes[i].enmVolType;
+ break;
+ }
+
+ return enmVolType;
+}
+
+static DECLCALLBACK(uint64_t) rtDvmFmtMbrVolumeGetFlags(RTDVMVOLUMEFMT hVolFmt)
+{
+ uint64_t fFlags = 0;
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+
+ if (pVol->pbMbrEntry[0x00] & 0x80)
+ fFlags |= DVMVOLUME_FLAGS_BOOTABLE | DVMVOLUME_FLAGS_ACTIVE;
+
+ return fFlags;
+}
+
+static DECLCALLBACK(int) rtDvmFmtMbrVolumeRead(RTDVMVOLUMEFMT hVolFmt, uint64_t off, void *pvBuf, size_t cbRead)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+ AssertReturn(off + cbRead <= pVol->cbVolume, VERR_INVALID_PARAMETER);
+
+ return rtDvmDiskRead(pVol->pVolMgr->pDisk, pVol->offStart + off, pvBuf, cbRead);
+}
+
+static DECLCALLBACK(int) rtDvmFmtMbrVolumeWrite(RTDVMVOLUMEFMT hVolFmt, uint64_t off, const void *pvBuf, size_t cbWrite)
+{
+ PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt;
+ AssertReturn(off + cbWrite <= pVol->cbVolume, VERR_INVALID_PARAMETER);
+
+ return rtDvmDiskWrite(pVol->pVolMgr->pDisk, pVol->offStart + off, pvBuf, cbWrite);
+}
+
+RTDVMFMTOPS g_rtDvmFmtMbr =
+{
+ /* pcszFmt */
+ "MBR",
+ /* pfnProbe */
+ rtDvmFmtMbrProbe,
+ /* pfnOpen */
+ rtDvmFmtMbrOpen,
+ /* pfnInitialize */
+ rtDvmFmtMbrInitialize,
+ /* pfnClose */
+ rtDvmFmtMbrClose,
+ /* pfnGetValidVolumes */
+ rtDvmFmtMbrGetValidVolumes,
+ /* pfnGetMaxVolumes */
+ rtDvmFmtMbrGetMaxVolumes,
+ /* pfnQueryFirstVolume */
+ rtDvmFmtMbrQueryFirstVolume,
+ /* pfnQueryNextVolume */
+ rtDvmFmtMbrQueryNextVolume,
+ /* pfnVolumeClose */
+ rtDvmFmtMbrVolumeClose,
+ /* pfnVolumeGetSize */
+ rtDvmFmtMbrVolumeGetSize,
+ /* pfnVolumeQueryName */
+ rtDvmFmtMbrVolumeQueryName,
+ /* pfnVolumeGetType */
+ rtDvmFmtMbrVolumeGetType,
+ /* pfnVolumeGetFlags */
+ rtDvmFmtMbrVolumeGetFlags,
+ /* pfnVolumeRead */
+ rtDvmFmtMbrVolumeRead,
+ /* pfnVolumeWrite */
+ rtDvmFmtMbrVolumeWrite
+};
+
diff --git a/src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp b/src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp
index 13f37b776..5cb304854 100644
--- a/src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp
+++ b/src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTErrConvertFromErrno.cpp $ */
+/* $Id: RTErrConvertFromErrno.cpp 31316 2010-08-02 15:36:30Z vboxsync $ */
/** @file
* IPRT - Convert errno to iprt status codes.
*/
diff --git a/src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp b/src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp
index cadac56fd..11df924fa 100644
--- a/src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp
+++ b/src/VBox/Runtime/common/err/RTErrConvertToErrno.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTErrConvertToErrno.cpp $ */
+/* $Id: RTErrConvertToErrno.cpp 36284 2011-03-15 13:06:05Z vboxsync $ */
/** @file
* IPRT - Convert iprt status codes to errno.
*/
@@ -176,6 +176,7 @@ RTDECL(int) RTErrConvertToErrno(int iErr)
case VERR_FILE_LOCK_FAILED: return ENOLCK;
#endif
#ifdef ENOSYS
+ case VERR_NOT_IMPLEMENTED:
case VERR_NOT_SUPPORTED: return ENOSYS;
#endif
#ifdef ENOTEMPTY
diff --git a/src/VBox/Runtime/common/err/errinfo.cpp b/src/VBox/Runtime/common/err/errinfo.cpp
index a8db71fcb..aef5a3973 100644
--- a/src/VBox/Runtime/common/err/errinfo.cpp
+++ b/src/VBox/Runtime/common/err/errinfo.cpp
@@ -1,4 +1,4 @@
-/* $Id: errinfo.cpp $ */
+/* $Id: errinfo.cpp 35182 2010-12-16 13:57:44Z vboxsync $ */
/** @file
* IPRT - Error Info.
*/
diff --git a/src/VBox/Runtime/common/err/errmsg.cpp b/src/VBox/Runtime/common/err/errmsg.cpp
index c22927469..b011bf79c 100644
--- a/src/VBox/Runtime/common/err/errmsg.cpp
+++ b/src/VBox/Runtime/common/err/errmsg.cpp
@@ -1,4 +1,4 @@
-/* $Id: errmsg.cpp $ */
+/* $Id: errmsg.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Status code messages.
*/
diff --git a/src/VBox/Runtime/common/err/errmsg.sed b/src/VBox/Runtime/common/err/errmsg.sed
index d4a1acc85..8af8c7c00 100644
--- a/src/VBox/Runtime/common/err/errmsg.sed
+++ b/src/VBox/Runtime/common/err/errmsg.sed
@@ -1,9 +1,10 @@
-# $Id: errmsg.sed $
+# $Id: errmsg.sed 35811 2011-02-01 13:12:08Z vboxsync $
## @file
# IPRT - SED script for converting */err.h.
#
-# Copyright (C) 2006-2009 Oracle Corporation
+#
+# Copyright (C) 2006-2011 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
@@ -93,6 +94,11 @@ s/ { NULL, \"\([^.!?"]*[.!?][.!?]*\)/ { \"\1\",\n \"\1/
# terminate the string
s/[[:space:]]*\*\//\"\,/
+
+# translate empty lines into new-lines (only one, please).
+s/[[:space:]]*[[:space:]]\*[[:space:]][[:space:]]*\*[[:space:]][[:space:]]*/\\n/g
+
+# remove asterics.
s/[[:space:]]*[[:space:]]\*[[:space:]][[:space:]]*/ /g
b end
diff --git a/src/VBox/Runtime/common/err/errmsgcom.sed b/src/VBox/Runtime/common/err/errmsgcom.sed
index b101ad7c9..b1c2096a0 100644
--- a/src/VBox/Runtime/common/err/errmsgcom.sed
+++ b/src/VBox/Runtime/common/err/errmsgcom.sed
@@ -1,4 +1,4 @@
-# $Id: errmsgcom.sed $
+# $Id: errmsgcom.sed 28800 2010-04-27 08:22:32Z vboxsync $
## @file
# IPRT - SED script for converting COM errors
#
diff --git a/src/VBox/Runtime/common/err/errmsgxpcom.cpp b/src/VBox/Runtime/common/err/errmsgxpcom.cpp
index 74071989c..bee0378da 100644
--- a/src/VBox/Runtime/common/err/errmsgxpcom.cpp
+++ b/src/VBox/Runtime/common/err/errmsgxpcom.cpp
@@ -1,4 +1,4 @@
-/* $Id: errmsgxpcom.cpp $ */
+/* $Id: errmsgxpcom.cpp 34654 2010-12-02 19:59:22Z vboxsync $ */
/** @file
* IPRT - Status code messages for XPCOM.
*/
diff --git a/src/VBox/Runtime/common/ldr/ldr.cpp b/src/VBox/Runtime/common/ldr/ldr.cpp
index ada4984c6..bbe54edc2 100644
--- a/src/VBox/Runtime/common/ldr/ldr.cpp
+++ b/src/VBox/Runtime/common/ldr/ldr.cpp
@@ -1,4 +1,4 @@
-/* $Id: ldr.cpp $ */
+/* $Id: ldr.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - Binary Image Loader.
*/
@@ -40,25 +40,6 @@
#include "internal/ldr.h"
-/*******************************************************************************
-* Structures and Typedefs *
-*******************************************************************************/
-typedef struct RTLDRREADERFILE
-{
- /** The core. */
- RTLDRREADER Core;
- /** The file. */
- RTFILE File;
- /** The file size. */
- RTFOFF cbFile;
- /** The current offset. */
- RTFOFF off;
- /** The filename (variable size). */
- char szFilename[1];
-} RTLDRREADERFILE, *PRTLDRREADERFILE;
-
-
-
/**
* Checks if a library is loadable or not.
*
diff --git a/src/VBox/Runtime/common/ldr/ldrELF.cpp b/src/VBox/Runtime/common/ldr/ldrELF.cpp
index 47b45f618..b260fc4c3 100644
--- a/src/VBox/Runtime/common/ldr/ldrELF.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrELF.cpp
@@ -1,4 +1,4 @@
-/* $Id: ldrELF.cpp $ */
+/* $Id: ldrELF.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Binary Image Loader, Executable and Linker Format (ELF).
*/
diff --git a/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h b/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h
index 755ef6a94..f0fff9008 100644
--- a/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h
+++ b/src/VBox/Runtime/common/ldr/ldrELFRelocatable.cpp.h
@@ -1,4 +1,4 @@
-/* $Id: ldrELFRelocatable.cpp.h $ */
+/* $Id: ldrELFRelocatable.cpp.h 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Binary Image Loader, Template for ELF Relocatable Images.
*/
diff --git a/src/VBox/Runtime/common/ldr/ldrEx.cpp b/src/VBox/Runtime/common/ldr/ldrEx.cpp
index 89750586d..ffd59542a 100644
--- a/src/VBox/Runtime/common/ldr/ldrEx.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrEx.cpp
@@ -1,4 +1,4 @@
-/* $Id: ldrEx.cpp $ */
+/* $Id: ldrEx.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Binary Image Loader, Extended Features.
*/
diff --git a/src/VBox/Runtime/common/ldr/ldrFile.cpp b/src/VBox/Runtime/common/ldr/ldrFile.cpp
index 4de2d328b..b0b43f9a8 100644
--- a/src/VBox/Runtime/common/ldr/ldrFile.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrFile.cpp
@@ -1,4 +1,4 @@
-/* $Id: ldrFile.cpp $ */
+/* $Id: ldrFile.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - Binary Image Loader, The File Oriented Parts.
*/
@@ -54,7 +54,7 @@ typedef struct RTLDRREADERFILE
/** The core. */
RTLDRREADER Core;
/** The file. */
- RTFILE File;
+ RTFILE hFile;
/** The file size. */
RTFOFF cbFile;
/** The current offset. */
@@ -78,7 +78,7 @@ static DECLCALLBACK(int) rtldrFileRead(PRTLDRREADER pReader, void *pvBuf, size_t
*/
if (pFileReader->off != off)
{
- int rc = RTFileSeek(pFileReader->File, off, RTFILE_SEEK_BEGIN, NULL);
+ int rc = RTFileSeek(pFileReader->hFile, off, RTFILE_SEEK_BEGIN, NULL);
if (RT_FAILURE(rc))
{
pFileReader->off = -1;
@@ -90,7 +90,7 @@ static DECLCALLBACK(int) rtldrFileRead(PRTLDRREADER pReader, void *pvBuf, size_t
/*
* Read.
*/
- int rc = RTFileRead(pFileReader->File, pvBuf, cb, NULL);
+ int rc = RTFileRead(pFileReader->hFile, pvBuf, cb, NULL);
if (RT_SUCCESS(rc))
pFileReader->off += cb;
else
@@ -184,11 +184,11 @@ static DECLCALLBACK(int) rtldrFileDestroy(PRTLDRREADER pReader)
{
int rc = VINF_SUCCESS;
PRTLDRREADERFILE pFileReader = (PRTLDRREADERFILE)pReader;
- if (pFileReader->File != NIL_RTFILE)
+ if (pFileReader->hFile != NIL_RTFILE)
{
- rc = RTFileClose(pFileReader->File);
+ rc = RTFileClose(pFileReader->hFile);
AssertRC(rc);
- pFileReader->File = NIL_RTFILE;
+ pFileReader->hFile = NIL_RTFILE;
}
RTMemFree(pFileReader);
return rc;
@@ -210,10 +210,10 @@ static int rtldrFileCreate(PRTLDRREADER *ppReader, const char *pszFilename)
if (pFileReader)
{
memcpy(pFileReader->szFilename, pszFilename, cchFilename + 1);
- rc = RTFileOpen(&pFileReader->File, pszFilename, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
+ rc = RTFileOpen(&pFileReader->hFile, pszFilename, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
if (RT_SUCCESS(rc))
{
- rc = RTFileGetSize(pFileReader->File, (uint64_t *)&pFileReader->cbFile);
+ rc = RTFileGetSize(pFileReader->hFile, (uint64_t *)&pFileReader->cbFile);
if (RT_SUCCESS(rc))
{
pFileReader->Core.pfnRead = rtldrFileRead;
@@ -229,7 +229,8 @@ static int rtldrFileCreate(PRTLDRREADER *ppReader, const char *pszFilename)
*ppReader = &pFileReader->Core;
return VINF_SUCCESS;
}
- RTFileClose(pFileReader->File);
+
+ RTFileClose(pFileReader->hFile);
}
RTMemFree(pFileReader);
}
diff --git a/src/VBox/Runtime/common/ldr/ldrNative.cpp b/src/VBox/Runtime/common/ldr/ldrNative.cpp
index 8462e7098..8c25fed4a 100644
--- a/src/VBox/Runtime/common/ldr/ldrNative.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrNative.cpp
@@ -1,4 +1,4 @@
-/* $Id: ldrNative.cpp $ */
+/* $Id: ldrNative.cpp 35191 2010-12-16 15:25:20Z vboxsync $ */
/** @file
* IPRT - Binary Image Loader, Native interface.
*/
diff --git a/src/VBox/Runtime/common/ldr/ldrPE.cpp b/src/VBox/Runtime/common/ldr/ldrPE.cpp
index 82f610b55..47be5429f 100644
--- a/src/VBox/Runtime/common/ldr/ldrPE.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrPE.cpp
@@ -1,4 +1,4 @@
-/* $Id: ldrPE.cpp $ */
+/* $Id: ldrPE.cpp 36969 2011-05-05 08:59:43Z vboxsync $ */
/** @file
* IPRT - Binary Image Loader, Portable Executable (PE).
*/
diff --git a/src/VBox/Runtime/common/ldr/ldrkStuff.cpp b/src/VBox/Runtime/common/ldr/ldrkStuff.cpp
index 96585a61b..09fd971c0 100644
--- a/src/VBox/Runtime/common/ldr/ldrkStuff.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrkStuff.cpp
@@ -1,4 +1,4 @@
-/* $Id: ldrkStuff.cpp $ */
+/* $Id: ldrkStuff.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Binary Image Loader, kLdr Interface.
*/
diff --git a/src/VBox/Runtime/common/log/log.cpp b/src/VBox/Runtime/common/log/log.cpp
index fe2ffa4b0..354b32997 100644
--- a/src/VBox/Runtime/common/log/log.cpp
+++ b/src/VBox/Runtime/common/log/log.cpp
@@ -1,4 +1,4 @@
-/* $Id: log.cpp $ */
+/* $Id: log.cpp 37818 2011-07-07 13:25:03Z vboxsync $ */
/** @file
* Runtime VBox - Logger.
*/
@@ -71,31 +71,64 @@
typedef struct RTLOGOUTPUTPREFIXEDARGS
{
/** The logger instance. */
- PRTLOGGER pLogger;
+ PRTLOGGER pLogger;
/** The flags. (used for prefixing.) */
- unsigned fFlags;
+ unsigned fFlags;
/** The group. (used for prefixing.) */
- unsigned iGroup;
+ unsigned iGroup;
} RTLOGOUTPUTPREFIXEDARGS, *PRTLOGOUTPUTPREFIXEDARGS;
-#ifdef IN_RING3
/**
- * File logging bits for the logger.
+ * Internal logger data.
+ *
+ * @remarks Don't make casual changes to this structure.
*/
-typedef struct RTLOGGERFILE
+typedef struct RTLOGGERINTERNAL
{
+ /** The structure revision (RTLOGGERINTERNAL_REV). */
+ uint32_t uRevision;
+ /** The size of the internal logger structure. */
+ uint32_t cbSelf;
+
+ /** Spinning mutex semaphore. Can be NIL. */
+ RTSEMSPINMUTEX hSpinMtx;
+ /** Pointer to the flush function. */
+ PFNRTLOGFLUSH pfnFlush;
+
+ /** Custom prefix callback. */
+ PFNRTLOGPREFIX pfnPrefix;
+ /** Prefix callback argument. */
+ void *pvPrefixUserArg;
+ /** This is set if a prefix is pending. */
+ bool fPendingPrefix;
+ /** Alignment padding. */
+ bool afPadding1[3];
+
+ /** The max number of groups that there is room for in afGroups and papszGroups.
+ * Used by RTLogCopyGroupAndFlags(). */
+ uint32_t cMaxGroups;
+ /** Pointer to the group name array.
+ * (The data is readonly and provided by the user.) */
+ const char * const *papszGroups;
+
+ /** The number of log entries per group. NULL if
+ * RTLOGFLAGS_RESTRICT_GROUPS is not specified. */
+ uint32_t *pacEntriesPerGroup;
+ /** The max number of entries per group. */
+ uint32_t cMaxEntriesPerGroup;
+ /** Padding. */
+ uint32_t u32Padding2;
+
+#ifdef IN_RING3 /* Note! Must be at the end! */
+ /** @name File logging bits for the logger.
+ * @{ */
/** Pointer to the function called when starting logging, and when
* ending or starting a new log file as part of history rotation.
* This can be NULL. */
PFNRTLOGPHASE pfnPhase;
+
/** Handle to log file (if open). */
- RTFILE File;
- /** Pointer to filename.
- * (The memory is allocated in the same block as RTLOGGER.) */
- char *pszFilename;
- /** Log file history settings: number of older files to keep.
- * 0 means no history. */
- uint32_t cHistory;
+ RTFILE hFile;
/** Log file history settings: maximum amount of data to put in a file. */
uint64_t cbHistoryFileMax;
/** Log file history settings: current amount of data in a file. */
@@ -104,9 +137,24 @@ typedef struct RTLOGGERFILE
uint32_t cSecsHistoryTimeSlot;
/** Log file history settings: in what time slot was the file created. */
uint32_t uHistoryTimeSlotStart;
-} RTLOGGERFILE;
+ /** Log file history settings: number of older files to keep.
+ * 0 means no history. */
+ uint32_t cHistory;
+ /** Pointer to filename. */
+ char szFilename[RTPATH_MAX];
+ /** @} */
#endif /* IN_RING3 */
+} RTLOGGERINTERNAL;
+/** The revision of the internal logger structure. */
+#define RTLOGGERINTERNAL_REV UINT32_C(9)
+
+#ifdef IN_RING3
+/** The size of the RTLOGGERINTERNAL structure in ring-0. */
+# define RTLOGGERINTERNAL_R0_SIZE RT_OFFSETOF(RTLOGGERINTERNAL, pfnPhase)
+AssertCompileMemberAlignment(RTLOGGERINTERNAL, hFile, sizeof(void *));
+AssertCompileMemberAlignment(RTLOGGERINTERNAL, cbHistoryFileMax, sizeof(uint64_t));
+#endif
/*******************************************************************************
* Internal Functions *
@@ -125,6 +173,7 @@ static void rtlogFlush(PRTLOGGER pLogger);
static DECLCALLBACK(size_t) rtLogOutput(void *pv, const char *pachChars, size_t cbChars);
static DECLCALLBACK(size_t) rtLogOutputPrefixed(void *pv, const char *pachChars, size_t cbChars);
static void rtlogLoggerExVLocked(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, va_list args);
+static void rtlogLoggerExFLocked(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...);
/*******************************************************************************
@@ -141,6 +190,7 @@ static PRTLOGGER g_pLogger;
/** The RTThreadGetWriteLockCount() change caused by the logger mutex semaphore. */
static uint32_t volatile g_cLoggerLockCount;
#endif
+
#ifdef IN_RING0
/** Number of per-thread loggers. */
static int32_t volatile g_cPerThreadLoggers;
@@ -209,6 +259,7 @@ static struct
{ "msprog", sizeof("msprog" ) - 1, RTLOGFLAGS_PREFIX_MS_PROG, false },
{ "tsc", sizeof("tsc" ) - 1, RTLOGFLAGS_PREFIX_TSC, false }, /* before ts! */
{ "ts", sizeof("ts" ) - 1, RTLOGFLAGS_PREFIX_TS, false },
+ /* We intentionally omit RTLOGFLAGS_RESTRICT_GROUPS. */
};
/**
@@ -243,9 +294,14 @@ static struct
DECLINLINE(int) rtlogLock(PRTLOGGER pLogger)
{
#ifndef IN_RC
- if (pLogger->hSpinMtx != NIL_RTSEMSPINMUTEX)
+ PRTLOGGERINTERNAL pInt = pLogger->pInt;
+ AssertMsgReturn(pInt->uRevision == RTLOGGERINTERNAL_REV, ("%#x != %#x\n", pInt->uRevision, RTLOGGERINTERNAL_REV),
+ VERR_LOG_REVISION_MISMATCH);
+ AssertMsgReturn(pInt->cbSelf == sizeof(*pInt), ("%#x != %#x\n", pInt->cbSelf, sizeof(*pInt)),
+ VERR_LOG_REVISION_MISMATCH);
+ if (pInt->hSpinMtx != NIL_RTSEMSPINMUTEX)
{
- int rc = RTSemSpinMutexRequest(pLogger->hSpinMtx);
+ int rc = RTSemSpinMutexRequest(pInt->hSpinMtx);
if (RT_FAILURE(rc))
return rc;
}
@@ -261,8 +317,8 @@ DECLINLINE(int) rtlogLock(PRTLOGGER pLogger)
DECLINLINE(void) rtlogUnlock(PRTLOGGER pLogger)
{
#ifndef IN_RC
- if (pLogger->hSpinMtx != NIL_RTSEMSPINMUTEX)
- RTSemSpinMutexRelease(pLogger->hSpinMtx);
+ if (pLogger->pInt->hSpinMtx != NIL_RTSEMSPINMUTEX)
+ RTSemSpinMutexRelease(pLogger->pInt->hSpinMtx);
#endif
return;
}
@@ -280,7 +336,7 @@ DECLINLINE(void) rtlogUnlock(PRTLOGGER pLogger)
static DECLCALLBACK(size_t) rtlogPhaseWrite(void *pvArg, const char *pachChars, size_t cbChars)
{
PRTLOGGER pLogger = (PRTLOGGER)pvArg;
- RTFileWrite(pLogger->pFile->File, pachChars, cbChars, NULL);
+ RTFileWrite(pLogger->pInt->hFile, pachChars, cbChars, NULL);
return cbChars;
}
@@ -324,8 +380,8 @@ static DECLCALLBACK(void) rtlogPhaseMsgLocked(PRTLOGGER pLogger, const char *psz
{
va_list args;
AssertPtrReturnVoid(pLogger);
- AssertPtrReturnVoid(pLogger->pFile);
- Assert(pLogger->hSpinMtx != NIL_RTSEMSPINMUTEX);
+ AssertPtrReturnVoid(pLogger->pInt);
+ Assert(pLogger->pInt->hSpinMtx != NIL_RTSEMSPINMUTEX);
va_start(args, pszFormat);
rtlogLoggerExVLocked(pLogger, 0, ~0, pszFormat, args);
@@ -344,8 +400,8 @@ static DECLCALLBACK(void) rtlogPhaseMsgNormal(PRTLOGGER pLogger, const char *psz
{
va_list args;
AssertPtrReturnVoid(pLogger);
- AssertPtrReturnVoid(pLogger->pFile);
- Assert(pLogger->hSpinMtx != NIL_RTSEMSPINMUTEX);
+ AssertPtrReturnVoid(pLogger->pInt);
+ Assert(pLogger->pInt->hSpinMtx != NIL_RTSEMSPINMUTEX);
va_start(args, pszFormat);
RTLogLoggerExV(pLogger, 0, ~0, pszFormat, args);
@@ -355,14 +411,15 @@ static DECLCALLBACK(void) rtlogPhaseMsgNormal(PRTLOGGER pLogger, const char *psz
# endif /* IN_RING3 */
RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,
- const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,
+ const char *pszEnvVarBase, unsigned cGroups, const char * const *papszGroups,
uint32_t fDestFlags, PFNRTLOGPHASE pfnPhase, uint32_t cHistory,
uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot,
char *pszErrorMsg, size_t cchErrorMsg, const char *pszFilenameFmt, va_list args)
{
- int rc;
- size_t cb;
- PRTLOGGER pLogger;
+ int rc;
+ size_t offInternal;
+ size_t cbLogger;
+ PRTLOGGER pLogger;
/*
* Validate input.
@@ -383,45 +440,55 @@ RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *psz
/*
* Allocate a logger instance.
*/
- cb = RT_OFFSETOF(RTLOGGER, afGroups[cGroups + 1]) + RTPATH_MAX;
-#ifdef IN_RING3
- cb += sizeof(RTLOGGERFILE);
-#endif
- pLogger = (PRTLOGGER)RTMemAllocZVar(cb);
+ offInternal = RT_OFFSETOF(RTLOGGER, afGroups[cGroups]);
+ offInternal = RT_ALIGN_Z(offInternal, sizeof(uint64_t));
+ cbLogger = offInternal + sizeof(RTLOGGERINTERNAL);
+ if (fFlags & RTLOGFLAGS_RESTRICT_GROUPS)
+ cbLogger += cGroups * sizeof(uint32_t);
+ pLogger = (PRTLOGGER)RTMemAllocZVar(cbLogger);
if (pLogger)
{
-#if defined(RT_ARCH_X86) && (!defined(LOG_USE_C99) || !defined(RT_WITHOUT_EXEC_ALLOC))
+# if defined(RT_ARCH_X86) && (!defined(LOG_USE_C99) || !defined(RT_WITHOUT_EXEC_ALLOC))
uint8_t *pu8Code;
-#endif
-
- pLogger->u32Magic = RTLOGGER_MAGIC;
- pLogger->papszGroups = papszGroups;
- pLogger->cMaxGroups = cGroups;
- pLogger->cGroups = cGroups;
-#ifdef IN_RING3
- pLogger->pFile = (PRTLOGGERFILE)((char *)&pLogger->afGroups[cGroups + 1] + RTPATH_MAX);
- pLogger->pFile->File = NIL_RTFILE;
- pLogger->pFile->pszFilename = (char *)&pLogger->afGroups[cGroups + 1];
- pLogger->pFile->pfnPhase = pfnPhase;
- pLogger->pFile->cHistory = cHistory;
+# endif
+ pLogger->u32Magic = RTLOGGER_MAGIC;
+ pLogger->cGroups = cGroups;
+ pLogger->fFlags = fFlags;
+ pLogger->fDestFlags = fDestFlags;
+ pLogger->pInt = (PRTLOGGERINTERNAL)((uintptr_t)pLogger + offInternal);
+ pLogger->pInt->uRevision = RTLOGGERINTERNAL_REV;
+ pLogger->pInt->cbSelf = sizeof(RTLOGGERINTERNAL);
+ pLogger->pInt->hSpinMtx = NIL_RTSEMSPINMUTEX;
+ pLogger->pInt->pfnFlush = NULL;
+ pLogger->pInt->pfnPrefix = NULL;
+ pLogger->pInt->pvPrefixUserArg = NULL;
+ pLogger->pInt->afPadding1[0] = false;
+ pLogger->pInt->afPadding1[1] = false;
+ pLogger->pInt->afPadding1[2] = false;
+ pLogger->pInt->cMaxGroups = cGroups;
+ pLogger->pInt->papszGroups = papszGroups;
+ if (fFlags & RTLOGFLAGS_RESTRICT_GROUPS)
+ pLogger->pInt->pacEntriesPerGroup = (uint32_t *)(pLogger->pInt + 1);
+ else
+ pLogger->pInt->pacEntriesPerGroup = NULL;
+ pLogger->pInt->cMaxEntriesPerGroup = UINT32_MAX;
+# ifdef IN_RING3
+ pLogger->pInt->pfnPhase = pfnPhase;
+ pLogger->pInt->hFile = NIL_RTFILE;
+ pLogger->pInt->cHistory = cHistory;
if (cbHistoryFileMax == 0)
- pLogger->pFile->cbHistoryFileMax = UINT64_MAX;
+ pLogger->pInt->cbHistoryFileMax = UINT64_MAX;
else
- pLogger->pFile->cbHistoryFileMax = cbHistoryFileMax;
+ pLogger->pInt->cbHistoryFileMax = cbHistoryFileMax;
if (cSecsHistoryTimeSlot == 0)
- pLogger->pFile->cSecsHistoryTimeSlot = UINT32_MAX;
+ pLogger->pInt->cSecsHistoryTimeSlot = UINT32_MAX;
else
- pLogger->pFile->cSecsHistoryTimeSlot = cSecsHistoryTimeSlot;
-#else /* !IN_RING3 */
- pLogger->pFile = NULL;
-#endif /* !IN_RING3 */
- pLogger->fFlags = fFlags;
- pLogger->fDestFlags = fDestFlags;
- pLogger->fPendingPrefix = true;
+ pLogger->pInt->cSecsHistoryTimeSlot = cSecsHistoryTimeSlot;
+# endif /* IN_RING3 */
if (pszGroupSettings)
RTLogGroupSettings(pLogger, pszGroupSettings);
-#if defined(RT_ARCH_X86) && (!defined(LOG_USE_C99) || !defined(RT_WITHOUT_EXEC_ALLOC))
+# if defined(RT_ARCH_X86) && (!defined(LOG_USE_C99) || !defined(RT_WITHOUT_EXEC_ALLOC))
/*
* Emit wrapper code.
*/
@@ -446,23 +513,23 @@ RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *psz
}
else
{
-# ifdef RT_OS_LINUX
+# ifdef RT_OS_LINUX
if (pszErrorMsg) /* Most probably SELinux causing trouble since the larger RTMemAlloc succeeded. */
RTStrPrintf(pszErrorMsg, cchErrorMsg, N_("mmap(PROT_WRITE | PROT_EXEC) failed -- SELinux?"));
-# endif
+# endif
rc = VERR_NO_MEMORY;
}
if (RT_SUCCESS(rc))
-#endif /* X86 wrapper code*/
+# endif /* X86 wrapper code*/
{
-#ifdef IN_RING3 /* files and env.vars. are only accessible when in R3 at the present time. */
+# ifdef IN_RING3 /* files and env.vars. are only accessible when in R3 at the present time. */
/*
* Format the filename.
*/
if (pszFilenameFmt)
{
/** @todo validate the length, fail on overflow. */
- RTStrPrintfV(pLogger->pFile->pszFilename, RTPATH_MAX, pszFilenameFmt, args);
+ RTStrPrintfV(pLogger->pInt->szFilename, sizeof(pLogger->pInt->szFilename), pszFilenameFmt, args);
pLogger->fDestFlags |= RTLOGDEST_FILE;
}
@@ -500,13 +567,13 @@ RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *psz
if (pszVar)
RTLogGroupSettings(pLogger, pszVar);
}
-#endif /* IN_RING3 */
+# endif /* IN_RING3 */
/*
* Open the destination(s).
*/
rc = VINF_SUCCESS;
-#ifdef IN_RING3
+# ifdef IN_RING3
if (pLogger->fDestFlags & RTLOGDEST_FILE)
{
if (pLogger->fFlags & RTLOGFLAGS_APPEND)
@@ -520,18 +587,18 @@ RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *psz
else
{
/* Force rotation if it is configured. */
- pLogger->pFile->cbHistoryFileWritten = UINT64_MAX;
+ pLogger->pInt->cbHistoryFileWritten = UINT64_MAX;
rtlogRotate(pLogger, 0, true /* fFirst */);
/* If the file is not open then rotation is not set up. */
- if (pLogger->pFile->File == NIL_RTFILE)
+ if (pLogger->pInt->hFile == NIL_RTFILE)
{
- pLogger->pFile->cbHistoryFileWritten = 0;
+ pLogger->pInt->cbHistoryFileWritten = 0;
rc = rtlogFileOpen(pLogger, pszErrorMsg, cchErrorMsg);
}
}
}
-#endif /* IN_RING3 */
+# endif /* IN_RING3 */
/*
* Create mutex and check how much it counts when entering the lock
@@ -539,25 +606,25 @@ RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *psz
*/
if (RT_SUCCESS(rc))
{
- rc = RTSemSpinMutexCreate(&pLogger->hSpinMtx, RTSEMSPINMUTEX_FLAGS_IRQ_SAFE);
+ rc = RTSemSpinMutexCreate(&pLogger->pInt->hSpinMtx, RTSEMSPINMUTEX_FLAGS_IRQ_SAFE);
if (RT_SUCCESS(rc))
{
-#ifdef IN_RING3 /** @todo do counters in ring-0 too? */
+# ifdef IN_RING3 /** @todo do counters in ring-0 too? */
RTTHREAD Thread = RTThreadSelf();
if (Thread != NIL_RTTHREAD)
{
int32_t c = RTLockValidatorWriteLockGetCount(Thread);
- RTSemSpinMutexRequest(pLogger->hSpinMtx);
+ RTSemSpinMutexRequest(pLogger->pInt->hSpinMtx);
c = RTLockValidatorWriteLockGetCount(Thread) - c;
- RTSemSpinMutexRelease(pLogger->hSpinMtx);
+ RTSemSpinMutexRelease(pLogger->pInt->hSpinMtx);
ASMAtomicWriteU32(&g_cLoggerLockCount, c);
}
/* Use the callback to generate some initial log contents. */
- Assert(VALID_PTR(pLogger->pFile->pfnPhase) || pLogger->pFile->pfnPhase == NULL);
- if (pLogger->pFile->pfnPhase)
- pLogger->pFile->pfnPhase(pLogger, RTLOGPHASE_BEGIN, rtlogPhaseMsgNormal);
-#endif
+ Assert(VALID_PTR(pLogger->pInt->pfnPhase) || pLogger->pInt->pfnPhase == NULL);
+ if (pLogger->pInt->pfnPhase)
+ pLogger->pInt->pfnPhase(pLogger, RTLOGPHASE_BEGIN, rtlogPhaseMsgNormal);
+# endif
*ppLogger = pLogger;
return VINF_SUCCESS;
}
@@ -565,14 +632,14 @@ RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *psz
if (pszErrorMsg)
RTStrPrintf(pszErrorMsg, cchErrorMsg, N_("failed to create semaphore"));
}
-#ifdef IN_RING3
- RTFileClose(pLogger->pFile->File);
-#endif
-#if defined(LOG_USE_C99) && defined(RT_WITHOUT_EXEC_ALLOC)
+# ifdef IN_RING3
+ RTFileClose(pLogger->pInt->hFile);
+# endif
+# if defined(LOG_USE_C99) && defined(RT_WITHOUT_EXEC_ALLOC)
RTMemFree(*(void **)&pLogger->pfnLogger);
-#else
+# else
RTMemExecFree(*(void **)&pLogger->pfnLogger, 64);
-#endif
+# endif
}
RTMemFree(pLogger);
}
@@ -639,8 +706,9 @@ RTDECL(int) RTLogDestroy(PRTLOGGER pLogger)
*/
if (!pLogger)
return VINF_SUCCESS;
- AssertReturn(VALID_PTR(pLogger), VERR_INVALID_POINTER);
+ AssertPtrReturn(pLogger, VERR_INVALID_POINTER);
AssertReturn(pLogger->u32Magic == RTLOGGER_MAGIC, VERR_INVALID_MAGIC);
+ AssertPtrReturn(pLogger->pInt, VERR_INVALID_POINTER);
/*
* Acquire logger instance sem and disable all logging. (paranoia)
@@ -658,32 +726,32 @@ RTDECL(int) RTLogDestroy(PRTLOGGER pLogger)
*/
rtlogFlush(pLogger);
-#ifdef IN_RING3
+# ifdef IN_RING3
/*
* Add end of logging message.
*/
if ( (pLogger->fDestFlags & RTLOGDEST_FILE)
- && pLogger->pFile->File != NIL_RTFILE)
- pLogger->pFile->pfnPhase(pLogger, RTLOGPHASE_END, rtlogPhaseMsgLocked);
+ && pLogger->pInt->hFile != NIL_RTFILE)
+ pLogger->pInt->pfnPhase(pLogger, RTLOGPHASE_END, rtlogPhaseMsgLocked);
/*
* Close output stuffs.
*/
- if (pLogger->pFile->File != NIL_RTFILE)
+ if (pLogger->pInt->hFile != NIL_RTFILE)
{
- int rc2 = RTFileClose(pLogger->pFile->File);
+ int rc2 = RTFileClose(pLogger->pInt->hFile);
AssertRC(rc2);
if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
rc = rc2;
- pLogger->pFile->File = NIL_RTFILE;
+ pLogger->pInt->hFile = NIL_RTFILE;
}
-#endif
+# endif
/*
* Free the mutex, the wrapper and the instance memory.
*/
- hSpinMtx = pLogger->hSpinMtx;
- pLogger->hSpinMtx = NIL_RTSEMSPINMUTEX;
+ hSpinMtx = pLogger->pInt->hSpinMtx;
+ pLogger->pInt->hSpinMtx = NIL_RTSEMSPINMUTEX;
if (hSpinMtx != NIL_RTSEMSPINMUTEX)
{
int rc2;
@@ -696,11 +764,11 @@ RTDECL(int) RTLogDestroy(PRTLOGGER pLogger)
if (pLogger->pfnLogger)
{
-#if defined(LOG_USE_C99) && defined(RT_WITHOUT_EXEC_ALLOC)
+# if defined(LOG_USE_C99) && defined(RT_WITHOUT_EXEC_ALLOC)
RTMemFree(*(void **)&pLogger->pfnLogger);
-#else
+# else
RTMemExecFree(*(void **)&pLogger->pfnLogger, 64);
-#endif
+# endif
pLogger->pfnLogger = NULL;
}
RTMemFree(pLogger);
@@ -771,7 +839,7 @@ RTDECL(int) RTLogCloneRC(PRTLOGGER pLogger, PRTLOGGERRC pLoggerRC, size_t cbLogg
if (cbLoggerRC < (size_t)RT_OFFSETOF(RTLOGGERRC, afGroups[pLogger->cGroups]))
{
AssertMsgFailed(("%d req=%d cGroups=%d\n", cbLoggerRC, RT_OFFSETOF(RTLOGGERRC, afGroups[pLogger->cGroups]), pLogger->cGroups));
- return VERR_INVALID_PARAMETER;
+ return VERR_BUFFER_OVERFLOW;
}
memcpy(&pLoggerRC->afGroups[0], &pLogger->afGroups[0], pLogger->cGroups * sizeof(pLoggerRC->afGroups[0]));
pLoggerRC->cGroups = pLogger->cGroups;
@@ -779,7 +847,7 @@ RTDECL(int) RTLogCloneRC(PRTLOGGER pLogger, PRTLOGGERRC pLoggerRC, size_t cbLogg
/*
* Copy bits from the HC instance.
*/
- pLoggerRC->fPendingPrefix = pLogger->fPendingPrefix;
+ pLoggerRC->fPendingPrefix = pLogger->pInt->fPendingPrefix;
pLoggerRC->fFlags |= pLogger->fFlags;
/*
@@ -850,67 +918,85 @@ RTDECL(void) RTLogFlushRC(PRTLOGGER pLogger, PRTLOGGERRC pLoggerRC)
}
RT_EXPORT_SYMBOL(RTLogFlushRC);
+# ifdef IN_RING3
-#ifdef IN_RING3
-/**
- * Create a logger instance for singled threaded ring-0 usage.
- *
- * @returns iprt status code.
- *
- * @param pLogger Where to create the logger instance.
- * @param cbLogger The amount of memory available for the logger instance.
- * @param pfnLogger Pointer to logger wrapper function for the clone.
- * @param pfnFlush Pointer to flush function for the clone.
- * @param fFlags Logger instance flags for the clone, a combination of the RTLOGFLAGS_* values.
- * @param fDestFlags The destination flags.
- */
-RTDECL(int) RTLogCreateForR0(PRTLOGGER pLogger, size_t cbLogger, PFNRTLOGGER pfnLogger, PFNRTLOGFLUSH pfnFlush,
+RTDECL(int) RTLogCreateForR0(PRTLOGGER pLogger, size_t cbLogger,
+ RTR0PTR pLoggerR0Ptr, RTR0PTR pfnLoggerR0Ptr, RTR0PTR pfnFlushR0Ptr,
uint32_t fFlags, uint32_t fDestFlags)
{
/*
* Validate input.
*/
AssertPtrReturn(pLogger, VERR_INVALID_PARAMETER);
- AssertReturn(cbLogger >= sizeof(*pLogger), VERR_INVALID_PARAMETER);
- AssertReturn(pfnLogger, VERR_INVALID_PARAMETER);
- AssertReturn(pfnFlush, VERR_INVALID_PARAMETER);
+ size_t const cbRequired = sizeof(*pLogger) + RTLOGGERINTERNAL_R0_SIZE;
+ AssertReturn(cbLogger >= cbRequired, VERR_BUFFER_OVERFLOW);
+ AssertReturn(pLoggerR0Ptr != NIL_RTR0PTR, VERR_INVALID_PARAMETER);
+ AssertReturn(pfnLoggerR0Ptr != NIL_RTR0PTR, VERR_INVALID_PARAMETER);
/*
* Initialize the ring-0 instance.
*/
- pLogger->offScratch = 0;
- pLogger->fPendingPrefix = false;
- pLogger->pfnLogger = pfnLogger;
- pLogger->pfnFlush = pfnFlush;
- pLogger->hSpinMtx = NIL_RTSEMSPINMUTEX; /* Not serialized. */
- pLogger->u32Magic = RTLOGGER_MAGIC;
- pLogger->fFlags = fFlags;
- pLogger->fDestFlags = fDestFlags & ~RTLOGDEST_FILE;
- pLogger->pFile = NULL;
- pLogger->papszGroups = NULL;
- pLogger->cMaxGroups = (uint32_t)((cbLogger - RT_OFFSETOF(RTLOGGER, afGroups[0])) / sizeof(pLogger->afGroups[0]));
- pLogger->cGroups = 1;
- pLogger->afGroups[0] = 0;
+ pLogger->achScratch[0] = 0;
+ pLogger->offScratch = 0;
+ pLogger->pfnLogger = (PFNRTLOGGER)pfnLoggerR0Ptr;
+ pLogger->fFlags = fFlags;
+ pLogger->fDestFlags = fDestFlags & ~RTLOGDEST_FILE;
+ pLogger->pInt = NULL;
+ pLogger->cGroups = 1;
+ pLogger->afGroups[0] = 0;
+
+ uint32_t cMaxGroups = (uint32_t)((cbLogger - cbRequired) / sizeof(pLogger->afGroups[0]));
+ if (fFlags & RTLOGFLAGS_RESTRICT_GROUPS)
+ cMaxGroups /= 2;
+ PRTLOGGERINTERNAL pInt;
+ for (;;)
+ {
+ AssertReturn(cMaxGroups > 0, VERR_BUFFER_OVERFLOW);
+ pInt = (PRTLOGGERINTERNAL)&pLogger->afGroups[cMaxGroups];
+ if (!((uintptr_t)pInt & (sizeof(uint64_t) - 1)))
+ break;
+ cMaxGroups--;
+ }
+ pLogger->pInt = (PRTLOGGERINTERNAL)(pLoggerR0Ptr + (uintptr_t)pInt - (uintptr_t)pLogger);
+ pInt->uRevision = RTLOGGERINTERNAL_REV;
+ pInt->cbSelf = RTLOGGERINTERNAL_R0_SIZE;
+ pInt->hSpinMtx = NIL_RTSEMSPINMUTEX; /* Not serialized. */
+ pInt->pfnFlush = (PFNRTLOGFLUSH)pfnFlushR0Ptr;
+ pInt->pfnPrefix = NULL;
+ pInt->pvPrefixUserArg = NULL;
+ pInt->fPendingPrefix = false;
+ pInt->cMaxGroups = cMaxGroups;
+ pInt->papszGroups = NULL;
+ pInt->cMaxEntriesPerGroup = UINT32_MAX;
+ if (fFlags & RTLOGFLAGS_RESTRICT_GROUPS)
+ {
+ memset(pInt + 1, 0, sizeof(uint32_t) * cMaxGroups);
+ pInt->pacEntriesPerGroup= (uint32_t *)(pLogger->pInt + 1);
+ }
+ else
+ pInt->pacEntriesPerGroup= NULL;
+
+ pLogger->u32Magic = RTLOGGER_MAGIC;
return VINF_SUCCESS;
}
RT_EXPORT_SYMBOL(RTLogCreateForR0);
-#endif /* IN_RING3 */
-/**
- * Copies the group settings and flags from logger instance to another.
- *
- * @returns IPRT status code.
- * @param pDstLogger The destination logger instance.
- * @param pSrcLogger The source logger instance. If NULL the default one is used.
- * @param fFlagsOr OR mask for the flags.
- * @param fFlagsAnd AND mask for the flags.
- */
-RTDECL(int) RTLogCopyGroupsAndFlags(PRTLOGGER pDstLogger, PCRTLOGGER pSrcLogger, unsigned fFlagsOr, unsigned fFlagsAnd)
+RTDECL(size_t) RTLogCalcSizeForR0(uint32_t cGroups, uint32_t fFlags)
{
- int rc;
- unsigned cGroups;
+ size_t cb = RT_OFFSETOF(RTLOGGER, afGroups[cGroups]);
+ cb = RT_ALIGN_Z(cb, sizeof(uint64_t));
+ cb += sizeof(RTLOGGERINTERNAL);
+ if (fFlags & RTLOGFLAGS_RESTRICT_GROUPS)
+ cb += sizeof(uint32_t) * cGroups;
+ return cb;
+}
+RT_EXPORT_SYMBOL(RTLogCalcSizeForR0);
+
+RTDECL(int) RTLogCopyGroupsAndFlagsForR0(PRTLOGGER pDstLogger, RTR0PTR pDstLoggerR0Ptr,
+ PCRTLOGGER pSrcLogger, uint32_t fFlagsOr, uint32_t fFlagsAnd)
+{
/*
* Validate input.
*/
@@ -925,7 +1011,7 @@ RTDECL(int) RTLogCopyGroupsAndFlags(PRTLOGGER pDstLogger, PCRTLOGGER pSrcLogger,
pSrcLogger = RTLogDefaultInstance();
if (!pSrcLogger)
{
- pDstLogger->fFlags |= RTLOGFLAGS_DISABLED;
+ pDstLogger->fFlags |= RTLOGFLAGS_DISABLED | fFlagsOr;
pDstLogger->cGroups = 1;
pDstLogger->afGroups[0] = 0;
return VINF_SUCCESS;
@@ -935,23 +1021,92 @@ RTDECL(int) RTLogCopyGroupsAndFlags(PRTLOGGER pDstLogger, PCRTLOGGER pSrcLogger,
/*
* Copy flags and group settings.
*/
- pDstLogger->fFlags = (pSrcLogger->fFlags & fFlagsAnd) | fFlagsOr;
+ pDstLogger->fFlags = (pSrcLogger->fFlags & fFlagsAnd & ~RTLOGFLAGS_RESTRICT_GROUPS) | fFlagsOr;
- rc = VINF_SUCCESS;
- cGroups = pSrcLogger->cGroups;
- if (cGroups < pDstLogger->cMaxGroups)
+ PRTLOGGERINTERNAL pDstInt = (PRTLOGGERINTERNAL)((uintptr_t)pDstLogger->pInt - pDstLoggerR0Ptr + (uintptr_t)pDstLogger);
+ int rc = VINF_SUCCESS;
+ uint32_t cGroups = pSrcLogger->cGroups;
+ if (cGroups > pDstInt->cMaxGroups)
{
- AssertMsgFailed(("cMaxGroups=%zd cGroups=%zd (min size %d)\n", pDstLogger->cMaxGroups,
- pSrcLogger->cGroups, RT_OFFSETOF(RTLOGGER, afGroups[pSrcLogger->cGroups])));
+ AssertMsgFailed(("cMaxGroups=%zd cGroups=%zd (min size %d)\n", pDstInt->cMaxGroups,
+ pSrcLogger->cGroups, RT_OFFSETOF(RTLOGGER, afGroups[pSrcLogger->cGroups]) + RTLOGGERINTERNAL_R0_SIZE));
rc = VERR_INVALID_PARAMETER;
- cGroups = pDstLogger->cMaxGroups;
+ cGroups = pDstInt->cMaxGroups;
}
memcpy(&pDstLogger->afGroups[0], &pSrcLogger->afGroups[0], cGroups * sizeof(pDstLogger->afGroups[0]));
pDstLogger->cGroups = cGroups;
return rc;
}
-RT_EXPORT_SYMBOL(RTLogCopyGroupsAndFlags);
+RT_EXPORT_SYMBOL(RTLogCopyGroupsAndFlagsForR0);
+
+
+RTDECL(int) RTLogSetCustomPrefixCallbackForR0(PRTLOGGER pLogger, RTR0PTR pLoggerR0Ptr,
+ RTR0PTR pfnCallbackR0Ptr, RTR0PTR pvUserR0Ptr)
+{
+ AssertPtrReturn(pLogger, VERR_INVALID_POINTER);
+ AssertReturn(pLogger->u32Magic == RTLOGGER_MAGIC, VERR_INVALID_MAGIC);
+
+ /*
+ * Do the work.
+ */
+ PRTLOGGERINTERNAL pInt = (PRTLOGGERINTERNAL)((uintptr_t)pLogger->pInt - pLoggerR0Ptr + (uintptr_t)pLogger);
+ AssertReturn(pInt->uRevision == RTLOGGERINTERNAL_REV, VERR_LOG_REVISION_MISMATCH);
+ pInt->pvPrefixUserArg = (void *)pvUserR0Ptr;
+ pInt->pfnPrefix = (PFNRTLOGPREFIX)pfnCallbackR0Ptr;
+
+ return VINF_SUCCESS;
+}
+RT_EXPORT_SYMBOL(RTLogSetCustomPrefixCallbackForR0);
+
+RTDECL(void) RTLogFlushR0(PRTLOGGER pLogger, PRTLOGGER pLoggerR0)
+{
+ /*
+ * Resolve defaults.
+ */
+ if (!pLogger)
+ {
+ pLogger = RTLogDefaultInstance();
+ if (!pLogger)
+ {
+ /* flushing to "/dev/null". */
+ if (pLoggerR0->offScratch)
+ pLoggerR0->offScratch = 0;
+ return;
+ }
+ }
+
+ /*
+ * Any thing to flush?
+ */
+ if ( pLoggerR0->offScratch
+ || pLogger->offScratch)
+ {
+ /*
+ * Acquire logger semaphores.
+ */
+ int rc = rtlogLock(pLogger);
+ if (RT_FAILURE(rc))
+ return;
+ if (RT_SUCCESS(rc))
+ {
+ /*
+ * Write whatever the GC instance contains to the HC one, and then
+ * flush the HC instance.
+ */
+ if (pLoggerR0->offScratch)
+ {
+ rtLogOutput(pLogger, pLoggerR0->achScratch, pLoggerR0->offScratch);
+ rtLogOutput(pLogger, NULL, 0);
+ pLoggerR0->offScratch = 0;
+ }
+ }
+ rtlogUnlock(pLogger);
+ }
+}
+RT_EXPORT_SYMBOL(RTLogFlushR0);
+
+# endif /* IN_RING3 */
/**
@@ -980,7 +1135,7 @@ RTDECL(void) RTLogFlushToLogger(PRTLOGGER pSrcLogger, PRTLOGGER pDstLogger)
if (RT_SUCCESS(rc))
{
pSrcLogger->offScratch = 0;
- rtlogLock(pSrcLogger);
+ rtlogUnlock(pSrcLogger);
}
}
return;
@@ -1049,8 +1204,8 @@ RTDECL(int) RTLogSetCustomPrefixCallback(PRTLOGGER pLogger, PFNRTLOGPREFIX pfnCa
* Do the work.
*/
rtlogLock(pLogger);
- pLogger->pvPrefixUserArg = pvUser;
- pLogger->pfnPrefix = pfnCallback;
+ pLogger->pInt->pvPrefixUserArg = pvUser;
+ pLogger->pInt->pfnPrefix = pfnCallback;
rtlogUnlock(pLogger);
return VINF_SUCCESS;
@@ -1218,7 +1373,7 @@ RTDECL(int) RTLogGroupSettings(PRTLOGGER pLogger, const char *pszVar)
for (i = 0; i < pLogger->cGroups; i++)
{
const char *psz2 = (const char*)pszStart;
- if (rtlogIsGroupMatching(pLogger->papszGroups[i], &psz2, cch))
+ if (rtlogIsGroupMatching(pLogger->pInt->papszGroups[i], &psz2, cch))
{
unsigned fFlags = RTLOGGRPFLAGS_ENABLED | RTLOGGRPFLAGS_LEVEL_1;
if (*psz2 == '.' || *psz2 == '=')
@@ -1278,10 +1433,10 @@ static unsigned rtlogGroupFlags(const char *psz)
{ "level6", RTLOGGRPFLAGS_LEVEL_6 },
{ "f", RTLOGGRPFLAGS_FLOW },
{ "flow", RTLOGGRPFLAGS_FLOW },
+ { "restrict", RTLOGGRPFLAGS_RESTRICT },
{ "lelik", RTLOGGRPFLAGS_LELIK },
{ "michael", RTLOGGRPFLAGS_MICHAEL },
- { "dmik", RTLOGGRPFLAGS_DMIK },
{ "sunlover", RTLOGGRPFLAGS_SUNLOVER },
{ "achim", RTLOGGRPFLAGS_ACHIM },
{ "achimha", RTLOGGRPFLAGS_ACHIM },
@@ -1343,9 +1498,9 @@ static unsigned rtlogGroupFlags(const char *psz)
*/
static int rtLogGetGroupSettingsAddOne(const char *pszName, uint32_t fGroup, char **ppszBuf, size_t *pcchBuf, bool *pfNotFirst)
{
-#define APPEND_PSZ(psz,cch) do { memcpy(*ppszBuf, (psz), (cch)); *ppszBuf += (cch); *pcchBuf -= (cch); } while (0)
-#define APPEND_SZ(sz) APPEND_PSZ(sz, sizeof(sz) - 1)
-#define APPEND_CH(ch) do { **ppszBuf = (ch); *ppszBuf += 1; *pcchBuf -= 1; } while (0)
+# define APPEND_PSZ(psz,cch) do { memcpy(*ppszBuf, (psz), (cch)); *ppszBuf += (cch); *pcchBuf -= (cch); } while (0)
+# define APPEND_SZ(sz) APPEND_PSZ(sz, sizeof(sz) - 1)
+# define APPEND_CH(ch) do { **ppszBuf = (ch); *ppszBuf += 1; *pcchBuf -= 1; } while (0)
/*
* Add the name.
@@ -1381,9 +1536,9 @@ static int rtLogGetGroupSettingsAddOne(const char *pszName, uint32_t fGroup, cha
else
return VERR_BUFFER_OVERFLOW;
-#undef APPEND_PSZ
-#undef APPEND_SZ
-#undef APPEND_CH
+# undef APPEND_PSZ
+# undef APPEND_SZ
+# undef APPEND_CH
return VINF_SUCCESS;
}
@@ -1442,7 +1597,7 @@ RTDECL(int) RTLogGetGroupSettings(PRTLOGGER pLogger, char *pszBuf, size_t cchBuf
fGroup = pLogger->afGroups[i];
if (fGroup)
{
- const char *pszName = pLogger->papszGroups[i];
+ const char *pszName = pLogger->pInt->papszGroups[i];
if (pszName)
{
rc = rtLogGetGroupSettingsAddOne(pszName, fGroup, &pszBuf, &cchBuf, &fNotFirst);
@@ -1457,8 +1612,8 @@ RTDECL(int) RTLogGetGroupSettings(PRTLOGGER pLogger, char *pszBuf, size_t cchBuf
return rc;
}
RT_EXPORT_SYMBOL(RTLogGetGroupSettings);
-#endif /* !IN_RC */
+#endif /* !IN_RC */
/**
* Updates the flags for the logger instance using the specified
@@ -1587,6 +1742,29 @@ RTDECL(bool) RTLogSetBuffering(PRTLOGGER pLogger, bool fBuffered)
}
RT_EXPORT_SYMBOL(RTLogSetBuffering);
+
+#ifdef IN_RING3
+RTDECL(uint32_t) RTLogSetGroupLimit(PRTLOGGER pLogger, uint32_t cMaxEntriesPerGroup)
+{
+ /*
+ * Resolve the logger instance.
+ */
+ if (!pLogger)
+ {
+ pLogger = RTLogDefaultInstance();
+ if (!pLogger)
+ return UINT32_MAX;
+ }
+
+ rtlogLock(pLogger);
+ uint32_t cOld = pLogger->pInt->cMaxEntriesPerGroup;
+ pLogger->pInt->cMaxEntriesPerGroup = cMaxEntriesPerGroup;
+ rtlogUnlock(pLogger);
+
+ return cOld;
+}
+#endif
+
#ifndef IN_RC
/**
@@ -1721,27 +1899,27 @@ RTDECL(int) RTLogDestinations(PRTLOGGER pLogger, char const *pszVar)
/* log file name */
if (i == 0 /* file */ && !fNo)
{
- AssertReturn(cch < RTPATH_MAX, VERR_OUT_OF_RANGE);
- memcpy(pLogger->pFile->pszFilename, pszVar, cch);
- pLogger->pFile->pszFilename[cch] = '\0';
+ AssertReturn(cch < sizeof(pLogger->pInt->szFilename), VERR_OUT_OF_RANGE);
+ memcpy(pLogger->pInt->szFilename, pszVar, cch);
+ pLogger->pInt->szFilename[cch] = '\0';
}
/* log directory */
else if (i == 1 /* dir */ && !fNo)
{
- char szTmp[RTPATH_MAX];
- const char *pszFile = RTPathFilename(pLogger->pFile->pszFilename);
+ char szTmp[sizeof(pLogger->pInt->szFilename)];
+ const char *pszFile = RTPathFilename(pLogger->pInt->szFilename);
size_t cchFile = pszFile ? strlen(pszFile) : 0;
- AssertReturn(cchFile + cch + 1 < RTPATH_MAX, VERR_OUT_OF_RANGE);
+ AssertReturn(cchFile + cch + 1 < sizeof(pLogger->pInt->szFilename), VERR_OUT_OF_RANGE);
memcpy(szTmp, cchFile ? pszFile : "", cchFile + 1);
- memcpy(pLogger->pFile->pszFilename, pszVar, cch);
- pLogger->pFile->pszFilename[cch] = '\0';
- RTPathStripTrailingSlash(pLogger->pFile->pszFilename);
+ memcpy(pLogger->pInt->szFilename, pszVar, cch);
+ pLogger->pInt->szFilename[cch] = '\0';
+ RTPathStripTrailingSlash(pLogger->pInt->szFilename);
- cch = strlen(pLogger->pFile->pszFilename);
- pLogger->pFile->pszFilename[cch++] = '/';
- memcpy(&pLogger->pFile->pszFilename[cch], szTmp, cchFile);
- pLogger->pFile->pszFilename[cch+cchFile] = '\0';
+ cch = strlen(pLogger->pInt->szFilename);
+ pLogger->pInt->szFilename[cch++] = '/';
+ memcpy(&pLogger->pInt->szFilename[cch], szTmp, cchFile);
+ pLogger->pInt->szFilename[cch + cchFile] = '\0';
}
else if (i == 2 /* history */)
{
@@ -1753,10 +1931,10 @@ RTDECL(int) RTLogDestinations(PRTLOGGER pLogger, char const *pszVar)
if (RT_SUCCESS(rc))
rc = RTStrToUInt32Full(szTmp, 0, &cHistory);
AssertMsgReturn(RT_SUCCESS(rc) && cHistory < _1M, ("Invalid history value %s (%Rrc)!\n", szTmp, rc), rc);
- pLogger->pFile->cHistory = cHistory;
+ pLogger->pInt->cHistory = cHistory;
}
else
- pLogger->pFile->cHistory = 0;
+ pLogger->pInt->cHistory = 0;
}
else if (i == 3 /* histsize */)
{
@@ -1765,13 +1943,13 @@ RTDECL(int) RTLogDestinations(PRTLOGGER pLogger, char const *pszVar)
char szTmp[32];
int rc = RTStrCopyEx(szTmp, sizeof(szTmp), pszVar, cch);
if (RT_SUCCESS(rc))
- rc = RTStrToUInt64Full(szTmp, 0, &pLogger->pFile->cbHistoryFileMax);
+ rc = RTStrToUInt64Full(szTmp, 0, &pLogger->pInt->cbHistoryFileMax);
AssertMsgRCReturn(rc, ("Invalid history file size value %s (%Rrc)!\n", szTmp, rc), rc);
- if (pLogger->pFile->cbHistoryFileMax == 0)
- pLogger->pFile->cbHistoryFileMax = UINT64_MAX;
+ if (pLogger->pInt->cbHistoryFileMax == 0)
+ pLogger->pInt->cbHistoryFileMax = UINT64_MAX;
}
else
- pLogger->pFile->cbHistoryFileMax = UINT64_MAX;
+ pLogger->pInt->cbHistoryFileMax = UINT64_MAX;
}
else if (i == 4 /* histtime */)
{
@@ -1780,13 +1958,13 @@ RTDECL(int) RTLogDestinations(PRTLOGGER pLogger, char const *pszVar)
char szTmp[32];
int rc = RTStrCopyEx(szTmp, sizeof(szTmp), pszVar, cch);
if (RT_SUCCESS(rc))
- rc = RTStrToUInt32Full(szTmp, 0, &pLogger->pFile->cSecsHistoryTimeSlot);
+ rc = RTStrToUInt32Full(szTmp, 0, &pLogger->pInt->cSecsHistoryTimeSlot);
AssertMsgRCReturn(rc, ("Invalid history time slot value %s (%Rrc)!\n", szTmp, rc), rc);
- if (pLogger->pFile->cSecsHistoryTimeSlot == 0)
- pLogger->pFile->cSecsHistoryTimeSlot = UINT32_MAX;
+ if (pLogger->pInt->cSecsHistoryTimeSlot == 0)
+ pLogger->pInt->cSecsHistoryTimeSlot = UINT32_MAX;
}
else
- pLogger->pFile->cSecsHistoryTimeSlot = UINT32_MAX;
+ pLogger->pInt->cSecsHistoryTimeSlot = UINT32_MAX;
}
else
AssertMsgFailedReturn(("Invalid destination value! %s%s doesn't take a value!\n",
@@ -1862,17 +2040,16 @@ RTDECL(int) RTLogGetDestinations(PRTLOGGER pLogger, char *pszBuf, size_t cchBuf)
fNotFirst = true;
}
-#ifdef IN_RING3
+# ifdef IN_RING3
/*
* Add the filename.
*/
- if ( (fDestFlags & RTLOGDEST_FILE)
- && VALID_PTR(pLogger->pFile->pszFilename))
+ if (fDestFlags & RTLOGDEST_FILE)
{
rc = RTStrCopyP(&pszBuf, &cchBuf, fNotFirst ? " file=" : "file=");
if (RT_FAILURE(rc))
return rc;
- rc = RTStrCopyP(&pszBuf, &cchBuf, pLogger->pFile->pszFilename);
+ rc = RTStrCopyP(&pszBuf, &cchBuf, pLogger->pInt->szFilename);
if (RT_FAILURE(rc))
return rc;
fNotFirst = true;
@@ -1881,29 +2058,29 @@ RTDECL(int) RTLogGetDestinations(PRTLOGGER pLogger, char *pszBuf, size_t cchBuf)
if (fDestFlags & RTLOGDEST_FILE)
{
char szNum[32];
- if (pLogger->pFile->cHistory)
+ if (pLogger->pInt->cHistory)
{
- RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? "history=%u" : " history=%u", pLogger->pFile->cHistory);
+ RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? "history=%u" : " history=%u", pLogger->pInt->cHistory);
rc = RTStrCopyP(&pszBuf, &cchBuf, szNum);
if (RT_FAILURE(rc))
return rc;
}
- if (pLogger->pFile->cbHistoryFileMax != UINT64_MAX)
+ if (pLogger->pInt->cbHistoryFileMax != UINT64_MAX)
{
- RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? "histsize=%llu" : " histsize=%llu", pLogger->pFile->cbHistoryFileMax);
+ RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? "histsize=%llu" : " histsize=%llu", pLogger->pInt->cbHistoryFileMax);
rc = RTStrCopyP(&pszBuf, &cchBuf, szNum);
if (RT_FAILURE(rc))
return rc;
}
- if (pLogger->pFile->cSecsHistoryTimeSlot != UINT32_MAX)
+ if (pLogger->pInt->cSecsHistoryTimeSlot != UINT32_MAX)
{
- RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? "histtime=%llu" : " histtime=%llu", pLogger->pFile->cSecsHistoryTimeSlot);
+ RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? "histtime=%llu" : " histtime=%llu", pLogger->pInt->cSecsHistoryTimeSlot);
rc = RTStrCopyP(&pszBuf, &cchBuf, szNum);
if (RT_FAILURE(rc))
return rc;
}
}
-#endif /* IN_RING3 */
+# endif /* IN_RING3 */
return VINF_SUCCESS;
}
@@ -2130,7 +2307,7 @@ RTDECL(int) RTLogSetDefaultInstanceThread(PRTLOGGER pLogger, uintptr_t uKey)
return rc;
}
RT_EXPORT_SYMBOL(RTLogSetDefaultInstanceThread);
-#endif
+#endif /* IN_RING0 */
/**
@@ -2208,9 +2385,32 @@ RTDECL(void) RTLogLoggerExV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
}
/*
- * Call worker.
+ * Check restrictions and call worker.
*/
- rtlogLoggerExVLocked(pLogger, fFlags, iGroup, pszFormat, args);
+#ifndef IN_RC
+ if (RT_UNLIKELY( (pLogger->fFlags & RTLOGFLAGS_RESTRICT_GROUPS)
+ && iGroup < pLogger->cGroups
+ && (pLogger->afGroups[iGroup] & RTLOGGRPFLAGS_RESTRICT)
+ && ++pLogger->pInt->pacEntriesPerGroup[iGroup] >= pLogger->pInt->cMaxEntriesPerGroup ))
+ {
+ uint32_t cEntries = pLogger->pInt->pacEntriesPerGroup[iGroup];
+ if (cEntries > pLogger->pInt->cMaxEntriesPerGroup)
+ pLogger->pInt->pacEntriesPerGroup[iGroup] = cEntries - 1;
+ else
+ {
+ rtlogLoggerExVLocked(pLogger, fFlags, iGroup, pszFormat, args);
+ if ( pLogger->pInt->papszGroups
+ && pLogger->pInt->papszGroups[iGroup])
+ rtlogLoggerExFLocked(pLogger, fFlags, iGroup, "%u messages from group %s (#%u), muting it.\n",
+ cEntries, pLogger->pInt->papszGroups[iGroup], iGroup);
+ else
+ rtlogLoggerExFLocked(pLogger, fFlags, iGroup, "%u messages from group #%u, muting it.\n",
+ cEntries, iGroup);
+ }
+ }
+ else
+#endif
+ rtlogLoggerExVLocked(pLogger, fFlags, iGroup, pszFormat, args);
/*
* Release the semaphore.
@@ -2260,10 +2460,10 @@ static void rtR0LogLoggerExFallbackFlush(PRTR0LOGLOGGERFALLBACK pThis)
if (pThis->fDestFlags & RTLOGDEST_STDERR)
RTLogWriteStdErr(pThis->achScratch, pThis->offScratch);
-#ifndef LOG_NO_COM
+# ifndef LOG_NO_COM
if (pThis->fDestFlags & RTLOGDEST_COM)
RTLogWriteCom(pThis->achScratch, pThis->offScratch);
-#endif
+# endif
/* empty the buffer. */
pThis->offScratch = 0;
@@ -2400,20 +2600,20 @@ static int rtlogFileOpen(PRTLOGGER pLogger, char *pszErrorMsg, size_t cchErrorMs
if (pLogger->fFlags & RTLOGFLAGS_WRITE_THROUGH)
fOpen |= RTFILE_O_WRITE_THROUGH;
- int rc = RTFileOpen(&pLogger->pFile->File, pLogger->pFile->pszFilename, fOpen);
+ int rc = RTFileOpen(&pLogger->pInt->hFile, pLogger->pInt->szFilename, fOpen);
if (RT_FAILURE(rc))
{
- pLogger->pFile->File = NIL_RTFILE;
+ pLogger->pInt->hFile = NIL_RTFILE;
if (pszErrorMsg)
- RTStrPrintf(pszErrorMsg, cchErrorMsg, N_("could not open file '%s' (fOpen=%#x)"), pLogger->pFile->pszFilename, fOpen);
+ RTStrPrintf(pszErrorMsg, cchErrorMsg, N_("could not open file '%s' (fOpen=%#x)"), pLogger->pInt->szFilename, fOpen);
}
else
{
- rc = RTFileGetSize(pLogger->pFile->File, &pLogger->pFile->cbHistoryFileWritten);
+ rc = RTFileGetSize(pLogger->pInt->hFile, &pLogger->pInt->cbHistoryFileWritten);
if (RT_FAILURE(rc))
{
/* Don't complain if this fails, assume the file is empty. */
- pLogger->pFile->cbHistoryFileWritten = 0;
+ pLogger->pInt->cbHistoryFileWritten = 0;
rc = VINF_SUCCESS;
}
}
@@ -2435,12 +2635,12 @@ static int rtlogFileOpen(PRTLOGGER pLogger, char *pszErrorMsg, size_t cchErrorMs
static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst)
{
/* Suppress rotating empty log files simply because the time elapsed. */
- if (RT_UNLIKELY(!pLogger->pFile->cbHistoryFileWritten))
- pLogger->pFile->uHistoryTimeSlotStart = uTimeSlot;
+ if (RT_UNLIKELY(!pLogger->pInt->cbHistoryFileWritten))
+ pLogger->pInt->uHistoryTimeSlotStart = uTimeSlot;
/* Check rotation condition: file still small enough and not too old? */
- if (RT_LIKELY( pLogger->pFile->cbHistoryFileWritten < pLogger->pFile->cbHistoryFileMax
- && uTimeSlot == pLogger->pFile->uHistoryTimeSlotStart))
+ if (RT_LIKELY( pLogger->pInt->cbHistoryFileWritten < pLogger->pInt->cbHistoryFileMax
+ && uTimeSlot == pLogger->pInt->uHistoryTimeSlotStart))
return;
/*
@@ -2455,26 +2655,26 @@ static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst)
* Disable log rotation temporarily, otherwise with extreme settings and
* chatty phase logging we could run into endless rotation.
*/
- uint32_t const cSavedHistory = pLogger->pFile->cHistory;
- pLogger->pFile->cHistory = 0;
+ uint32_t const cSavedHistory = pLogger->pInt->cHistory;
+ pLogger->pInt->cHistory = 0;
/*
* Close the old log file.
*/
- if (pLogger->pFile->File != NIL_RTFILE)
+ if (pLogger->pInt->hFile != NIL_RTFILE)
{
/* Use the callback to generate some final log contents, but only if
* this is a rotation with a fully set up logger. Leave the other case
* to the RTLogCreateExV function. */
- if (pLogger->pFile->pfnPhase && !fFirst)
+ if (pLogger->pInt->pfnPhase && !fFirst)
{
uint32_t fODestFlags = pLogger->fDestFlags;
pLogger->fDestFlags &= RTLOGDEST_FILE;
- pLogger->pFile->pfnPhase(pLogger, RTLOGPHASE_PREROTATE, rtlogPhaseMsgLocked);
+ pLogger->pInt->pfnPhase(pLogger, RTLOGPHASE_PREROTATE, rtlogPhaseMsgLocked);
pLogger->fDestFlags = fODestFlags;
}
- RTFileClose(pLogger->pFile->File);
- pLogger->pFile->File = NIL_RTFILE;
+ RTFileClose(pLogger->pInt->hFile);
+ pLogger->pInt->hFile = NIL_RTFILE;
}
if (cSavedHistory)
@@ -2484,15 +2684,16 @@ static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst)
*/
for (uint32_t i = cSavedHistory - 1; i + 1 > 0; i--)
{
- char szOldName[RTPATH_MAX];
+ char szOldName[sizeof(pLogger->pInt->szFilename) + 32];
if (i > 0)
- RTStrPrintf(szOldName, sizeof(szOldName), "%s.%u", pLogger->pFile->pszFilename, i);
+ RTStrPrintf(szOldName, sizeof(szOldName), "%s.%u", pLogger->pInt->szFilename, i);
else
- RTStrCopy(szOldName, sizeof(szOldName), pLogger->pFile->pszFilename);
- char szNewName[RTPATH_MAX];
- RTStrPrintf(szNewName, sizeof(szNewName), "%s.%u", pLogger->pFile->pszFilename, i + 1);
- if (RTFileRename(szOldName, szNewName,
- RTFILEMOVE_FLAGS_REPLACE) == VERR_FILE_NOT_FOUND)
+ RTStrCopy(szOldName, sizeof(szOldName), pLogger->pInt->szFilename);
+
+ char szNewName[sizeof(pLogger->pInt->szFilename) + 32];
+ RTStrPrintf(szNewName, sizeof(szNewName), "%s.%u", pLogger->pInt->szFilename, i + 1);
+ if ( RTFileRename(szOldName, szNewName, RTFILEMOVE_FLAGS_REPLACE)
+ == VERR_FILE_NOT_FOUND)
RTFileDelete(szNewName);
}
@@ -2501,8 +2702,8 @@ static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst)
*/
for (uint32_t i = cSavedHistory + 1; ; i++)
{
- char szExcessName[RTPATH_MAX];
- RTStrPrintf(szExcessName, sizeof(szExcessName), "%s.%u", pLogger->pFile->pszFilename, i);
+ char szExcessName[sizeof(pLogger->pInt->szFilename) + 32];
+ RTStrPrintf(szExcessName, sizeof(szExcessName), "%s.%u", pLogger->pInt->szFilename, i);
int rc = RTFileDelete(szExcessName);
if (RT_FAILURE(rc))
break;
@@ -2512,8 +2713,8 @@ static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst)
/*
* Update logger state and create new log file.
*/
- pLogger->pFile->cbHistoryFileWritten = 0;
- pLogger->pFile->uHistoryTimeSlotStart = uTimeSlot;
+ pLogger->pInt->cbHistoryFileWritten = 0;
+ pLogger->pInt->uHistoryTimeSlotStart = uTimeSlot;
rtlogFileOpen(pLogger, NULL, 0);
/*
@@ -2521,16 +2722,16 @@ static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst)
* is a rotation with a fully set up logger. Leave the other case to the
* RTLogCreateExV function.
*/
- if (pLogger->pFile->pfnPhase && !fFirst)
+ if (pLogger->pInt->pfnPhase && !fFirst)
{
uint32_t const fSavedDestFlags = pLogger->fDestFlags;
pLogger->fDestFlags &= RTLOGDEST_FILE;
- pLogger->pFile->pfnPhase(pLogger, RTLOGPHASE_POSTROTATE, rtlogPhaseMsgLocked);
+ pLogger->pInt->pfnPhase(pLogger, RTLOGPHASE_POSTROTATE, rtlogPhaseMsgLocked);
pLogger->fDestFlags = fSavedDestFlags;
}
/* Restore saved values. */
- pLogger->pFile->cHistory = cSavedHistory;
+ pLogger->pInt->cHistory = cSavedHistory;
pLogger->fFlags = fSavedFlags;
}
@@ -2558,14 +2759,14 @@ static void rtlogFlush(PRTLOGGER pLogger)
# ifdef IN_RING3
if (pLogger->fDestFlags & RTLOGDEST_FILE)
{
- if (pLogger->pFile->File != NIL_RTFILE)
+ if (pLogger->pInt->hFile != NIL_RTFILE)
{
- RTFileWrite(pLogger->pFile->File, pLogger->achScratch, pLogger->offScratch, NULL);
+ RTFileWrite(pLogger->pInt->hFile, pLogger->achScratch, pLogger->offScratch, NULL);
if (pLogger->fFlags & RTLOGFLAGS_FLUSH)
- RTFileFlush(pLogger->pFile->File);
+ RTFileFlush(pLogger->pInt->hFile);
}
- if (pLogger->pFile->cHistory)
- pLogger->pFile->cbHistoryFileWritten += pLogger->offScratch;
+ if (pLogger->pInt->cHistory)
+ pLogger->pInt->cbHistoryFileWritten += pLogger->offScratch;
}
# endif
@@ -2581,8 +2782,13 @@ static void rtlogFlush(PRTLOGGER pLogger)
# endif
#endif /* !IN_RC */
+#ifdef IN_RC
if (pLogger->pfnFlush)
pLogger->pfnFlush(pLogger);
+#else
+ if (pLogger->pInt->pfnFlush)
+ pLogger->pInt->pfnFlush(pLogger);
+#endif
/* empty the buffer. */
pLogger->offScratch = 0;
@@ -2594,10 +2800,8 @@ static void rtlogFlush(PRTLOGGER pLogger)
* and footer messages.
*/
if ( (pLogger->fDestFlags & RTLOGDEST_FILE)
- && pLogger->pFile->cHistory)
- rtlogRotate(pLogger,
- RTTimeProgramSecTS() / pLogger->pFile->cSecsHistoryTimeSlot,
- false /* fFirst */);
+ && pLogger->pInt->cHistory)
+ rtlogRotate(pLogger, RTTimeProgramSecTS() / pLogger->pInt->cSecsHistoryTimeSlot, false /* fFirst */);
#endif
}
@@ -2677,16 +2881,21 @@ static DECLCALLBACK(size_t) rtLogOutputPrefixed(void *pv, const char *pachChars,
size_t cbRet = 0;
for (;;)
{
- size_t cb = sizeof(pLogger->achScratch) - pLogger->offScratch - 1;
- char *psz;
+ size_t cb = sizeof(pLogger->achScratch) - pLogger->offScratch - 1;
const char *pszNewLine;
+ char *psz;
+#ifdef IN_RC
+ bool *pfPendingPrefix = &pLogger->fPendingPrefix;
+#else
+ bool *pfPendingPrefix = &pLogger->pInt->fPendingPrefix;
+#endif
/*
* Pending prefix?
*/
- if (pLogger->fPendingPrefix)
+ if (*pfPendingPrefix)
{
- pLogger->fPendingPrefix = false;
+ *pfPendingPrefix = false;
#if defined(DEBUG) && defined(IN_RING3)
/* sanity */
@@ -2879,9 +3088,9 @@ static DECLCALLBACK(size_t) rtLogOutputPrefixed(void *pv, const char *pachChars,
}
#ifndef IN_RC
if ( (pLogger->fFlags & RTLOGFLAGS_PREFIX_CUSTOM)
- && pLogger->pfnPrefix)
+ && pLogger->pInt->pfnPrefix)
{
- psz += pLogger->pfnPrefix(pLogger, psz, 31, pLogger->pvPrefixUserArg);
+ psz += pLogger->pInt->pfnPrefix(pLogger, psz, 31, pLogger->pInt->pvPrefixUserArg);
*psz++ = ' '; /* +32 */
}
#endif
@@ -2916,7 +3125,7 @@ static DECLCALLBACK(size_t) rtLogOutputPrefixed(void *pv, const char *pachChars,
if (pLogger->fFlags & RTLOGFLAGS_PREFIX_FLAG)
{
#ifdef IN_RING3
- const char *pszGroup = pArgs->iGroup != ~0U ? pLogger->papszGroups[pArgs->iGroup] : NULL;
+ const char *pszGroup = pArgs->iGroup != ~0U ? pLogger->pInt->papszGroups[pArgs->iGroup] : NULL;
#else
const char *pszGroup = NULL;
#endif
@@ -2965,7 +3174,6 @@ static DECLCALLBACK(size_t) rtLogOutputPrefixed(void *pv, const char *pachChars,
/* personal groups */
case RTLOGGRPFLAGS_LELIK: pszGroup = "lelik" ; cch = sizeof("lelik" ) - 1; break;
case RTLOGGRPFLAGS_MICHAEL: pszGroup = "Michael" ; cch = sizeof("Michael" ) - 1; break;
- case RTLOGGRPFLAGS_DMIK: pszGroup = "dmik" ; cch = sizeof("dmik" ) - 1; break;
case RTLOGGRPFLAGS_SUNLOVER: pszGroup = "sunlover"; cch = sizeof("sunlover") - 1; break;
case RTLOGGRPFLAGS_ACHIM: pszGroup = "Achim" ; cch = sizeof("Achim" ) - 1; break;
case RTLOGGRPFLAGS_SANDER: pszGroup = "Sander" ; cch = sizeof("Sander" ) - 1; break;
@@ -3023,7 +3231,7 @@ static DECLCALLBACK(size_t) rtLogOutputPrefixed(void *pv, const char *pachChars,
else
{
cb = pszNewLine - pachChars + 1;
- pLogger->fPendingPrefix = true;
+ *pfPendingPrefix = true;
}
}
@@ -3044,7 +3252,7 @@ static DECLCALLBACK(size_t) rtLogOutputPrefixed(void *pv, const char *pachChars,
cbRet++;
cbChars--;
cb++;
- pLogger->fPendingPrefix = true;
+ *pfPendingPrefix = true;
}
/* done? */
@@ -3101,3 +3309,23 @@ static void rtlogLoggerExVLocked(PRTLOGGER pLogger, unsigned fFlags, unsigned iG
rtlogFlush(pLogger);
}
+
+/**
+ * For calling rtlogLoggerExVLocked.
+ *
+ * @param pLogger The logger.
+ * @param fFlags The logging flags.
+ * @param iGroup The group.
+ * The value ~0U is reserved for compatibility with RTLogLogger[V] and is
+ * only for internal usage!
+ * @param pszFormat Format string.
+ * @param ... Format arguments.
+ */
+static void rtlogLoggerExFLocked(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...)
+{
+ va_list va;
+ va_start(va, pszFormat);
+ rtlogLoggerExVLocked(pLogger, fFlags, iGroup, pszFormat, va);
+ va_end(va);
+}
+
diff --git a/src/VBox/Runtime/common/log/logcom.cpp b/src/VBox/Runtime/common/log/logcom.cpp
index ed4f26208..065b1dd4d 100644
--- a/src/VBox/Runtime/common/log/logcom.cpp
+++ b/src/VBox/Runtime/common/log/logcom.cpp
@@ -1,4 +1,4 @@
-/* $Id: logcom.cpp $ */
+/* $Id: logcom.cpp 29271 2010-05-09 21:25:16Z vboxsync $ */
/** @file
* IPRT - Logging to Serial Port.
*/
diff --git a/src/VBox/Runtime/common/log/logellipsis.cpp b/src/VBox/Runtime/common/log/logellipsis.cpp
index 48c05840d..ce490429d 100644
--- a/src/VBox/Runtime/common/log/logellipsis.cpp
+++ b/src/VBox/Runtime/common/log/logellipsis.cpp
@@ -1,4 +1,4 @@
-/* $Id: logellipsis.cpp $ */
+/* $Id: logellipsis.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* Runtime VBox - Logger, the ellipsis variants.
*/
diff --git a/src/VBox/Runtime/common/log/logformat.cpp b/src/VBox/Runtime/common/log/logformat.cpp
index 40cd7d144..761844c88 100644
--- a/src/VBox/Runtime/common/log/logformat.cpp
+++ b/src/VBox/Runtime/common/log/logformat.cpp
@@ -1,4 +1,4 @@
-/* $Id: logformat.cpp $ */
+/* $Id: logformat.cpp 33496 2010-10-27 12:15:28Z vboxsync $ */
/** @file
* IPRT - Log Formatter.
*/
diff --git a/src/VBox/Runtime/common/log/logrel.cpp b/src/VBox/Runtime/common/log/logrel.cpp
index 64f7eb2a7..7fb5ec746 100644
--- a/src/VBox/Runtime/common/log/logrel.cpp
+++ b/src/VBox/Runtime/common/log/logrel.cpp
@@ -1,4 +1,4 @@
-/* $Id: logrel.cpp $ */
+/* $Id: logrel.cpp 33704 2010-11-02 18:21:28Z vboxsync $ */
/** @file
* Runtime VBox - Release Logger.
*/
diff --git a/src/VBox/Runtime/common/log/logrelellipsis.cpp b/src/VBox/Runtime/common/log/logrelellipsis.cpp
index 5f1806c6b..dbf5619ac 100644
--- a/src/VBox/Runtime/common/log/logrelellipsis.cpp
+++ b/src/VBox/Runtime/common/log/logrelellipsis.cpp
@@ -1,4 +1,4 @@
-/* $Id: logrelellipsis.cpp $ */
+/* $Id: logrelellipsis.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* Runtime VBox - Logger, the release ellipsis variants.
*/
diff --git a/src/VBox/Runtime/common/log/tracebuf.cpp b/src/VBox/Runtime/common/log/tracebuf.cpp
new file mode 100644
index 000000000..6751b4385
--- /dev/null
+++ b/src/VBox/Runtime/common/log/tracebuf.cpp
@@ -0,0 +1,662 @@
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include "internal/iprt.h"
+#include <iprt/trace.h>
+
+
+#include <iprt/assert.h>
+#include <iprt/asm.h>
+#include <iprt/err.h>
+#include <iprt/log.h>
+#ifndef IN_RC
+# include <iprt/mem.h>
+#endif
+#if defined(IN_RING0) || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86))
+# include <iprt/mp.h>
+#else
+# include <iprt/asm-amd64-x86.h>
+#endif
+#include <iprt/path.h>
+#include <iprt/string.h>
+#include <iprt/time.h>
+
+#include "internal/magics.h"
+
+
+/*******************************************************************************
+* Structures and Typedefs *
+*******************************************************************************/
+/** Alignment used to place the trace buffer members, this should be a multiple
+ * of the cache line size if possible. (We should dynamically determine it.) */
+#define RTTRACEBUF_ALIGNMENT 64
+AssertCompile(RTTRACEBUF_ALIGNMENT >= sizeof(uint64_t) * 2);
+
+/** The maximum number of entries. */
+#define RTTRACEBUF_MAX_ENTRIES _64K
+/** The minimum number of entries. */
+#define RTTRACEBUF_MIN_ENTRIES 4
+/** The default number of entries. */
+#define RTTRACEBUF_DEF_ENTRIES 256
+
+/** The maximum entry size. */
+#define RTTRACEBUF_MAX_ENTRY_SIZE _1M
+/** The minimum entry size. */
+#define RTTRACEBUF_MIN_ENTRY_SIZE RTTRACEBUF_ALIGNMENT
+/** The default entry size. */
+#define RTTRACEBUF_DEF_ENTRY_SIZE 256
+AssertCompile(!(RTTRACEBUF_DEF_ENTRY_SIZE & (RTTRACEBUF_DEF_ENTRY_SIZE - 1)));
+
+/**
+ * The volatile trace buffer members.
+ */
+typedef struct RTTRACEBUFVOLATILE
+{
+ /** Reference counter. */
+ uint32_t volatile cRefs;
+ /** The next entry to make use of. */
+ uint32_t volatile iEntry;
+} RTTRACEBUFVOLATILE;
+/** Pointer to the volatile parts of a trace buffer. */
+typedef RTTRACEBUFVOLATILE *PRTTRACEBUFVOLATILE;
+
+
+/**
+ * Trace buffer entry.
+ */
+typedef struct RTTRACEBUFENTRY
+{
+ /** The nano second entry time stamp. */
+ uint64_t NanoTS;
+ /** The ID of the CPU the event was recorded. */
+ RTCPUID idCpu;
+ /** The message. */
+ char szMsg[RTTRACEBUF_ALIGNMENT - sizeof(uint64_t) - sizeof(RTCPUID)];
+} RTTRACEBUFENTRY;
+AssertCompile(sizeof(RTTRACEBUFENTRY) <= RTTRACEBUF_ALIGNMENT);
+/** Pointer to a trace buffer entry. */
+typedef RTTRACEBUFENTRY *PRTTRACEBUFENTRY;
+
+
+
+/**
+ * Trace buffer structure.
+ *
+ * @remarks This structure must be context agnostic, i.e. no pointers or
+ * other types that may differ between contexts (R3/R0/RC).
+ */
+typedef struct RTTRACEBUFINT
+{
+ /** Magic value (RTTRACEBUF_MAGIC). */
+ uint32_t u32Magic;
+ /** The entry size. */
+ uint32_t cbEntry;
+ /** The number of entries. */
+ uint32_t cEntries;
+ /** Flags (always zero for now). */
+ uint32_t fFlags;
+ /** The offset to the volatile members (RTTRACEBUFVOLATILE) (relative to
+ * the start of this structure). */
+ uint32_t offVolatile;
+ /** The offset to the entries (relative to the start of this structure). */
+ uint32_t offEntries;
+ /** Reserved entries. */
+ uint32_t au32Reserved[2];
+} RTTRACEBUFINT;
+/** Pointer to a const trace buffer. */
+typedef RTTRACEBUFINT const *PCRTTRACEBUFINT;
+
+
+/*******************************************************************************
+* Defined Constants And Macros *
+*******************************************************************************/
+/**
+ * Get the current CPU Id.
+ */
+#if defined(IN_RING0) || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86))
+# define RTTRACEBUF_CUR_CPU() RTMpCpuId()
+#else
+# define RTTRACEBUF_CUR_CPU() ASMGetApicId()
+#endif
+
+/** Calculates the address of the volatile trace buffer members. */
+#define RTTRACEBUF_TO_VOLATILE(a_pThis) ((PRTTRACEBUFVOLATILE)((uint8_t *)(a_pThis) + (a_pThis)->offVolatile))
+
+/** Calculates the address of a trace buffer entry. */
+#define RTTRACEBUF_TO_ENTRY(a_pThis, a_iEntry) \
+ ((PRTTRACEBUFENTRY)( (uint8_t *)(a_pThis) + (a_pThis)->offEntries + (a_iEntry) * (a_pThis)->cbEntry ))
+
+/** Validates a trace buffer handle and returns rc if not valid. */
+#define RTTRACEBUF_VALID_RETURN_RC(a_pThis, a_rc) \
+ do { \
+ AssertPtrReturn((a_pThis), (a_rc)); \
+ AssertReturn((a_pThis)->u32Magic == RTTRACEBUF_MAGIC, (a_rc)); \
+ AssertReturn((a_pThis)->offVolatile < RTTRACEBUF_ALIGNMENT * 2, (a_rc)); \
+ AssertReturn(RTTRACEBUF_TO_VOLATILE(a_pThis)->cRefs > 0, (a_rc)); \
+ } while (0)
+
+/**
+ * Resolves and validates a trace buffer handle and returns rc if not valid.
+ *
+ * @param a_hTraceBuf The trace buffer handle passed by the user.
+ * @param a_pThis Where to store the trace buffer pointer.
+ */
+#define RTTRACEBUF_RESOLVE_VALIDATE_RETAIN_RETURN(a_hTraceBuf, a_pThis) \
+ do { \
+ uint32_t cRefs; \
+ if ((a_hTraceBuf) == RTTRACEBUF_DEFAULT) \
+ { \
+ (a_pThis) = RTTraceGetDefaultBuf(); \
+ if (!RT_VALID_PTR(a_pThis)) \
+ return VERR_NOT_FOUND; \
+ } \
+ else \
+ { \
+ (a_pThis) = (a_hTraceBuf); \
+ AssertPtrReturn((a_pThis), VERR_INVALID_HANDLE); \
+ } \
+ AssertReturn((a_pThis)->u32Magic == RTTRACEBUF_MAGIC, VERR_INVALID_HANDLE); \
+ AssertReturn((a_pThis)->offVolatile < RTTRACEBUF_ALIGNMENT * 2, VERR_INVALID_HANDLE); \
+ \
+ cRefs = ASMAtomicIncU32(&RTTRACEBUF_TO_VOLATILE(a_pThis)->cRefs); \
+ if (RT_UNLIKELY(cRefs < 1 || cRefs >= _1M)) \
+ { \
+ ASMAtomicDecU32(&RTTRACEBUF_TO_VOLATILE(a_pThis)->cRefs); \
+ AssertFailedReturn(VERR_INVALID_HANDLE); \
+ } \
+ } while (0)
+
+
+/**
+ * Drops a trace buffer reference.
+ *
+ * @param a_pThis Pointer to the trace buffer.
+ */
+#define RTTRACEBUF_DROP_REFERENCE(a_pThis) \
+ do { \
+ uint32_t cRefs = ASMAtomicDecU32(&RTTRACEBUF_TO_VOLATILE(a_pThis)->cRefs); \
+ if (!cRefs) \
+ rtTraceBufDestroy((RTTRACEBUFINT *)a_pThis); \
+ } while (0)
+
+
+/**
+ * The prologue code for a RTTraceAddSomething function.
+ *
+ * Resolves a trace buffer handle, grabs a reference to it and allocates the
+ * next entry. Return with an appropriate error status on failure.
+ *
+ * @param a_hTraceBuf The trace buffer handle passed by the user.
+ *
+ * @remarks This is kind of ugly, sorry.
+ */
+#define RTTRACEBUF_ADD_PROLOGUE(a_hTraceBuf) \
+ int rc; \
+ uint32_t cRefs; \
+ uint32_t iEntry; \
+ PCRTTRACEBUFINT pThis; \
+ PRTTRACEBUFVOLATILE pVolatile; \
+ PRTTRACEBUFENTRY pEntry; \
+ char *pszBuf; \
+ size_t cchBuf; \
+ \
+ /* Resolve and validate the handle. */ \
+ if ((a_hTraceBuf) == RTTRACEBUF_DEFAULT) \
+ { \
+ pThis = RTTraceGetDefaultBuf(); \
+ if (!RT_VALID_PTR(pThis)) \
+ return VERR_NOT_FOUND; \
+ } \
+ else if ((a_hTraceBuf) != NIL_RTTRACEBUF) \
+ { \
+ pThis = (a_hTraceBuf); \
+ AssertPtrReturn(pThis, VERR_INVALID_HANDLE); \
+ } \
+ else \
+ return VERR_INVALID_HANDLE; \
+ \
+ AssertReturn(pThis->u32Magic == RTTRACEBUF_MAGIC, VERR_INVALID_HANDLE); \
+ if (pThis->fFlags & RTTRACEBUF_FLAGS_DISABLED) \
+ return VINF_SUCCESS; \
+ AssertReturn(pThis->offVolatile < RTTRACEBUF_ALIGNMENT * 2, VERR_INVALID_HANDLE); \
+ pVolatile = RTTRACEBUF_TO_VOLATILE(pThis); \
+ \
+ /* Grab a reference. */ \
+ cRefs = ASMAtomicIncU32(&pVolatile->cRefs); \
+ if (RT_UNLIKELY(cRefs < 1 || cRefs >= _1M)) \
+ { \
+ ASMAtomicDecU32(&pVolatile->cRefs); \
+ AssertFailedReturn(VERR_INVALID_HANDLE); \
+ } \
+ \
+ /* Grab the next entry and set the time stamp. */ \
+ iEntry = ASMAtomicIncU32(&pVolatile->iEntry) - 1; \
+ iEntry %= pThis->cEntries; \
+ pEntry = RTTRACEBUF_TO_ENTRY(pThis, iEntry); \
+ pEntry->NanoTS = RTTimeNanoTS(); \
+ pEntry->idCpu = RTTRACEBUF_CUR_CPU(); \
+ pszBuf = &pEntry->szMsg[0]; \
+ *pszBuf = '\0'; \
+ cchBuf = pThis->cbEntry - RT_OFFSETOF(RTTRACEBUFENTRY, szMsg) - 1; \
+ rc = VINF_SUCCESS
+
+
+/**
+ * Used by a RTTraceAddPosSomething to store the source position in the entry
+ * prior to adding the actual trace message text.
+ *
+ * Both pszBuf and cchBuf will be adjusted such that pszBuf points and the zero
+ * terminator after the source position part.
+ */
+#define RTTRACEBUF_ADD_STORE_SRC_POS() \
+ do { \
+ /* file(line): - no path */ \
+ size_t cchPos = RTStrPrintf(pszBuf, cchBuf, "%s(%d): ", RTPathFilename(pszFile), iLine); \
+ pszBuf += cchPos; \
+ cchBuf -= cchPos; \
+ } while (0)
+
+
+/**
+ * The epilogue code for a RTTraceAddSomething function.
+ *
+ * This will release the trace buffer reference.
+ */
+#define RTTRACEBUF_ADD_EPILOGUE() \
+ cRefs = ASMAtomicDecU32(&pVolatile->cRefs); \
+ if (!cRefs) \
+ rtTraceBufDestroy((RTTRACEBUFINT *)pThis); \
+ return rc
+
+
+#ifndef IN_RC /* Drop this in RC context (too lazy to split the file). */
+
+RTDECL(int) RTTraceBufCreate(PRTTRACEBUF phTraceBuf, uint32_t cEntries, uint32_t cbEntry, uint32_t fFlags)
+{
+ AssertPtrReturn(phTraceBuf, VERR_INVALID_POINTER);
+ AssertReturn(!(fFlags & ~(RTTRACEBUF_FLAGS_MASK & ~ RTTRACEBUF_FLAGS_FREE_ME)), VERR_INVALID_PARAMETER);
+ AssertMsgReturn(cbEntry <= RTTRACEBUF_MAX_ENTRIES, ("%#x\n", cbEntry), VERR_OUT_OF_RANGE);
+ AssertMsgReturn(cEntries <= RTTRACEBUF_MAX_ENTRY_SIZE, ("%#x\n", cEntries), VERR_OUT_OF_RANGE);
+
+ /*
+ * Apply default and alignment adjustments.
+ */
+ if (!cbEntry)
+ cbEntry = RTTRACEBUF_DEF_ENTRY_SIZE;
+ else
+ cbEntry = RT_ALIGN_32(cbEntry, RTTRACEBUF_ALIGNMENT);
+
+ if (!cEntries)
+ cEntries = RTTRACEBUF_DEF_ENTRIES;
+ else if (cEntries < RTTRACEBUF_MIN_ENTRIES)
+ cEntries = RTTRACEBUF_MIN_ENTRIES;
+
+ /*
+ * Calculate the required buffer size, allocte it and hand it on to the
+ * carver API.
+ */
+ size_t cbBlock = cbEntry * cEntries
+ + RT_ALIGN_Z(sizeof(RTTRACEBUFINT), RTTRACEBUF_ALIGNMENT)
+ + RT_ALIGN_Z(sizeof(RTTRACEBUFVOLATILE), RTTRACEBUF_ALIGNMENT);
+ void *pvBlock = RTMemAlloc(cbBlock);
+ if (!((uintptr_t)pvBlock & (RTTRACEBUF_ALIGNMENT - 1)))
+ {
+ RTMemFree(pvBlock);
+ cbBlock += RTTRACEBUF_ALIGNMENT - 1;
+ pvBlock = RTMemAlloc(cbBlock);
+ }
+ int rc;
+ if (pvBlock)
+ {
+ rc = RTTraceBufCarve(phTraceBuf, cEntries, cbEntry, fFlags, pvBlock, &cbBlock);
+ if (RT_FAILURE(rc))
+ RTMemFree(pvBlock);
+ }
+ else
+ rc = VERR_NO_MEMORY;
+ return rc;
+}
+
+
+RTDECL(int) RTTraceBufCarve(PRTTRACEBUF phTraceBuf, uint32_t cEntries, uint32_t cbEntry, uint32_t fFlags,
+ void *pvBlock, size_t *pcbBlock)
+{
+ AssertPtrReturn(phTraceBuf, VERR_INVALID_POINTER);
+ AssertReturn(!(fFlags & ~RTTRACEBUF_FLAGS_MASK), VERR_INVALID_PARAMETER);
+ AssertMsgReturn(cbEntry <= RTTRACEBUF_MAX_ENTRIES, ("%#x\n", cbEntry), VERR_OUT_OF_RANGE);
+ AssertMsgReturn(cEntries <= RTTRACEBUF_MAX_ENTRY_SIZE, ("%#x\n", cEntries), VERR_OUT_OF_RANGE);
+ AssertPtrReturn(pcbBlock, VERR_INVALID_POINTER);
+ size_t const cbBlock = *pcbBlock;
+ AssertReturn(RT_VALID_PTR(pvBlock) || !cbBlock, VERR_INVALID_POINTER);
+
+ /*
+ * Apply defaults, align sizes and check against available buffer space.
+ * This code can be made a bit more clever, if someone feels like it.
+ */
+ size_t const cbHdr = RT_ALIGN_Z(sizeof(RTTRACEBUFINT), RTTRACEBUF_ALIGNMENT)
+ + RT_ALIGN_Z(sizeof(RTTRACEBUFVOLATILE), RTTRACEBUF_ALIGNMENT);
+ size_t const cbEntryBuf = cbBlock > cbHdr ? cbBlock - cbHdr : 0;
+ if (cbEntry)
+ cbEntry = RT_ALIGN_32(cbEntry, RTTRACEBUF_ALIGNMENT);
+ else
+ {
+ if (!cbEntryBuf)
+ {
+ cbEntry = RTTRACEBUF_DEF_ENTRY_SIZE;
+ cEntries = RTTRACEBUF_DEF_ENTRIES;
+ }
+ else if (cEntries)
+ {
+ size_t cbEntryZ = cbBlock / cEntries;
+ cbEntryZ &= ~(RTTRACEBUF_ALIGNMENT - 1);
+ if (cbEntryZ > RTTRACEBUF_MAX_ENTRIES)
+ cbEntryZ = RTTRACEBUF_MAX_ENTRIES;
+ cbEntry = (uint32_t)cbEntryZ;
+ }
+ else if (cbBlock >= RT_ALIGN_32(512, RTTRACEBUF_ALIGNMENT) * 256)
+ cbEntry = RT_ALIGN_32(512, RTTRACEBUF_ALIGNMENT);
+ else if (cbBlock >= RT_ALIGN_32(256, RTTRACEBUF_ALIGNMENT) * 64)
+ cbEntry = RT_ALIGN_32(256, RTTRACEBUF_ALIGNMENT);
+ else if (cbBlock >= RT_ALIGN_32(128, RTTRACEBUF_ALIGNMENT) * 32)
+ cbEntry = RT_ALIGN_32(128, RTTRACEBUF_ALIGNMENT);
+ else
+ cbEntry = sizeof(RTTRACEBUFENTRY);
+ }
+ Assert(RT_ALIGN_32(cbEntry, RTTRACEBUF_ALIGNMENT) == cbEntry);
+
+ if (!cEntries)
+ {
+ size_t cEntriesZ = cbEntryBuf / cbEntry;
+ if (cEntriesZ > RTTRACEBUF_MAX_ENTRIES)
+ cEntriesZ = RTTRACEBUF_MAX_ENTRIES;
+ cEntries = (uint32_t)cEntriesZ;
+ }
+ if (cEntries < RTTRACEBUF_MIN_ENTRIES)
+ cEntries = RTTRACEBUF_MIN_ENTRIES;
+
+ uint32_t offVolatile = RTTRACEBUF_ALIGNMENT - ((uintptr_t)pvBlock & (RTTRACEBUF_ALIGNMENT - 1));
+ if (offVolatile < sizeof(RTTRACEBUFINT))
+ offVolatile += RTTRACEBUF_ALIGNMENT;
+ size_t cbReqBlock = offVolatile
+ + RT_ALIGN_Z(sizeof(RTTRACEBUFVOLATILE), RTTRACEBUF_ALIGNMENT)
+ + cbEntry * cEntries;
+ if (*pcbBlock < cbReqBlock)
+ {
+ *pcbBlock = cbReqBlock;
+ return VERR_BUFFER_OVERFLOW;
+ }
+
+ /*
+ * Do the carving.
+ */
+ memset(pvBlock, 0, cbBlock);
+
+ RTTRACEBUFINT *pThis = (RTTRACEBUFINT *)pvBlock;
+ pThis->u32Magic = RTTRACEBUF_MAGIC;
+ pThis->cbEntry = cbEntry;
+ pThis->cEntries = cEntries;
+ pThis->fFlags = fFlags;
+ pThis->offVolatile = offVolatile;
+ pThis->offEntries = offVolatile + RT_ALIGN_Z(sizeof(RTTRACEBUFVOLATILE), RTTRACEBUF_ALIGNMENT);
+
+ PRTTRACEBUFVOLATILE pVolatile = (PRTTRACEBUFVOLATILE)((uint8_t *)pThis + offVolatile);
+ pVolatile->cRefs = 1;
+ pVolatile->iEntry = 0;
+
+ *pcbBlock = cbBlock - cbReqBlock;
+ *phTraceBuf = pThis;
+ return VINF_SUCCESS;
+}
+
+#endif /* !IN_RC */
+
+
+/**
+ * Destructor.
+ *
+ * @param pThis The trace buffer to destroy.
+ */
+static void rtTraceBufDestroy(RTTRACEBUFINT *pThis)
+{
+ AssertReturnVoid(ASMAtomicCmpXchgU32(&pThis->u32Magic, RTTRACEBUF_MAGIC_DEAD, RTTRACEBUF_MAGIC));
+ if (pThis->fFlags & RTTRACEBUF_FLAGS_FREE_ME)
+ {
+#ifdef IN_RC
+ AssertReleaseFailed();
+#else
+ RTMemFree(pThis);
+#endif
+ }
+}
+
+
+RTDECL(uint32_t)RTTraceBufRetain(RTTRACEBUF hTraceBuf)
+{
+ PCRTTRACEBUFINT pThis = hTraceBuf;
+ RTTRACEBUF_VALID_RETURN_RC(pThis, UINT32_MAX);
+ return ASMAtomicIncU32(&RTTRACEBUF_TO_VOLATILE(pThis)->cRefs);
+}
+
+
+RTDECL(uint32_t) RTTraceBufRelease(RTTRACEBUF hTraceBuf)
+{
+ if (hTraceBuf == NIL_RTTRACEBUF)
+ return 0;
+
+ PCRTTRACEBUFINT pThis = hTraceBuf;
+ RTTRACEBUF_VALID_RETURN_RC(pThis, UINT32_MAX);
+
+ uint32_t cRefs = ASMAtomicDecU32(&RTTRACEBUF_TO_VOLATILE(pThis)->cRefs);
+ if (!cRefs)
+ rtTraceBufDestroy((RTTRACEBUFINT *)pThis);
+ return cRefs;
+}
+
+
+RTDECL(int) RTTraceBufAddMsg(RTTRACEBUF hTraceBuf, const char *pszMsg)
+{
+ RTTRACEBUF_ADD_PROLOGUE(hTraceBuf);
+ RTStrCopy(pszBuf, cchBuf, pszMsg);
+ RTTRACEBUF_ADD_EPILOGUE();
+}
+
+
+RTDECL(int) RTTraceBufAddMsgEx( RTTRACEBUF hTraceBuf, const char *pszMsg, size_t cbMaxMsg)
+{
+ RTTRACEBUF_ADD_PROLOGUE(hTraceBuf);
+ RTStrCopyEx(pszBuf, cchBuf, pszMsg, cbMaxMsg);
+ RTTRACEBUF_ADD_EPILOGUE();
+}
+
+
+RTDECL(int) RTTraceBufAddMsgF(RTTRACEBUF hTraceBuf, const char *pszMsgFmt, ...)
+{
+ int rc;
+ va_list va;
+ va_start(va, pszMsgFmt);
+ rc = RTTraceBufAddMsgV(hTraceBuf, pszMsgFmt, va);
+ va_end(va);
+ return rc;
+}
+
+
+RTDECL(int) RTTraceBufAddMsgV(RTTRACEBUF hTraceBuf, const char *pszMsgFmt, va_list va)
+{
+ RTTRACEBUF_ADD_PROLOGUE(hTraceBuf);
+ RTStrPrintfV(pszBuf, cchBuf, pszMsgFmt, va);
+ RTTRACEBUF_ADD_EPILOGUE();
+}
+
+
+RTDECL(int) RTTraceBufAddPos(RTTRACEBUF hTraceBuf, RT_SRC_POS_DECL)
+{
+ RTTRACEBUF_ADD_PROLOGUE(hTraceBuf);
+ RTTRACEBUF_ADD_STORE_SRC_POS();
+ RTTRACEBUF_ADD_EPILOGUE();
+}
+
+
+RTDECL(int) RTTraceBufAddPosMsg(RTTRACEBUF hTraceBuf, RT_SRC_POS_DECL, const char *pszMsg)
+{
+ RTTRACEBUF_ADD_PROLOGUE(hTraceBuf);
+ RTTRACEBUF_ADD_STORE_SRC_POS();
+ RTStrCopy(pszBuf, cchBuf, pszMsg);
+ RTTRACEBUF_ADD_EPILOGUE();
+}
+
+
+RTDECL(int) RTTraceBufAddPosMsgEx(RTTRACEBUF hTraceBuf, RT_SRC_POS_DECL, const char *pszMsg, size_t cbMaxMsg)
+{
+ RTTRACEBUF_ADD_PROLOGUE(hTraceBuf);
+ RTTRACEBUF_ADD_STORE_SRC_POS();
+ RTStrCopyEx(pszBuf, cchBuf, pszMsg, cbMaxMsg);
+ RTTRACEBUF_ADD_EPILOGUE();
+}
+
+
+RTDECL(int) RTTraceBufAddPosMsgF(RTTRACEBUF hTraceBuf, RT_SRC_POS_DECL, const char *pszMsgFmt, ...)
+{
+ int rc;
+ va_list va;
+ va_start(va, pszMsgFmt);
+ rc = RTTraceBufAddPosMsgV(hTraceBuf, RT_SRC_POS_ARGS, pszMsgFmt, va);
+ va_end(va);
+ return rc;
+}
+
+
+RTDECL(int) RTTraceBufAddPosMsgV(RTTRACEBUF hTraceBuf, RT_SRC_POS_DECL, const char *pszMsgFmt, va_list va)
+{
+ RTTRACEBUF_ADD_PROLOGUE(hTraceBuf);
+ RTTRACEBUF_ADD_STORE_SRC_POS();
+ RTStrPrintfV(pszBuf, cchBuf, pszMsgFmt, va);
+ RTTRACEBUF_ADD_EPILOGUE();
+}
+
+
+RTDECL(int) RTTraceBufEnumEntries(RTTRACEBUF hTraceBuf, PFNRTTRACEBUFCALLBACK pfnCallback, void *pvUser)
+{
+ int rc = VINF_SUCCESS;
+ uint32_t iBase;
+ uint32_t cLeft;
+ PCRTTRACEBUFINT pThis;
+ RTTRACEBUF_RESOLVE_VALIDATE_RETAIN_RETURN(hTraceBuf, pThis);
+
+ iBase = ASMAtomicReadU32(&RTTRACEBUF_TO_VOLATILE(pThis)->iEntry);
+ cLeft = pThis->cEntries;
+ while (cLeft--)
+ {
+ PRTTRACEBUFENTRY pEntry;
+
+ iBase %= pThis->cEntries;
+ pEntry = RTTRACEBUF_TO_ENTRY(pThis, iBase);
+ if (pEntry->NanoTS)
+ {
+ rc = pfnCallback((RTTRACEBUF)pThis, cLeft, pEntry->NanoTS, pEntry->idCpu, pEntry->szMsg, pvUser);
+ if (rc != VINF_SUCCESS)
+ break;
+ }
+
+ /* next */
+ iBase += 1;
+ }
+
+ RTTRACEBUF_DROP_REFERENCE(pThis);
+ return rc;
+}
+
+
+RTDECL(uint32_t) RTTraceBufGetEntrySize(RTTRACEBUF hTraceBuf)
+{
+ PCRTTRACEBUFINT pThis = hTraceBuf;
+ RTTRACEBUF_VALID_RETURN_RC(pThis, 0);
+ return pThis->cbEntry;
+}
+
+
+RTDECL(uint32_t) RTTraceBufGetEntryCount(RTTRACEBUF hTraceBuf)
+{
+ PCRTTRACEBUFINT pThis = hTraceBuf;
+ RTTRACEBUF_VALID_RETURN_RC(pThis, 0);
+ return pThis->cEntries;
+}
+
+
+RTDECL(bool) RTTraceBufDisable(RTTRACEBUF hTraceBuf)
+{
+ PCRTTRACEBUFINT pThis = hTraceBuf;
+ RTTRACEBUF_VALID_RETURN_RC(pThis, false);
+ return !ASMAtomicBitTestAndSet((void volatile *)&pThis->fFlags, RTTRACEBUF_FLAGS_DISABLED_BIT);
+}
+
+
+RTDECL(bool) RTTraceBufEnable(RTTRACEBUF hTraceBuf)
+{
+ PCRTTRACEBUFINT pThis = hTraceBuf;
+ RTTRACEBUF_VALID_RETURN_RC(pThis, false);
+ return !ASMAtomicBitTestAndClear((void volatile *)&pThis->fFlags, RTTRACEBUF_FLAGS_DISABLED_BIT);
+}
+
+
+/*
+ *
+ * Move the following to a separate file, consider using the enumerator.
+ *
+ */
+
+RTDECL(int) RTTraceBufDumpToLog(RTTRACEBUF hTraceBuf)
+{
+ uint32_t iBase;
+ uint32_t cLeft;
+ PCRTTRACEBUFINT pThis;
+ RTTRACEBUF_RESOLVE_VALIDATE_RETAIN_RETURN(hTraceBuf, pThis);
+
+ iBase = ASMAtomicReadU32(&RTTRACEBUF_TO_VOLATILE(pThis)->iEntry);
+ cLeft = pThis->cEntries;
+ while (cLeft--)
+ {
+ PRTTRACEBUFENTRY pEntry;
+
+ iBase %= pThis->cEntries;
+ pEntry = RTTRACEBUF_TO_ENTRY(pThis, iBase);
+ if (pEntry->NanoTS)
+ RTLogPrintf("%04u/%'llu/%02x: %s\n", cLeft, pEntry->NanoTS, pEntry->idCpu, pEntry->szMsg);
+
+ /* next */
+ iBase += 1;
+ }
+
+ RTTRACEBUF_DROP_REFERENCE(pThis);
+ return VINF_SUCCESS;
+}
+
+
+RTDECL(int) RTTraceBufDumpToAssert(RTTRACEBUF hTraceBuf)
+{
+ uint32_t iBase;
+ uint32_t cLeft;
+ PCRTTRACEBUFINT pThis;
+ RTTRACEBUF_RESOLVE_VALIDATE_RETAIN_RETURN(hTraceBuf, pThis);
+
+ iBase = ASMAtomicReadU32(&RTTRACEBUF_TO_VOLATILE(pThis)->iEntry);
+ cLeft = pThis->cEntries;
+ while (cLeft--)
+ {
+ PRTTRACEBUFENTRY pEntry;
+
+ iBase %= pThis->cEntries;
+ pEntry = RTTRACEBUF_TO_ENTRY(pThis, iBase);
+ if (pEntry->NanoTS)
+ RTAssertMsg2AddWeak("%u/%'llu/%02x: %s\n", cLeft, pEntry->NanoTS, pEntry->idCpu, pEntry->szMsg);
+
+ /* next */
+ iBase += 1;
+ }
+
+ RTTRACEBUF_DROP_REFERENCE(pThis);
+ return VINF_SUCCESS;
+}
+
+
+
diff --git a/src/VBox/Runtime/common/log/tracedefault.cpp b/src/VBox/Runtime/common/log/tracedefault.cpp
new file mode 100644
index 000000000..65c7f9398
--- /dev/null
+++ b/src/VBox/Runtime/common/log/tracedefault.cpp
@@ -0,0 +1,57 @@
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include "internal/iprt.h"
+#include <iprt/trace.h>
+
+#include <iprt/asm.h>
+#include <iprt/err.h>
+#include <iprt/thread.h>
+
+
+/*******************************************************************************
+* Global Variables *
+*******************************************************************************/
+/** The default trace buffer handle. */
+static RTTRACEBUF g_hDefaultTraceBuf = NIL_RTTRACEBUF;
+
+
+
+RTDECL(int) RTTraceSetDefaultBuf(RTTRACEBUF hTraceBuf)
+{
+ /* Retain the new buffer. */
+ if (hTraceBuf != NIL_RTTRACEBUF)
+ {
+ uint32_t cRefs = RTTraceBufRetain(hTraceBuf);
+ if (cRefs >= _1M)
+ return VERR_INVALID_HANDLE;
+ }
+
+ RTTRACEBUF hOldTraceBuf;
+#ifdef IN_RC
+ hOldTraceBuf = (RTTRACEBUF)ASMAtomicXchgPtr((void **)&g_hDefaultTraceBuf, hTraceBuf);
+#else
+ ASMAtomicXchgHandle(&g_hDefaultTraceBuf, hTraceBuf, &hOldTraceBuf);
+#endif
+
+ if ( hOldTraceBuf != NIL_RTTRACEBUF
+ && hOldTraceBuf != hTraceBuf)
+ {
+ /* Race prevention kludge. */
+#ifndef IN_RC
+ RTThreadSleep(33);
+#endif
+ RTTraceBufRelease(hOldTraceBuf);
+ }
+
+ return VINF_SUCCESS;
+}
+
+
+RTDECL(RTTRACEBUF) RTTraceGetDefaultBuf(void)
+{
+ return g_hDefaultTraceBuf;
+}
+
+
diff --git a/src/VBox/Runtime/common/math/ceill.asm b/src/VBox/Runtime/common/math/ceill.asm
index 502181cdd..4cd635bad 100644
--- a/src/VBox/Runtime/common/math/ceill.asm
+++ b/src/VBox/Runtime/common/math/ceill.asm
@@ -1,4 +1,4 @@
-; $Id: ceill.asm $
+; $Id: ceill.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT ceill - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/cosl.asm b/src/VBox/Runtime/common/math/cosl.asm
index c37c3c6af..6e46eb70a 100644
--- a/src/VBox/Runtime/common/math/cosl.asm
+++ b/src/VBox/Runtime/common/math/cosl.asm
@@ -1,4 +1,4 @@
-; $Id: cosl.asm $
+; $Id: cosl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT cosl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/fabs.asm b/src/VBox/Runtime/common/math/fabs.asm
index 18ca01151..f2e114436 100644
--- a/src/VBox/Runtime/common/math/fabs.asm
+++ b/src/VBox/Runtime/common/math/fabs.asm
@@ -1,4 +1,4 @@
-; $Id: fabs.asm $
+; $Id: fabs.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT fabs - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/fabsf.asm b/src/VBox/Runtime/common/math/fabsf.asm
index c58d2fc4d..550ebc9c6 100644
--- a/src/VBox/Runtime/common/math/fabsf.asm
+++ b/src/VBox/Runtime/common/math/fabsf.asm
@@ -1,4 +1,4 @@
-; $Id: fabsf.asm $
+; $Id: fabsf.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT fabsf - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/fabsl.asm b/src/VBox/Runtime/common/math/fabsl.asm
index 1302b00dd..e6cbd75a7 100644
--- a/src/VBox/Runtime/common/math/fabsl.asm
+++ b/src/VBox/Runtime/common/math/fabsl.asm
@@ -1,4 +1,4 @@
-; $Id: fabsl.asm $
+; $Id: fabsl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT fabsl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/floor.asm b/src/VBox/Runtime/common/math/floor.asm
index 7d98b4b4f..49b8accbe 100644
--- a/src/VBox/Runtime/common/math/floor.asm
+++ b/src/VBox/Runtime/common/math/floor.asm
@@ -1,4 +1,4 @@
-; $Id: floor.asm $
+; $Id: floor.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT floor - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/floorf.asm b/src/VBox/Runtime/common/math/floorf.asm
index b54919190..9df9ae551 100644
--- a/src/VBox/Runtime/common/math/floorf.asm
+++ b/src/VBox/Runtime/common/math/floorf.asm
@@ -1,4 +1,4 @@
-; $Id: floorf.asm $
+; $Id: floorf.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT floorf - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/floorl.asm b/src/VBox/Runtime/common/math/floorl.asm
index c27ada71f..8ba748507 100644
--- a/src/VBox/Runtime/common/math/floorl.asm
+++ b/src/VBox/Runtime/common/math/floorl.asm
@@ -1,4 +1,4 @@
-; $Id: floorl.asm $
+; $Id: floorl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT floorl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/ldexpl.asm b/src/VBox/Runtime/common/math/ldexpl.asm
index f53a4e439..230f61fde 100644
--- a/src/VBox/Runtime/common/math/ldexpl.asm
+++ b/src/VBox/Runtime/common/math/ldexpl.asm
@@ -1,4 +1,4 @@
-; $Id: ldexpl.asm $
+; $Id: ldexpl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT ldexpl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/llrint.asm b/src/VBox/Runtime/common/math/llrint.asm
index c870b9136..edd46105d 100644
--- a/src/VBox/Runtime/common/math/llrint.asm
+++ b/src/VBox/Runtime/common/math/llrint.asm
@@ -1,4 +1,4 @@
-; $Id: llrint.asm $
+; $Id: llrint.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT llrint - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/llrintf.asm b/src/VBox/Runtime/common/math/llrintf.asm
index d0c23db7b..1662c474b 100644
--- a/src/VBox/Runtime/common/math/llrintf.asm
+++ b/src/VBox/Runtime/common/math/llrintf.asm
@@ -1,4 +1,4 @@
-; $Id: llrintf.asm $
+; $Id: llrintf.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT llrintf - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/llrintl.asm b/src/VBox/Runtime/common/math/llrintl.asm
index a0ce49125..f35a4d4e9 100644
--- a/src/VBox/Runtime/common/math/llrintl.asm
+++ b/src/VBox/Runtime/common/math/llrintl.asm
@@ -1,4 +1,4 @@
-; $Id: llrintl.asm $
+; $Id: llrintl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT llrintl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/logl.asm b/src/VBox/Runtime/common/math/logl.asm
index 83e7de969..11c19785e 100644
--- a/src/VBox/Runtime/common/math/logl.asm
+++ b/src/VBox/Runtime/common/math/logl.asm
@@ -1,4 +1,4 @@
-; $Id: logl.asm $
+; $Id: logl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT logl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/lrint.asm b/src/VBox/Runtime/common/math/lrint.asm
index 270a79f82..7e0f0e0f9 100644
--- a/src/VBox/Runtime/common/math/lrint.asm
+++ b/src/VBox/Runtime/common/math/lrint.asm
@@ -1,4 +1,4 @@
-; $Id: lrint.asm $
+; $Id: lrint.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT lrint - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/lrintf.asm b/src/VBox/Runtime/common/math/lrintf.asm
index 997294971..80a475587 100644
--- a/src/VBox/Runtime/common/math/lrintf.asm
+++ b/src/VBox/Runtime/common/math/lrintf.asm
@@ -1,4 +1,4 @@
-; $Id: lrintf.asm $
+; $Id: lrintf.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT lrintf - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/lrintl.asm b/src/VBox/Runtime/common/math/lrintl.asm
index f336af6ac..777a4a5d8 100644
--- a/src/VBox/Runtime/common/math/lrintl.asm
+++ b/src/VBox/Runtime/common/math/lrintl.asm
@@ -1,4 +1,4 @@
-; $Id: lrintl.asm $
+; $Id: lrintl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT lrintl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/remainder.asm b/src/VBox/Runtime/common/math/remainder.asm
index 117aa502e..1ad6af1e1 100644
--- a/src/VBox/Runtime/common/math/remainder.asm
+++ b/src/VBox/Runtime/common/math/remainder.asm
@@ -1,4 +1,4 @@
-; $Id: remainder.asm $
+; $Id: remainder.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT remainder - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/remainderf.asm b/src/VBox/Runtime/common/math/remainderf.asm
index c9b079b70..09e731259 100644
--- a/src/VBox/Runtime/common/math/remainderf.asm
+++ b/src/VBox/Runtime/common/math/remainderf.asm
@@ -1,4 +1,4 @@
-; $Id: remainderf.asm $
+; $Id: remainderf.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT remainderf - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/remainderl.asm b/src/VBox/Runtime/common/math/remainderl.asm
index 922f93a74..3f58e9086 100644
--- a/src/VBox/Runtime/common/math/remainderl.asm
+++ b/src/VBox/Runtime/common/math/remainderl.asm
@@ -1,4 +1,4 @@
-; $Id: remainderl.asm $
+; $Id: remainderl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT remainderl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/sinl.asm b/src/VBox/Runtime/common/math/sinl.asm
index 57f5ab8b1..689d33c72 100644
--- a/src/VBox/Runtime/common/math/sinl.asm
+++ b/src/VBox/Runtime/common/math/sinl.asm
@@ -1,4 +1,4 @@
-; $Id: sinl.asm $
+; $Id: sinl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT sinl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/tanl.asm b/src/VBox/Runtime/common/math/tanl.asm
index 85e61d04f..fea96200b 100644
--- a/src/VBox/Runtime/common/math/tanl.asm
+++ b/src/VBox/Runtime/common/math/tanl.asm
@@ -1,4 +1,4 @@
-; $Id: tanl.asm $
+; $Id: tanl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT tanl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/trunc.asm b/src/VBox/Runtime/common/math/trunc.asm
index 9ea36820f..c079fcc50 100644
--- a/src/VBox/Runtime/common/math/trunc.asm
+++ b/src/VBox/Runtime/common/math/trunc.asm
@@ -1,4 +1,4 @@
-; $Id: trunc.asm $
+; $Id: trunc.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT trunc - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/truncf.asm b/src/VBox/Runtime/common/math/truncf.asm
index 9fb8166c7..e2a57264a 100644
--- a/src/VBox/Runtime/common/math/truncf.asm
+++ b/src/VBox/Runtime/common/math/truncf.asm
@@ -1,4 +1,4 @@
-; $Id: truncf.asm $
+; $Id: truncf.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT truncf - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/math/truncl.asm b/src/VBox/Runtime/common/math/truncl.asm
index 45576833e..ff0fb816a 100644
--- a/src/VBox/Runtime/common/math/truncl.asm
+++ b/src/VBox/Runtime/common/math/truncl.asm
@@ -1,4 +1,4 @@
-; $Id: truncl.asm $
+; $Id: truncl.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT truncl - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp b/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp
index ef0f35ee7..0621c9620 100644
--- a/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp
+++ b/src/VBox/Runtime/common/misc/RTAssertMsg1Weak.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTAssertMsg1Weak.cpp $ */
+/* $Id: RTAssertMsg1Weak.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTAssertMsg1Weak.
*/
diff --git a/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp b/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp
index 401baac80..d6ee76210 100644
--- a/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp
+++ b/src/VBox/Runtime/common/misc/RTAssertMsg2.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTAssertMsg2.cpp $ */
+/* $Id: RTAssertMsg2.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTAssertMsg2.
*/
diff --git a/src/VBox/Runtime/common/misc/RTAssertMsg2Add.cpp b/src/VBox/Runtime/common/misc/RTAssertMsg2Add.cpp
index e0f3fb23f..6112b1835 100644
--- a/src/VBox/Runtime/common/misc/RTAssertMsg2Add.cpp
+++ b/src/VBox/Runtime/common/misc/RTAssertMsg2Add.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTAssertMsg2Add.cpp $ */
+/* $Id: RTAssertMsg2Add.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTAssertMsg2Add.
*/
diff --git a/src/VBox/Runtime/common/misc/RTAssertMsg2AddWeak.cpp b/src/VBox/Runtime/common/misc/RTAssertMsg2AddWeak.cpp
index 297e60d99..bbf1d998c 100644
--- a/src/VBox/Runtime/common/misc/RTAssertMsg2AddWeak.cpp
+++ b/src/VBox/Runtime/common/misc/RTAssertMsg2AddWeak.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTAssertMsg2AddWeak.cpp $ */
+/* $Id: RTAssertMsg2AddWeak.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTAssertMsg2AddWeak.
*/
diff --git a/src/VBox/Runtime/common/misc/RTAssertMsg2AddWeakV.cpp b/src/VBox/Runtime/common/misc/RTAssertMsg2AddWeakV.cpp
index 99bc5e64c..d1361d99f 100644
--- a/src/VBox/Runtime/common/misc/RTAssertMsg2AddWeakV.cpp
+++ b/src/VBox/Runtime/common/misc/RTAssertMsg2AddWeakV.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTAssertMsg2AddWeakV.cpp $ */
+/* $Id: RTAssertMsg2AddWeakV.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTAssertMsg2AddWeakV.
*/
diff --git a/src/VBox/Runtime/common/misc/RTAssertMsg2Weak.cpp b/src/VBox/Runtime/common/misc/RTAssertMsg2Weak.cpp
index 2b5b9cf6b..f45c1eff9 100644
--- a/src/VBox/Runtime/common/misc/RTAssertMsg2Weak.cpp
+++ b/src/VBox/Runtime/common/misc/RTAssertMsg2Weak.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTAssertMsg2Weak.cpp $ */
+/* $Id: RTAssertMsg2Weak.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTAssertMsg2Weak.
*/
diff --git a/src/VBox/Runtime/common/misc/RTAssertMsg2WeakV.cpp b/src/VBox/Runtime/common/misc/RTAssertMsg2WeakV.cpp
index 2d9b5eff7..8cffc1212 100644
--- a/src/VBox/Runtime/common/misc/RTAssertMsg2WeakV.cpp
+++ b/src/VBox/Runtime/common/misc/RTAssertMsg2WeakV.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTAssertMsg2WeakV.cpp $ */
+/* $Id: RTAssertMsg2WeakV.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTAssertMsg2WeakV.
*/
diff --git a/src/VBox/Runtime/common/misc/RTFileOpenF.cpp b/src/VBox/Runtime/common/misc/RTFileOpenF.cpp
index 39e50e13c..008503f06 100644
--- a/src/VBox/Runtime/common/misc/RTFileOpenF.cpp
+++ b/src/VBox/Runtime/common/misc/RTFileOpenF.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileOpenF.cpp $ */
+/* $Id: RTFileOpenF.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - RTFileOpenF.
*/
@@ -32,7 +32,7 @@
#include "internal/iprt.h"
-RTR3DECL(int) RTFileOpenF(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, ...)
+RTR3DECL(int) RTFileOpenF(PRTFILE pFile, uint64_t fOpen, const char *pszFilenameFmt, ...)
{
va_list va;
va_start(va, pszFilenameFmt);
diff --git a/src/VBox/Runtime/common/misc/RTFileOpenV.cpp b/src/VBox/Runtime/common/misc/RTFileOpenV.cpp
index fe9bb46a2..565c075cb 100644
--- a/src/VBox/Runtime/common/misc/RTFileOpenV.cpp
+++ b/src/VBox/Runtime/common/misc/RTFileOpenV.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileOpenV.cpp $ */
+/* $Id: RTFileOpenV.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - RTFileOpenV.
*/
@@ -36,7 +36,7 @@
#include <iprt/string.h>
-RTR3DECL(int) RTFileOpenV(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, va_list va)
+RTR3DECL(int) RTFileOpenV(PRTFILE pFile, uint64_t fOpen, const char *pszFilenameFmt, va_list va)
{
char szFilename[RTPATH_MAX];
size_t cchFilename = RTStrPrintfV(szFilename, sizeof(szFilename), pszFilenameFmt, va);
diff --git a/src/VBox/Runtime/common/misc/RTMemWipeThoroughly.cpp b/src/VBox/Runtime/common/misc/RTMemWipeThoroughly.cpp
index c5656b46f..c80fea755 100644
--- a/src/VBox/Runtime/common/misc/RTMemWipeThoroughly.cpp
+++ b/src/VBox/Runtime/common/misc/RTMemWipeThoroughly.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMemWipeThoroughly.cpp $ */
+/* $Id: RTMemWipeThoroughly.cpp 30827 2010-07-14 12:49:36Z vboxsync $ */
/** @file
* IPRT - RTMemWipeThoroughly.
*/
diff --git a/src/VBox/Runtime/common/misc/assert.cpp b/src/VBox/Runtime/common/misc/assert.cpp
index fb4165029..ca7d1caf1 100644
--- a/src/VBox/Runtime/common/misc/assert.cpp
+++ b/src/VBox/Runtime/common/misc/assert.cpp
@@ -1,4 +1,4 @@
-/* $Id: assert.cpp $ */
+/* $Id: assert.cpp 37233 2011-05-27 13:31:57Z vboxsync $ */
/** @file
* IPRT - Assertions, common code.
*/
@@ -32,6 +32,7 @@
#include "internal/iprt.h"
#include <iprt/asm.h>
+#include <iprt/err.h>
#include <iprt/log.h>
#include <iprt/string.h>
#include <iprt/stdarg.h>
@@ -121,6 +122,9 @@ RTDECL(void) RTAssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFi
*/
if (!RTAssertAreQuiet())
{
+ RTERRVARS SavedErrVars;
+ RTErrVarsSave(&SavedErrVars);
+
#ifdef IN_RING0
# ifdef IN_GUEST_R0
RTLogBackdoorPrintf("\n!!Assertion Failed!!\n"
@@ -181,6 +185,8 @@ RTDECL(void) RTAssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFi
fflush(stderr);
# endif
#endif /* !IN_RING0 */
+
+ RTErrVarsRestore(&SavedErrVars);
}
}
RT_EXPORT_SYMBOL(RTAssertMsg1);
@@ -225,6 +231,9 @@ static void rtAssertMsg2Worker(bool fInitial, const char *pszFormat, va_list va)
*/
if (!RTAssertAreQuiet())
{
+ RTERRVARS SavedErrVars;
+ RTErrVarsSave(&SavedErrVars);
+
#ifdef IN_RING0
# ifdef IN_GUEST_R0
va_copy(vaCopy, va);
@@ -265,7 +274,7 @@ static void rtAssertMsg2Worker(bool fInitial, const char *pszFormat, va_list va)
# ifdef IN_RING3
/* print to stderr, helps user and gdb debugging. */
- char szMsg[1024];
+ char szMsg[sizeof(g_szRTAssertMsg2)];
va_copy(vaCopy, va);
RTStrPrintfV(szMsg, sizeof(szMsg), pszFormat, vaCopy);
va_end(vaCopy);
@@ -273,8 +282,9 @@ static void rtAssertMsg2Worker(bool fInitial, const char *pszFormat, va_list va)
fflush(stderr);
# endif
#endif /* !IN_RING0 */
- }
+ RTErrVarsRestore(&SavedErrVars);
+ }
}
diff --git a/src/VBox/Runtime/common/misc/buildconfig.cpp b/src/VBox/Runtime/common/misc/buildconfig.cpp
index 54e87b39b..03cedbe03 100644
--- a/src/VBox/Runtime/common/misc/buildconfig.cpp
+++ b/src/VBox/Runtime/common/misc/buildconfig.cpp
@@ -1,4 +1,4 @@
-/* $Id: buildconfig.cpp $ */
+/* $Id: buildconfig.cpp 33680 2010-11-02 11:08:08Z vboxsync $ */
/** @file
* IPRT - Build Configuration Information.
*/
diff --git a/src/VBox/Runtime/common/misc/cidr.cpp b/src/VBox/Runtime/common/misc/cidr.cpp
index d64d8e436..b05ae8a72 100644
--- a/src/VBox/Runtime/common/misc/cidr.cpp
+++ b/src/VBox/Runtime/common/misc/cidr.cpp
@@ -1,4 +1,4 @@
-/* $Id: cidr.cpp $ */
+/* $Id: cidr.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - IPv4 address parsing.
*/
diff --git a/src/VBox/Runtime/common/misc/circbuf.cpp b/src/VBox/Runtime/common/misc/circbuf.cpp
index da6c51f93..0a6f78b07 100644
--- a/src/VBox/Runtime/common/misc/circbuf.cpp
+++ b/src/VBox/Runtime/common/misc/circbuf.cpp
@@ -1,4 +1,4 @@
-/* $Id: circbuf.cpp $ */
+/* $Id: circbuf.cpp 37210 2011-05-25 09:55:16Z vboxsync $ */
/** @file
* IPRT - Lock Free Circular Buffer
*/
@@ -25,18 +25,36 @@
*/
-/******************************************************************************
- * Header Files *
- ******************************************************************************/
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
#include <iprt/circbuf.h>
#include <iprt/mem.h>
#include <iprt/assert.h>
#include <iprt/asm.h>
#include <iprt/err.h>
-/******************************************************************************
- * Public Functions *
- ******************************************************************************/
+
+/*******************************************************************************
+* Structures and Typedefs *
+*******************************************************************************/
+/** @todo r=bird: this is missing docs and magic. uXPos should be offX.
+ * cbBufSize should be cbBuf. */
+typedef struct RTCIRCBUF
+{
+ /** The current read position in the buffer. */
+ size_t uReadPos;
+ /** The current write position in the buffer. */
+ size_t uWritePos;
+ /** How much space of the buffer is currently in use. */
+ volatile size_t cbBufUsed;
+ /** How big is the buffer. */
+ size_t cbBufSize;
+ /** The buffer itself. */
+ void *pvBuf;
+} RTCIRCBUF;
+
+
RTDECL(int) RTCircBufCreate(PRTCIRCBUF *ppBuf, size_t cbSize)
{
@@ -49,69 +67,59 @@ RTDECL(int) RTCircBufCreate(PRTCIRCBUF *ppBuf, size_t cbSize)
if (!pTmpBuf)
return VERR_NO_MEMORY;
- int rc = VINF_SUCCESS;
- do
+ pTmpBuf->pvBuf = RTMemAlloc(cbSize);
+ if (pTmpBuf->pvBuf)
{
- pTmpBuf->pvBuf = RTMemAlloc(cbSize);
- if (!pTmpBuf)
- {
- rc = VERR_NO_MEMORY;
- break;
- }
-
pTmpBuf->cbBufSize = cbSize;
*ppBuf = pTmpBuf;
- }while (0);
-
- if (RT_FAILURE(rc))
- RTMemFree(pTmpBuf);
+ return VINF_SUCCESS;
+ }
- return rc;
+ RTMemFree(pTmpBuf);
+ return VERR_NO_MEMORY;
}
+
RTDECL(void) RTCircBufDestroy(PRTCIRCBUF pBuf)
{
/* Validate input. */
- AssertPtrNull(pBuf);
-
- if (pBuf)
- {
- if (pBuf->pvBuf)
- RTMemFree(pBuf->pvBuf);
- RTMemFree(pBuf);
- }
+ if (!pBuf)
+ return;
+ AssertPtr(pBuf);
+ RTMemFree(pBuf->pvBuf);
+ RTMemFree(pBuf);
}
+
RTDECL(void) RTCircBufReset(PRTCIRCBUF pBuf)
{
/* Validate input. */
AssertPtr(pBuf);
- pBuf->uReadPos = 0;
+ pBuf->uReadPos = 0;
pBuf->uWritePos = 0;
pBuf->cbBufUsed = 0;
}
+
RTDECL(size_t) RTCircBufFree(PRTCIRCBUF pBuf)
{
/* Validate input. */
AssertPtrReturn(pBuf, 0);
- size_t cbSize = 0;
- ASMAtomicReadSize(&pBuf->cbBufUsed, &cbSize);
- return pBuf->cbBufSize - cbSize;
+ return pBuf->cbBufSize - ASMAtomicReadZ(&pBuf->cbBufUsed);
}
+
RTDECL(size_t) RTCircBufUsed(PRTCIRCBUF pBuf)
{
/* Validate input. */
AssertPtrReturn(pBuf, 0);
- size_t cbSize = 0;
- ASMAtomicReadSize(&pBuf->cbBufUsed, &cbSize);
- return cbSize;
+ return ASMAtomicReadZ(&pBuf->cbBufUsed);
}
+
RTDECL(size_t) RTCircBufSize(PRTCIRCBUF pBuf)
{
/* Validate input. */
@@ -120,6 +128,7 @@ RTDECL(size_t) RTCircBufSize(PRTCIRCBUF pBuf)
return pBuf->cbBufSize;
}
+
RTDECL(void) RTCircBufAcquireReadBlock(PRTCIRCBUF pBuf, size_t cbReqSize, void **ppvStart, size_t *pcbSize)
{
/* Validate input. */
@@ -128,29 +137,27 @@ RTDECL(void) RTCircBufAcquireReadBlock(PRTCIRCBUF pBuf, size_t cbReqSize, void *
AssertPtr(ppvStart);
AssertPtr(pcbSize);
- size_t uUsed = 0;
- size_t uSize = 0;
-
*ppvStart = 0;
*pcbSize = 0;
/* How much is in use? */
- ASMAtomicReadSize(&pBuf->cbBufUsed, &uUsed);
- if (uUsed > 0)
+ size_t cbUsed = ASMAtomicReadZ(&pBuf->cbBufUsed);
+ if (cbUsed > 0)
{
/* Get the size out of the requested size, the read block till the end
* of the buffer & the currently used size. */
- uSize = RT_MIN(cbReqSize, RT_MIN(pBuf->cbBufSize - pBuf->uReadPos, uUsed));
- if (uSize > 0)
+ size_t cbSize = RT_MIN(cbReqSize, RT_MIN(pBuf->cbBufSize - pBuf->uReadPos, cbUsed));
+ if (cbSize > 0)
{
/* Return the pointer address which point to the current read
* position. */
- *ppvStart = (char*)pBuf->pvBuf + pBuf->uReadPos;
- *pcbSize = uSize;
+ *ppvStart = (char *)pBuf->pvBuf + pBuf->uReadPos;
+ *pcbSize = cbSize;
}
}
}
+
RTDECL(void) RTCircBufReleaseReadBlock(PRTCIRCBUF pBuf, size_t cbSize)
{
/* Validate input. */
@@ -159,10 +166,10 @@ RTDECL(void) RTCircBufReleaseReadBlock(PRTCIRCBUF pBuf, size_t cbSize)
/* Split at the end of the buffer. */
pBuf->uReadPos = (pBuf->uReadPos + cbSize) % pBuf->cbBufSize;
- size_t cbOld = 0;
- ASMAtomicSubSize(&pBuf->cbBufUsed, cbSize, &cbOld);
+ ASMAtomicSubZ(&pBuf->cbBufUsed, cbSize);
}
+
RTDECL(void) RTCircBufAcquireWriteBlock(PRTCIRCBUF pBuf, size_t cbReqSize, void **ppvStart, size_t *pcbSize)
{
/* Validate input. */
@@ -171,31 +178,27 @@ RTDECL(void) RTCircBufAcquireWriteBlock(PRTCIRCBUF pBuf, size_t cbReqSize, void
AssertPtr(ppvStart);
AssertPtr(pcbSize);
- size_t uFree;
- size_t uSize;
-
*ppvStart = 0;
*pcbSize = 0;
/* How much is free? */
- size_t cbSize = 0;
- ASMAtomicReadSize(&pBuf->cbBufUsed, &cbSize);
- uFree = pBuf->cbBufSize - cbSize;
- if (uFree > 0)
+ size_t cbFree = pBuf->cbBufSize - ASMAtomicReadZ(&pBuf->cbBufUsed);
+ if (cbFree > 0)
{
/* Get the size out of the requested size, the write block till the end
* of the buffer & the currently free size. */
- uSize = RT_MIN(cbReqSize, RT_MIN(pBuf->cbBufSize - pBuf->uWritePos, uFree));
- if (uSize > 0)
+ size_t cbSize = RT_MIN(cbReqSize, RT_MIN(pBuf->cbBufSize - pBuf->uWritePos, cbFree));
+ if (cbSize > 0)
{
/* Return the pointer address which point to the current write
* position. */
*ppvStart = (char*)pBuf->pvBuf + pBuf->uWritePos;
- *pcbSize = uSize;
+ *pcbSize = cbSize;
}
}
}
+
RTDECL(void) RTCircBufReleaseWriteBlock(PRTCIRCBUF pBuf, size_t cbSize)
{
/* Validate input. */
@@ -204,7 +207,7 @@ RTDECL(void) RTCircBufReleaseWriteBlock(PRTCIRCBUF pBuf, size_t cbSize)
/* Split at the end of the buffer. */
pBuf->uWritePos = (pBuf->uWritePos + cbSize) % pBuf->cbBufSize;
- size_t cbOld = 0;
- ASMAtomicAddSize(&pBuf->cbBufUsed, cbSize, &cbOld);
+ size_t cbOldIgnored = 0;
+ ASMAtomicAddZ(&pBuf->cbBufUsed, cbSize);
}
diff --git a/src/VBox/Runtime/common/misc/getopt.cpp b/src/VBox/Runtime/common/misc/getopt.cpp
index 7198a94b5..9c186d5d4 100644
--- a/src/VBox/Runtime/common/misc/getopt.cpp
+++ b/src/VBox/Runtime/common/misc/getopt.cpp
@@ -1,10 +1,10 @@
-/* $Id: getopt.cpp $ */
+/* $Id: getopt.cpp 37665 2011-06-28 12:32:13Z vboxsync $ */
/** @file
* IPRT - Command Line Parsing
*/
/*
- * Copyright (C) 2007-2010 Oracle Corporation
+ * Copyright (C) 2007-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -216,7 +216,9 @@ static PCRTGETOPTDEF rtGetOptSearchLong(const char *pszOption, PCRTGETOPTDEF paO
* there is no index.
*/
size_t cchLong = strlen(pOpt->pszLong);
- if (!strncmp(pszOption, pOpt->pszLong, cchLong))
+ if ( !strncmp(pszOption, pOpt->pszLong, cchLong)
+ || ( pOpt->fFlags & RTGETOPT_FLAG_ICASE
+ && !RTStrNICmp(pszOption, pOpt->pszLong, cchLong)))
{
if (pOpt->fFlags & RTGETOPT_FLAG_INDEX)
while (RT_C_IS_DIGIT(pszOption[cchLong]))
@@ -234,7 +236,9 @@ static PCRTGETOPTDEF rtGetOptSearchLong(const char *pszOption, PCRTGETOPTDEF paO
* As above, we also match where there is no index.
*/
size_t cchLong = strlen(pOpt->pszLong);
- if (!strncmp(pszOption, pOpt->pszLong, cchLong))
+ if ( !strncmp(pszOption, pOpt->pszLong, cchLong)
+ || ( pOpt->fFlags & RTGETOPT_FLAG_ICASE
+ && !RTStrNICmp(pszOption, pOpt->pszLong, cchLong)))
{
while (RT_C_IS_DIGIT(pszOption[cchLong]))
cchLong++;
@@ -242,7 +246,9 @@ static PCRTGETOPTDEF rtGetOptSearchLong(const char *pszOption, PCRTGETOPTDEF paO
return pOpt;
}
}
- else if (!strcmp(pszOption, pOpt->pszLong))
+ else if ( !strcmp(pszOption, pOpt->pszLong)
+ || ( pOpt->fFlags & RTGETOPT_FLAG_ICASE
+ && !RTStrICmp(pszOption, pOpt->pszLong)))
return pOpt;
}
pOpt++;
@@ -250,7 +256,9 @@ static PCRTGETOPTDEF rtGetOptSearchLong(const char *pszOption, PCRTGETOPTDEF paO
if (!(fFlags & RTGETOPTINIT_FLAGS_NO_STD_OPTS))
for (uint32_t i = 0; i < RT_ELEMENTS(g_aStdOptions); i++)
- if (!strcmp(pszOption, g_aStdOptions[i].pszLong))
+ if ( !strcmp(pszOption, g_aStdOptions[i].pszLong)
+ || ( pOpt->fFlags & RTGETOPT_FLAG_ICASE
+ && !RTStrICmp(pszOption, g_aStdOptions[i].pszLong)))
return &g_aStdOptions[i];
return NULL;
diff --git a/src/VBox/Runtime/common/misc/getoptargv.cpp b/src/VBox/Runtime/common/misc/getoptargv.cpp
index 10b1d758b..1ca9ccdb6 100644
--- a/src/VBox/Runtime/common/misc/getoptargv.cpp
+++ b/src/VBox/Runtime/common/misc/getoptargv.cpp
@@ -1,4 +1,4 @@
-/* $Id: getoptargv.cpp $ */
+/* $Id: getoptargv.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Command Line Parsing, Argument Vector.
*/
diff --git a/src/VBox/Runtime/common/misc/handle.cpp b/src/VBox/Runtime/common/misc/handle.cpp
index b4f81e21b..3d71248ae 100644
--- a/src/VBox/Runtime/common/misc/handle.cpp
+++ b/src/VBox/Runtime/common/misc/handle.cpp
@@ -1,4 +1,4 @@
-/* $Id: handle.cpp $ */
+/* $Id: handle.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Generic Handle Manipulation.
*/
diff --git a/src/VBox/Runtime/common/misc/handletable.cpp b/src/VBox/Runtime/common/misc/handletable.cpp
index a4139b003..1a80a3e14 100644
--- a/src/VBox/Runtime/common/misc/handletable.cpp
+++ b/src/VBox/Runtime/common/misc/handletable.cpp
@@ -1,4 +1,4 @@
-/* $Id: handletable.cpp $ */
+/* $Id: handletable.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Handle Tables.
*/
diff --git a/src/VBox/Runtime/common/misc/handletable.h b/src/VBox/Runtime/common/misc/handletable.h
index 5e2eac29d..27ae574ed 100644
--- a/src/VBox/Runtime/common/misc/handletable.h
+++ b/src/VBox/Runtime/common/misc/handletable.h
@@ -1,4 +1,4 @@
-/* $Id: handletable.h $ */
+/* $Id: handletable.h 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Handle Tables, internal header.
*/
diff --git a/src/VBox/Runtime/common/misc/handletablectx.cpp b/src/VBox/Runtime/common/misc/handletablectx.cpp
index f88363b77..e0511cc2b 100644
--- a/src/VBox/Runtime/common/misc/handletablectx.cpp
+++ b/src/VBox/Runtime/common/misc/handletablectx.cpp
@@ -1,4 +1,4 @@
-/* $Id: handletablectx.cpp $ */
+/* $Id: handletablectx.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Handle Tables.
*/
diff --git a/src/VBox/Runtime/common/misc/handletablesimple.cpp b/src/VBox/Runtime/common/misc/handletablesimple.cpp
index c5d685ffe..7fbd77030 100644
--- a/src/VBox/Runtime/common/misc/handletablesimple.cpp
+++ b/src/VBox/Runtime/common/misc/handletablesimple.cpp
@@ -1,4 +1,4 @@
-/* $Id: handletablesimple.cpp $ */
+/* $Id: handletablesimple.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Handle Tables.
*/
diff --git a/src/VBox/Runtime/common/misc/lockvalidator.cpp b/src/VBox/Runtime/common/misc/lockvalidator.cpp
index 9d29404d7..1542221ae 100644
--- a/src/VBox/Runtime/common/misc/lockvalidator.cpp
+++ b/src/VBox/Runtime/common/misc/lockvalidator.cpp
@@ -1,4 +1,4 @@
-/* $Id: lockvalidator.cpp $ */
+/* $Id: lockvalidator.cpp 36597 2011-04-06 19:46:15Z vboxsync $ */
/** @file
* IPRT - Lock Validator.
*/
@@ -42,6 +42,7 @@
#include "internal/lockvalidator.h"
#include "internal/magics.h"
+#include "internal/strhash.h"
#include "internal/thread.h"
@@ -850,29 +851,6 @@ DECL_FORCE_INLINE(void) rtLockValidatorSrcPosInit(PRTLOCKVALSRCPOS pSrcPos)
}
-/* sdbm:
- This algorithm was created for sdbm (a public-domain reimplementation of
- ndbm) database library. it was found to do well in scrambling bits,
- causing better distribution of the keys and fewer splits. it also happens
- to be a good general hashing function with good distribution. the actual
- function is hash(i) = hash(i - 1) * 65599 + str[i]; what is included below
- is the faster version used in gawk. [there is even a faster, duff-device
- version] the magic constant 65599 was picked out of thin air while
- experimenting with different constants, and turns out to be a prime.
- this is one of the algorithms used in berkeley db (see sleepycat) and
- elsewhere. */
-DECL_FORCE_INLINE(uint32_t) sdbm(const char *str, uint32_t hash)
-{
- uint8_t *pu8 = (uint8_t *)str;
- int c;
-
- while ((c = *pu8++))
- hash = c + (hash << 6) + (hash << 16) - hash;
-
- return hash;
-}
-
-
/**
* Hashes the specified source position.
*
@@ -888,9 +866,9 @@ static uint32_t rtLockValidatorSrcPosHash(PCRTLOCKVALSRCPOS pSrcPos)
{
uHash = 0;
if (pSrcPos->pszFile)
- uHash = sdbm(pSrcPos->pszFile, uHash);
+ uHash = sdbmInc(pSrcPos->pszFile, uHash);
if (pSrcPos->pszFunction)
- uHash = sdbm(pSrcPos->pszFunction, uHash);
+ uHash = sdbmInc(pSrcPos->pszFunction, uHash);
uHash += pSrcPos->uLine;
}
else
diff --git a/src/VBox/Runtime/common/misc/message.cpp b/src/VBox/Runtime/common/misc/message.cpp
index 937858708..a136c84e1 100644
--- a/src/VBox/Runtime/common/misc/message.cpp
+++ b/src/VBox/Runtime/common/misc/message.cpp
@@ -1,4 +1,4 @@
-/* $Id: message.cpp $ */
+/* $Id: message.cpp 37951 2011-07-14 10:13:59Z vboxsync $ */
/** @file
* IPRT - Error reporting to standard error.
*/
@@ -36,6 +36,31 @@
#include "internal/process.h"
+/*******************************************************************************
+* Global Variables *
+*******************************************************************************/
+/** The program name we're using. */
+static const char * volatile g_pszProgName = NULL;
+/** Custom program name set via RTMsgSetProgName. */
+static char g_szProgName[128];
+
+
+RTDECL(int) RTMsgSetProgName(const char *pszFormat, ...)
+{
+ g_pszProgName = &g_szrtProcExePath[g_offrtProcName];
+
+ va_list va;
+ va_start(va, pszFormat);
+ RTStrPrintfV(g_szProgName, sizeof(g_szProgName) - 1, pszFormat, va);
+ va_end(va);
+
+ g_pszProgName = g_szProgName;
+
+ return VINF_SUCCESS;
+}
+RT_EXPORT_SYMBOL(RTMsgSetProgName);
+
+
static int rtMsgWorker(PRTSTREAM pDst, const char *pszPrefix, const char *pszFormat, va_list va)
{
if ( !*pszFormat
@@ -43,6 +68,10 @@ static int rtMsgWorker(PRTSTREAM pDst, const char *pszPrefix, const char *pszFor
RTStrmPrintf(pDst, "\n");
else
{
+ const char *pszProgName = g_pszProgName;
+ if (!pszProgName)
+ g_pszProgName = pszProgName = &g_szrtProcExePath[g_offrtProcName];
+
char *pszMsg;
ssize_t cch = RTStrAPrintfV(&pszMsg, pszFormat, va);
if (cch >= 0)
@@ -54,7 +83,7 @@ static int rtMsgWorker(PRTSTREAM pDst, const char *pszPrefix, const char *pszFor
char *pszEnd = strchr(psz, '\n');
if (!pszEnd)
{
- RTStrmPrintf(pDst, "%s: %s%s\n", &g_szrtProcExePath[g_offrtProcName], pszPrefix, psz);
+ RTStrmPrintf(pDst, "%s: %s%s\n", pszProgName, pszPrefix, psz);
break;
}
if (pszEnd == psz)
@@ -62,7 +91,7 @@ static int rtMsgWorker(PRTSTREAM pDst, const char *pszPrefix, const char *pszFor
else
{
*pszEnd = '\0';
- RTStrmPrintf(pDst, "%s: %s%s\n", &g_szrtProcExePath[g_offrtProcName], pszPrefix, psz);
+ RTStrmPrintf(pDst, "%s: %s%s\n", pszProgName, pszPrefix, psz);
}
psz = pszEnd + 1;
} while (*psz);
@@ -71,7 +100,7 @@ static int rtMsgWorker(PRTSTREAM pDst, const char *pszPrefix, const char *pszFor
else
{
/* Simple fallback for handling out-of-memory conditions. */
- RTStrmPrintf(pDst, "%s: %s", &g_szrtProcExePath[g_offrtProcName], pszPrefix);
+ RTStrmPrintf(pDst, "%s: %s", pszProgName, pszPrefix);
RTStrmPrintfV(pDst, pszFormat, va);
if (!strchr(pszFormat, '\n'))
RTStrmPrintf(pDst, "\n");
diff --git a/src/VBox/Runtime/common/misc/once.cpp b/src/VBox/Runtime/common/misc/once.cpp
index 4b0a31d0b..468d5cb85 100644
--- a/src/VBox/Runtime/common/misc/once.cpp
+++ b/src/VBox/Runtime/common/misc/once.cpp
@@ -1,4 +1,4 @@
-/* $Id: once.cpp $ */
+/* $Id: once.cpp 37316 2011-06-03 12:49:02Z vboxsync $ */
/** @file
* IPRT - Execute Once.
*/
@@ -156,7 +156,7 @@ static int rtOnceOtherThread(PRTONCE pOnce, PRTSEMEVENTMULTI phEvtM)
}
-RTDECL(int) RTOnce(PRTONCE pOnce, PFNRTONCE pfnOnce, void *pvUser1, void *pvUser2)
+RTDECL(int) RTOnceSlow(PRTONCE pOnce, PFNRTONCE pfnOnce, void *pvUser1, void *pvUser2)
{
/*
* Validate input (strict builds only).
@@ -243,7 +243,7 @@ RTDECL(int) RTOnce(PRTONCE pOnce, PFNRTONCE pfnOnce, void *pvUser1, void *pvUser
return rcOnce;
}
-RT_EXPORT_SYMBOL(RTOnce);
+RT_EXPORT_SYMBOL(RTOnceSlow);
RTDECL(void) RTOnceReset(PRTONCE pOnce)
diff --git a/src/VBox/Runtime/common/misc/req.cpp b/src/VBox/Runtime/common/misc/req.cpp
index aff3b447d..60f27c6f3 100644
--- a/src/VBox/Runtime/common/misc/req.cpp
+++ b/src/VBox/Runtime/common/misc/req.cpp
@@ -1,4 +1,4 @@
-/* $Id: req.cpp $ */
+/* $Id: req.cpp 33595 2010-10-29 10:35:00Z vboxsync $ */
/** @file
* IPRT - Request packets
*/
diff --git a/src/VBox/Runtime/common/misc/s3.cpp b/src/VBox/Runtime/common/misc/s3.cpp
index 06e6766a9..963fb3fe8 100644
--- a/src/VBox/Runtime/common/misc/s3.cpp
+++ b/src/VBox/Runtime/common/misc/s3.cpp
@@ -1,4 +1,4 @@
-/* $Id: s3.cpp $ */
+/* $Id: s3.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - S3 communication API.
*/
diff --git a/src/VBox/Runtime/common/misc/sanity-c.c b/src/VBox/Runtime/common/misc/sanity-c.c
index 042cf3839..28cf5475a 100644
--- a/src/VBox/Runtime/common/misc/sanity-c.c
+++ b/src/VBox/Runtime/common/misc/sanity-c.c
@@ -1,4 +1,4 @@
-/* $Id: sanity-c.c $ */
+/* $Id: sanity-c.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Setup Sanity Checks, C.
*/
diff --git a/src/VBox/Runtime/common/misc/sanity-cpp.cpp b/src/VBox/Runtime/common/misc/sanity-cpp.cpp
index ea0202d9f..2bbdf33e0 100644
--- a/src/VBox/Runtime/common/misc/sanity-cpp.cpp
+++ b/src/VBox/Runtime/common/misc/sanity-cpp.cpp
@@ -1,4 +1,4 @@
-/* $Id: sanity-cpp.cpp $ */
+/* $Id: sanity-cpp.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Setup Sanity Checks, C++.
*/
diff --git a/src/VBox/Runtime/common/misc/sanity.h b/src/VBox/Runtime/common/misc/sanity.h
index f0461c425..97c7dc077 100644
--- a/src/VBox/Runtime/common/misc/sanity.h
+++ b/src/VBox/Runtime/common/misc/sanity.h
@@ -1,4 +1,4 @@
-/* $Id: sanity.h $ */
+/* $Id: sanity.h 35512 2011-01-12 17:50:12Z vboxsync $ */
/** @file
* IPRT - Setup Sanity Checks, C and C++.
*/
diff --git a/src/VBox/Runtime/common/misc/semspingpong.cpp b/src/VBox/Runtime/common/misc/semspingpong.cpp
index e13bed820..fa3802fa7 100644
--- a/src/VBox/Runtime/common/misc/semspingpong.cpp
+++ b/src/VBox/Runtime/common/misc/semspingpong.cpp
@@ -1,4 +1,4 @@
-/* $Id: semspingpong.cpp $ */
+/* $Id: semspingpong.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Thread Ping-Pong Construct.
*/
diff --git a/src/VBox/Runtime/common/misc/setjmp.asm b/src/VBox/Runtime/common/misc/setjmp.asm
index 9bacbbc4e..811f03abd 100644
--- a/src/VBox/Runtime/common/misc/setjmp.asm
+++ b/src/VBox/Runtime/common/misc/setjmp.asm
@@ -1,4 +1,4 @@
-; $Id: setjmp.asm $
+; $Id: setjmp.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT setjmp & longjmp - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/misc/sg.cpp b/src/VBox/Runtime/common/misc/sg.cpp
index 4d3192d86..08ef8b632 100644
--- a/src/VBox/Runtime/common/misc/sg.cpp
+++ b/src/VBox/Runtime/common/misc/sg.cpp
@@ -1,4 +1,4 @@
-/* $Id: sg.cpp $ */
+/* $Id: sg.cpp 36312 2011-03-18 12:59:15Z vboxsync $ */
/** @file
* IPRT - S/G buffer handling.
*/
@@ -38,6 +38,13 @@ static void *sgBufGet(PRTSGBUF pSgBuf, size_t *pcbData)
size_t cbData = RT_MIN(*pcbData, pSgBuf->cbSegLeft);
void *pvBuf = pSgBuf->pvSegCur;
+ AssertReleaseMsg( pSgBuf->cbSegLeft <= 5 * _1M
+ && (uintptr_t)pSgBuf->pvSegCur >= (uintptr_t)pSgBuf->paSegs[pSgBuf->idxSeg].pvSeg
+ && (uintptr_t)pSgBuf->pvSegCur + pSgBuf->cbSegLeft <= (uintptr_t)pSgBuf->paSegs[pSgBuf->idxSeg].pvSeg + pSgBuf->paSegs[pSgBuf->idxSeg].cbSeg,
+ ("pSgBuf->idxSeg=%d pSgBuf->cSegs=%d pSgBuf->pvSegCur=%p pSgBuf->cbSegLeft=%zd pSgBuf->paSegs[%d].pvSeg=%p pSgBuf->paSegs[%d].cbSeg=%zd\n",
+ pSgBuf->idxSeg, pSgBuf->cSegs, pSgBuf->pvSegCur, pSgBuf->cbSegLeft,
+ pSgBuf->idxSeg, pSgBuf->paSegs[pSgBuf->idxSeg].pvSeg, pSgBuf->idxSeg, pSgBuf->paSegs[pSgBuf->idxSeg].cbSeg));
+
pSgBuf->cbSegLeft -= cbData;
/* Advance to the next segment if required. */
diff --git a/src/VBox/Runtime/common/misc/term.cpp b/src/VBox/Runtime/common/misc/term.cpp
index 7b789df84..c62953a04 100644
--- a/src/VBox/Runtime/common/misc/term.cpp
+++ b/src/VBox/Runtime/common/misc/term.cpp
@@ -1,4 +1,4 @@
-/* $Id: term.cpp $ */
+/* $Id: term.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Common Termination Code.
*/
diff --git a/src/VBox/Runtime/common/misc/thread.cpp b/src/VBox/Runtime/common/misc/thread.cpp
index 5a61bd8ef..85a2cf114 100644
--- a/src/VBox/Runtime/common/misc/thread.cpp
+++ b/src/VBox/Runtime/common/misc/thread.cpp
@@ -1,4 +1,4 @@
-/* $Id: thread.cpp $ */
+/* $Id: thread.cpp 36951 2011-05-04 07:07:34Z vboxsync $ */
/** @file
* IPRT - Threads, common routines.
*/
@@ -83,13 +83,17 @@ static RTSEMRW g_ThreadRWSem = NIL_RTSEMRW;
/** The spinlocks protecting the tree. */
static RTSPINLOCK g_ThreadSpinlock = NIL_RTSPINLOCK;
#endif
+/** Indicates whether we've been initialized or not. */
+static bool g_frtThreadInitialized;
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
static void rtThreadDestroy(PRTTHREADINT pThread);
+#ifdef IN_RING3
static int rtThreadAdopt(RTTHREADTYPE enmType, unsigned fFlags, uint32_t fIntFlags, const char *pszName);
+#endif
static void rtThreadRemoveLocked(PRTTHREADINT pThread);
static PRTTHREADINT rtThreadAlloc(RTTHREADTYPE enmType, unsigned fFlags, uint32_t fIntFlags, const char *pszName);
@@ -126,7 +130,7 @@ static PRTTHREADINT rtThreadAlloc(RTTHREADTYPE enmType, unsigned fFlags, uint32_
*
* @returns iprt status code.
*/
-int rtThreadInit(void)
+DECLHIDDEN(int) rtThreadInit(void)
{
#ifdef IN_RING3
int rc = VINF_ALREADY_INITIALIZED;
@@ -145,7 +149,10 @@ int rtThreadInit(void)
if (RT_SUCCESS(rc))
rc = rtSchedNativeCalcDefaultPriority(RTTHREADTYPE_DEFAULT);
if (RT_SUCCESS(rc))
+ {
+ g_frtThreadInitialized = true;
return VINF_SUCCESS;
+ }
/* failed, clear out */
RTSemRWDestroy(g_ThreadRWSem);
@@ -154,17 +161,20 @@ int rtThreadInit(void)
}
#elif defined(IN_RING0)
-
+ int rc;
/*
* Create the spinlock and to native init.
*/
Assert(g_ThreadSpinlock == NIL_RTSPINLOCK);
- int rc = RTSpinlockCreate(&g_ThreadSpinlock);
+ rc = RTSpinlockCreate(&g_ThreadSpinlock);
if (RT_SUCCESS(rc))
{
rc = rtThreadNativeInit();
if (RT_SUCCESS(rc))
+ {
+ g_frtThreadInitialized = true;
return VINF_SUCCESS;
+ }
/* failed, clear out */
RTSpinlockDestroy(g_ThreadSpinlock);
@@ -180,7 +190,7 @@ int rtThreadInit(void)
/**
* Terminates the thread database.
*/
-void rtThreadTerm(void)
+DECLHIDDEN(void) rtThreadTerm(void)
{
#ifdef IN_RING3
/* we don't cleanup here yet */
@@ -228,8 +238,6 @@ DECLINLINE(void) rtThreadUnLockRD(void)
AssertReleaseRC(rc);
}
-#endif /* IN_RING3 */
-
/**
* Adopts the calling thread.
@@ -237,6 +245,8 @@ DECLINLINE(void) rtThreadUnLockRD(void)
*/
static int rtThreadAdopt(RTTHREADTYPE enmType, unsigned fFlags, uint32_t fIntFlags, const char *pszName)
{
+ int rc;
+ PRTTHREADINT pThread;
Assert(!(fFlags & RTTHREADFLAGS_WAITABLE));
fFlags &= ~RTTHREADFLAGS_WAITABLE;
@@ -245,8 +255,8 @@ static int rtThreadAdopt(RTTHREADTYPE enmType, unsigned fFlags, uint32_t fIntFla
* (It is vital that rtThreadNativeAdopt updates the TLS before
* we try inserting the thread because of locking.)
*/
- int rc = VERR_NO_MEMORY;
- PRTTHREADINT pThread = rtThreadAlloc(enmType, fFlags, RTTHREADINT_FLAGS_ALIEN | fIntFlags, pszName);
+ rc = VERR_NO_MEMORY;
+ pThread = rtThreadAlloc(enmType, fFlags, RTTHREADINT_FLAGS_ALIEN | fIntFlags, pszName);
if (pThread)
{
RTNATIVETHREAD NativeThread = RTThreadNativeSelf();
@@ -261,7 +271,6 @@ static int rtThreadAdopt(RTTHREADTYPE enmType, unsigned fFlags, uint32_t fIntFla
return rc;
}
-
/**
* Adopts a non-IPRT thread.
*
@@ -273,12 +282,15 @@ static int rtThreadAdopt(RTTHREADTYPE enmType, unsigned fFlags, uint32_t fIntFla
*/
RTDECL(int) RTThreadAdopt(RTTHREADTYPE enmType, unsigned fFlags, const char *pszName, PRTTHREAD pThread)
{
+ int rc;
+ RTTHREAD Thread;
+
AssertReturn(!(fFlags & RTTHREADFLAGS_WAITABLE), VERR_INVALID_PARAMETER);
AssertReturn(!pszName || VALID_PTR(pszName), VERR_INVALID_POINTER);
AssertReturn(!pThread || VALID_PTR(pThread), VERR_INVALID_POINTER);
- int rc = VINF_SUCCESS;
- RTTHREAD Thread = RTThreadSelf();
+ rc = VINF_SUCCESS;
+ Thread = RTThreadSelf();
if (Thread == NIL_RTTHREAD)
{
/* generate a name if none was given. */
@@ -323,6 +335,7 @@ RTDECL(RTTHREAD) RTThreadSelfAutoAdopt(void)
}
RT_EXPORT_SYMBOL(RTThreadSelfAutoAdopt);
+#endif /* IN_RING3 */
/**
* Allocates a per thread data structure and initializes the basic fields.
@@ -340,9 +353,12 @@ PRTTHREADINT rtThreadAlloc(RTTHREADTYPE enmType, unsigned fFlags, uint32_t fIntF
PRTTHREADINT pThread = (PRTTHREADINT)RTMemAllocZ(sizeof(RTTHREADINT));
if (pThread)
{
+ size_t cchName;
+ int rc;
+
pThread->Core.Key = (void*)NIL_RTTHREAD;
pThread->u32Magic = RTTHREADINT_MAGIC;
- size_t cchName = strlen(pszName);
+ cchName = strlen(pszName);
if (cchName >= RTTHREAD_NAME_LEN)
cchName = RTTHREAD_NAME_LEN - 1;
memcpy(pThread->szName, pszName, cchName);
@@ -360,7 +376,7 @@ PRTTHREADINT rtThreadAlloc(RTTHREADTYPE enmType, unsigned fFlags, uint32_t fIntF
#ifdef RT_WITH_ICONV_CACHE
rtStrIconvCacheInit(pThread);
#endif
- int rc = RTSemEventMultiCreate(&pThread->EventUser);
+ rc = RTSemEventMultiCreate(&pThread->EventUser);
if (RT_SUCCESS(rc))
{
rc = RTSemEventMultiCreate(&pThread->EventTerminated);
@@ -383,55 +399,58 @@ PRTTHREADINT rtThreadAlloc(RTTHREADTYPE enmType, unsigned fFlags, uint32_t fIntF
* @param pThread Pointer to thread structure allocated by rtThreadAlloc().
* @param NativeThread The native thread id.
*/
-void rtThreadInsert(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread)
+DECLHIDDEN(void) rtThreadInsert(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread)
{
Assert(pThread);
Assert(pThread->u32Magic == RTTHREADINT_MAGIC);
- RT_THREAD_LOCK_TMP(Tmp);
- RT_THREAD_LOCK_RW(Tmp);
-
- /*
- * Do not insert a terminated thread.
- *
- * This may happen if the thread finishes before the RTThreadCreate call
- * gets this far. Since the OS may quickly reuse the native thread ID
- * it should not be reinserted at this point.
- */
- if (rtThreadGetState(pThread) != RTTHREADSTATE_TERMINATED)
{
+ RT_THREAD_LOCK_TMP(Tmp);
+ RT_THREAD_LOCK_RW(Tmp);
+
/*
- * Before inserting we must check if there is a thread with this id
- * in the tree already. We're racing parent and child on insert here
- * so that the handle is valid in both ends when they return / start.
+ * Do not insert a terminated thread.
*
- * If it's not ourself we find, it's a dead alien thread and we will
- * unlink it from the tree. Alien threads will be released at this point.
+ * This may happen if the thread finishes before the RTThreadCreate call
+ * gets this far. Since the OS may quickly reuse the native thread ID
+ * it should not be reinserted at this point.
*/
- PRTTHREADINT pThreadOther = (PRTTHREADINT)RTAvlPVGet(&g_ThreadTree, (void *)NativeThread);
- if (pThreadOther != pThread)
+ if (rtThreadGetState(pThread) != RTTHREADSTATE_TERMINATED)
{
- /* remove dead alien if any */
- if (pThreadOther)
+ /*
+ * Before inserting we must check if there is a thread with this id
+ * in the tree already. We're racing parent and child on insert here
+ * so that the handle is valid in both ends when they return / start.
+ *
+ * If it's not ourself we find, it's a dead alien thread and we will
+ * unlink it from the tree. Alien threads will be released at this point.
+ */
+ PRTTHREADINT pThreadOther = (PRTTHREADINT)RTAvlPVGet(&g_ThreadTree, (void *)NativeThread);
+ if (pThreadOther != pThread)
{
- AssertMsg(pThreadOther->fIntFlags & RTTHREADINT_FLAGS_ALIEN, ("%p:%s; %p:%s\n", pThread, pThread->szName, pThreadOther, pThreadOther->szName));
- ASMAtomicBitClear(&pThread->fIntFlags, RTTHREADINT_FLAG_IN_TREE_BIT);
- rtThreadRemoveLocked(pThreadOther);
- if (pThreadOther->fIntFlags & RTTHREADINT_FLAGS_ALIEN)
+ bool fRc;
+ /* remove dead alien if any */
+ if (pThreadOther)
+ {
+ AssertMsg(pThreadOther->fIntFlags & RTTHREADINT_FLAGS_ALIEN, ("%p:%s; %p:%s\n", pThread, pThread->szName, pThreadOther, pThreadOther->szName));
+ ASMAtomicBitClear(&pThread->fIntFlags, RTTHREADINT_FLAG_IN_TREE_BIT);
+ rtThreadRemoveLocked(pThreadOther);
+ if (pThreadOther->fIntFlags & RTTHREADINT_FLAGS_ALIEN)
rtThreadRelease(pThreadOther);
- }
+ }
- /* insert the thread */
- ASMAtomicWritePtr(&pThread->Core.Key, (void *)NativeThread);
- bool fRc = RTAvlPVInsert(&g_ThreadTree, &pThread->Core);
- ASMAtomicOrU32(&pThread->fIntFlags, RTTHREADINT_FLAG_IN_TREE);
+ /* insert the thread */
+ ASMAtomicWritePtr(&pThread->Core.Key, (void *)NativeThread);
+ fRc = RTAvlPVInsert(&g_ThreadTree, &pThread->Core);
+ ASMAtomicOrU32(&pThread->fIntFlags, RTTHREADINT_FLAG_IN_TREE);
- AssertReleaseMsg(fRc, ("Lock problem? %p (%RTnthrd) %s\n", pThread, NativeThread, pThread->szName));
- NOREF(fRc);
+ AssertReleaseMsg(fRc, ("Lock problem? %p (%RTnthrd) %s\n", pThread, NativeThread, pThread->szName));
+ NOREF(fRc);
+ }
}
- }
- RT_THREAD_UNLOCK_RW(Tmp);
+ RT_THREAD_UNLOCK_RW(Tmp);
+ }
}
@@ -486,14 +505,15 @@ DECLINLINE(bool) rtThreadIsAlive(PRTTHREADINT pThread)
* @returns NULL if not a thread IPRT knows.
* @param NativeThread The native thread id.
*/
-PRTTHREADINT rtThreadGetByNative(RTNATIVETHREAD NativeThread)
+DECLHIDDEN(PRTTHREADINT) rtThreadGetByNative(RTNATIVETHREAD NativeThread)
{
+ PRTTHREADINT pThread;
/*
* Simple tree lookup.
*/
RT_THREAD_LOCK_TMP(Tmp);
RT_THREAD_LOCK_RD(Tmp);
- PRTTHREADINT pThread = (PRTTHREADINT)RTAvlPVGet(&g_ThreadTree, (void *)NativeThread);
+ pThread = (PRTTHREADINT)RTAvlPVGet(&g_ThreadTree, (void *)NativeThread);
RT_THREAD_UNLOCK_RD(Tmp);
return pThread;
}
@@ -507,7 +527,7 @@ PRTTHREADINT rtThreadGetByNative(RTNATIVETHREAD NativeThread)
* @returns NULL if Thread was not found.
* @param Thread Thread id which structure is to be returned.
*/
-PRTTHREADINT rtThreadGet(RTTHREAD Thread)
+DECLHIDDEN(PRTTHREADINT) rtThreadGet(RTTHREAD Thread)
{
if ( Thread != NIL_RTTHREAD
&& VALID_PTR(Thread))
@@ -531,10 +551,11 @@ PRTTHREADINT rtThreadGet(RTTHREAD Thread)
* @returns New reference count.
* @param pThread The thread structure to release.
*/
-uint32_t rtThreadRelease(PRTTHREADINT pThread)
+DECLHIDDEN(uint32_t) rtThreadRelease(PRTTHREADINT pThread)
{
- Assert(pThread);
uint32_t cRefs;
+
+ Assert(pThread);
if (pThread->cRefs >= 1)
{
cRefs = ASMAtomicDecU32(&pThread->cRefs);
@@ -557,6 +578,7 @@ uint32_t rtThreadRelease(PRTTHREADINT pThread)
*/
static void rtThreadDestroy(PRTTHREADINT pThread)
{
+ RTSEMEVENTMULTI hEvt1, hEvt2;
/*
* Remove it from the tree and mark it as dead.
*
@@ -587,9 +609,9 @@ static void rtThreadDestroy(PRTTHREADINT pThread)
ASMAtomicXchgU32(&pThread->u32Magic, RTTHREADINT_MAGIC_DEAD);
ASMAtomicWritePtr(&pThread->Core.Key, (void *)NIL_RTTHREAD);
pThread->enmType = RTTHREADTYPE_INVALID;
- RTSEMEVENTMULTI hEvt1 = pThread->EventUser;
+ hEvt1 = pThread->EventUser;
pThread->EventUser = NIL_RTSEMEVENTMULTI;
- RTSEMEVENTMULTI hEvt2 = pThread->EventTerminated;
+ hEvt2 = pThread->EventTerminated;
pThread->EventTerminated = NIL_RTSEMEVENTMULTI;
#ifdef IN_RING3
@@ -615,7 +637,7 @@ static void rtThreadDestroy(PRTTHREADINT pThread)
* @param pThread The thread structure.
* @param rc The thread result code.
*/
-void rtThreadTerminate(PRTTHREADINT pThread, int rc)
+DECLHIDDEN(void) rtThreadTerminate(PRTTHREADINT pThread, int rc)
{
Assert(pThread->cRefs >= 1);
@@ -654,8 +676,9 @@ void rtThreadTerminate(PRTTHREADINT pThread, int rc)
* @param NativeThread The native thread id.
* @param pszThreadName The name of the thread (purely a dummy for backtrace).
*/
-int rtThreadMain(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread, const char *pszThreadName)
+DECLHIDDEN(int) rtThreadMain(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread, const char *pszThreadName)
{
+ int rc;
NOREF(pszThreadName);
rtThreadInsert(pThread, NativeThread);
Log(("rtThreadMain: Starting: pThread=%p NativeThread=%RTnthrd Name=%s pfnThread=%p pvUser=%p\n",
@@ -664,7 +687,7 @@ int rtThreadMain(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread, const char *
/*
* Change the priority.
*/
- int rc = rtThreadNativeSetPriority(pThread, pThread->enmType);
+ rc = rtThreadNativeSetPriority(pThread, pThread->enmType);
#ifdef IN_RING3
AssertMsgRC(rc, ("Failed to set priority of thread %p (%RTnthrd / %s) to enmType=%d enmPriority=%d rc=%Rrc\n",
pThread, NativeThread, pThread->szName, pThread->enmType, g_enmProcessPriority, rc));
@@ -713,6 +736,9 @@ int rtThreadMain(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread, const char *
RTDECL(int) RTThreadCreate(PRTTHREAD pThread, PFNRTTHREAD pfnThread, void *pvUser, size_t cbStack,
RTTHREADTYPE enmType, unsigned fFlags, const char *pszName)
{
+ int rc;
+ PRTTHREADINT pThreadInt;
+
LogFlow(("RTThreadCreate: pThread=%p pfnThread=%p pvUser=%p cbStack=%#x enmType=%d fFlags=%#x pszName=%p:{%s}\n",
pThread, pfnThread, pvUser, cbStack, enmType, fFlags, pszName, pszName));
@@ -743,15 +769,15 @@ RTDECL(int) RTThreadCreate(PRTTHREAD pThread, PFNRTTHREAD pfnThread, void *pvUse
/*
* Allocate thread argument.
*/
- int rc;
- PRTTHREADINT pThreadInt = rtThreadAlloc(enmType, fFlags, 0, pszName);
+ pThreadInt = rtThreadAlloc(enmType, fFlags, 0, pszName);
if (pThreadInt)
{
+ RTNATIVETHREAD NativeThread;
+
pThreadInt->pfnThread = pfnThread;
pThreadInt->pvUser = pvUser;
pThreadInt->cbStack = cbStack;
- RTNATIVETHREAD NativeThread;
rc = rtThreadNativeCreate(pThreadInt, &NativeThread);
if (RT_SUCCESS(rc))
{
@@ -819,8 +845,9 @@ RTDECL(int) RTThreadCreateF(PRTTHREAD pThread, PFNRTTHREAD pfnThread, void *pvUs
RTTHREADTYPE enmType, uint32_t fFlags, const char *pszNameFmt, ...)
{
va_list va;
+ int rc;
va_start(va, pszNameFmt);
- int rc = RTThreadCreateV(pThread, pfnThread, pvUser, cbStack, enmType, fFlags, pszNameFmt, va);
+ rc = RTThreadCreateV(pThread, pfnThread, pvUser, cbStack, enmType, fFlags, pszNameFmt, va);
va_end(va);
return rc;
}
@@ -897,9 +924,10 @@ RT_EXPORT_SYMBOL(RTThreadSelfName);
*/
RTDECL(const char *) RTThreadGetName(RTTHREAD Thread)
{
+ PRTTHREADINT pThread;
if (Thread == NIL_RTTHREAD)
return NULL;
- PRTTHREADINT pThread = rtThreadGet(Thread);
+ pThread = rtThreadGet(Thread);
if (pThread)
{
const char *szName = pThread->szName;
@@ -923,13 +951,14 @@ RTDECL(int) RTThreadSetName(RTTHREAD Thread, const char *pszName)
/*
* Validate input.
*/
+ PRTTHREADINT pThread;
size_t cchName = strlen(pszName);
if (cchName >= RTTHREAD_NAME_LEN)
{
AssertMsgFailed(("pszName=%s is too long, max is %d\n", pszName, RTTHREAD_NAME_LEN - 1));
return VERR_INVALID_PARAMETER;
}
- PRTTHREADINT pThread = rtThreadGet(Thread);
+ pThread = rtThreadGet(Thread);
if (!pThread)
return VERR_INVALID_HANDLE;
@@ -970,6 +999,47 @@ RTDECL(bool) RTThreadIsMain(RTTHREAD hThread)
RT_EXPORT_SYMBOL(RTThreadIsMain);
+RTDECL(bool) RTThreadIsSelfAlive(void)
+{
+ if (g_frtThreadInitialized)
+ {
+ RTTHREAD hSelf = RTThreadSelf();
+ if (hSelf != NIL_RTTHREAD)
+ {
+ /*
+ * Inspect the thread state. ASSUMES thread state order.
+ */
+ RTTHREADSTATE enmState = rtThreadGetState(hSelf);
+ if ( enmState >= RTTHREADSTATE_RUNNING
+ && enmState <= RTTHREADSTATE_END)
+ return true;
+ }
+ }
+ return false;
+}
+RT_EXPORT_SYMBOL(RTThreadIsSelfAlive);
+
+
+RTDECL(bool) RTThreadIsSelfKnown(void)
+{
+ if (g_frtThreadInitialized)
+ {
+ RTTHREAD hSelf = RTThreadSelf();
+ if (hSelf != NIL_RTTHREAD)
+ return true;
+ }
+ return false;
+}
+RT_EXPORT_SYMBOL(RTThreadIsSelfKnown);
+
+
+RTDECL(bool) RTThreadIsInitialized(void)
+{
+ return g_frtThreadInitialized;
+}
+RT_EXPORT_SYMBOL(RTThreadIsInitialized);
+
+
/**
* Signal the user event.
*
@@ -1270,7 +1340,7 @@ static DECLCALLBACK(int) rtThreadSetPriorityOne(PAVLPVNODECORE pNode, void *pvUs
* @returns iprt status code.
* @param enmPriority The new priority.
*/
-int rtThreadDoSetProcPriority(RTPROCPRIORITY enmPriority)
+DECLHIDDEN(int) rtThreadDoSetProcPriority(RTPROCPRIORITY enmPriority)
{
LogFlow(("rtThreadDoSetProcPriority: enmPriority=%d\n", enmPriority));
@@ -1452,7 +1522,7 @@ static DECLCALLBACK(int) rtThreadClearTlsEntryCallback(PAVLPVNODECORE pNode, voi
*
* @param iTls The TLS entry. (valid)
*/
-void rtThreadClearTlsEntry(RTTLS iTls)
+DECLHIDDEN(void) rtThreadClearTlsEntry(RTTLS iTls)
{
RT_THREAD_LOCK_TMP(Tmp);
RT_THREAD_LOCK_RD(Tmp);
@@ -1461,4 +1531,3 @@ void rtThreadClearTlsEntry(RTTLS iTls)
}
#endif /* IPRT_WITH_GENERIC_TLS */
-
diff --git a/src/VBox/Runtime/common/path/RTPathAbsDup.cpp b/src/VBox/Runtime/common/path/RTPathAbsDup.cpp
index b9f217f99..50572f39f 100644
--- a/src/VBox/Runtime/common/path/RTPathAbsDup.cpp
+++ b/src/VBox/Runtime/common/path/RTPathAbsDup.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathAbsDup.cpp $ */
+/* $Id: RTPathAbsDup.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathAbsDup
*/
diff --git a/src/VBox/Runtime/common/path/RTPathAbsEx.cpp b/src/VBox/Runtime/common/path/RTPathAbsEx.cpp
index c647b5473..bbd4f8095 100644
--- a/src/VBox/Runtime/common/path/RTPathAbsEx.cpp
+++ b/src/VBox/Runtime/common/path/RTPathAbsEx.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathAbsEx.cpp $ */
+/* $Id: RTPathAbsEx.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathAbsEx
*/
diff --git a/src/VBox/Runtime/common/path/RTPathAbsExDup.cpp b/src/VBox/Runtime/common/path/RTPathAbsExDup.cpp
index 8bb8cd176..f756cbb4a 100644
--- a/src/VBox/Runtime/common/path/RTPathAbsExDup.cpp
+++ b/src/VBox/Runtime/common/path/RTPathAbsExDup.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathAbsExDup.cpp $ */
+/* $Id: RTPathAbsExDup.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathAbsExDup
*/
diff --git a/src/VBox/Runtime/common/path/RTPathAppend.cpp b/src/VBox/Runtime/common/path/RTPathAppend.cpp
index 5bad6483e..a66bb3af7 100644
--- a/src/VBox/Runtime/common/path/RTPathAppend.cpp
+++ b/src/VBox/Runtime/common/path/RTPathAppend.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathAppend.cpp $ */
+/* $Id: RTPathAppend.cpp 34214 2010-11-19 17:18:15Z vboxsync $ */
/** @file
* IPRT - RTPathAppend
*/
diff --git a/src/VBox/Runtime/common/path/RTPathAppendEx.cpp b/src/VBox/Runtime/common/path/RTPathAppendEx.cpp
index 159b62558..e29910800 100644
--- a/src/VBox/Runtime/common/path/RTPathAppendEx.cpp
+++ b/src/VBox/Runtime/common/path/RTPathAppendEx.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathAppendEx.cpp $ */
+/* $Id: RTPathAppendEx.cpp 34214 2010-11-19 17:18:15Z vboxsync $ */
/** @file
* IPRT - RTPathAppendEx
*/
diff --git a/src/VBox/Runtime/common/path/RTPathChangeToDosSlashes.cpp b/src/VBox/Runtime/common/path/RTPathChangeToDosSlashes.cpp
index 68b58803e..848759fa1 100644
--- a/src/VBox/Runtime/common/path/RTPathChangeToDosSlashes.cpp
+++ b/src/VBox/Runtime/common/path/RTPathChangeToDosSlashes.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathChangeToDosSlashes.cpp $ */
+/* $Id: RTPathChangeToDosSlashes.cpp 34205 2010-11-19 15:09:08Z vboxsync $ */
/** @file
* IPRT - RTPathChangeToDosSlashes
*/
diff --git a/src/VBox/Runtime/common/path/RTPathChangeToUnixSlashes.cpp b/src/VBox/Runtime/common/path/RTPathChangeToUnixSlashes.cpp
index c8e5e3c3c..823c7ee83 100644
--- a/src/VBox/Runtime/common/path/RTPathChangeToUnixSlashes.cpp
+++ b/src/VBox/Runtime/common/path/RTPathChangeToUnixSlashes.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathChangeToUnixSlashes.cpp $ */
+/* $Id: RTPathChangeToUnixSlashes.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - RTPathChangeToUnixSlashes
*/
diff --git a/src/VBox/Runtime/common/path/RTPathCopyComponents.cpp b/src/VBox/Runtime/common/path/RTPathCopyComponents.cpp
index afe4738cc..55b5f4f86 100644
--- a/src/VBox/Runtime/common/path/RTPathCopyComponents.cpp
+++ b/src/VBox/Runtime/common/path/RTPathCopyComponents.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathCopyComponents.cpp $ */
+/* $Id: RTPathCopyComponents.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathCountComponents
*/
diff --git a/src/VBox/Runtime/common/path/RTPathCountComponents.cpp b/src/VBox/Runtime/common/path/RTPathCountComponents.cpp
index 509614634..63a213bfc 100644
--- a/src/VBox/Runtime/common/path/RTPathCountComponents.cpp
+++ b/src/VBox/Runtime/common/path/RTPathCountComponents.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathCountComponents.cpp $ */
+/* $Id: RTPathCountComponents.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathCountComponents
*/
diff --git a/src/VBox/Runtime/common/path/RTPathExt.cpp b/src/VBox/Runtime/common/path/RTPathExt.cpp
index 292c5f2f7..de33d45e8 100644
--- a/src/VBox/Runtime/common/path/RTPathExt.cpp
+++ b/src/VBox/Runtime/common/path/RTPathExt.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathExt.cpp $ */
+/* $Id: RTPathExt.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathExt
*/
diff --git a/src/VBox/Runtime/common/path/RTPathFilename.cpp b/src/VBox/Runtime/common/path/RTPathFilename.cpp
index a6ef8cf8c..a77835bf0 100644
--- a/src/VBox/Runtime/common/path/RTPathFilename.cpp
+++ b/src/VBox/Runtime/common/path/RTPathFilename.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathFilename.cpp $ */
+/* $Id: RTPathFilename.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathFilename
*/
diff --git a/src/VBox/Runtime/common/path/RTPathHaveExt.cpp b/src/VBox/Runtime/common/path/RTPathHaveExt.cpp
index e5be22e1e..506a53eed 100644
--- a/src/VBox/Runtime/common/path/RTPathHaveExt.cpp
+++ b/src/VBox/Runtime/common/path/RTPathHaveExt.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathHaveExt.cpp $ */
+/* $Id: RTPathHaveExt.cpp 32864 2010-10-01 12:32:06Z vboxsync $ */
/** @file
* IPRT - RTPathHaveExt
*/
diff --git a/src/VBox/Runtime/common/path/RTPathHavePath.cpp b/src/VBox/Runtime/common/path/RTPathHavePath.cpp
index 3e33d4608..0e7188c2d 100644
--- a/src/VBox/Runtime/common/path/RTPathHavePath.cpp
+++ b/src/VBox/Runtime/common/path/RTPathHavePath.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathHavePath.cpp $ */
+/* $Id: RTPathHavePath.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathHavePath
*/
diff --git a/src/VBox/Runtime/common/path/RTPathJoin.cpp b/src/VBox/Runtime/common/path/RTPathJoin.cpp
index 100a7987c..68919a49b 100644
--- a/src/VBox/Runtime/common/path/RTPathJoin.cpp
+++ b/src/VBox/Runtime/common/path/RTPathJoin.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathJoin.cpp $ */
+/* $Id: RTPathJoin.cpp 33450 2010-10-26 09:24:32Z vboxsync $ */
/** @file
* IPRT - RTPathJoin.
*/
diff --git a/src/VBox/Runtime/common/path/RTPathJoinA.cpp b/src/VBox/Runtime/common/path/RTPathJoinA.cpp
index c1b8fbe46..e50c692c7 100644
--- a/src/VBox/Runtime/common/path/RTPathJoinA.cpp
+++ b/src/VBox/Runtime/common/path/RTPathJoinA.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathJoinA.cpp $ */
+/* $Id: RTPathJoinA.cpp 33450 2010-10-26 09:24:32Z vboxsync $ */
/** @file
* IPRT - RTPathJoinA.
*/
diff --git a/src/VBox/Runtime/common/path/RTPathJoinEx.cpp b/src/VBox/Runtime/common/path/RTPathJoinEx.cpp
index d0b43e397..ab8b92172 100644
--- a/src/VBox/Runtime/common/path/RTPathJoinEx.cpp
+++ b/src/VBox/Runtime/common/path/RTPathJoinEx.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathJoinEx.cpp $ */
+/* $Id: RTPathJoinEx.cpp 34214 2010-11-19 17:18:15Z vboxsync $ */
/** @file
* IPRT - RTPathJoinEx.
*/
diff --git a/src/VBox/Runtime/common/path/RTPathParse.cpp b/src/VBox/Runtime/common/path/RTPathParse.cpp
index ce42e3309..fa22539ef 100644
--- a/src/VBox/Runtime/common/path/RTPathParse.cpp
+++ b/src/VBox/Runtime/common/path/RTPathParse.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathParse.cpp $ */
+/* $Id: RTPathParse.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathParse
*/
diff --git a/src/VBox/Runtime/common/path/RTPathRealDup.cpp b/src/VBox/Runtime/common/path/RTPathRealDup.cpp
index 18ce0a821..6d28932b2 100644
--- a/src/VBox/Runtime/common/path/RTPathRealDup.cpp
+++ b/src/VBox/Runtime/common/path/RTPathRealDup.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathRealDup.cpp $ */
+/* $Id: RTPathRealDup.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathRealDup
*/
diff --git a/src/VBox/Runtime/common/path/RTPathStartsWithRoot.cpp b/src/VBox/Runtime/common/path/RTPathStartsWithRoot.cpp
index 52118240a..6a9aeab2f 100644
--- a/src/VBox/Runtime/common/path/RTPathStartsWithRoot.cpp
+++ b/src/VBox/Runtime/common/path/RTPathStartsWithRoot.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathStartsWithRoot.cpp $ */
+/* $Id: RTPathStartsWithRoot.cpp 33245 2010-10-20 09:51:08Z vboxsync $ */
/** @file
* IPRT - RTPathStartsWithRoot
*/
diff --git a/src/VBox/Runtime/common/path/RTPathStripExt.cpp b/src/VBox/Runtime/common/path/RTPathStripExt.cpp
index 789bb3e99..aa8920588 100644
--- a/src/VBox/Runtime/common/path/RTPathStripExt.cpp
+++ b/src/VBox/Runtime/common/path/RTPathStripExt.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathStripExt.cpp $ */
+/* $Id: RTPathStripExt.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathStripExt
*/
diff --git a/src/VBox/Runtime/common/path/RTPathStripFilename.cpp b/src/VBox/Runtime/common/path/RTPathStripFilename.cpp
index 3db34165d..13548445b 100644
--- a/src/VBox/Runtime/common/path/RTPathStripFilename.cpp
+++ b/src/VBox/Runtime/common/path/RTPathStripFilename.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathStripFilename.cpp $ */
+/* $Id: RTPathStripFilename.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathStripFilename
*/
diff --git a/src/VBox/Runtime/common/path/RTPathStripTrailingSlash.cpp b/src/VBox/Runtime/common/path/RTPathStripTrailingSlash.cpp
index 2296e04b7..624409ce8 100644
--- a/src/VBox/Runtime/common/path/RTPathStripTrailingSlash.cpp
+++ b/src/VBox/Runtime/common/path/RTPathStripTrailingSlash.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathStripTrailingSlash.cpp $ */
+/* $Id: RTPathStripTrailingSlash.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathSTripTrailingSlash
*/
diff --git a/src/VBox/Runtime/common/path/RTPathTraverseList.cpp b/src/VBox/Runtime/common/path/RTPathTraverseList.cpp
index daa88dcec..c77d43792 100644
--- a/src/VBox/Runtime/common/path/RTPathTraverseList.cpp
+++ b/src/VBox/Runtime/common/path/RTPathTraverseList.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathTraverseList.cpp $ */
+/* $Id: RTPathTraverseList.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTPathTraverseList
*/
diff --git a/src/VBox/Runtime/common/path/comparepaths.cpp b/src/VBox/Runtime/common/path/comparepaths.cpp
index 7c42db33b..c8cf5e81f 100644
--- a/src/VBox/Runtime/common/path/comparepaths.cpp
+++ b/src/VBox/Runtime/common/path/comparepaths.cpp
@@ -1,4 +1,4 @@
-/* $Id: comparepaths.cpp $ */
+/* $Id: comparepaths.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Path Comparison.
*/
diff --git a/src/VBox/Runtime/common/path/rtPathRootSpecLen.cpp b/src/VBox/Runtime/common/path/rtPathRootSpecLen.cpp
index 92c911361..25db8263c 100644
--- a/src/VBox/Runtime/common/path/rtPathRootSpecLen.cpp
+++ b/src/VBox/Runtime/common/path/rtPathRootSpecLen.cpp
@@ -1,4 +1,4 @@
-/* $Id: rtPathRootSpecLen.cpp $ */
+/* $Id: rtPathRootSpecLen.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - rtPathRootSpecLen (internal).
*/
diff --git a/src/VBox/Runtime/common/path/rtPathVolumeSpecLen.cpp b/src/VBox/Runtime/common/path/rtPathVolumeSpecLen.cpp
index 4a9fcb7aa..e40d5a6f6 100644
--- a/src/VBox/Runtime/common/path/rtPathVolumeSpecLen.cpp
+++ b/src/VBox/Runtime/common/path/rtPathVolumeSpecLen.cpp
@@ -1,4 +1,4 @@
-/* $Id: rtPathVolumeSpecLen.cpp $ */
+/* $Id: rtPathVolumeSpecLen.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - rtPathVolumeSpecLen
*/
diff --git a/src/VBox/Runtime/common/rand/rand.cpp b/src/VBox/Runtime/common/rand/rand.cpp
index f4d1dad4d..8fd1214f6 100644
--- a/src/VBox/Runtime/common/rand/rand.cpp
+++ b/src/VBox/Runtime/common/rand/rand.cpp
@@ -1,4 +1,4 @@
-/* $Id: rand.cpp $ */
+/* $Id: rand.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Random Numbers.
*/
diff --git a/src/VBox/Runtime/common/rand/randadv.cpp b/src/VBox/Runtime/common/rand/randadv.cpp
index 7af090310..cb7fab745 100644
--- a/src/VBox/Runtime/common/rand/randadv.cpp
+++ b/src/VBox/Runtime/common/rand/randadv.cpp
@@ -1,4 +1,4 @@
-/* $Id: randadv.cpp $ */
+/* $Id: randadv.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Random Numbers, Generic Glue.
*/
@@ -213,7 +213,7 @@ RTDECL(uint64_t) RTRandAdvU64(RTRAND hRand) RT_NO_THROW
RT_EXPORT_SYMBOL(RTRandAdvU64);
-DECLCALLBACK(void) rtRandAdvSynthesizeBytesFromU32(PRTRANDINT pThis, uint8_t *pb, size_t cb)
+DECLHIDDEN(DECLCALLBACK(void)) rtRandAdvSynthesizeBytesFromU32(PRTRANDINT pThis, uint8_t *pb, size_t cb)
{
while (cb > 0)
{
@@ -245,7 +245,7 @@ DECLCALLBACK(void) rtRandAdvSynthesizeBytesFromU32(PRTRANDINT pThis, uint8_t *p
}
-DECLCALLBACK(void) rtRandAdvSynthesizeBytesFromU64(PRTRANDINT pThis, uint8_t *pb, size_t cb)
+DECLHIDDEN(DECLCALLBACK(void)) rtRandAdvSynthesizeBytesFromU64(PRTRANDINT pThis, uint8_t *pb, size_t cb)
{
while (cb > 0)
{
@@ -289,7 +289,7 @@ DECLCALLBACK(void) rtRandAdvSynthesizeBytesFromU64(PRTRANDINT pThis, uint8_t *p
}
-DECLCALLBACK(uint32_t) rtRandAdvSynthesizeU32FromBytes(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last)
+DECLHIDDEN(DECLCALLBACK(uint32_t)) rtRandAdvSynthesizeU32FromBytes(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last)
{
union
{
@@ -323,13 +323,13 @@ DECLCALLBACK(uint32_t) rtRandAdvSynthesizeU32FromBytes(PRTRANDINT pThis, uint32
}
-DECLCALLBACK(uint32_t) rtRandAdvSynthesizeU32FromU64(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last)
+DECLHIDDEN(DECLCALLBACK(uint32_t)) rtRandAdvSynthesizeU32FromU64(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last)
{
return (uint32_t)pThis->pfnGetU64(pThis, u32First, u32Last);
}
-DECLCALLBACK(uint64_t) rtRandAdvSynthesizeU64FromBytes(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last)
+DECLHIDDEN(DECLCALLBACK(uint64_t)) rtRandAdvSynthesizeU64FromBytes(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last)
{
union
{
@@ -364,7 +364,7 @@ DECLCALLBACK(uint64_t) rtRandAdvSynthesizeU64FromBytes(PRTRANDINT pThis, uint64
}
-DECLCALLBACK(uint64_t) rtRandAdvSynthesizeU64FromU32(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last)
+DECLHIDDEN(DECLCALLBACK(uint64_t)) rtRandAdvSynthesizeU64FromU32(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last)
{
uint64_t off = u64Last - u64First;
if (off <= UINT32_MAX)
@@ -377,7 +377,7 @@ DECLCALLBACK(uint64_t) rtRandAdvSynthesizeU64FromU32(PRTRANDINT pThis, uint64_t
/** @copydoc RTRANDINT::pfnSeed */
-DECLCALLBACK(int) rtRandAdvStubSeed(PRTRANDINT pThis, uint64_t u64Seed)
+DECLHIDDEN(DECLCALLBACK(int)) rtRandAdvStubSeed(PRTRANDINT pThis, uint64_t u64Seed)
{
NOREF(pThis);
NOREF(u64Seed);
@@ -386,7 +386,7 @@ DECLCALLBACK(int) rtRandAdvStubSeed(PRTRANDINT pThis, uint64_t u64Seed)
/** @copydoc RTRANDINT::pfnSaveState */
-DECLCALLBACK(int) rtRandAdvStubSaveState(PRTRANDINT pThis, char *pszState, size_t *pcbState)
+DECLHIDDEN(DECLCALLBACK(int)) rtRandAdvStubSaveState(PRTRANDINT pThis, char *pszState, size_t *pcbState)
{
NOREF(pThis);
NOREF(pszState);
@@ -396,7 +396,7 @@ DECLCALLBACK(int) rtRandAdvStubSaveState(PRTRANDINT pThis, char *pszState, size_
/** @copydoc RTRANDINT::pfnRestoreState */
-DECLCALLBACK(int) rtRandAdvStubRestoreState(PRTRANDINT pThis, char const *pszState)
+DECLHIDDEN(DECLCALLBACK(int)) rtRandAdvStubRestoreState(PRTRANDINT pThis, char const *pszState)
{
NOREF(pThis);
NOREF(pszState);
@@ -405,7 +405,7 @@ DECLCALLBACK(int) rtRandAdvStubRestoreState(PRTRANDINT pThis, char const *pszSta
/** @copydoc RTRANDINT::pfnDestroy */
-DECLCALLBACK(int) rtRandAdvDefaultDestroy(PRTRANDINT pThis)
+DECLHIDDEN(DECLCALLBACK(int)) rtRandAdvDefaultDestroy(PRTRANDINT pThis)
{
pThis->u32Magic = ~RTRANDINT_MAGIC;
RTMemFree(pThis);
diff --git a/src/VBox/Runtime/common/rand/randparkmiller.cpp b/src/VBox/Runtime/common/rand/randparkmiller.cpp
index 4c0f3fd1e..94f118cac 100644
--- a/src/VBox/Runtime/common/rand/randparkmiller.cpp
+++ b/src/VBox/Runtime/common/rand/randparkmiller.cpp
@@ -1,4 +1,4 @@
-/* $Id: randparkmiller.cpp $ */
+/* $Id: randparkmiller.cpp 29250 2010-05-09 17:53:58Z vboxsync $ */
/** @file
* IPRT - Random Numbers, Park-Miller Pseudo Random.
*/
diff --git a/src/VBox/Runtime/common/sort/RTSortApvIsSorted.cpp b/src/VBox/Runtime/common/sort/RTSortApvIsSorted.cpp
index ccf4c62a5..f422f839d 100644
--- a/src/VBox/Runtime/common/sort/RTSortApvIsSorted.cpp
+++ b/src/VBox/Runtime/common/sort/RTSortApvIsSorted.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSortApvIsSorted.cpp $ */
+/* $Id: RTSortApvIsSorted.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTSortApvIsSorted.
*/
diff --git a/src/VBox/Runtime/common/sort/RTSortIsSorted.cpp b/src/VBox/Runtime/common/sort/RTSortIsSorted.cpp
index ff066e4e4..15b1e281b 100644
--- a/src/VBox/Runtime/common/sort/RTSortIsSorted.cpp
+++ b/src/VBox/Runtime/common/sort/RTSortIsSorted.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSortIsSorted.cpp $ */
+/* $Id: RTSortIsSorted.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTSortIsSorted.
*/
diff --git a/src/VBox/Runtime/common/sort/shellsort.cpp b/src/VBox/Runtime/common/sort/shellsort.cpp
index 23f956fec..e40728467 100644
--- a/src/VBox/Runtime/common/sort/shellsort.cpp
+++ b/src/VBox/Runtime/common/sort/shellsort.cpp
@@ -1,4 +1,4 @@
-/* $Id: shellsort.cpp $ */
+/* $Id: shellsort.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTSortIsSorted.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrCat.cpp b/src/VBox/Runtime/common/string/RTStrCat.cpp
index b85a8832a..257552fe0 100644
--- a/src/VBox/Runtime/common/string/RTStrCat.cpp
+++ b/src/VBox/Runtime/common/string/RTStrCat.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrCat.cpp $ */
+/* $Id: RTStrCat.cpp 33678 2010-11-02 10:30:46Z vboxsync $ */
/** @file
* IPRT - RTStrCat.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrCatEx.cpp b/src/VBox/Runtime/common/string/RTStrCatEx.cpp
index 69cb92c3f..32f82f1c6 100644
--- a/src/VBox/Runtime/common/string/RTStrCatEx.cpp
+++ b/src/VBox/Runtime/common/string/RTStrCatEx.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrCatEx.cpp $ */
+/* $Id: RTStrCatEx.cpp 33678 2010-11-02 10:30:46Z vboxsync $ */
/** @file
* IPRT - RTStrCatEx
*/
diff --git a/src/VBox/Runtime/common/string/RTStrCatP.cpp b/src/VBox/Runtime/common/string/RTStrCatP.cpp
index 145fb9c2e..c5139ce2a 100644
--- a/src/VBox/Runtime/common/string/RTStrCatP.cpp
+++ b/src/VBox/Runtime/common/string/RTStrCatP.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrCatP.cpp $ */
+/* $Id: RTStrCatP.cpp 36407 2011-03-24 16:14:57Z vboxsync $ */
/** @file
* IPRT - RTStrCat.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrCatPEx.cpp b/src/VBox/Runtime/common/string/RTStrCatPEx.cpp
index 808773ffa..9a31a0889 100644
--- a/src/VBox/Runtime/common/string/RTStrCatPEx.cpp
+++ b/src/VBox/Runtime/common/string/RTStrCatPEx.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrCatPEx.cpp $ */
+/* $Id: RTStrCatPEx.cpp 36407 2011-03-24 16:14:57Z vboxsync $ */
/** @file
* IPRT - RTStrCatPEx
*/
diff --git a/src/VBox/Runtime/common/string/RTStrCmp.cpp b/src/VBox/Runtime/common/string/RTStrCmp.cpp
index 779675f0b..1348da93f 100644
--- a/src/VBox/Runtime/common/string/RTStrCmp.cpp
+++ b/src/VBox/Runtime/common/string/RTStrCmp.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrCmp.cpp $ */
+/* $Id: RTStrCmp.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTStrCmp.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrConvertHexBytes.cpp b/src/VBox/Runtime/common/string/RTStrConvertHexBytes.cpp
index 841ff4436..4e1c3f17c 100644
--- a/src/VBox/Runtime/common/string/RTStrConvertHexBytes.cpp
+++ b/src/VBox/Runtime/common/string/RTStrConvertHexBytes.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrConvertHexBytes.cpp $ */
+/* $Id: RTStrConvertHexBytes.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTStrConvertHexBytes.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrCopy.cpp b/src/VBox/Runtime/common/string/RTStrCopy.cpp
index b8062cedc..51e67b38f 100644
--- a/src/VBox/Runtime/common/string/RTStrCopy.cpp
+++ b/src/VBox/Runtime/common/string/RTStrCopy.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrCopy.cpp $ */
+/* $Id: RTStrCopy.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTStrCopy.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrCopyEx.cpp b/src/VBox/Runtime/common/string/RTStrCopyEx.cpp
index 2baabd189..2074729fe 100644
--- a/src/VBox/Runtime/common/string/RTStrCopyEx.cpp
+++ b/src/VBox/Runtime/common/string/RTStrCopyEx.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrCopyEx.cpp $ */
+/* $Id: RTStrCopyEx.cpp 33678 2010-11-02 10:30:46Z vboxsync $ */
/** @file
* IPRT - RTStrCopyEx.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrCopyP.cpp b/src/VBox/Runtime/common/string/RTStrCopyP.cpp
index 0e6c166a9..3c7bf68a3 100644
--- a/src/VBox/Runtime/common/string/RTStrCopyP.cpp
+++ b/src/VBox/Runtime/common/string/RTStrCopyP.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrCopyP.cpp $ */
+/* $Id: RTStrCopyP.cpp 36407 2011-03-24 16:14:57Z vboxsync $ */
/** @file
* IPRT - RTStrCopyP.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrCopyPEx.cpp b/src/VBox/Runtime/common/string/RTStrCopyPEx.cpp
index 84919a043..7d3b8e7fe 100644
--- a/src/VBox/Runtime/common/string/RTStrCopyPEx.cpp
+++ b/src/VBox/Runtime/common/string/RTStrCopyPEx.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrCopyPEx.cpp $ */
+/* $Id: RTStrCopyPEx.cpp 36407 2011-03-24 16:14:57Z vboxsync $ */
/** @file
* IPRT - RTStrCopyPEx.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrNCmp.cpp b/src/VBox/Runtime/common/string/RTStrNCmp.cpp
index 5070218aa..c1c3583f5 100644
--- a/src/VBox/Runtime/common/string/RTStrNCmp.cpp
+++ b/src/VBox/Runtime/common/string/RTStrNCmp.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrNCmp.cpp $ */
+/* $Id: RTStrNCmp.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTStrNCmp.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrNLen.cpp b/src/VBox/Runtime/common/string/RTStrNLen.cpp
index d30c9ed51..16349edf9 100644
--- a/src/VBox/Runtime/common/string/RTStrNLen.cpp
+++ b/src/VBox/Runtime/common/string/RTStrNLen.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrNLen.cpp $ */
+/* $Id: RTStrNLen.cpp 30320 2010-06-21 08:35:09Z vboxsync $ */
/** @file
* IPRT - RTStrNLen.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrNLenEx.cpp b/src/VBox/Runtime/common/string/RTStrNLenEx.cpp
index 3764ce353..124e96000 100644
--- a/src/VBox/Runtime/common/string/RTStrNLenEx.cpp
+++ b/src/VBox/Runtime/common/string/RTStrNLenEx.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrNLenEx.cpp $ */
+/* $Id: RTStrNLenEx.cpp 30320 2010-06-21 08:35:09Z vboxsync $ */
/** @file
* IPRT - RTStrNLenEx.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrPrintHexBytes.cpp b/src/VBox/Runtime/common/string/RTStrPrintHexBytes.cpp
index f00298e5f..054ac46b3 100644
--- a/src/VBox/Runtime/common/string/RTStrPrintHexBytes.cpp
+++ b/src/VBox/Runtime/common/string/RTStrPrintHexBytes.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrPrintHexBytes.cpp $ */
+/* $Id: RTStrPrintHexBytes.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTStrPrintHexBytes.
*/
diff --git a/src/VBox/Runtime/common/string/RTStrStr.cpp b/src/VBox/Runtime/common/string/RTStrStr.cpp
index 903826e10..300837a00 100644
--- a/src/VBox/Runtime/common/string/RTStrStr.cpp
+++ b/src/VBox/Runtime/common/string/RTStrStr.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTStrStr.cpp $ */
+/* $Id: RTStrStr.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTStrStr.
*/
diff --git a/src/VBox/Runtime/common/string/base64.cpp b/src/VBox/Runtime/common/string/base64.cpp
index 58869fe38..6aab11dae 100644
--- a/src/VBox/Runtime/common/string/base64.cpp
+++ b/src/VBox/Runtime/common/string/base64.cpp
@@ -1,4 +1,4 @@
-/* $Id: base64.cpp $ */
+/* $Id: base64.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Base64, MIME content transfer encoding.
*/
diff --git a/src/VBox/Runtime/common/string/memchr.asm b/src/VBox/Runtime/common/string/memchr.asm
index 0ee2968d5..d8d0e37d7 100644
--- a/src/VBox/Runtime/common/string/memchr.asm
+++ b/src/VBox/Runtime/common/string/memchr.asm
@@ -1,4 +1,4 @@
-; $Id: memchr.asm $
+; $Id: memchr.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT memchr - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/string/memchr.cpp b/src/VBox/Runtime/common/string/memchr.cpp
index ba2de0958..f6cc7ed56 100644
--- a/src/VBox/Runtime/common/string/memchr.cpp
+++ b/src/VBox/Runtime/common/string/memchr.cpp
@@ -1,4 +1,4 @@
-/* $Id: memchr.cpp $ */
+/* $Id: memchr.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - CRT Strings, memcpy().
*/
diff --git a/src/VBox/Runtime/common/string/memchr_alias.c b/src/VBox/Runtime/common/string/memchr_alias.c
index 0d009c7da..f023eac1d 100644
--- a/src/VBox/Runtime/common/string/memchr_alias.c
+++ b/src/VBox/Runtime/common/string/memchr_alias.c
@@ -1,4 +1,4 @@
-/* $Id: memchr_alias.c $ */
+/* $Id: memchr_alias.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - No-CRT memchr() alias for gcc.
*/
diff --git a/src/VBox/Runtime/common/string/memcmp.asm b/src/VBox/Runtime/common/string/memcmp.asm
index afadf923e..f0695aafd 100644
--- a/src/VBox/Runtime/common/string/memcmp.asm
+++ b/src/VBox/Runtime/common/string/memcmp.asm
@@ -1,4 +1,4 @@
-; $Id: memcmp.asm $
+; $Id: memcmp.asm 30255 2010-06-16 14:55:17Z vboxsync $
;; @file
; IPRT - No-CRT memcmp - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/string/memcmp.cpp b/src/VBox/Runtime/common/string/memcmp.cpp
index 3dea769e6..f7a389271 100644
--- a/src/VBox/Runtime/common/string/memcmp.cpp
+++ b/src/VBox/Runtime/common/string/memcmp.cpp
@@ -1,4 +1,4 @@
-/* $Id: memcmp.cpp $ */
+/* $Id: memcmp.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - CRT Strings, memcmp().
*/
diff --git a/src/VBox/Runtime/common/string/memcmp_alias.c b/src/VBox/Runtime/common/string/memcmp_alias.c
index 30f786375..34f15a586 100644
--- a/src/VBox/Runtime/common/string/memcmp_alias.c
+++ b/src/VBox/Runtime/common/string/memcmp_alias.c
@@ -1,4 +1,4 @@
-/* $Id: memcmp_alias.c $ */
+/* $Id: memcmp_alias.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - No-CRT memcmp() alias for gcc.
*/
diff --git a/src/VBox/Runtime/common/string/memcpy.asm b/src/VBox/Runtime/common/string/memcpy.asm
index 6f1bed22a..cda29d223 100644
--- a/src/VBox/Runtime/common/string/memcpy.asm
+++ b/src/VBox/Runtime/common/string/memcpy.asm
@@ -1,4 +1,4 @@
-; $Id: memcpy.asm $
+; $Id: memcpy.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT memcpy - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/string/memcpy.cpp b/src/VBox/Runtime/common/string/memcpy.cpp
index 56ccdfb28..f799113a5 100644
--- a/src/VBox/Runtime/common/string/memcpy.cpp
+++ b/src/VBox/Runtime/common/string/memcpy.cpp
@@ -1,4 +1,4 @@
-/* $Id: memcpy.cpp $ */
+/* $Id: memcpy.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - CRT Strings, memcpy().
*/
diff --git a/src/VBox/Runtime/common/string/memcpy_alias.c b/src/VBox/Runtime/common/string/memcpy_alias.c
index 5ddc7b8c9..1e4998286 100644
--- a/src/VBox/Runtime/common/string/memcpy_alias.c
+++ b/src/VBox/Runtime/common/string/memcpy_alias.c
@@ -1,4 +1,4 @@
-/* $Id: memcpy_alias.c $ */
+/* $Id: memcpy_alias.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - No-CRT memcpy() alias for gcc.
*/
diff --git a/src/VBox/Runtime/common/string/memmove.asm b/src/VBox/Runtime/common/string/memmove.asm
index b10ede777..02d795f35 100644
--- a/src/VBox/Runtime/common/string/memmove.asm
+++ b/src/VBox/Runtime/common/string/memmove.asm
@@ -1,4 +1,4 @@
-; $Id: memmove.asm $
+; $Id: memmove.asm 33540 2010-10-28 09:27:05Z vboxsync $
;; @file
; IPRT - No-CRT memmove - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/string/memmove_alias.c b/src/VBox/Runtime/common/string/memmove_alias.c
index f30c91497..30c62a666 100644
--- a/src/VBox/Runtime/common/string/memmove_alias.c
+++ b/src/VBox/Runtime/common/string/memmove_alias.c
@@ -1,4 +1,4 @@
-/* $Id: memmove_alias.c $ */
+/* $Id: memmove_alias.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - No-CRT memmove() alias for gcc.
*/
diff --git a/src/VBox/Runtime/common/string/mempcpy.asm b/src/VBox/Runtime/common/string/mempcpy.asm
index b47c43682..849e0acf4 100644
--- a/src/VBox/Runtime/common/string/mempcpy.asm
+++ b/src/VBox/Runtime/common/string/mempcpy.asm
@@ -1,4 +1,4 @@
-; $Id: mempcpy.asm $
+; $Id: mempcpy.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT mempcpy - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/string/memset.asm b/src/VBox/Runtime/common/string/memset.asm
index 96cc48ec8..1f39cd282 100644
--- a/src/VBox/Runtime/common/string/memset.asm
+++ b/src/VBox/Runtime/common/string/memset.asm
@@ -1,4 +1,4 @@
-; $Id: memset.asm $
+; $Id: memset.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT memset - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/string/memset.cpp b/src/VBox/Runtime/common/string/memset.cpp
index 9bf358936..c2fda0b1f 100644
--- a/src/VBox/Runtime/common/string/memset.cpp
+++ b/src/VBox/Runtime/common/string/memset.cpp
@@ -1,4 +1,4 @@
-/* $Id: memset.cpp $ */
+/* $Id: memset.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - CRT Strings, memset().
*/
diff --git a/src/VBox/Runtime/common/string/memset_alias.c b/src/VBox/Runtime/common/string/memset_alias.c
index 49d4abd35..4c6bff270 100644
--- a/src/VBox/Runtime/common/string/memset_alias.c
+++ b/src/VBox/Runtime/common/string/memset_alias.c
@@ -1,4 +1,4 @@
-/* $Id: memset_alias.c $ */
+/* $Id: memset_alias.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - No-CRT memset() alias for gcc.
*/
diff --git a/src/VBox/Runtime/common/string/ministring.cpp b/src/VBox/Runtime/common/string/ministring.cpp
index dc4a429ea..3a7f31565 100644
--- a/src/VBox/Runtime/common/string/ministring.cpp
+++ b/src/VBox/Runtime/common/string/ministring.cpp
@@ -1,4 +1,4 @@
-/* $Id: ministring.cpp $ */
+/* $Id: ministring.cpp 36561 2011-04-05 13:42:59Z vboxsync $ */
/** @file
* IPRT - Mini C++ string class.
*
@@ -7,7 +7,7 @@
*/
/*
- * Copyright (C) 2007-2010 Oracle Corporation
+ * Copyright (C) 2007-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -32,13 +32,13 @@
* Header Files *
*******************************************************************************/
#include <iprt/cpp/ministring.h>
-using namespace iprt;
/*******************************************************************************
* Global Variables *
*******************************************************************************/
-const size_t MiniString::npos = ~(size_t)0;
+const size_t RTCString::npos = ~(size_t)0;
+
/*******************************************************************************
* Defined Constants And Macros *
@@ -47,7 +47,7 @@ const size_t MiniString::npos = ~(size_t)0;
#define IPRT_MINISTRING_APPEND_ALIGNMENT 64
-MiniString &MiniString::printf(const char *pszFormat, ...)
+RTCString &RTCString::printf(const char *pszFormat, ...)
{
va_list va;
va_start(va, pszFormat);
@@ -57,7 +57,7 @@ MiniString &MiniString::printf(const char *pszFormat, ...)
}
/**
- * Callback used with RTStrFormatV by MiniString::printfV.
+ * Callback used with RTStrFormatV by RTCString::printfV.
*
* @returns The number of bytes added (not used).
*
@@ -66,9 +66,9 @@ MiniString &MiniString::printf(const char *pszFormat, ...)
* @param cbChars The number of characters. 0 on the final callback.
*/
/*static*/ DECLCALLBACK(size_t)
-MiniString::printfOutputCallback(void *pvArg, const char *pachChars, size_t cbChars)
+RTCString::printfOutputCallback(void *pvArg, const char *pachChars, size_t cbChars)
{
- MiniString *pThis = (MiniString *)pvArg;
+ RTCString *pThis = (RTCString *)pvArg;
if (cbChars)
{
size_t cchBoth = pThis->m_cch + cbChars;
@@ -93,14 +93,14 @@ MiniString::printfOutputCallback(void *pvArg, const char *pachChars, size_t cbCh
return cbChars;
}
-MiniString &MiniString::printfV(const char *pszFormat, va_list va)
+RTCString &RTCString::printfV(const char *pszFormat, va_list va)
{
cleanup();
RTStrFormatV(printfOutputCallback, this, NULL, NULL, pszFormat, va);
return *this;
}
-MiniString &MiniString::append(const MiniString &that)
+RTCString &RTCString::append(const RTCString &that)
{
size_t cchThat = that.length();
if (cchThat)
@@ -124,7 +124,7 @@ MiniString &MiniString::append(const MiniString &that)
return *this;
}
-MiniString &MiniString::append(const char *pszThat)
+RTCString &RTCString::append(const char *pszThat)
{
size_t cchThat = strlen(pszThat);
if (cchThat)
@@ -148,7 +148,7 @@ MiniString &MiniString::append(const char *pszThat)
return *this;
}
-MiniString& MiniString::append(char ch)
+RTCString& RTCString::append(char ch)
{
Assert((unsigned char)ch < 0x80); /* Don't create invalid UTF-8. */
if (ch)
@@ -169,13 +169,13 @@ MiniString& MiniString::append(char ch)
return *this;
}
-MiniString &MiniString::appendCodePoint(RTUNICP uc)
+RTCString &RTCString::appendCodePoint(RTUNICP uc)
{
/*
* Single byte encoding.
*/
if (uc < 0x80)
- return MiniString::append((char)uc);
+ return RTCString::append((char)uc);
/*
* Multibyte encoding.
@@ -199,8 +199,7 @@ MiniString &MiniString::appendCodePoint(RTUNICP uc)
return *this;
}
-size_t MiniString::find(const char *pcszFind, size_t pos /*= 0*/)
- const
+size_t RTCString::find(const char *pcszFind, size_t pos /*= 0*/) const
{
const char *pszThis, *p;
@@ -213,7 +212,7 @@ size_t MiniString::find(const char *pcszFind, size_t pos /*= 0*/)
return npos;
}
-void MiniString::findReplace(char cFind, char cReplace)
+void RTCString::findReplace(char cFind, char cReplace)
{
for (size_t i = 0; i < length(); ++i)
{
@@ -223,10 +222,9 @@ void MiniString::findReplace(char cFind, char cReplace)
}
}
-MiniString MiniString::substrCP(size_t pos /*= 0*/, size_t n /*= npos*/)
- const
+RTCString RTCString::substrCP(size_t pos /*= 0*/, size_t n /*= npos*/) const
{
- MiniString ret;
+ RTCString ret;
if (n)
{
@@ -272,7 +270,7 @@ MiniString MiniString::substrCP(size_t pos /*= 0*/, size_t n /*= npos*/)
return ret;
}
-bool MiniString::endsWith(const MiniString &that, CaseSensitivity cs /*= CaseSensitive*/) const
+bool RTCString::endsWith(const RTCString &that, CaseSensitivity cs /*= CaseSensitive*/) const
{
size_t l1 = length();
if (l1 == 0)
@@ -287,11 +285,10 @@ bool MiniString::endsWith(const MiniString &that, CaseSensitivity cs /*= CaseSen
size_t l = l1 - l2;
if (cs == CaseSensitive)
return ::RTStrCmp(&m_psz[l], that.m_psz) == 0;
- else
- return ::RTStrICmp(&m_psz[l], that.m_psz) == 0;
+ return ::RTStrICmp(&m_psz[l], that.m_psz) == 0;
}
-bool MiniString::startsWith(const MiniString &that, CaseSensitivity cs /*= CaseSensitive*/) const
+bool RTCString::startsWith(const RTCString &that, CaseSensitivity cs /*= CaseSensitive*/) const
{
size_t l1 = length();
size_t l2 = that.length();
@@ -303,31 +300,112 @@ bool MiniString::startsWith(const MiniString &that, CaseSensitivity cs /*= CaseS
if (cs == CaseSensitive)
return ::RTStrNCmp(m_psz, that.m_psz, l2) == 0;
- else
- return ::RTStrNICmp(m_psz, that.m_psz, l2) == 0;
+ return ::RTStrNICmp(m_psz, that.m_psz, l2) == 0;
}
-bool MiniString::contains(const MiniString &that, CaseSensitivity cs /*= CaseSensitive*/) const
+bool RTCString::contains(const RTCString &that, CaseSensitivity cs /*= CaseSensitive*/) const
{
/** @todo r-bird: Not checking for NULL strings like startsWith does (and
* endsWith only does half way). */
if (cs == CaseSensitive)
return ::RTStrStr(m_psz, that.m_psz) != NULL;
- else
- return ::RTStrIStr(m_psz, that.m_psz) != NULL;
+ return ::RTStrIStr(m_psz, that.m_psz) != NULL;
}
-int MiniString::toInt(uint64_t &i) const
+int RTCString::toInt(uint64_t &i) const
{
if (!m_psz)
return VERR_NO_DIGITS;
return RTStrToUInt64Ex(m_psz, NULL, 0, &i);
}
-int MiniString::toInt(uint32_t &i) const
+int RTCString::toInt(uint32_t &i) const
{
if (!m_psz)
return VERR_NO_DIGITS;
return RTStrToUInt32Ex(m_psz, NULL, 0, &i);
}
+RTCList<RTCString, RTCString *>
+RTCString::split(const RTCString &a_rstrSep, SplitMode mode /* = RemoveEmptyParts */)
+{
+ RTCList<RTCString> strRet;
+ if (!m_psz)
+ return strRet;
+ if (a_rstrSep.isEmpty())
+ {
+ strRet.append(RTCString(m_psz));
+ return strRet;
+ }
+
+ size_t cch = m_cch;
+ char const *pszTmp = m_psz;
+ while (cch > 0)
+ {
+ char const *pszNext = strstr(pszTmp, a_rstrSep.c_str());
+ if (!pszNext)
+ {
+ strRet.append(RTCString(pszTmp, cch));
+ break;
+ }
+ size_t cchNext = pszNext - pszTmp;
+ if ( cchNext > 0
+ || mode == KeepEmptyParts)
+ strRet.append(RTCString(pszTmp, cchNext));
+ pszTmp += cchNext + a_rstrSep.length();
+ cch -= cchNext + a_rstrSep.length();
+ }
+
+ return strRet;
+}
+
+/* static */
+RTCString
+RTCString::join(const RTCList<RTCString, RTCString *> &a_rList,
+ const RTCString &a_rstrSep /* = "" */)
+{
+ RTCString strRet;
+ if (a_rList.size() > 1)
+ {
+ /* calc the required size */
+ size_t cbNeeded = a_rstrSep.length() * (a_rList.size() - 1) + 1;
+ for (size_t i = 0; i < a_rList.size(); ++i)
+ cbNeeded += a_rList.at(i).length();
+ strRet.reserve(cbNeeded);
+
+ /* do the appending. */
+ for (size_t i = 0; i < a_rList.size() - 1; ++i)
+ {
+ strRet.append(a_rList.at(i));
+ strRet.append(a_rstrSep);
+ }
+ strRet.append(a_rList.last());
+ }
+ /* special case: one list item. */
+ else if (a_rList.size() > 0)
+ strRet.append(a_rList.last());
+
+ return strRet;
+}
+
+const RTCString operator+(const RTCString &a_rStr1, const RTCString &a_rStr2)
+{
+ RTCString strRet(a_rStr1);
+ strRet += a_rStr2;
+ return strRet;
+}
+
+const RTCString operator+(const RTCString &a_rStr1, const char *a_pszStr2)
+{
+ RTCString strRet(a_rStr1);
+ strRet += a_pszStr2;
+ return strRet;
+}
+
+const RTCString operator+(const char *a_psz1, const RTCString &a_rStr2)
+{
+ RTCString strRet(a_psz1);
+ strRet += a_rStr2;
+ return strRet;
+}
+
diff --git a/src/VBox/Runtime/common/string/simplepattern.cpp b/src/VBox/Runtime/common/string/simplepattern.cpp
index f54d4ce02..607984fd6 100644
--- a/src/VBox/Runtime/common/string/simplepattern.cpp
+++ b/src/VBox/Runtime/common/string/simplepattern.cpp
@@ -1,4 +1,4 @@
-/* $Id: simplepattern.cpp $ */
+/* $Id: simplepattern.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - RTStrSimplePattern.
*/
diff --git a/src/VBox/Runtime/common/string/straprintf.cpp b/src/VBox/Runtime/common/string/straprintf.cpp
index a0ee03502..2df24c9bd 100644
--- a/src/VBox/Runtime/common/string/straprintf.cpp
+++ b/src/VBox/Runtime/common/string/straprintf.cpp
@@ -1,4 +1,4 @@
-/* $Id: straprintf.cpp $ */
+/* $Id: straprintf.cpp 33464 2010-10-26 12:27:50Z vboxsync $ */
/** @file
* IPRT - Allocating String Formatters.
*/
diff --git a/src/VBox/Runtime/common/string/strcache.cpp b/src/VBox/Runtime/common/string/strcache.cpp
index 642d5836d..480a8b37b 100644
--- a/src/VBox/Runtime/common/string/strcache.cpp
+++ b/src/VBox/Runtime/common/string/strcache.cpp
@@ -1,4 +1,4 @@
-/* $Id: strcache.cpp $ */
+/* $Id: strcache.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - String Cache.
*/
diff --git a/src/VBox/Runtime/common/string/strchr.asm b/src/VBox/Runtime/common/string/strchr.asm
index 7163f28c5..55ac28e44 100644
--- a/src/VBox/Runtime/common/string/strchr.asm
+++ b/src/VBox/Runtime/common/string/strchr.asm
@@ -1,4 +1,4 @@
-; $Id: strchr.asm $
+; $Id: strchr.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT strchr - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/string/strchr_alias.c b/src/VBox/Runtime/common/string/strchr_alias.c
index 4b4fe4b10..b0c5ba97a 100644
--- a/src/VBox/Runtime/common/string/strchr_alias.c
+++ b/src/VBox/Runtime/common/string/strchr_alias.c
@@ -1,4 +1,4 @@
-/* $Id: strchr_alias.c $ */
+/* $Id: strchr_alias.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - No-CRT strchr() alias for gcc.
*/
diff --git a/src/VBox/Runtime/common/string/strcmp.asm b/src/VBox/Runtime/common/string/strcmp.asm
index 574e5d140..261cabdd4 100644
--- a/src/VBox/Runtime/common/string/strcmp.asm
+++ b/src/VBox/Runtime/common/string/strcmp.asm
@@ -1,4 +1,4 @@
-; $Id: strcmp.asm $
+; $Id: strcmp.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT strcmp - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/string/strcmp_alias.c b/src/VBox/Runtime/common/string/strcmp_alias.c
index 3c5f7f839..d69b7130d 100644
--- a/src/VBox/Runtime/common/string/strcmp_alias.c
+++ b/src/VBox/Runtime/common/string/strcmp_alias.c
@@ -1,4 +1,4 @@
-/* $Id: strcmp_alias.c $ */
+/* $Id: strcmp_alias.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - No-CRT strcmp() alias for gcc.
*/
diff --git a/src/VBox/Runtime/common/string/strcpy.asm b/src/VBox/Runtime/common/string/strcpy.asm
index bee8738ba..0c9e53377 100644
--- a/src/VBox/Runtime/common/string/strcpy.asm
+++ b/src/VBox/Runtime/common/string/strcpy.asm
@@ -1,4 +1,4 @@
-; $Id: strcpy.asm $
+; $Id: strcpy.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT strcpy - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/string/strcpy.cpp b/src/VBox/Runtime/common/string/strcpy.cpp
index 55da775db..6c67ab319 100644
--- a/src/VBox/Runtime/common/string/strcpy.cpp
+++ b/src/VBox/Runtime/common/string/strcpy.cpp
@@ -1,4 +1,4 @@
-/* $Id: strcpy.cpp $ */
+/* $Id: strcpy.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - CRT Strings, strcpy().
*/
diff --git a/src/VBox/Runtime/common/string/strcpy_alias.c b/src/VBox/Runtime/common/string/strcpy_alias.c
index 517cd801a..096f240a1 100644
--- a/src/VBox/Runtime/common/string/strcpy_alias.c
+++ b/src/VBox/Runtime/common/string/strcpy_alias.c
@@ -1,4 +1,4 @@
-/* $Id: strcpy_alias.c $ */
+/* $Id: strcpy_alias.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - No-CRT strcpy() alias for gcc.
*/
diff --git a/src/VBox/Runtime/common/string/strformat.cpp b/src/VBox/Runtime/common/string/strformat.cpp
index fec8315ec..d6058e6c0 100644
--- a/src/VBox/Runtime/common/string/strformat.cpp
+++ b/src/VBox/Runtime/common/string/strformat.cpp
@@ -1,4 +1,4 @@
-/* $Id: strformat.cpp $ */
+/* $Id: strformat.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - String Formatter.
*/
diff --git a/src/VBox/Runtime/common/string/strformatnum.cpp b/src/VBox/Runtime/common/string/strformatnum.cpp
index db4a810c7..171cd1918 100644
--- a/src/VBox/Runtime/common/string/strformatnum.cpp
+++ b/src/VBox/Runtime/common/string/strformatnum.cpp
@@ -1,4 +1,4 @@
-/* $Id: strformatnum.cpp $ */
+/* $Id: strformatnum.cpp 35585 2011-01-17 14:20:13Z vboxsync $ */
/** @file
* IPRT - String Formatter, Single Numbers.
*/
diff --git a/src/VBox/Runtime/common/string/strformatrt.cpp b/src/VBox/Runtime/common/string/strformatrt.cpp
index b37710bbc..d2409c457 100644
--- a/src/VBox/Runtime/common/string/strformatrt.cpp
+++ b/src/VBox/Runtime/common/string/strformatrt.cpp
@@ -1,4 +1,4 @@
-/* $Id: strformatrt.cpp $ */
+/* $Id: strformatrt.cpp 37996 2011-07-18 10:09:19Z vboxsync $ */
/** @file
* IPRT - IPRT String Formatter Extensions.
*/
@@ -30,6 +30,8 @@
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_STRING
#include <iprt/string.h>
+#define RT_NO_EXPORT_SYMBOL /* don't slurp <linux/module.h> which then again
+ slurps arch-specific headers defining symbols */
#include "internal/iprt.h"
#include <iprt/log.h>
@@ -44,6 +46,10 @@
#include <iprt/time.h>
#include <iprt/net.h>
#include <iprt/path.h>
+#define STRFORMAT_WITH_X86
+#ifdef STRFORMAT_WITH_X86
+# include <iprt/x86.h>
+#endif
#include "internal/string.h"
@@ -63,10 +69,14 @@
* @param fFlags Flags (RTSTR_NTFS_*).
* @param chArgSize The argument size specifier, 'l' or 'L'.
*/
-size_t rtstrFormatRt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat, va_list *pArgs, int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize)
+DECLHIDDEN(size_t) rtstrFormatRt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat, va_list *pArgs,
+ int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize)
{
const char *pszFormatOrg = *ppszFormat;
- char ch = *(*ppszFormat)++;
+ char ch = *(*ppszFormat)++;
+ size_t cch;
+ char szBuf[80];
+
if (ch == 'R')
{
ch = *(*ppszFormat)++;
@@ -204,8 +214,6 @@ size_t rtstrFormatRt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **p
PCRTNETADDR pNetAddr;
PCRTUUID pUuid;
} u;
- char szBuf[80];
- unsigned cch;
AssertMsg(!chArgSize, ("Not argument size '%c' for RT types! '%.10s'\n", chArgSize, pszFormatOrg));
@@ -644,8 +652,8 @@ size_t rtstrFormatRt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **p
*/
case 'd':
{
- size_t cch = 0;
int off = 0;
+ cch = 0;
if (cchWidth <= 0)
cchWidth = 16;
@@ -682,7 +690,7 @@ size_t rtstrFormatRt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **p
{
if (cchPrecision-- > 0)
{
- size_t cch = RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%02x", *pu8++);
+ cch = RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%02x", *pu8++);
for (; cchPrecision > 0; cchPrecision--, pu8++)
cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, " %02x", *pu8);
return cch;
@@ -984,6 +992,124 @@ size_t rtstrFormatRt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **p
}
#endif /* IN_RING3 */
+
+ /*
+ * Groups 6 - CPU Architecture Register Formatters.
+ * "%RAarch[reg]"
+ */
+ case 'A':
+ {
+ char const * const pszArch = *ppszFormat;
+ const char *pszReg = pszArch;
+ size_t cchOutput = 0;
+ int cPrinted = 0;
+ size_t cchReg;
+
+ /* Parse out the */
+ while ((ch = *pszReg++) && ch != '[')
+ { /* nothing */ }
+ AssertMsgBreak(ch == '[', ("Malformed IPRT architecture register format type '%.10s'!\n", pszFormatOrg));
+
+ cchReg = 0;
+ while ((ch = pszReg[cchReg]) && ch != ']')
+ cchReg++;
+ AssertMsgBreak(ch == ']', ("Malformed IPRT architecture register format type '%.10s'!\n", pszFormatOrg));
+
+ *ppszFormat = &pszReg[cchReg + 1];
+
+
+#define REG_EQUALS(a_szReg) (sizeof(a_szReg) - 1 == cchReg && !strncmp(a_szReg, pszReg, sizeof(a_szReg) - 1))
+#define REG_OUT_BIT(a_uVal, a_fBitMask, a_szName) \
+ do { \
+ if ((a_uVal) & (a_fBitMask)) \
+ { \
+ if (!cPrinted++) \
+ cchOutput += pfnOutput(pvArgOutput, "{" a_szName, sizeof(a_szName)); \
+ else \
+ cchOutput += pfnOutput(pvArgOutput, "," a_szName, sizeof(a_szName)); \
+ (a_uVal) &= ~(a_fBitMask); \
+ } \
+ } while (0)
+#define REG_OUT_CLOSE(a_uVal) \
+ do { \
+ if ((a_uVal)) \
+ { \
+ cchOutput += pfnOutput(pvArgOutput, !cPrinted ? "{unkn=" : ",unkn=", 6); \
+ cch = RTStrFormatNumber(&szBuf[0], (a_uVal), 16, 1, -1, fFlags); \
+ cchOutput += pfnOutput(pvArgOutput, szBuf, cch); \
+ cPrinted++; \
+ } \
+ if (cPrinted) \
+ cchOutput += pfnOutput(pvArgOutput, "}", 1); \
+ } while (0)
+
+
+ if (0)
+ { /* dummy */ }
+#ifdef STRFORMAT_WITH_X86
+ /*
+ * X86 & AMD64.
+ */
+ else if ( pszReg - pszArch == 3 + 1
+ && pszArch[0] == 'x'
+ && pszArch[1] == '8'
+ && pszArch[2] == '6')
+ {
+ if (REG_EQUALS("cr0"))
+ {
+ uint64_t cr0 = va_arg(*pArgs, uint64_t);
+ fFlags |= RTSTR_F_64BIT;
+ cch = RTStrFormatNumber(&szBuf[0], cr0, 16, 8, -1, fFlags | RTSTR_F_ZEROPAD);
+ cchOutput += pfnOutput(pvArgOutput, szBuf, cch);
+ REG_OUT_BIT(cr0, X86_CR0_PE, "PE");
+ REG_OUT_BIT(cr0, X86_CR0_MP, "MP");
+ REG_OUT_BIT(cr0, X86_CR0_EM, "EM");
+ REG_OUT_BIT(cr0, X86_CR0_TS, "DE");
+ REG_OUT_BIT(cr0, X86_CR0_ET, "ET");
+ REG_OUT_BIT(cr0, X86_CR0_NE, "NE");
+ REG_OUT_BIT(cr0, X86_CR0_WP, "WP");
+ REG_OUT_BIT(cr0, X86_CR0_AM, "AM");
+ REG_OUT_BIT(cr0, X86_CR0_NW, "NW");
+ REG_OUT_BIT(cr0, X86_CR0_CD, "CD");
+ REG_OUT_BIT(cr0, X86_CR0_PG, "PG");
+ REG_OUT_CLOSE(cr0);
+ }
+ else if (REG_EQUALS("cr4"))
+ {
+ uint64_t cr4 = va_arg(*pArgs, uint64_t);
+ fFlags |= RTSTR_F_64BIT;
+ cch = RTStrFormatNumber(&szBuf[0], cr4, 16, 8, -1, fFlags | RTSTR_F_ZEROPAD);
+ cchOutput += pfnOutput(pvArgOutput, szBuf, cch);
+ REG_OUT_BIT(cr4, X86_CR4_VME, "VME");
+ REG_OUT_BIT(cr4, X86_CR4_PVI, "PVI");
+ REG_OUT_BIT(cr4, X86_CR4_TSD, "TSD");
+ REG_OUT_BIT(cr4, X86_CR4_DE, "DE");
+ REG_OUT_BIT(cr4, X86_CR4_PSE, "PSE");
+ REG_OUT_BIT(cr4, X86_CR4_PAE, "PAE");
+ REG_OUT_BIT(cr4, X86_CR4_MCE, "MCE");
+ REG_OUT_BIT(cr4, X86_CR4_PGE, "PGE");
+ REG_OUT_BIT(cr4, X86_CR4_PCE, "PCE");
+ REG_OUT_BIT(cr4, X86_CR4_OSFSXR, "OSFSXR");
+ REG_OUT_BIT(cr4, X86_CR4_OSXMMEEXCPT, "OSXMMEEXCPT");
+ REG_OUT_BIT(cr4, X86_CR4_VMXE, "VMXE");
+ REG_OUT_BIT(cr4, X86_CR4_SMXE, "SMXE");
+ REG_OUT_BIT(cr4, X86_CR4_PCIDE, "PCIDE");
+ REG_OUT_BIT(cr4, X86_CR4_OSXSAVE, "OSXSAVE");
+ REG_OUT_BIT(cr4, X86_CR4_SMEP, "SMPE");
+ REG_OUT_CLOSE(cr4);
+ }
+ else
+ AssertMsgFailed(("Unknown x86 register specified in '%.10s'!\n", pszFormatOrg));
+ }
+#endif
+ else
+ AssertMsgFailed(("Unknown architecture specified in '%.10s'!\n", pszFormatOrg));
+#undef REG_OUT_BIT
+#undef REG_OUT_CLOSE
+#undef REG_EQUALS
+ return cchOutput;
+ }
+
/*
* Invalid/Unknown. Bitch about it.
*/
diff --git a/src/VBox/Runtime/common/string/strformattype.cpp b/src/VBox/Runtime/common/string/strformattype.cpp
index aca496fec..2bd99d91f 100644
--- a/src/VBox/Runtime/common/string/strformattype.cpp
+++ b/src/VBox/Runtime/common/string/strformattype.cpp
@@ -1,4 +1,4 @@
-/* $Id: strformattype.cpp $ */
+/* $Id: strformattype.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - IPRT String Formatter Extensions, Dynamic Types.
*/
@@ -415,7 +415,8 @@ RT_EXPORT_SYMBOL(RTStrFormatTypeSetUser);
* @param fFlags Flags (RTSTR_NTFS_*).
* @param chArgSize The argument size specifier, 'l' or 'L'.
*/
-size_t rtstrFormatType(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat, va_list *pArgs, int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize)
+DECLHIDDEN(size_t) rtstrFormatType(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat,
+ va_list *pArgs, int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize)
{
size_t cch;
int32_t i;
diff --git a/src/VBox/Runtime/common/string/stringalloc.cpp b/src/VBox/Runtime/common/string/stringalloc.cpp
index f5d4ec087..06afd0c55 100644
--- a/src/VBox/Runtime/common/string/stringalloc.cpp
+++ b/src/VBox/Runtime/common/string/stringalloc.cpp
@@ -1,4 +1,4 @@
-/* $Id: stringalloc.cpp $ */
+/* $Id: stringalloc.cpp 34032 2010-11-12 16:20:25Z vboxsync $ */
/** @file
* IPRT - String Manipulation.
*/
diff --git a/src/VBox/Runtime/common/string/strlen.asm b/src/VBox/Runtime/common/string/strlen.asm
index e3ff2f378..90418f5af 100644
--- a/src/VBox/Runtime/common/string/strlen.asm
+++ b/src/VBox/Runtime/common/string/strlen.asm
@@ -1,4 +1,4 @@
-; $Id: strlen.asm $
+; $Id: strlen.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - No-CRT strlen - AMD64 & X86.
;
diff --git a/src/VBox/Runtime/common/string/strlen.cpp b/src/VBox/Runtime/common/string/strlen.cpp
index 173ba2cbc..377ef64ee 100644
--- a/src/VBox/Runtime/common/string/strlen.cpp
+++ b/src/VBox/Runtime/common/string/strlen.cpp
@@ -1,4 +1,4 @@
-/* $Id: strlen.cpp $ */
+/* $Id: strlen.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - CRT Strings, strlen().
*/
diff --git a/src/VBox/Runtime/common/string/strlen_alias.c b/src/VBox/Runtime/common/string/strlen_alias.c
index 8fab3d167..a89c778ae 100644
--- a/src/VBox/Runtime/common/string/strlen_alias.c
+++ b/src/VBox/Runtime/common/string/strlen_alias.c
@@ -1,4 +1,4 @@
-/* $Id: strlen_alias.c $ */
+/* $Id: strlen_alias.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - No-CRT strlen() alias for gcc.
*/
diff --git a/src/VBox/Runtime/common/string/strncmp.cpp b/src/VBox/Runtime/common/string/strncmp.cpp
index 16faf4b1b..37f81e565 100644
--- a/src/VBox/Runtime/common/string/strncmp.cpp
+++ b/src/VBox/Runtime/common/string/strncmp.cpp
@@ -1,4 +1,4 @@
-/* $Id: strncmp.cpp $ */
+/* $Id: strncmp.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - CRT Strings, strncmp().
*/
diff --git a/src/VBox/Runtime/common/string/strpbrk.cpp b/src/VBox/Runtime/common/string/strpbrk.cpp
index e8d49a811..0f2c64b84 100644
--- a/src/VBox/Runtime/common/string/strpbrk.cpp
+++ b/src/VBox/Runtime/common/string/strpbrk.cpp
@@ -1,4 +1,4 @@
-/* $Id: strpbrk.cpp $ */
+/* $Id: strpbrk.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - strpbrk().
*/
diff --git a/src/VBox/Runtime/common/string/strprintf.cpp b/src/VBox/Runtime/common/string/strprintf.cpp
index 13bfd4b7a..40e589f7b 100644
--- a/src/VBox/Runtime/common/string/strprintf.cpp
+++ b/src/VBox/Runtime/common/string/strprintf.cpp
@@ -1,4 +1,4 @@
-/* $Id: strprintf.cpp $ */
+/* $Id: strprintf.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - String Formatters.
*/
diff --git a/src/VBox/Runtime/common/string/strspace.cpp b/src/VBox/Runtime/common/string/strspace.cpp
index 561db74c3..1c8b4655f 100644
--- a/src/VBox/Runtime/common/string/strspace.cpp
+++ b/src/VBox/Runtime/common/string/strspace.cpp
@@ -1,4 +1,4 @@
-/* $Id: strspace.cpp $ */
+/* $Id: strspace.cpp 36597 2011-04-06 19:46:15Z vboxsync $ */
/** @file
* IPRT - Unique String Spaces.
*/
@@ -32,6 +32,7 @@
#include "internal/iprt.h"
#include <iprt/assert.h>
+#include "internal/strhash.h"
/*******************************************************************************
@@ -40,6 +41,7 @@
/*
* AVL configuration.
*/
+#define KAVL_DECL(a_Type) static a_Type
#define KAVL_FN(a) rtstrspace##a
#define KAVL_MAX_STACK 27 /* Up to 2^24 nodes. */
#define KAVL_EQUAL_ALLOWED 1
@@ -72,44 +74,6 @@
-/* sdbm:
- This algorithm was created for sdbm (a public-domain reimplementation of
- ndbm) database library. it was found to do well in scrambling bits,
- causing better distribution of the keys and fewer splits. it also happens
- to be a good general hashing function with good distribution. the actual
- function is hash(i) = hash(i - 1) * 65599 + str[i]; what is included below
- is the faster version used in gawk. [there is even a faster, duff-device
- version] the magic constant 65599 was picked out of thin air while
- experimenting with different constants, and turns out to be a prime.
- this is one of the algorithms used in berkeley db (see sleepycat) and
- elsewhere. */
-DECLINLINE(uint32_t) sdbm(const char *str, size_t *pcch)
-{
- uint8_t *pu8 = (uint8_t *)str;
- uint32_t hash = 0;
- int c;
-
- while ((c = *pu8++))
- hash = c + (hash << 6) + (hash << 16) - hash;
-
- *pcch = (uintptr_t)pu8 - (uintptr_t)str - 1;
- return hash;
-}
-
-DECLINLINE(uint32_t) sdbmN(const char *str, size_t cchMax, size_t *pcch)
-{
- uint8_t *pu8 = (uint8_t *)str;
- uint32_t hash = 0;
- int c;
-
- while ((c = *pu8++) && cchMax-- > 0)
- hash = c + (hash << 6) + (hash << 16) - hash;
-
- *pcch = (uintptr_t)pu8 - (uintptr_t)str - 1;
- return hash;
-}
-
-
/**
* Inserts a string into a unique string space.
*
diff --git a/src/VBox/Runtime/common/string/strstrip.cpp b/src/VBox/Runtime/common/string/strstrip.cpp
index 3f1b28096..909faebe5 100644
--- a/src/VBox/Runtime/common/string/strstrip.cpp
+++ b/src/VBox/Runtime/common/string/strstrip.cpp
@@ -1,4 +1,4 @@
-/* $Id: strstrip.cpp $ */
+/* $Id: strstrip.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - String Stripping and Trimming.
*/
diff --git a/src/VBox/Runtime/common/string/strtonum.cpp b/src/VBox/Runtime/common/string/strtonum.cpp
index 60285fd06..2c96e3db3 100644
--- a/src/VBox/Runtime/common/string/strtonum.cpp
+++ b/src/VBox/Runtime/common/string/strtonum.cpp
@@ -1,4 +1,4 @@
-/* $Id: strtonum.cpp $ */
+/* $Id: strtonum.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - String To Number Conversion.
*/
diff --git a/src/VBox/Runtime/common/string/strversion.cpp b/src/VBox/Runtime/common/string/strversion.cpp
index 7a93bc8d6..bab3a4c20 100644
--- a/src/VBox/Runtime/common/string/strversion.cpp
+++ b/src/VBox/Runtime/common/string/strversion.cpp
@@ -1,4 +1,4 @@
-/* $Id: strversion.cpp $ */
+/* $Id: strversion.cpp 35076 2010-12-14 13:31:41Z vboxsync $ */
/** @file
* IPRT - Version String Parsing.
*/
diff --git a/src/VBox/Runtime/common/string/uni.cpp b/src/VBox/Runtime/common/string/uni.cpp
index 1fe613ecb..1f84b533f 100644
--- a/src/VBox/Runtime/common/string/uni.cpp
+++ b/src/VBox/Runtime/common/string/uni.cpp
@@ -1,4 +1,4 @@
-/* $Id: uni.cpp $ */
+/* $Id: uni.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Unicode.
*/
diff --git a/src/VBox/Runtime/common/string/unidata.cpp b/src/VBox/Runtime/common/string/unidata.cpp
index ea5ce4edc..914a3f3f6 100644
--- a/src/VBox/Runtime/common/string/unidata.cpp
+++ b/src/VBox/Runtime/common/string/unidata.cpp
@@ -1,4 +1,4 @@
-/* $Id: unidata.cpp $ */
+/* $Id: unidata.cpp 33560 2010-10-28 14:25:30Z vboxsync $ */
/** @file
* IPRT - Unicode Tables
*
diff --git a/src/VBox/Runtime/common/string/uniread.cpp b/src/VBox/Runtime/common/string/uniread.cpp
index 6b7fd3bcf..02719fa5e 100644
--- a/src/VBox/Runtime/common/string/uniread.cpp
+++ b/src/VBox/Runtime/common/string/uniread.cpp
@@ -1,4 +1,4 @@
-/* $Id: uniread.cpp $ */
+/* $Id: uniread.cpp 33560 2010-10-28 14:25:30Z vboxsync $ */
/** @file
* IPRT - Unicode Specification Reader.
*/
diff --git a/src/VBox/Runtime/common/string/utf-16.cpp b/src/VBox/Runtime/common/string/utf-16.cpp
index f24e95b74..bf9d3cb3e 100644
--- a/src/VBox/Runtime/common/string/utf-16.cpp
+++ b/src/VBox/Runtime/common/string/utf-16.cpp
@@ -1,4 +1,4 @@
-/* $Id: utf-16.cpp $ */
+/* $Id: utf-16.cpp 31157 2010-07-28 03:15:35Z vboxsync $ */
/** @file
* IPRT - UTF-16.
*/
diff --git a/src/VBox/Runtime/common/string/utf-8-case.cpp b/src/VBox/Runtime/common/string/utf-8-case.cpp
index 7a0bf2ebb..71ea836d2 100644
--- a/src/VBox/Runtime/common/string/utf-8-case.cpp
+++ b/src/VBox/Runtime/common/string/utf-8-case.cpp
@@ -1,4 +1,4 @@
-/* $Id: utf-8-case.cpp $ */
+/* $Id: utf-8-case.cpp 33562 2010-10-28 14:38:50Z vboxsync $ */
/** @file
* IPRT - UTF-8 Case Sensitivity and Folding.
*/
diff --git a/src/VBox/Runtime/common/string/utf-8.cpp b/src/VBox/Runtime/common/string/utf-8.cpp
index 7f95ca999..537e45c66 100644
--- a/src/VBox/Runtime/common/string/utf-8.cpp
+++ b/src/VBox/Runtime/common/string/utf-8.cpp
@@ -1,4 +1,4 @@
-/* $Id: utf-8.cpp $ */
+/* $Id: utf-8.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - UTF-8 Decoding.
*/
@@ -51,7 +51,7 @@
* @param pcchActual Where to store the actual size of the UTF-8 string
* on success (cch = cb again). Optional.
*/
-int rtUtf8Length(const char *psz, size_t cch, size_t *pcuc, size_t *pcchActual)
+DECLHIDDEN(int) rtUtf8Length(const char *psz, size_t cch, size_t *pcuc, size_t *pcchActual)
{
const unsigned char *puch = (const unsigned char *)psz;
size_t cCodePoints = 0;
diff --git a/src/VBox/Runtime/common/table/avl_Base.cpp.h b/src/VBox/Runtime/common/table/avl_Base.cpp.h
index ff69772f1..1c9f0aa36 100644
--- a/src/VBox/Runtime/common/table/avl_Base.cpp.h
+++ b/src/VBox/Runtime/common/table/avl_Base.cpp.h
@@ -1,4 +1,4 @@
-/* $Id: avl_Base.cpp.h $ */
+/* $Id: avl_Base.cpp.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* kAVLBase - basic routines for all AVL trees.
*/
@@ -126,6 +126,12 @@
# define KAVL_R_IS_IDENTICAL(key1B, key2B, key1E, key2E) KAVL_E(key1B, key2B)
#endif
+/** @def KAVL_DECL
+ * Function declation macro in the RTDECL tradition.
+ * @param a_Type The function return type. */
+#ifndef KAVL_DECL
+# define KAVL_DECL(a_Type) RTDECL(a_Type)
+#endif
/*******************************************************************************
@@ -290,15 +296,15 @@ DECLINLINE(void) KAVL_FN(Rebalance)(PKAVLSTACK pStack)
* Fill in leaf node and insert it.
* Rebalance the tree.
*/
-RTDECL(bool) KAVL_FN(Insert)(PPKAVLNODECORE ppTree, PKAVLNODECORE pNode)
+KAVL_DECL(bool) KAVL_FN(Insert)(PPKAVLNODECORE ppTree, PKAVLNODECORE pNode)
{
KAVLSTACK AVLStack;
PPKAVLNODECORE ppCurNode = ppTree;
+ register PKAVLNODECORE pCurNode;
register KAVLKEY Key = pNode->Key; NOREF(Key);
#ifdef KAVL_RANGE
register KAVLKEY KeyLast = pNode->KeyLast; NOREF(KeyLast);
#endif
- register PKAVLNODECORE pCurNode;
AVLStack.cEntries = 0;
@@ -390,7 +396,7 @@ RTDECL(bool) KAVL_FN(Insert)(PPKAVLNODECORE ppTree, PKAVLNODECORE pNode)
* END
* return pointer to the removed node (if found).
*/
-RTDECL(PKAVLNODECORE) KAVL_FN(Remove)(PPKAVLNODECORE ppTree, KAVLKEY Key)
+KAVL_DECL(PKAVLNODECORE) KAVL_FN(Remove)(PPKAVLNODECORE ppTree, KAVLKEY Key)
{
KAVLSTACK AVLStack;
PPKAVLNODECORE ppDeleteNode = ppTree;
diff --git a/src/VBox/Runtime/common/table/avl_Destroy.cpp.h b/src/VBox/Runtime/common/table/avl_Destroy.cpp.h
index 0794d4aa1..9b255ca17 100644
--- a/src/VBox/Runtime/common/table/avl_Destroy.cpp.h
+++ b/src/VBox/Runtime/common/table/avl_Destroy.cpp.h
@@ -1,4 +1,4 @@
-/* $Id: avl_Destroy.cpp.h $ */
+/* $Id: avl_Destroy.cpp.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* kAVLDestroy - Walk the tree calling a callback to destroy all the nodes.
*/
@@ -40,7 +40,7 @@
* @param pfnCallBack Pointer to callback function.
* @param pvUser User parameter passed on to the callback function.
*/
-RTDECL(int) KAVL_FN(Destroy)(PPKAVLNODECORE ppTree, PKAVLCALLBACK pfnCallBack, void *pvUser)
+KAVL_DECL(int) KAVL_FN(Destroy)(PPKAVLNODECORE ppTree, PKAVLCALLBACK pfnCallBack, void *pvUser)
{
unsigned cEntries;
PKAVLNODECORE apEntries[KAVL_MAX_STACK];
diff --git a/src/VBox/Runtime/common/table/avl_DoWithAll.cpp.h b/src/VBox/Runtime/common/table/avl_DoWithAll.cpp.h
index ffc5ef582..233936803 100644
--- a/src/VBox/Runtime/common/table/avl_DoWithAll.cpp.h
+++ b/src/VBox/Runtime/common/table/avl_DoWithAll.cpp.h
@@ -1,4 +1,4 @@
-/* $Id: avl_DoWithAll.cpp.h $ */
+/* $Id: avl_DoWithAll.cpp.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* kAVLDoWithAll - Do with all nodes routine for AVL trees.
*/
@@ -37,7 +37,7 @@
* @param pfnCallBack Pointer to callback function.
* @param pvParam Userparameter passed on to the callback function.
*/
-RTDECL(int) KAVL_FN(DoWithAll)(PPKAVLNODECORE ppTree, int fFromLeft, PKAVLCALLBACK pfnCallBack, void * pvParam)
+KAVL_DECL(int) KAVL_FN(DoWithAll)(PPKAVLNODECORE ppTree, int fFromLeft, PKAVLCALLBACK pfnCallBack, void * pvParam)
{
KAVLSTACK2 AVLStack;
PKAVLNODECORE pNode;
diff --git a/src/VBox/Runtime/common/table/avl_Enum.cpp.h b/src/VBox/Runtime/common/table/avl_Enum.cpp.h
index b9a73092c..d29387bb8 100644
--- a/src/VBox/Runtime/common/table/avl_Enum.cpp.h
+++ b/src/VBox/Runtime/common/table/avl_Enum.cpp.h
@@ -1,4 +1,4 @@
-/* $Id: avl_Enum.cpp.h $ */
+/* $Id: avl_Enum.cpp.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* Enumeration routines for AVL trees.
*/
@@ -36,7 +36,7 @@
*
* @param ppTree Pointer to pointer to the tree root node.
*/
-RTDECL(PKAVLNODECORE) KAVL_FN(GetRoot)(PPKAVLNODECORE ppTree)
+KAVL_DECL(PKAVLNODECORE) KAVL_FN(GetRoot)(PPKAVLNODECORE ppTree)
{
return KAVL_GET_POINTER_NULL(ppTree);
}
@@ -50,7 +50,7 @@ RTDECL(PKAVLNODECORE) KAVL_FN(GetRoot)(PPKAVLNODECORE ppTree)
*
* @param pNode The current node.
*/
-RTDECL(PKAVLNODECORE) KAVL_FN(GetRight)(PKAVLNODECORE pNode)
+KAVL_DECL(PKAVLNODECORE) KAVL_FN(GetRight)(PKAVLNODECORE pNode)
{
if (pNode)
return KAVL_GET_POINTER_NULL(&pNode->pRight);
@@ -66,7 +66,7 @@ RTDECL(PKAVLNODECORE) KAVL_FN(GetRight)(PKAVLNODECORE pNode)
*
* @param pNode The current node.
*/
-RTDECL(PKAVLNODECORE) KAVL_FN(GetLeft)(PKAVLNODECORE pNode)
+KAVL_DECL(PKAVLNODECORE) KAVL_FN(GetLeft)(PKAVLNODECORE pNode)
{
if (pNode)
return KAVL_GET_POINTER_NULL(&pNode->pLeft);
@@ -83,7 +83,7 @@ RTDECL(PKAVLNODECORE) KAVL_FN(GetLeft)(PKAVLNODECORE pNode)
*
* @param pNode The current node.
*/
-RTDECL(PKAVLNODECORE) KAVL_FN(GetNextEqual)(PKAVLNODECORE pNode)
+KAVL_DECL(PKAVLNODECORE) KAVL_FN(GetNextEqual)(PKAVLNODECORE pNode)
{
if (pNode)
return KAVL_GET_POINTER_NULL(&pNode->pList);
diff --git a/src/VBox/Runtime/common/table/avl_Get.cpp.h b/src/VBox/Runtime/common/table/avl_Get.cpp.h
index ea8b66be0..3bb16a1ed 100644
--- a/src/VBox/Runtime/common/table/avl_Get.cpp.h
+++ b/src/VBox/Runtime/common/table/avl_Get.cpp.h
@@ -1,4 +1,4 @@
-/* $Id: avl_Get.cpp.h $ */
+/* $Id: avl_Get.cpp.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* kAVLGet - get routine for AVL trees.
*/
@@ -35,7 +35,7 @@
* @param Key Key value of the node which is to be found.
* @author knut st. osmundsen
*/
-RTDECL(PKAVLNODECORE) KAVL_FN(Get)(PPKAVLNODECORE ppTree, KAVLKEY Key)
+KAVL_DECL(PKAVLNODECORE) KAVL_FN(Get)(PPKAVLNODECORE ppTree, KAVLKEY Key)
{
register PKAVLNODECORE pNode = KAVL_GET_POINTER_NULL(ppTree);
diff --git a/src/VBox/Runtime/common/table/avl_GetBestFit.cpp.h b/src/VBox/Runtime/common/table/avl_GetBestFit.cpp.h
index 10fba6627..4b6ceb72d 100644
--- a/src/VBox/Runtime/common/table/avl_GetBestFit.cpp.h
+++ b/src/VBox/Runtime/common/table/avl_GetBestFit.cpp.h
@@ -1,4 +1,4 @@
-/* $Id: avl_GetBestFit.cpp.h $ */
+/* $Id: avl_GetBestFit.cpp.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* kAVLGetBestFit - Get Best Fit routine for AVL trees.
* Intended specially on heaps. The tree should allow duplicate keys.
@@ -41,7 +41,7 @@
* >= (above): The node where you last turned left.
* <= (below): the node where you last turned right.
*/
-RTDECL(PKAVLNODECORE) KAVL_FN(GetBestFit)(PPKAVLNODECORE ppTree, KAVLKEY Key, bool fAbove)
+KAVL_DECL(PKAVLNODECORE) KAVL_FN(GetBestFit)(PPKAVLNODECORE ppTree, KAVLKEY Key, bool fAbove)
{
register PKAVLNODECORE pNode = KAVL_GET_POINTER_NULL(ppTree);
if (pNode)
diff --git a/src/VBox/Runtime/common/table/avl_Range.cpp.h b/src/VBox/Runtime/common/table/avl_Range.cpp.h
index dcdffea31..fc658838c 100644
--- a/src/VBox/Runtime/common/table/avl_Range.cpp.h
+++ b/src/VBox/Runtime/common/table/avl_Range.cpp.h
@@ -1,4 +1,4 @@
-/* $Id: avl_Range.cpp.h $ */
+/* $Id: avl_Range.cpp.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* kAVLRange - Range routines for AVL trees.
*/
@@ -35,7 +35,7 @@
* @param ppTree Pointer to Pointer to the tree root node.
* @param Key The Key to find matching range for.
*/
-RTDECL(PKAVLNODECORE) KAVL_FN(RangeGet)(PPKAVLNODECORE ppTree, register KAVLKEY Key)
+KAVL_DECL(PKAVLNODECORE) KAVL_FN(RangeGet)(PPKAVLNODECORE ppTree, register KAVLKEY Key)
{
register PKAVLNODECORE pNode = KAVL_GET_POINTER_NULL(ppTree);
if (pNode)
diff --git a/src/VBox/Runtime/common/table/avl_RemoveBestFit.cpp.h b/src/VBox/Runtime/common/table/avl_RemoveBestFit.cpp.h
index 26d5a470f..30e11c15c 100644
--- a/src/VBox/Runtime/common/table/avl_RemoveBestFit.cpp.h
+++ b/src/VBox/Runtime/common/table/avl_RemoveBestFit.cpp.h
@@ -1,4 +1,4 @@
-/* $Id: avl_RemoveBestFit.cpp.h $ */
+/* $Id: avl_RemoveBestFit.cpp.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* kAVLRemoveBestFit - Remove Best Fit routine for AVL trees.
* Intended specially on heaps. The tree should allow duplicate keys.
@@ -43,7 +43,7 @@
* <= (below): the node where you last turned right.
* @remark This implementation should be speeded up slightly!
*/
-RTDECL(PKAVLNODECORE) KAVL_FN(RemoveBestFit)(PPKAVLNODECORE ppTree, KAVLKEY Key, bool fAbove)
+KAVL_DECL(PKAVLNODECORE) KAVL_FN(RemoveBestFit)(PPKAVLNODECORE ppTree, KAVLKEY Key, bool fAbove)
{
/*
* If we find anything we'll have to remove the node and return it.
diff --git a/src/VBox/Runtime/common/table/avlgcphys.cpp b/src/VBox/Runtime/common/table/avlgcphys.cpp
index 7f8566b12..c4f258165 100644
--- a/src/VBox/Runtime/common/table/avlgcphys.cpp
+++ b/src/VBox/Runtime/common/table/avlgcphys.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlgcphys.cpp $ */
+/* $Id: avlgcphys.cpp 32284 2010-09-07 12:29:14Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTGCPHYS, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avlgcptr.cpp b/src/VBox/Runtime/common/table/avlgcptr.cpp
index 426668609..f1e184493 100644
--- a/src/VBox/Runtime/common/table/avlgcptr.cpp
+++ b/src/VBox/Runtime/common/table/avlgcptr.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlgcptr.cpp $ */
+/* $Id: avlgcptr.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTGCPTR, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avlhcphys.cpp b/src/VBox/Runtime/common/table/avlhcphys.cpp
index 499c55534..f41088b52 100644
--- a/src/VBox/Runtime/common/table/avlhcphys.cpp
+++ b/src/VBox/Runtime/common/table/avlhcphys.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlhcphys.cpp $ */
+/* $Id: avlhcphys.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTHCPHYS, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avllu32.cpp b/src/VBox/Runtime/common/table/avllu32.cpp
index 587a5feb3..afc7a8fbf 100644
--- a/src/VBox/Runtime/common/table/avllu32.cpp
+++ b/src/VBox/Runtime/common/table/avllu32.cpp
@@ -1,4 +1,4 @@
-/* $Id: avllu32.cpp $ */
+/* $Id: avllu32.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, uint32_t, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avlogcphys.cpp b/src/VBox/Runtime/common/table/avlogcphys.cpp
index 01cb5f0ef..fc83a1fbb 100644
--- a/src/VBox/Runtime/common/table/avlogcphys.cpp
+++ b/src/VBox/Runtime/common/table/avlogcphys.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlogcphys.cpp $ */
+/* $Id: avlogcphys.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTGCPHYS, unique keys, offset pointers.
*/
diff --git a/src/VBox/Runtime/common/table/avlogcptr.cpp b/src/VBox/Runtime/common/table/avlogcptr.cpp
index 6602c3097..27f7c5b5f 100644
--- a/src/VBox/Runtime/common/table/avlogcptr.cpp
+++ b/src/VBox/Runtime/common/table/avlogcptr.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlogcptr.cpp $ */
+/* $Id: avlogcptr.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTGCPTR, unique keys, offset pointers.
*/
diff --git a/src/VBox/Runtime/common/table/avlohcphys.cpp b/src/VBox/Runtime/common/table/avlohcphys.cpp
index 9f6dabae7..d3c273553 100644
--- a/src/VBox/Runtime/common/table/avlohcphys.cpp
+++ b/src/VBox/Runtime/common/table/avlohcphys.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlohcphys.cpp $ */
+/* $Id: avlohcphys.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTHCPHYS, unique keys, offset pointers.
*/
diff --git a/src/VBox/Runtime/common/table/avloioport.cpp b/src/VBox/Runtime/common/table/avloioport.cpp
index 38aa69066..4ff60d870 100644
--- a/src/VBox/Runtime/common/table/avloioport.cpp
+++ b/src/VBox/Runtime/common/table/avloioport.cpp
@@ -1,4 +1,4 @@
-/* $Id: avloioport.cpp $ */
+/* $Id: avloioport.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTIOPORT, unique keys, offset pointers.
*/
diff --git a/src/VBox/Runtime/common/table/avlou32.cpp b/src/VBox/Runtime/common/table/avlou32.cpp
index c01cafa1e..3882a5d0d 100644
--- a/src/VBox/Runtime/common/table/avlou32.cpp
+++ b/src/VBox/Runtime/common/table/avlou32.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlou32.cpp $ */
+/* $Id: avlou32.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, uint_32, unique keys, offset pointers.
*/
diff --git a/src/VBox/Runtime/common/table/avlpv.cpp b/src/VBox/Runtime/common/table/avlpv.cpp
index c30680700..a5f82b9d3 100644
--- a/src/VBox/Runtime/common/table/avlpv.cpp
+++ b/src/VBox/Runtime/common/table/avlpv.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlpv.cpp $ */
+/* $Id: avlpv.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, void *, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avlrfoff.cpp b/src/VBox/Runtime/common/table/avlrfoff.cpp
index dd6391b62..7c9da3b87 100644
--- a/src/VBox/Runtime/common/table/avlrfoff.cpp
+++ b/src/VBox/Runtime/common/table/avlrfoff.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlrfoff.cpp $ */
+/* $Id: avlrfoff.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTFOFF, range, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avlrgcptr.cpp b/src/VBox/Runtime/common/table/avlrgcptr.cpp
index 4ea64fd2d..aa1c8b380 100644
--- a/src/VBox/Runtime/common/table/avlrgcptr.cpp
+++ b/src/VBox/Runtime/common/table/avlrgcptr.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlrgcptr.cpp $ */
+/* $Id: avlrgcptr.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTGCPTR, range, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avlrogcphys.cpp b/src/VBox/Runtime/common/table/avlrogcphys.cpp
index f52acdbb2..eb19638e3 100644
--- a/src/VBox/Runtime/common/table/avlrogcphys.cpp
+++ b/src/VBox/Runtime/common/table/avlrogcphys.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlrogcphys.cpp $ */
+/* $Id: avlrogcphys.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTGCPHYS, range, unique keys, offset pointers.
*/
diff --git a/src/VBox/Runtime/common/table/avlrogcptr.cpp b/src/VBox/Runtime/common/table/avlrogcptr.cpp
index 2f4559473..783923815 100644
--- a/src/VBox/Runtime/common/table/avlrogcptr.cpp
+++ b/src/VBox/Runtime/common/table/avlrogcptr.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlrogcptr.cpp $ */
+/* $Id: avlrogcptr.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTGCPTR, range, unique keys, offset pointers.
*/
diff --git a/src/VBox/Runtime/common/table/avlroioport.cpp b/src/VBox/Runtime/common/table/avlroioport.cpp
index 9aa583411..b07e035c6 100644
--- a/src/VBox/Runtime/common/table/avlroioport.cpp
+++ b/src/VBox/Runtime/common/table/avlroioport.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlroioport.cpp $ */
+/* $Id: avlroioport.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTIOPORT, range, unique keys, offset pointers.
*/
diff --git a/src/VBox/Runtime/common/table/avlroogcptr.cpp b/src/VBox/Runtime/common/table/avlroogcptr.cpp
index 6c425d5b5..8b449f6a8 100644
--- a/src/VBox/Runtime/common/table/avlroogcptr.cpp
+++ b/src/VBox/Runtime/common/table/avlroogcptr.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlroogcptr.cpp $ */
+/* $Id: avlroogcptr.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTGCPTR, range, unique keys, overlapping ranges, offset pointers.
*/
diff --git a/src/VBox/Runtime/common/table/avlrpv.cpp b/src/VBox/Runtime/common/table/avlrpv.cpp
index f7e00339f..817dd3822 100644
--- a/src/VBox/Runtime/common/table/avlrpv.cpp
+++ b/src/VBox/Runtime/common/table/avlrpv.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlrpv.cpp $ */
+/* $Id: avlrpv.cpp 33268 2010-10-20 15:37:15Z vboxsync $ */
/** @file
* IPRT - AVL tree, void *, range, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avlru64.cpp b/src/VBox/Runtime/common/table/avlru64.cpp
index a7476ea5d..b562e9466 100644
--- a/src/VBox/Runtime/common/table/avlru64.cpp
+++ b/src/VBox/Runtime/common/table/avlru64.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlru64.cpp $ */
+/* $Id: avlru64.cpp 34218 2010-11-21 17:00:38Z vboxsync $ */
/** @file
* IPRT - AVL tree, void *, range, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avlruintptr.cpp b/src/VBox/Runtime/common/table/avlruintptr.cpp
index c267284a9..b9b8bc2cb 100644
--- a/src/VBox/Runtime/common/table/avlruintptr.cpp
+++ b/src/VBox/Runtime/common/table/avlruintptr.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlruintptr.cpp $ */
+/* $Id: avlruintptr.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTUINTPTR, range, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avlu32.cpp b/src/VBox/Runtime/common/table/avlu32.cpp
index 3bf1283b5..63420e65d 100644
--- a/src/VBox/Runtime/common/table/avlu32.cpp
+++ b/src/VBox/Runtime/common/table/avlu32.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlu32.cpp $ */
+/* $Id: avlu32.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, uint32_t, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avluintptr.cpp b/src/VBox/Runtime/common/table/avluintptr.cpp
index 08d3eb455..96e2b56a3 100644
--- a/src/VBox/Runtime/common/table/avluintptr.cpp
+++ b/src/VBox/Runtime/common/table/avluintptr.cpp
@@ -1,4 +1,4 @@
-/* $Id: avluintptr.cpp $ */
+/* $Id: avluintptr.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTUINTPTR, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/avlul.cpp b/src/VBox/Runtime/common/table/avlul.cpp
index 62b94f97e..644c23d58 100644
--- a/src/VBox/Runtime/common/table/avlul.cpp
+++ b/src/VBox/Runtime/common/table/avlul.cpp
@@ -1,4 +1,4 @@
-/* $Id: avlul.cpp $ */
+/* $Id: avlul.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, unsigned long, unique keys.
*/
diff --git a/src/VBox/Runtime/common/table/table.cpp b/src/VBox/Runtime/common/table/table.cpp
index b2d7c8b03..a649cb395 100644
--- a/src/VBox/Runtime/common/table/table.cpp
+++ b/src/VBox/Runtime/common/table/table.cpp
@@ -1,4 +1,4 @@
-/* $Id: table.cpp $ */
+/* $Id: table.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - AVL tree, RTHCPHYS, unique keys.
*/
diff --git a/src/VBox/Runtime/common/time/time.cpp b/src/VBox/Runtime/common/time/time.cpp
index 6a04c4216..3a4e7b6bc 100644
--- a/src/VBox/Runtime/common/time/time.cpp
+++ b/src/VBox/Runtime/common/time/time.cpp
@@ -1,4 +1,4 @@
-/* $Id: time.cpp $ */
+/* $Id: time.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Time.
*/
@@ -419,7 +419,7 @@ RT_EXPORT_SYMBOL(RTTimeImplode);
* Internal worker for RTTimeNormalize and RTTimeLocalNormalize.
* It doesn't adjust the UCT offset but leaves that for RTTimeLocalNormalize.
*/
-PRTTIME rtTimeNormalizeInternal(PRTTIME pTime)
+static PRTTIME rtTimeNormalizeInternal(PRTTIME pTime)
{
unsigned uSecond;
unsigned uMinute;
diff --git a/src/VBox/Runtime/common/time/timeprog.cpp b/src/VBox/Runtime/common/time/timeprog.cpp
index 61571d534..c6bdd2380 100644
--- a/src/VBox/Runtime/common/time/timeprog.cpp
+++ b/src/VBox/Runtime/common/time/timeprog.cpp
@@ -1,4 +1,4 @@
-/* $Id: timeprog.cpp $ */
+/* $Id: timeprog.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Time Relative to Program Start.
*/
diff --git a/src/VBox/Runtime/common/time/timesup.cpp b/src/VBox/Runtime/common/time/timesup.cpp
index 197294462..90d659ab7 100644
--- a/src/VBox/Runtime/common/time/timesup.cpp
+++ b/src/VBox/Runtime/common/time/timesup.cpp
@@ -1,4 +1,4 @@
-/* $Id: timesup.cpp $ */
+/* $Id: timesup.cpp 37955 2011-07-14 12:23:02Z vboxsync $ */
/** @file
* IPRT - Time using SUPLib.
*/
@@ -38,8 +38,8 @@
#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
# include <iprt/asm.h>
# include <iprt/asm-amd64-x86.h>
+# include <iprt/x86.h>
# include <VBox/sup.h>
-# include <VBox/x86.h>
#endif
#include "internal/time.h"
diff --git a/src/VBox/Runtime/common/time/timesupA.asm b/src/VBox/Runtime/common/time/timesupA.asm
index 9c0449304..c5360fb2e 100644
--- a/src/VBox/Runtime/common/time/timesupA.asm
+++ b/src/VBox/Runtime/common/time/timesupA.asm
@@ -1,4 +1,4 @@
-; $Id: timesupA.asm $
+; $Id: timesupA.asm 28800 2010-04-27 08:22:32Z vboxsync $
;; @file
; IPRT - Time using SUPLib, the Assembly Implementation.
;
diff --git a/src/VBox/Runtime/common/time/timesupA.mac b/src/VBox/Runtime/common/time/timesupA.mac
index b146c5a6e..2fc22038c 100644
--- a/src/VBox/Runtime/common/time/timesupA.mac
+++ b/src/VBox/Runtime/common/time/timesupA.mac
@@ -1,4 +1,4 @@
-; $Id: timesupA.mac $
+; $Id: timesupA.mac 36262 2011-03-11 14:50:45Z vboxsync $
;; @file
; IPRT - Time using SUPLib, the Assembly Code Template.
;
diff --git a/src/VBox/Runtime/common/time/timesupref.cpp b/src/VBox/Runtime/common/time/timesupref.cpp
index 12c9bb350..04f68f259 100644
--- a/src/VBox/Runtime/common/time/timesupref.cpp
+++ b/src/VBox/Runtime/common/time/timesupref.cpp
@@ -1,4 +1,4 @@
-/* $Id: timesupref.cpp $ */
+/* $Id: timesupref.cpp 29267 2010-05-09 21:21:36Z vboxsync $ */
/** @file
* IPRT - Time using SUPLib, the C Implementation.
*/
diff --git a/src/VBox/Runtime/common/time/timesupref.h b/src/VBox/Runtime/common/time/timesupref.h
index e7b345132..8aa2beac4 100644
--- a/src/VBox/Runtime/common/time/timesupref.h
+++ b/src/VBox/Runtime/common/time/timesupref.h
@@ -1,4 +1,4 @@
-/* $Id: timesupref.h $ */
+/* $Id: timesupref.h 36262 2011-03-11 14:50:45Z vboxsync $ */
/** @file
* IPRT - Time using SUPLib, the C Code Template.
*/
diff --git a/src/VBox/Runtime/common/time/timesysalias.cpp b/src/VBox/Runtime/common/time/timesysalias.cpp
index 37f65d392..c3f91dcf8 100644
--- a/src/VBox/Runtime/common/time/timesysalias.cpp
+++ b/src/VBox/Runtime/common/time/timesysalias.cpp
@@ -1,4 +1,4 @@
-/* $Id: timesysalias.cpp $ */
+/* $Id: timesysalias.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Time using RTTimeSystem*.
*/
diff --git a/src/VBox/Runtime/common/vfs/vfsbase.cpp b/src/VBox/Runtime/common/vfs/vfsbase.cpp
index cc8cf3198..9c0abf5c5 100644
--- a/src/VBox/Runtime/common/vfs/vfsbase.cpp
+++ b/src/VBox/Runtime/common/vfs/vfsbase.cpp
@@ -1,4 +1,4 @@
-/* $Id: vfsbase.cpp $ */
+/* $Id: vfsbase.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - Virtual File System, Base.
*/
@@ -2297,7 +2297,7 @@ RTDECL(int) RTVfsNewFile(PCRTVFSFILEOPS pFileOps, size_t cbInstance, uint32_t fO
}
-RTDECL(int) RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint32_t fOpen, PRTVFSFILE phVfsFile)
+RTDECL(int) RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint64_t fOpen, PRTVFSFILE phVfsFile)
{
/*
* Validate input.
diff --git a/src/VBox/Runtime/common/vfs/vfschain.cpp b/src/VBox/Runtime/common/vfs/vfschain.cpp
index 1a7b37e20..1afbbad91 100644
--- a/src/VBox/Runtime/common/vfs/vfschain.cpp
+++ b/src/VBox/Runtime/common/vfs/vfschain.cpp
@@ -1,4 +1,4 @@
-/* $Id: vfschain.cpp $ */
+/* $Id: vfschain.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - Virtual File System, Chains.
*/
@@ -562,7 +562,7 @@ RTDECL(int) RTVfsChainElementDeregisterProvider(PRTVFSCHAINELEMENTREG pRegRec, b
}
-RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint32_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError)
+RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint64_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError)
{
AssertPtrReturn(pszSpec, VERR_INVALID_POINTER);
AssertReturn(*pszSpec != '\0', VERR_INVALID_PARAMETER);
@@ -609,7 +609,7 @@ RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint32_t fOpen, PRTVFSFILE p
}
-RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint32_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError)
+RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint64_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError)
{
AssertPtrReturn(pszSpec, VERR_INVALID_POINTER);
AssertReturn(*pszSpec != '\0', VERR_INVALID_PARAMETER);
diff --git a/src/VBox/Runtime/common/vfs/vfsiosmisc.cpp b/src/VBox/Runtime/common/vfs/vfsiosmisc.cpp
index fb9043c09..f7d88c154 100644
--- a/src/VBox/Runtime/common/vfs/vfsiosmisc.cpp
+++ b/src/VBox/Runtime/common/vfs/vfsiosmisc.cpp
@@ -1,4 +1,4 @@
-/* $Id: vfsiosmisc.cpp $ */
+/* $Id: vfsiosmisc.cpp 34967 2010-12-10 17:52:01Z vboxsync $ */
/** @file
* IPRT - Virtual File System, Misc I/O Stream Operations.
*/
diff --git a/src/VBox/Runtime/common/vfs/vfsmemory.cpp b/src/VBox/Runtime/common/vfs/vfsmemory.cpp
index 05b410c4f..82333fbce 100644
--- a/src/VBox/Runtime/common/vfs/vfsmemory.cpp
+++ b/src/VBox/Runtime/common/vfs/vfsmemory.cpp
@@ -1,4 +1,4 @@
-/* $Id: vfsmemory.cpp $ */
+/* $Id: vfsmemory.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Virtual File System, Memory Backed VFS.
*/
@@ -694,7 +694,7 @@ static DECLCALLBACK(int) rtVfsMemFile_QuerySize(void *pvThis, uint64_t *pcbFile)
/**
* Standard file operations.
*/
-DECLHIDDEN(const RTVFSFILEOPS) g_rtVfsStdFileOps =
+DECL_HIDDEN_CONST(const RTVFSFILEOPS) g_rtVfsStdFileOps =
{
{ /* Stream */
{ /* Obj */
diff --git a/src/VBox/Runtime/common/vfs/vfsmisc.cpp b/src/VBox/Runtime/common/vfs/vfsmisc.cpp
index 7fee96945..b50b7c590 100644
--- a/src/VBox/Runtime/common/vfs/vfsmisc.cpp
+++ b/src/VBox/Runtime/common/vfs/vfsmisc.cpp
@@ -1,4 +1,4 @@
-/* $Id: vfsmisc.cpp $ */
+/* $Id: vfsmisc.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - Virtual File System, Misc functions with heavy dependencies.
*/
@@ -38,7 +38,7 @@
-RTDECL(int) RTVfsIoStrmFromStdHandle(RTHANDLESTD enmStdHandle, uint32_t fOpen, bool fLeaveOpen,
+RTDECL(int) RTVfsIoStrmFromStdHandle(RTHANDLESTD enmStdHandle, uint64_t fOpen, bool fLeaveOpen,
PRTVFSIOSTREAM phVfsIos)
{
/*
diff --git a/src/VBox/Runtime/common/vfs/vfsstdfile.cpp b/src/VBox/Runtime/common/vfs/vfsstdfile.cpp
index 29afc485c..070b96d4c 100644
--- a/src/VBox/Runtime/common/vfs/vfsstdfile.cpp
+++ b/src/VBox/Runtime/common/vfs/vfsstdfile.cpp
@@ -1,4 +1,4 @@
-/* $Id: vfsstdfile.cpp $ */
+/* $Id: vfsstdfile.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - Virtual File System, Standard File Implementation.
*/
@@ -380,7 +380,7 @@ static DECLCALLBACK(int) rtVfsStdFile_QuerySize(void *pvThis, uint64_t *pcbFile)
/**
* Standard file operations.
*/
-DECLHIDDEN(const RTVFSFILEOPS) g_rtVfsStdFileOps =
+DECL_HIDDEN_CONST(const RTVFSFILEOPS) g_rtVfsStdFileOps =
{
{ /* Stream */
{ /* Obj */
@@ -418,7 +418,7 @@ DECLHIDDEN(const RTVFSFILEOPS) g_rtVfsStdFileOps =
};
-RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile)
+RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint64_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile)
{
/*
* Check the handle validity.
@@ -450,7 +450,7 @@ RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, P
}
-RTDECL(int) RTVfsIoStrmFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos)
+RTDECL(int) RTVfsIoStrmFromRTFile(RTFILE hFile, uint64_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos)
{
RTVFSFILE hVfsFile;
int rc = RTVfsFileFromRTFile(hFile, fOpen, fLeaveOpen, &hVfsFile);
diff --git a/src/VBox/Runtime/common/zip/gzipvfs.cpp b/src/VBox/Runtime/common/zip/gzipvfs.cpp
index e680fae0e..33cb16f0b 100644
--- a/src/VBox/Runtime/common/zip/gzipvfs.cpp
+++ b/src/VBox/Runtime/common/zip/gzipvfs.cpp
@@ -1,4 +1,4 @@
-/* $Id: gzipvfs.cpp $ */
+/* $Id: gzipvfs.cpp 34049 2010-11-13 01:31:07Z vboxsync $ */
/** @file
* IPRT - GZIP Compressor and Decompressor I/O Stream.
*/
diff --git a/src/VBox/Runtime/common/zip/tar.cpp b/src/VBox/Runtime/common/zip/tar.cpp
index 9e1a351f4..d59dcb963 100644
--- a/src/VBox/Runtime/common/zip/tar.cpp
+++ b/src/VBox/Runtime/common/zip/tar.cpp
@@ -1,4 +1,4 @@
-/* $Id: tar.cpp $ */
+/* $Id: tar.cpp 35351 2010-12-27 17:04:17Z vboxsync $ */
/** @file
* IPRT - Tar archive I/O.
*/
diff --git a/src/VBox/Runtime/common/zip/tar.h b/src/VBox/Runtime/common/zip/tar.h
index 4e1be2586..3876300b8 100644
--- a/src/VBox/Runtime/common/zip/tar.h
+++ b/src/VBox/Runtime/common/zip/tar.h
@@ -1,4 +1,4 @@
-/* $Id: tar.h $ */
+/* $Id: tar.h 34179 2010-11-18 15:49:17Z vboxsync $ */
/** @file
* IPRT - TAR Virtual Filesystem.
*/
diff --git a/src/VBox/Runtime/common/zip/tarcmd.cpp b/src/VBox/Runtime/common/zip/tarcmd.cpp
index 6e7f84a99..45a104731 100644
--- a/src/VBox/Runtime/common/zip/tarcmd.cpp
+++ b/src/VBox/Runtime/common/zip/tarcmd.cpp
@@ -1,4 +1,4 @@
-/* $Id: tarcmd.cpp $ */
+/* $Id: tarcmd.cpp 35351 2010-12-27 17:04:17Z vboxsync $ */
/** @file
* IPRT - TAR Command.
*/
diff --git a/src/VBox/Runtime/common/zip/tarvfs.cpp b/src/VBox/Runtime/common/zip/tarvfs.cpp
index ccff3b208..26a350a45 100644
--- a/src/VBox/Runtime/common/zip/tarvfs.cpp
+++ b/src/VBox/Runtime/common/zip/tarvfs.cpp
@@ -1,4 +1,4 @@
-/* $Id: tarvfs.cpp $ */
+/* $Id: tarvfs.cpp 34928 2010-12-09 22:54:17Z vboxsync $ */
/** @file
* IPRT - TAR Virtual Filesystem.
*/
diff --git a/src/VBox/Runtime/common/zip/zip.cpp b/src/VBox/Runtime/common/zip/zip.cpp
index dde89825d..7b9d34acb 100644
--- a/src/VBox/Runtime/common/zip/zip.cpp
+++ b/src/VBox/Runtime/common/zip/zip.cpp
@@ -1,4 +1,4 @@
-/* $Id: zip.cpp $ */
+/* $Id: zip.cpp 33982 2010-11-11 12:37:18Z vboxsync $ */
/** @file
* IPRT - Compression.
*/
diff --git a/src/VBox/Runtime/darwin/RTErrConvertFromDarwin.cpp b/src/VBox/Runtime/darwin/RTErrConvertFromDarwin.cpp
index 082edf8bb..ae3de0b8d 100644
--- a/src/VBox/Runtime/darwin/RTErrConvertFromDarwin.cpp
+++ b/src/VBox/Runtime/darwin/RTErrConvertFromDarwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTErrConvertFromDarwin.cpp $ */
+/* $Id: RTErrConvertFromDarwin.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Convert Darwin Mach returns codes to iprt status codes.
*/
diff --git a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinCOM.cpp b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinCOM.cpp
index 19663e7d5..5a2828cfd 100644
--- a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinCOM.cpp
+++ b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinCOM.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTErrConvertFromDarwinCOM.cpp $ */
+/* $Id: RTErrConvertFromDarwinCOM.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Convert Darwin COM returns codes to iprt status codes.
*/
diff --git a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinIO.cpp b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinIO.cpp
index 2bf4fe7da..f5d14bd1e 100644
--- a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinIO.cpp
+++ b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinIO.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTErrConvertFromDarwinIO.cpp $ */
+/* $Id: RTErrConvertFromDarwinIO.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Convert Darwin IOKit returns codes to iprt status codes.
*/
diff --git a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinKern.cpp b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinKern.cpp
index caeceb245..48d3fc1c2 100644
--- a/src/VBox/Runtime/darwin/RTErrConvertFromDarwinKern.cpp
+++ b/src/VBox/Runtime/darwin/RTErrConvertFromDarwinKern.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTErrConvertFromDarwinKern.cpp $ */
+/* $Id: RTErrConvertFromDarwinKern.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Convert Darwin Mach returns codes to iprt status codes.
*/
diff --git a/src/VBox/Runtime/gc/initterm-gc.cpp b/src/VBox/Runtime/gc/initterm-gc.cpp
index b35ca578b..4210e5049 100644
--- a/src/VBox/Runtime/gc/initterm-gc.cpp
+++ b/src/VBox/Runtime/gc/initterm-gc.cpp
@@ -1,4 +1,4 @@
-/* $Id: initterm-gc.cpp $ */
+/* $Id: initterm-gc.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Init Raw-mode Context.
*/
diff --git a/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp b/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp
index 52ea2eef2..b5d54e39e 100644
--- a/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp
+++ b/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTAssertShouldPanic-generic.cpp $ */
+/* $Id: RTAssertShouldPanic-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Assertions, generic RTAssertShouldPanic.
*/
diff --git a/src/VBox/Runtime/generic/RTDirCreateTemp-generic.cpp b/src/VBox/Runtime/generic/RTDirCreateTemp-generic.cpp
index 82214b4fe..afb9aea46 100644
--- a/src/VBox/Runtime/generic/RTDirCreateTemp-generic.cpp
+++ b/src/VBox/Runtime/generic/RTDirCreateTemp-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTDirCreateTemp-generic.cpp $ */
+/* $Id: RTDirCreateTemp-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTDirCreateTemp, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTDirCreateUniqueNumbered-generic.cpp b/src/VBox/Runtime/generic/RTDirCreateUniqueNumbered-generic.cpp
new file mode 100644
index 000000000..7a9c378b5
--- /dev/null
+++ b/src/VBox/Runtime/generic/RTDirCreateUniqueNumbered-generic.cpp
@@ -0,0 +1,102 @@
+/* $Id: RTDirCreateUniqueNumbered-generic.cpp 36604 2011-04-06 23:02:52Z vboxsync $ */
+/** @file
+ * IPRT - RTDirCreateUniqueNumbered, generic implementation.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/dir.h>
+#include "internal/iprt.h"
+
+#include <iprt/assert.h>
+#include <iprt/err.h>
+#include <iprt/path.h>
+#include <iprt/string.h>
+
+
+RTDECL(int) RTDirCreateUniqueNumbered(char *pszPath, size_t cbSize, RTFMODE fMode, signed int cchDigits, char chSep)
+{
+ /*
+ * Validate input.
+ */
+ AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
+ AssertReturn(cbSize, VERR_BUFFER_OVERFLOW);
+ AssertReturn(cchDigits > 0, VERR_INVALID_PARAMETER);
+
+ /* Check that there is sufficient space. */
+ char *pszEnd = RTStrEnd(pszPath, cbSize);
+ AssertReturn(pszEnd, VERR_BUFFER_OVERFLOW);
+ AssertReturn(cbSize - 1 - (pszEnd - pszPath) >= (size_t)cchDigits + (chSep ? 1 : 0), VERR_BUFFER_OVERFLOW);
+ size_t cbLeft = cbSize - (pszEnd - pszPath);
+
+ /* First try is to create the path without any numbers. */
+ int rc = RTDirCreate(pszPath, fMode);
+ if ( RT_SUCCESS(rc)
+ || rc != VERR_ALREADY_EXISTS)
+ return rc;
+
+ /* If the separator value isn't zero, add it. */
+ if (chSep != '\0')
+ {
+ cbLeft--;
+ *pszEnd++ = chSep;
+ *pszEnd = '\0';
+ }
+
+ /* How many tries? Stay within somewhat sane limits. */
+ uint32_t cMaxTries;
+ if (cchDigits >= 8)
+ cMaxTries = 100 * _1M;
+ else
+ {
+ cMaxTries = 10;
+ for (int a = 0; a < cchDigits - 1; ++a)
+ cMaxTries *= 10;
+ }
+
+ /* Try cMaxTries - 1 times to create a directory with appended numbers. */
+ uint32_t i = 1;
+ while (i < cMaxTries)
+ {
+ /* Format the number with leading zero's. */
+ ssize_t rc2 = RTStrFormatU32(pszEnd, cbLeft, i, 10, cchDigits, 0, RTSTR_F_WIDTH | RTSTR_F_ZEROPAD);
+ if (RT_FAILURE((int) rc2))
+ {
+ *pszPath = '\0';
+ return (int)rc2;
+ }
+ rc = RTDirCreate(pszPath, fMode);
+ if (RT_SUCCESS(rc))
+ return rc;
+ ++i;
+ }
+
+ /* We've given up. */
+ *pszPath = '\0';
+ return VERR_ALREADY_EXISTS;
+}
+RT_EXPORT_SYMBOL(RTDirCreateUniqueNumbered);
+
diff --git a/src/VBox/Runtime/generic/RTDirExists-generic.cpp b/src/VBox/Runtime/generic/RTDirExists-generic.cpp
index 0b5f04a98..f3a4fc1e0 100644
--- a/src/VBox/Runtime/generic/RTDirExists-generic.cpp
+++ b/src/VBox/Runtime/generic/RTDirExists-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTDirExists-generic.cpp $ */
+/* $Id: RTDirExists-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTDirExists, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTDirQueryInfo-generic.cpp b/src/VBox/Runtime/generic/RTDirQueryInfo-generic.cpp
index a01a8d80d..60c2174a8 100644
--- a/src/VBox/Runtime/generic/RTDirQueryInfo-generic.cpp
+++ b/src/VBox/Runtime/generic/RTDirQueryInfo-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTDirQueryInfo-generic.cpp $ */
+/* $Id: RTDirQueryInfo-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTDirQueryInfo, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTDirSetTimes-generic.cpp b/src/VBox/Runtime/generic/RTDirSetTimes-generic.cpp
index b5b781e24..019c61f83 100644
--- a/src/VBox/Runtime/generic/RTDirSetTimes-generic.cpp
+++ b/src/VBox/Runtime/generic/RTDirSetTimes-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTDirSetTimes-generic.cpp $ */
+/* $Id: RTDirSetTimes-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTDirSetTimes, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTEnvDupEx-generic.cpp b/src/VBox/Runtime/generic/RTEnvDupEx-generic.cpp
index 5320cc5f0..c101ca7ed 100644
--- a/src/VBox/Runtime/generic/RTEnvDupEx-generic.cpp
+++ b/src/VBox/Runtime/generic/RTEnvDupEx-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTEnvDupEx-generic.cpp $ */
+/* $Id: RTEnvDupEx-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Environment, RTEnvDupEx, generic.
*/
diff --git a/src/VBox/Runtime/generic/RTFileCopy-generic.cpp b/src/VBox/Runtime/generic/RTFileCopy-generic.cpp
index ea55290cf..b19fb6c88 100644
--- a/src/VBox/Runtime/generic/RTFileCopy-generic.cpp
+++ b/src/VBox/Runtime/generic/RTFileCopy-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileCopy-generic.cpp $ */
+/* $Id: RTFileCopy-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTFileCopy, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTFileExists-generic.cpp b/src/VBox/Runtime/generic/RTFileExists-generic.cpp
index f81988165..5c8cffd6d 100644
--- a/src/VBox/Runtime/generic/RTFileExists-generic.cpp
+++ b/src/VBox/Runtime/generic/RTFileExists-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileExists-generic.cpp $ */
+/* $Id: RTFileExists-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTFileExists, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTFileMove-generic.cpp b/src/VBox/Runtime/generic/RTFileMove-generic.cpp
index 21556ec70..aa2a37430 100644
--- a/src/VBox/Runtime/generic/RTFileMove-generic.cpp
+++ b/src/VBox/Runtime/generic/RTFileMove-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileMove-generic.cpp $ */
+/* $Id: RTFileMove-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTFileMove, Generic.
*/
diff --git a/src/VBox/Runtime/generic/RTFileQuerySize-generic.cpp b/src/VBox/Runtime/generic/RTFileQuerySize-generic.cpp
index a561eea67..3129b7016 100644
--- a/src/VBox/Runtime/generic/RTFileQuerySize-generic.cpp
+++ b/src/VBox/Runtime/generic/RTFileQuerySize-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileQuerySize-generic.cpp $ */
+/* $Id: RTFileQuerySize-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTFileQuerySize, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTFileReadAll-generic.cpp b/src/VBox/Runtime/generic/RTFileReadAll-generic.cpp
index 71c0af124..ea8b8dcc9 100644
--- a/src/VBox/Runtime/generic/RTFileReadAll-generic.cpp
+++ b/src/VBox/Runtime/generic/RTFileReadAll-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileReadAll-generic.cpp $ */
+/* $Id: RTFileReadAll-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTFileReadAll, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTFileReadAllByHandle-generic.cpp b/src/VBox/Runtime/generic/RTFileReadAllByHandle-generic.cpp
index 2d94160f1..d45ca98d1 100644
--- a/src/VBox/Runtime/generic/RTFileReadAllByHandle-generic.cpp
+++ b/src/VBox/Runtime/generic/RTFileReadAllByHandle-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileReadAllByHandle-generic.cpp $ */
+/* $Id: RTFileReadAllByHandle-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTFileReadAllByHandle, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTFileReadAllByHandleEx-generic.cpp b/src/VBox/Runtime/generic/RTFileReadAllByHandleEx-generic.cpp
index 0c41126c6..12b713ea4 100644
--- a/src/VBox/Runtime/generic/RTFileReadAllByHandleEx-generic.cpp
+++ b/src/VBox/Runtime/generic/RTFileReadAllByHandleEx-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileReadAllByHandleEx-generic.cpp $ */
+/* $Id: RTFileReadAllByHandleEx-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTFileReadAllByHandleEx, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTFileReadAllEx-generic.cpp b/src/VBox/Runtime/generic/RTFileReadAllEx-generic.cpp
index 2046d7319..fe086addd 100644
--- a/src/VBox/Runtime/generic/RTFileReadAllEx-generic.cpp
+++ b/src/VBox/Runtime/generic/RTFileReadAllEx-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileReadAllEx-generic.cpp $ */
+/* $Id: RTFileReadAllEx-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTFileReadAllEx, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTFileReadAllFree-generic.cpp b/src/VBox/Runtime/generic/RTFileReadAllFree-generic.cpp
index 1f1dd2920..8491c323a 100644
--- a/src/VBox/Runtime/generic/RTFileReadAllFree-generic.cpp
+++ b/src/VBox/Runtime/generic/RTFileReadAllFree-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileReadAllFree-generic.cpp $ */
+/* $Id: RTFileReadAllFree-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTFileReadAllFree, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTLogDefaultInit-generic.cpp b/src/VBox/Runtime/generic/RTLogDefaultInit-generic.cpp
index 5a1e122c5..f0596f88e 100644
--- a/src/VBox/Runtime/generic/RTLogDefaultInit-generic.cpp
+++ b/src/VBox/Runtime/generic/RTLogDefaultInit-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogDefaultInit-generic.cpp $ */
+/* $Id: RTLogDefaultInit-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Default Log Init, Generic Dummy.
*/
diff --git a/src/VBox/Runtime/generic/RTLogWriteDebugger-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteDebugger-generic.cpp
index 116900b57..bb1b35876 100644
--- a/src/VBox/Runtime/generic/RTLogWriteDebugger-generic.cpp
+++ b/src/VBox/Runtime/generic/RTLogWriteDebugger-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteDebugger-generic.cpp $ */
+/* $Id: RTLogWriteDebugger-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log To Debugger, Generic Dummy.
*/
diff --git a/src/VBox/Runtime/generic/RTLogWriteStdErr-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteStdErr-generic.cpp
index fc7af9816..18fdbf84a 100644
--- a/src/VBox/Runtime/generic/RTLogWriteStdErr-generic.cpp
+++ b/src/VBox/Runtime/generic/RTLogWriteStdErr-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteStdErr-generic.cpp $ */
+/* $Id: RTLogWriteStdErr-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log To StdErr, Generic.
*/
diff --git a/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp
index 4a42187a7..9c3e05161 100644
--- a/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp
+++ b/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteStdErr-stub-generic.cpp $ */
+/* $Id: RTLogWriteStdErr-stub-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log To StdErr, Generic Dummy.
*/
diff --git a/src/VBox/Runtime/generic/RTLogWriteStdOut-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteStdOut-generic.cpp
index a358c08d4..9805d180d 100644
--- a/src/VBox/Runtime/generic/RTLogWriteStdOut-generic.cpp
+++ b/src/VBox/Runtime/generic/RTLogWriteStdOut-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteStdOut-generic.cpp $ */
+/* $Id: RTLogWriteStdOut-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log To StdOut, Generic.
*/
diff --git a/src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp
index 99b6b2bb3..54fcd2850 100644
--- a/src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp
+++ b/src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteStdOut-stub-generic.cpp $ */
+/* $Id: RTLogWriteStdOut-stub-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log To StdOut, Generic Dummy.
*/
diff --git a/src/VBox/Runtime/generic/RTLogWriteUser-generic.cpp b/src/VBox/Runtime/generic/RTLogWriteUser-generic.cpp
index 2fe4d0dfb..6ac712221 100644
--- a/src/VBox/Runtime/generic/RTLogWriteUser-generic.cpp
+++ b/src/VBox/Runtime/generic/RTLogWriteUser-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteUser-generic.cpp $ */
+/* $Id: RTLogWriteUser-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log User Specific Output, Generic Dummy.
*/
diff --git a/src/VBox/Runtime/generic/RTMpCpuId-generic.cpp b/src/VBox/Runtime/generic/RTMpCpuId-generic.cpp
index 591d8318c..7ee70e824 100644
--- a/src/VBox/Runtime/generic/RTMpCpuId-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpCpuId-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpCpuId-generic.cpp $ */
+/* $Id: RTMpCpuId-generic.cpp 29500 2010-05-14 21:43:06Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpCpuId.
*/
diff --git a/src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp b/src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp
index 2fec3382a..09b6f26f2 100644
--- a/src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpCpuIdFromSetIndex-generic.cpp $ */
+/* $Id: RTMpCpuIdFromSetIndex-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpCpuIdFromSetIndex.
*/
diff --git a/src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp b/src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp
index 894f8f4f7..ce825e471 100644
--- a/src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpCpuIdToSetIndex-generic.cpp $ */
+/* $Id: RTMpCpuIdToSetIndex-generic.cpp 36232 2011-03-09 16:41:09Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpCpuIdToSetIndex.
*/
diff --git a/src/VBox/Runtime/generic/RTMpGetArraySize-generic.cpp b/src/VBox/Runtime/generic/RTMpGetArraySize-generic.cpp
index eafac57ff..03f30590c 100644
--- a/src/VBox/Runtime/generic/RTMpGetArraySize-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetArraySize-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetArraySize-generic.cpp $ */
+/* $Id: RTMpGetArraySize-generic.cpp 36254 2011-03-10 17:22:08Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpGetArraySize.
*/
diff --git a/src/VBox/Runtime/generic/RTMpGetCount-generic.cpp b/src/VBox/Runtime/generic/RTMpGetCount-generic.cpp
index f8625e183..52de02d84 100644
--- a/src/VBox/Runtime/generic/RTMpGetCount-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetCount-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetCount-generic.cpp $ */
+/* $Id: RTMpGetCount-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpGetCount.
*/
diff --git a/src/VBox/Runtime/generic/RTMpGetCurFrequency-generic.cpp b/src/VBox/Runtime/generic/RTMpGetCurFrequency-generic.cpp
index 04c9a68dc..c9f590ee6 100644
--- a/src/VBox/Runtime/generic/RTMpGetCurFrequency-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetCurFrequency-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetCurFrequency-generic.cpp $ */
+/* $Id: RTMpGetCurFrequency-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpGetCurFrequency.
*/
diff --git a/src/VBox/Runtime/generic/RTMpGetDescription-generic-stub.cpp b/src/VBox/Runtime/generic/RTMpGetDescription-generic-stub.cpp
index a3c176689..3391abb38 100644
--- a/src/VBox/Runtime/generic/RTMpGetDescription-generic-stub.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetDescription-generic-stub.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetDescription-generic-stub.cpp $ */
+/* $Id: RTMpGetDescription-generic-stub.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpGetDescription stub.
*/
diff --git a/src/VBox/Runtime/generic/RTMpGetDescription-generic.cpp b/src/VBox/Runtime/generic/RTMpGetDescription-generic.cpp
index dccd40583..cdb41904a 100644
--- a/src/VBox/Runtime/generic/RTMpGetDescription-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetDescription-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetDescription-generic.cpp $ */
+/* $Id: RTMpGetDescription-generic.cpp 29264 2010-05-09 19:58:37Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpGetDescription.
*/
diff --git a/src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp b/src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp
index e79633014..8ef1b8dbf 100644
--- a/src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetMaxCpuId-generic.cpp $ */
+/* $Id: RTMpGetMaxCpuId-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpGetMaxCpuId.
*/
diff --git a/src/VBox/Runtime/generic/RTMpGetMaxFrequency-generic.cpp b/src/VBox/Runtime/generic/RTMpGetMaxFrequency-generic.cpp
index 4f468d882..978f439d7 100644
--- a/src/VBox/Runtime/generic/RTMpGetMaxFrequency-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetMaxFrequency-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetMaxFrequency-generic.cpp $ */
+/* $Id: RTMpGetMaxFrequency-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpGetMaxFrequency.
*/
diff --git a/src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp b/src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp
index e11543e04..36f43f1ed 100644
--- a/src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetOnlineCount-generic.cpp $ */
+/* $Id: RTMpGetOnlineCount-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpGetOnlineCount.
*/
diff --git a/src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp b/src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp
index 753ee62dc..05be2872c 100644
--- a/src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetOnlineSet-generic.cpp $ */
+/* $Id: RTMpGetOnlineSet-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpGetOnlineSet.
*/
diff --git a/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp b/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp
index 01b724965..6a83d70e9 100644
--- a/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetSet-generic.cpp $ */
+/* $Id: RTMpGetSet-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpGetSet.
*/
diff --git a/src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp b/src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp
index b53c13ae9..79cfae8b8 100644
--- a/src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpIsCpuOnline-generic.cpp $ */
+/* $Id: RTMpIsCpuOnline-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpIsCpuOnline.
*/
diff --git a/src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp b/src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp
index 7c57ae831..dfdb48046 100644
--- a/src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpIsCpuPossible-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpIsCpuPossible-generic.cpp $ */
+/* $Id: RTMpIsCpuPossible-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Generic RTMpIsCpuPossible.
*/
diff --git a/src/VBox/Runtime/generic/RTProcDaemonize-generic.cpp b/src/VBox/Runtime/generic/RTProcDaemonize-generic.cpp
index a099fb0a6..9fe36f6f9 100644
--- a/src/VBox/Runtime/generic/RTProcDaemonize-generic.cpp
+++ b/src/VBox/Runtime/generic/RTProcDaemonize-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTProcDaemonize-generic.cpp $ */
+/* $Id: RTProcDaemonize-generic.cpp 33806 2010-11-05 17:20:15Z vboxsync $ */
/** @file
* IPRT - RTProcDaemonize, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTProcIsRunningByName-generic.cpp b/src/VBox/Runtime/generic/RTProcIsRunningByName-generic.cpp
index 89e2b4c82..ff37e079a 100644
--- a/src/VBox/Runtime/generic/RTProcIsRunningByName-generic.cpp
+++ b/src/VBox/Runtime/generic/RTProcIsRunningByName-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTProcIsRunningByName-generic.cpp $ */
+/* $Id: RTProcIsRunningByName-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTProcIsRunningByName, generic stub.
*/
diff --git a/src/VBox/Runtime/generic/RTRandAdvCreateSystemFaster-generic.cpp b/src/VBox/Runtime/generic/RTRandAdvCreateSystemFaster-generic.cpp
index 0b05fa5e8..fb277d4e5 100644
--- a/src/VBox/Runtime/generic/RTRandAdvCreateSystemFaster-generic.cpp
+++ b/src/VBox/Runtime/generic/RTRandAdvCreateSystemFaster-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTRandAdvCreateSystemFaster-generic.cpp $ */
+/* $Id: RTRandAdvCreateSystemFaster-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Random Numbers, generic RTRandAdvCreateSystemFaster.
*/
diff --git a/src/VBox/Runtime/generic/RTRandAdvCreateSystemTruer-generic.cpp b/src/VBox/Runtime/generic/RTRandAdvCreateSystemTruer-generic.cpp
index 375757a77..39c42cbca 100644
--- a/src/VBox/Runtime/generic/RTRandAdvCreateSystemTruer-generic.cpp
+++ b/src/VBox/Runtime/generic/RTRandAdvCreateSystemTruer-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTRandAdvCreateSystemTruer-generic.cpp $ */
+/* $Id: RTRandAdvCreateSystemTruer-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Random Numbers, generic RTRandAdvCreateSystemTruer.
*/
diff --git a/src/VBox/Runtime/generic/RTSemEventMultiWait-2-ex-generic.cpp b/src/VBox/Runtime/generic/RTSemEventMultiWait-2-ex-generic.cpp
index 437be6be1..6ce2d195e 100644
--- a/src/VBox/Runtime/generic/RTSemEventMultiWait-2-ex-generic.cpp
+++ b/src/VBox/Runtime/generic/RTSemEventMultiWait-2-ex-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSemEventMultiWait-2-ex-generic.cpp $ */
+/* $Id: RTSemEventMultiWait-2-ex-generic.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - RTSemEventMultiWait, implementation based on RTSemEventMultiWaitEx.
*/
diff --git a/src/VBox/Runtime/generic/RTSemEventMultiWait-generic.cpp b/src/VBox/Runtime/generic/RTSemEventMultiWait-generic.cpp
index 16a9580bf..54b4ba601 100644
--- a/src/VBox/Runtime/generic/RTSemEventMultiWait-generic.cpp
+++ b/src/VBox/Runtime/generic/RTSemEventMultiWait-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSemEventMultiWait-generic.cpp $ */
+/* $Id: RTSemEventMultiWait-generic.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - RTSemEventMultiWait, generic RTSemEventMultiWaitNoResume wrapper.
*/
diff --git a/src/VBox/Runtime/generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp b/src/VBox/Runtime/generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp
index c3eb88db0..651f10109 100644
--- a/src/VBox/Runtime/generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp
+++ b/src/VBox/Runtime/generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSemEventMultiWaitNoResume-2-ex-generic.cpp $ */
+/* $Id: RTSemEventMultiWaitNoResume-2-ex-generic.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - RTSemEventMultiWaitNoResume, generic implementation based
* on RTSemEventMultiWaitEx.
diff --git a/src/VBox/Runtime/generic/RTSemEventWait-2-ex-generic.cpp b/src/VBox/Runtime/generic/RTSemEventWait-2-ex-generic.cpp
index b2e78807d..4cad3116d 100644
--- a/src/VBox/Runtime/generic/RTSemEventWait-2-ex-generic.cpp
+++ b/src/VBox/Runtime/generic/RTSemEventWait-2-ex-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSemEventWait-2-ex-generic.cpp $ */
+/* $Id: RTSemEventWait-2-ex-generic.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - RTSemEventWait, implementation based on RTSemEventWaitEx.
*/
diff --git a/src/VBox/Runtime/generic/RTSemEventWait-generic.cpp b/src/VBox/Runtime/generic/RTSemEventWait-generic.cpp
index ade778085..eea5dc6b3 100644
--- a/src/VBox/Runtime/generic/RTSemEventWait-generic.cpp
+++ b/src/VBox/Runtime/generic/RTSemEventWait-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSemEventWait-generic.cpp $ */
+/* $Id: RTSemEventWait-generic.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - RTSemEventWait, generic RTSemEventWaitNoResume wrapper.
*/
diff --git a/src/VBox/Runtime/generic/RTSemEventWaitNoResume-2-ex-generic.cpp b/src/VBox/Runtime/generic/RTSemEventWaitNoResume-2-ex-generic.cpp
index 3dbe66cdc..d712334f5 100644
--- a/src/VBox/Runtime/generic/RTSemEventWaitNoResume-2-ex-generic.cpp
+++ b/src/VBox/Runtime/generic/RTSemEventWaitNoResume-2-ex-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSemEventWaitNoResume-2-ex-generic.cpp $ */
+/* $Id: RTSemEventWaitNoResume-2-ex-generic.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - RTSemEventWaitNoResume, generic implementation based
* on RTSemEventWaitEx.
diff --git a/src/VBox/Runtime/generic/RTSemMutexRequest-generic.cpp b/src/VBox/Runtime/generic/RTSemMutexRequest-generic.cpp
index 32c3f8760..4c378138a 100644
--- a/src/VBox/Runtime/generic/RTSemMutexRequest-generic.cpp
+++ b/src/VBox/Runtime/generic/RTSemMutexRequest-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSemMutexRequest-generic.cpp $ */
+/* $Id: RTSemMutexRequest-generic.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - RTSemMutexRequest, generic RTSemMutexRequestNoResume wrapper.
*/
diff --git a/src/VBox/Runtime/generic/RTSemMutexRequestDebug-generic.cpp b/src/VBox/Runtime/generic/RTSemMutexRequestDebug-generic.cpp
index 4ba150392..b426a789f 100644
--- a/src/VBox/Runtime/generic/RTSemMutexRequestDebug-generic.cpp
+++ b/src/VBox/Runtime/generic/RTSemMutexRequestDebug-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSemMutexRequestDebug-generic.cpp $ */
+/* $Id: RTSemMutexRequestDebug-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTSemMutexRequestDebug, generic RTSemMutexRequestNoResumeDebug wrapper.
*/
diff --git a/src/VBox/Runtime/generic/RTSystemQueryDmiString-generic.cpp b/src/VBox/Runtime/generic/RTSystemQueryDmiString-generic.cpp
index 723f1aa33..59c064bcc 100644
--- a/src/VBox/Runtime/generic/RTSystemQueryDmiString-generic.cpp
+++ b/src/VBox/Runtime/generic/RTSystemQueryDmiString-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSystemQueryDmiString-generic.cpp $ */
+/* $Id: RTSystemQueryDmiString-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTSystemQueryDmiString, generic stub.
*/
diff --git a/src/VBox/Runtime/generic/RTSystemQueryOSInfo-generic.cpp b/src/VBox/Runtime/generic/RTSystemQueryOSInfo-generic.cpp
index ec52c77d9..c2fe3c6ae 100644
--- a/src/VBox/Runtime/generic/RTSystemQueryOSInfo-generic.cpp
+++ b/src/VBox/Runtime/generic/RTSystemQueryOSInfo-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSystemQueryOSInfo-generic.cpp $ */
+/* $Id: RTSystemQueryOSInfo-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTSystemQueryOSInfo, generic stub.
*/
diff --git a/src/VBox/Runtime/generic/RTThreadGetAffinity-stub-generic.cpp b/src/VBox/Runtime/generic/RTThreadGetAffinity-stub-generic.cpp
new file mode 100644
index 000000000..053db160e
--- /dev/null
+++ b/src/VBox/Runtime/generic/RTThreadGetAffinity-stub-generic.cpp
@@ -0,0 +1,44 @@
+/* $Id: RTThreadGetAffinity-stub-generic.cpp 37154 2011-05-19 12:54:32Z vboxsync $ */
+/** @file
+ * IPRT - Generic RTThreadGetAffinity stub.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/thread.h>
+#include "internal/iprt.h"
+
+#include <iprt/cpuset.h>
+#include <iprt/err.h>
+
+
+RTR3DECL(int) RTThreadGetAffinity(PRTCPUSET pCpuSet)
+{
+ RTCpuSetEmpty(pCpuSet);
+ RTCpuSetAddByIndex(pCpuSet, 0);
+ return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/Runtime/generic/RTThreadGetNativeState-generic.cpp b/src/VBox/Runtime/generic/RTThreadGetNativeState-generic.cpp
index ab8229bd7..d776ac8d7 100644
--- a/src/VBox/Runtime/generic/RTThreadGetNativeState-generic.cpp
+++ b/src/VBox/Runtime/generic/RTThreadGetNativeState-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTThreadGetNativeState-generic.cpp $ */
+/* $Id: RTThreadGetNativeState-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTThreadGetNativeState, generic stub implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTThreadSetAffinity-stub-generic.cpp b/src/VBox/Runtime/generic/RTThreadSetAffinity-stub-generic.cpp
new file mode 100644
index 000000000..d442d28d9
--- /dev/null
+++ b/src/VBox/Runtime/generic/RTThreadSetAffinity-stub-generic.cpp
@@ -0,0 +1,46 @@
+/* $Id: RTThreadSetAffinity-stub-generic.cpp 37154 2011-05-19 12:54:32Z vboxsync $ */
+/** @file
+ * IPRT - Generic RTThreadSetAffinity stub.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/thread.h>
+#include "internal/iprt.h"
+
+#include <iprt/cpuset.h>
+#include <iprt/err.h>
+
+
+RTR3DECL(int) RTThreadSetAffinity(PCRTCPUSET pCpuSet)
+{
+ RTCPUSET CurSet;
+ RTThreadGetAffinity(&CurSet);
+ if (pCpuSet && !RTCpuSetIsEqual(&CurSet, pCpuSet))
+ return VERR_INVALID_PARAMETER;
+ return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/Runtime/generic/RTThreadSetAffinityToCpu-generic.cpp b/src/VBox/Runtime/generic/RTThreadSetAffinityToCpu-generic.cpp
new file mode 100644
index 000000000..9d728891a
--- /dev/null
+++ b/src/VBox/Runtime/generic/RTThreadSetAffinityToCpu-generic.cpp
@@ -0,0 +1,59 @@
+/* $Id: RTThreadSetAffinityToCpu-generic.cpp 37154 2011-05-19 12:54:32Z vboxsync $ */
+/** @file
+ * IPRT - Generic RTThreadSetAffinityToCpu implementation.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/thread.h>
+#include "internal/iprt.h"
+
+#include <iprt/cpuset.h>
+#include <iprt/err.h>
+
+
+
+RTR3DECL(int) RTThreadSetAffinityToCpu(RTCPUID idCpu)
+{
+ int rc;
+ if (idCpu == NIL_RTCPUID)
+ rc = RTThreadSetAffinity(NULL);
+ else
+ {
+ int iCpu = RTMpCpuIdToSetIndex(idCpu);
+ if (iCpu >= 0)
+ {
+ RTCPUSET CpuSet;
+ RTCpuSetEmpty(&CpuSet);
+ RTCpuSetAddByIndex(&CpuSet, iCpu);
+ rc = RTThreadSetAffinity(&CpuSet);
+ }
+ else
+ rc = VERR_CPU_NOT_FOUND;
+ }
+ return rc;
+}
+
diff --git a/src/VBox/Runtime/generic/RTTimeLocalDeltaNano-generic.cpp b/src/VBox/Runtime/generic/RTTimeLocalDeltaNano-generic.cpp
index 92826f0e5..6c55fdaf5 100644
--- a/src/VBox/Runtime/generic/RTTimeLocalDeltaNano-generic.cpp
+++ b/src/VBox/Runtime/generic/RTTimeLocalDeltaNano-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTTimeLocalDeltaNano-generic.cpp $ */
+/* $Id: RTTimeLocalDeltaNano-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Time, generic RTTimeLocalDeltaNano.
*/
diff --git a/src/VBox/Runtime/generic/RTTimeLocalExplode-generic.cpp b/src/VBox/Runtime/generic/RTTimeLocalExplode-generic.cpp
index ae760602d..be65e9b56 100644
--- a/src/VBox/Runtime/generic/RTTimeLocalExplode-generic.cpp
+++ b/src/VBox/Runtime/generic/RTTimeLocalExplode-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTTimeLocalExplode-generic.cpp $ */
+/* $Id: RTTimeLocalExplode-generic.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Time, generic RTTimeLocalExplode.
*/
diff --git a/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp b/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp
index 81c28c537..7dbbe8d6c 100644
--- a/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp
+++ b/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTTimerCreate-generic.cpp $ */
+/* $Id: RTTimerCreate-generic.cpp 32504 2010-09-15 10:12:38Z vboxsync $ */
/** @file
* IPRT - Timers, Generic RTTimerCreate() Implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTTimerLRCreate-generic.cpp b/src/VBox/Runtime/generic/RTTimerLRCreate-generic.cpp
index 6af2c79a5..e7d1e3db8 100644
--- a/src/VBox/Runtime/generic/RTTimerLRCreate-generic.cpp
+++ b/src/VBox/Runtime/generic/RTTimerLRCreate-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTTimerLRCreate-generic.cpp $ */
+/* $Id: RTTimerLRCreate-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Low Resolution Timers, Generic RTTimerLRCreate() Implementation.
*/
diff --git a/src/VBox/Runtime/generic/RTUuidCreate-generic.cpp b/src/VBox/Runtime/generic/RTUuidCreate-generic.cpp
index e88ab1ff8..1df1dbf3c 100644
--- a/src/VBox/Runtime/generic/RTUuidCreate-generic.cpp
+++ b/src/VBox/Runtime/generic/RTUuidCreate-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTUuidCreate-generic.cpp $ */
+/* $Id: RTUuidCreate-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - UUID, Generic RTUuidCreate implementation.
*/
diff --git a/src/VBox/Runtime/generic/critsect-generic.cpp b/src/VBox/Runtime/generic/critsect-generic.cpp
index 0cb8a61bc..e11e53d77 100644
--- a/src/VBox/Runtime/generic/critsect-generic.cpp
+++ b/src/VBox/Runtime/generic/critsect-generic.cpp
@@ -1,10 +1,10 @@
-/* $Id: critsect-generic.cpp $ */
+/* $Id: critsect-generic.cpp 37419 2011-06-11 20:25:37Z vboxsync $ */
/** @file
* IPRT - Critical Section, Generic.
*/
/*
- * Copyright (C) 2006-2009 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -28,6 +28,7 @@
/*******************************************************************************
* Header Files *
*******************************************************************************/
+#define RTCRITSECT_WITHOUT_REMAPPING
#include <iprt/critsect.h>
#include "internal/iprt.h"
@@ -40,7 +41,6 @@
#include "internal/strict.h"
-#undef RTCritSectInit
RTDECL(int) RTCritSectInit(PRTCRITSECT pCritSect)
{
return RTCritSectInitEx(pCritSect, 0, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTCritSect");
@@ -51,7 +51,7 @@ RT_EXPORT_SYMBOL(RTCritSectInit);
RTDECL(int) RTCritSectInitEx(PRTCRITSECT pCritSect, uint32_t fFlags, RTLOCKVALCLASS hClass, uint32_t uSubClass,
const char *pszNameFmt, ...)
{
- AssertReturn(!(fFlags & ~(RTCRITSECT_FLAGS_NO_NESTING | RTCRITSECT_FLAGS_NO_LOCK_VAL | RTCRITSECT_FLAGS_BOOTSTRAP_HACK)),
+ AssertReturn(!(fFlags & ~(RTCRITSECT_FLAGS_NO_NESTING | RTCRITSECT_FLAGS_NO_LOCK_VAL | RTCRITSECT_FLAGS_BOOTSTRAP_HACK | RTCRITSECT_FLAGS_NOP)),
VERR_INVALID_PARAMETER);
/*
@@ -65,7 +65,7 @@ RTDECL(int) RTCritSectInitEx(PRTCRITSECT pCritSect, uint32_t fFlags, RTLOCKVALCL
pCritSect->pValidatorRec = NULL;
int rc = VINF_SUCCESS;
#ifdef RTCRITSECT_STRICT
- if (!(fFlags & RTCRITSECT_FLAGS_BOOTSTRAP_HACK))
+ if (!(fFlags & (RTCRITSECT_FLAGS_BOOTSTRAP_HACK | RTCRITSECT_FLAGS_NOP)))
{
if (!pszNameFmt)
{
@@ -110,6 +110,7 @@ RTDECL(uint32_t) RTCritSectSetSubClass(PRTCRITSECT pCritSect, uint32_t uSubClass
#ifdef RTCRITSECT_STRICT
AssertPtrReturn(pCritSect, RTLOCKVAL_SUB_CLASS_INVALID);
AssertReturn(pCritSect->u32Magic == RTCRITSECT_MAGIC, RTLOCKVAL_SUB_CLASS_INVALID);
+ AssertReturn(!(pCritSect->fFlags & RTCRITSECT_FLAGS_NOP), RTLOCKVAL_SUB_CLASS_INVALID);
return RTLockValidatorRecExclSetSubClass(pCritSect->pValidatorRec, uSubClass);
#else
return RTLOCKVAL_SUB_CLASS_INVALID;
@@ -121,11 +122,18 @@ DECL_FORCE_INLINE(int) rtCritSectTryEnter(PRTCRITSECT pCritSect, PCRTLOCKVALSRCP
{
Assert(pCritSect);
Assert(pCritSect->u32Magic == RTCRITSECT_MAGIC);
- RTNATIVETHREAD NativeThreadSelf = RTThreadNativeSelf();
+ /*AssertReturn(pCritSect->u32Magic == RTCRITSECT_MAGIC, VERR_SEM_DESTROYED);*/
+
+ /*
+ * Return straight away if NOP.
+ */
+ if (pCritSect->fFlags & RTCRITSECT_FLAGS_NOP)
+ return VINF_SUCCESS;
/*
* Try take the lock. (cLockers is -1 if it's free)
*/
+ RTNATIVETHREAD NativeThreadSelf = RTThreadNativeSelf();
if (!ASMAtomicCmpXchgS32(&pCritSect->cLockers, 0, -1))
{
/*
@@ -163,7 +171,6 @@ DECL_FORCE_INLINE(int) rtCritSectTryEnter(PRTCRITSECT pCritSect, PCRTLOCKVALSRCP
}
-#undef RTCritSectTryEnter
RTDECL(int) RTCritSectTryEnter(PRTCRITSECT pCritSect)
{
#ifndef RTCRTISECT_STRICT
@@ -186,19 +193,24 @@ RT_EXPORT_SYMBOL(RTCritSectTryEnterDebug);
DECL_FORCE_INLINE(int) rtCritSectEnter(PRTCRITSECT pCritSect, PCRTLOCKVALSRCPOS pSrcPos)
{
- Assert(pCritSect);
- Assert(pCritSect->u32Magic == RTCRITSECT_MAGIC);
- RTNATIVETHREAD NativeThreadSelf = RTThreadNativeSelf();
+ AssertPtr(pCritSect);
+ AssertReturn(pCritSect->u32Magic == RTCRITSECT_MAGIC, VERR_SEM_DESTROYED);
- /* If the critical section has already been destroyed, then inform the caller. */
- if (pCritSect->u32Magic != RTCRITSECT_MAGIC)
- return VERR_SEM_DESTROYED;
+ /*
+ * Return straight away if NOP.
+ */
+ if (pCritSect->fFlags & RTCRITSECT_FLAGS_NOP)
+ return VINF_SUCCESS;
+ /*
+ * How is calling and is the order right?
+ */
+ RTNATIVETHREAD NativeThreadSelf = RTThreadNativeSelf();
#ifdef RTCRITSECT_STRICT
- RTTHREAD hThreadSelf = pCritSect->pValidatorRec
- ? RTThreadSelfAutoAdopt()
- : RTThreadSelf();
- int rc9;
+ RTTHREAD hThreadSelf = pCritSect->pValidatorRec
+ ? RTThreadSelfAutoAdopt()
+ : RTThreadSelf();
+ int rc9;
if (pCritSect->pValidatorRec) /* (bootstap) */
{
rc9 = RTLockValidatorRecExclCheckOrder(pCritSect->pValidatorRec, hThreadSelf, pSrcPos, RT_INDEFINITE_WAIT);
@@ -282,7 +294,6 @@ DECL_FORCE_INLINE(int) rtCritSectEnter(PRTCRITSECT pCritSect, PCRTLOCKVALSRCPOS
}
-#undef RTCritSectEnter
RTDECL(int) RTCritSectEnter(PRTCRITSECT pCritSect)
{
#ifndef RTCRITSECT_STRICT
@@ -306,10 +317,16 @@ RT_EXPORT_SYMBOL(RTCritSectEnterDebug);
RTDECL(int) RTCritSectLeave(PRTCRITSECT pCritSect)
{
/*
- * Assert ownership and so on.
+ * Assert sanity and check for NOP.
*/
Assert(pCritSect);
Assert(pCritSect->u32Magic == RTCRITSECT_MAGIC);
+ if (pCritSect->fFlags & RTCRITSECT_FLAGS_NOP)
+ return VINF_SUCCESS;
+
+ /*
+ * Assert ownership and so on.
+ */
Assert(pCritSect->cNestings > 0);
Assert(pCritSect->cLockers >= 0);
Assert(pCritSect->NativeThreadOwner == RTThreadNativeSelf());
@@ -425,7 +442,6 @@ static int rtCritSectEnterMultiple(size_t cCritSects, PRTCRITSECT *papCritSects,
}
-#undef RTCritSectEnterMultiple
RTDECL(int) RTCritSectEnterMultiple(size_t cCritSects, PRTCRITSECT *papCritSects)
{
#ifndef RTCRITSECT_STRICT
diff --git a/src/VBox/Runtime/generic/env-generic.cpp b/src/VBox/Runtime/generic/env-generic.cpp
index f07abc997..0c4911cde 100644
--- a/src/VBox/Runtime/generic/env-generic.cpp
+++ b/src/VBox/Runtime/generic/env-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: env-generic.cpp $ */
+/* $Id: env-generic.cpp 36576 2011-04-06 13:28:12Z vboxsync $ */
/** @file
* IPRT - Environment, Generic.
*/
diff --git a/src/VBox/Runtime/generic/errvars-generic.cpp b/src/VBox/Runtime/generic/errvars-generic.cpp
new file mode 100644
index 000000000..c57abd44c
--- /dev/null
+++ b/src/VBox/Runtime/generic/errvars-generic.cpp
@@ -0,0 +1,66 @@
+/* $Id: errvars-generic.cpp 37233 2011-05-27 13:31:57Z vboxsync $ */
+/** @file
+ * IPRT - Save and Restore Error Variables, generic stub implementation.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/err.h>
+#include "internal/iprt.h"
+
+#include <iprt/assert.h>
+#include "internal/magics.h"
+
+
+
+RTDECL(PRTERRVARS) RTErrVarsSave(PRTERRVARS pVars)
+{
+ pVars->ai32Vars[0] = RTERRVARS_MAGIC;
+ return pVars;
+}
+
+
+RTDECL(void) RTErrVarsRestore(PCRTERRVARS pVars)
+{
+ Assert(pVars->ai32Vars[0] == RTERRVARS_MAGIC);
+}
+
+
+RTDECL(bool) RTErrVarsAreEqual(PCRTERRVARS pVars1, PCRTERRVARS pVars2)
+{
+ Assert(pVars1->ai32Vars[0] == RTERRVARS_MAGIC);
+ Assert(pVars2->ai32Vars[0] == RTERRVARS_MAGIC);
+
+ return pVars1->ai32Vars[0] == pVars2->ai32Vars[0];
+}
+
+
+RTDECL(bool) RTErrVarsHaveChanged(PCRTERRVARS pVars)
+{
+ Assert(pVars->ai32Vars[0] == RTERRVARS_MAGIC);
+ return false;
+}
+
diff --git a/src/VBox/Runtime/generic/fs-stubs-generic.cpp b/src/VBox/Runtime/generic/fs-stubs-generic.cpp
index 4d4403ad8..193121b50 100644
--- a/src/VBox/Runtime/generic/fs-stubs-generic.cpp
+++ b/src/VBox/Runtime/generic/fs-stubs-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: fs-stubs-generic.cpp $ */
+/* $Id: fs-stubs-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - File System, Generic Stubs.
*/
diff --git a/src/VBox/Runtime/generic/mempool-generic.cpp b/src/VBox/Runtime/generic/mempool-generic.cpp
index 8f53402a0..6d485a6d6 100644
--- a/src/VBox/Runtime/generic/mempool-generic.cpp
+++ b/src/VBox/Runtime/generic/mempool-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: mempool-generic.cpp $ */
+/* $Id: mempool-generic.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Memory Allocation Pool.
*/
diff --git a/src/VBox/Runtime/generic/mppresent-generic.cpp b/src/VBox/Runtime/generic/mppresent-generic.cpp
index 2d345f771..6ebfa08df 100644
--- a/src/VBox/Runtime/generic/mppresent-generic.cpp
+++ b/src/VBox/Runtime/generic/mppresent-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: mppresent-generic.cpp $ */
+/* $Id: mppresent-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Stubs for the RTMp*Present* API.
*/
diff --git a/src/VBox/Runtime/generic/pathhost-generic.cpp b/src/VBox/Runtime/generic/pathhost-generic.cpp
index fa615e1af..b35c7f9ae 100644
--- a/src/VBox/Runtime/generic/pathhost-generic.cpp
+++ b/src/VBox/Runtime/generic/pathhost-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: pathhost-generic.cpp $ */
+/* $Id: pathhost-generic.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Path Conversions, generic pass through.
*/
diff --git a/src/VBox/Runtime/generic/sched-generic.cpp b/src/VBox/Runtime/generic/sched-generic.cpp
index 8ae5b89c0..4905ad62c 100644
--- a/src/VBox/Runtime/generic/sched-generic.cpp
+++ b/src/VBox/Runtime/generic/sched-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: sched-generic.cpp $ */
+/* $Id: sched-generic.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Scheduling, generic stubs.
*/
@@ -45,7 +45,7 @@
* @returns iprt status code.
* @param enmType The thread type to be assumed for the current thread.
*/
-int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
{
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
return VINF_SUCCESS;
@@ -61,7 +61,7 @@ int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
* @param enmPriority The priority to validate and set.
* @remark Located in sched.
*/
-int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
+DECLHIDDEN(int) rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
{
Assert(enmPriority > RTPROCPRIORITY_INVALID && enmPriority < RTPROCPRIORITY_LAST);
return VINF_SUCCESS;
@@ -80,7 +80,7 @@ int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
* @param enmType The thread type.
* @remark Located in sched.
*/
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
return VINF_SUCCESS;
diff --git a/src/VBox/Runtime/generic/semfastmutex-generic.cpp b/src/VBox/Runtime/generic/semfastmutex-generic.cpp
index 69de1410e..8c4ac1ee6 100644
--- a/src/VBox/Runtime/generic/semfastmutex-generic.cpp
+++ b/src/VBox/Runtime/generic/semfastmutex-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: semfastmutex-generic.cpp $ */
+/* $Id: semfastmutex-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Fast Mutex, Generic.
*/
diff --git a/src/VBox/Runtime/generic/semrw-generic.cpp b/src/VBox/Runtime/generic/semrw-generic.cpp
index f565119e8..81348fb74 100644
--- a/src/VBox/Runtime/generic/semrw-generic.cpp
+++ b/src/VBox/Runtime/generic/semrw-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: semrw-generic.cpp $ */
+/* $Id: semrw-generic.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Read-Write Semaphore, Generic.
*
diff --git a/src/VBox/Runtime/generic/semrw-lockless-generic.cpp b/src/VBox/Runtime/generic/semrw-lockless-generic.cpp
index 3da9d6fe1..6d1d567f5 100644
--- a/src/VBox/Runtime/generic/semrw-lockless-generic.cpp
+++ b/src/VBox/Runtime/generic/semrw-lockless-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: semrw-lockless-generic.cpp $ */
+/* $Id: semrw-lockless-generic.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT Testcase - RTSemXRoads, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/semxroads-generic.cpp b/src/VBox/Runtime/generic/semxroads-generic.cpp
index 55f9670a3..73c84209f 100644
--- a/src/VBox/Runtime/generic/semxroads-generic.cpp
+++ b/src/VBox/Runtime/generic/semxroads-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: semxroads-generic.cpp $ */
+/* $Id: semxroads-generic.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT Testcase - RTSemXRoads, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/spinlock-generic.cpp b/src/VBox/Runtime/generic/spinlock-generic.cpp
index beac17b0d..f4570ad7b 100644
--- a/src/VBox/Runtime/generic/spinlock-generic.cpp
+++ b/src/VBox/Runtime/generic/spinlock-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: spinlock-generic.cpp $ */
+/* $Id: spinlock-generic.cpp 34239 2010-11-22 13:58:16Z vboxsync $ */
/** @file
* IPRT - Spinlock, generic implementation.
*/
diff --git a/src/VBox/Runtime/generic/strcache-stubs-generic.cpp b/src/VBox/Runtime/generic/strcache-stubs-generic.cpp
index 0b358a461..b45dc5182 100644
--- a/src/VBox/Runtime/generic/strcache-stubs-generic.cpp
+++ b/src/VBox/Runtime/generic/strcache-stubs-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: strcache-stubs-generic.cpp $ */
+/* $Id: strcache-stubs-generic.cpp 30320 2010-06-21 08:35:09Z vboxsync $ */
/** @file
* IPRT - String Cache, stub implementation.
*/
diff --git a/src/VBox/Runtime/generic/timer-generic.cpp b/src/VBox/Runtime/generic/timer-generic.cpp
index fb3c5b501..6c3595e19 100644
--- a/src/VBox/Runtime/generic/timer-generic.cpp
+++ b/src/VBox/Runtime/generic/timer-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: timer-generic.cpp $ */
+/* $Id: timer-generic.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Timers, Generic.
*/
diff --git a/src/VBox/Runtime/generic/timerlr-generic.cpp b/src/VBox/Runtime/generic/timerlr-generic.cpp
index 6019356f7..890bd2fb7 100644
--- a/src/VBox/Runtime/generic/timerlr-generic.cpp
+++ b/src/VBox/Runtime/generic/timerlr-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: timerlr-generic.cpp $ */
+/* $Id: timerlr-generic.cpp 34507 2010-11-30 13:14:14Z vboxsync $ */
/** @file
* IPRT - Low Resolution Timers, Generic.
*
diff --git a/src/VBox/Runtime/generic/tls-generic.cpp b/src/VBox/Runtime/generic/tls-generic.cpp
index d178ed095..0c241d2e3 100644
--- a/src/VBox/Runtime/generic/tls-generic.cpp
+++ b/src/VBox/Runtime/generic/tls-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: tls-generic.cpp $ */
+/* $Id: tls-generic.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Thread Local Storage (TSL), Generic Implementation.
*/
@@ -140,7 +140,7 @@ RTR3DECL(int) RTTlsSet(RTTLS iTls, void *pvValue)
*
* @param pThread The current thread.
*/
-void rtThreadTlsDestruction(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtThreadTlsDestruction(PRTTHREADINT pThread)
{
for (RTTLS iTls = 0; iTls < RTTHREAD_TLS_ENTRIES; iTls++)
{
diff --git a/src/VBox/Runtime/generic/utf16locale-generic.cpp b/src/VBox/Runtime/generic/utf16locale-generic.cpp
index b75ec9d15..22a1b5896 100644
--- a/src/VBox/Runtime/generic/utf16locale-generic.cpp
+++ b/src/VBox/Runtime/generic/utf16locale-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: utf16locale-generic.cpp $ */
+/* $Id: utf16locale-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - UTF-16 Locale Specific Manipulation, Generic.
*/
diff --git a/src/VBox/Runtime/generic/uuid-generic.cpp b/src/VBox/Runtime/generic/uuid-generic.cpp
index 423892ce2..30c83c8d4 100644
--- a/src/VBox/Runtime/generic/uuid-generic.cpp
+++ b/src/VBox/Runtime/generic/uuid-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: uuid-generic.cpp $ */
+/* $Id: uuid-generic.cpp 32995 2010-10-08 08:11:27Z vboxsync $ */
/** @file
* IPRT - UUID, Generic.
*/
diff --git a/src/VBox/Runtime/include/internal/alignmentchecks.h b/src/VBox/Runtime/include/internal/alignmentchecks.h
index 96e96e88e..5ecda8bf9 100644
--- a/src/VBox/Runtime/include/internal/alignmentchecks.h
+++ b/src/VBox/Runtime/include/internal/alignmentchecks.h
@@ -1,4 +1,4 @@
-/* $Id: alignmentchecks.h $ */
+/* $Id: alignmentchecks.h 29250 2010-05-09 17:53:58Z vboxsync $ */
/** @file
* IPRT - Internal header for hacking alignment checks on x86 and AMD64.
*/
diff --git a/src/VBox/Runtime/include/internal/assert.h b/src/VBox/Runtime/include/internal/assert.h
index 8d56b8cf2..a45568b5e 100644
--- a/src/VBox/Runtime/include/internal/assert.h
+++ b/src/VBox/Runtime/include/internal/assert.h
@@ -1,4 +1,4 @@
-/* $Id: assert.h $ */
+/* $Id: assert.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Internal RTAssert header
*/
@@ -42,7 +42,7 @@ RT_C_DECLS_BEGIN
* @param pszFile Location file name.
* @param pszFunction Location function name.
*/
-void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction);
+DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction);
/**
* Print the 2nd (optional) part of an assert message to whatever native
@@ -53,7 +53,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi
* @param pszFormat Printf like format string.
* @param va Arguments to that string.
*/
-void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va);
+DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va);
#endif
diff --git a/src/VBox/Runtime/include/internal/dbgmod.h b/src/VBox/Runtime/include/internal/dbgmod.h
index 900052444..ae9c3ca74 100644
--- a/src/VBox/Runtime/include/internal/dbgmod.h
+++ b/src/VBox/Runtime/include/internal/dbgmod.h
@@ -1,4 +1,4 @@
-/* $Id: dbgmod.h $ */
+/* $Id: dbgmod.h 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Internal Header for RTDbgMod and the associated interpreters.
*/
diff --git a/src/VBox/Runtime/include/internal/dir.h b/src/VBox/Runtime/include/internal/dir.h
index 987fe32a0..57a5d1f14 100644
--- a/src/VBox/Runtime/include/internal/dir.h
+++ b/src/VBox/Runtime/include/internal/dir.h
@@ -1,4 +1,4 @@
-/* $Id: dir.h $ */
+/* $Id: dir.h 28918 2010-04-29 18:30:09Z vboxsync $ */
/** @file
* IPRT - Internal Header for RTDir.
*/
diff --git a/src/VBox/Runtime/include/internal/dvm.h b/src/VBox/Runtime/include/internal/dvm.h
new file mode 100644
index 000000000..6b9cdd612
--- /dev/null
+++ b/src/VBox/Runtime/include/internal/dvm.h
@@ -0,0 +1,286 @@
+/* $Id: dvm.h 37270 2011-05-30 21:25:42Z vboxsync $ */
+/** @file
+ * IPRT - Disk Volume Management Internals.
+ */
+
+/*
+ * Copyright (C) 2006-2007 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#ifndef ___internal_dvm_h
+#define ___internal_dvm_h
+
+#include <iprt/types.h>
+#include <iprt/err.h>
+#include <iprt/assert.h>
+#include "internal/magics.h"
+
+RT_C_DECLS_BEGIN
+
+/** Format specific volume manager handle. */
+typedef struct RTDVMFMTINTERNAL *RTDVMFMT;
+/** Pointer to a format specific volume manager handle. */
+typedef RTDVMFMT *PRTDVMFMT;
+/** NIL volume manager handle. */
+#define NIL_RTDVMFMT ((RTDVMFMT)~0)
+
+/** Format specific volume data handle. */
+typedef struct RTDVMVOLUMEFMTINTERNAL *RTDVMVOLUMEFMT;
+/** Pointer to a format specific volume data handle. */
+typedef RTDVMVOLUMEFMT *PRTDVMVOLUMEFMT;
+/** NIL volume handle. */
+#define NIL_RTDVMVOLUMEFMT ((RTDVMVOLUMEFMT)~0)
+
+/**
+ * Disk descriptor.
+ */
+typedef struct RTDVMDISK
+{
+ /** Size of the disk in bytes. */
+ uint64_t cbDisk;
+ /** Sector size. */
+ uint64_t cbSector;
+ /** Read callback */
+ PFNDVMREAD pfnRead;
+ /** Write callback. */
+ PFNDVMWRITE pfnWrite;
+ /** Opaque user data. */
+ void *pvUser;
+} RTDVMDISK;
+/** Pointer to a disk descriptor. */
+typedef RTDVMDISK *PRTDVMDISK;
+/** Pointer to a const descriptor. */
+typedef const RTDVMDISK *PCRTDVMDISK;
+
+/** Score to indicate that the backend can't handle the format at all */
+#define RTDVM_MATCH_SCORE_UNSUPPORTED 0
+/** Score to indicate that a backend supports the format
+ * but there can be other backends. */
+#define RTDVM_MATCH_SCORE_SUPPORTED (UINT32_MAX/2)
+/** Score to indicate a perfect match. */
+#define RTDVM_MATCH_SCORE_PERFECT UINT32_MAX
+
+/**
+ * Volume format operations.
+ */
+typedef struct RTDVMFMTOPS
+{
+ /** Name of the format. */
+ const char *pcszFmt;
+
+ /**
+ * Probes the given disk for known structures.
+ *
+ * @returns IPRT status code.
+ * @param pDisk Disk descriptor.
+ * @param puScore Where to store the match score on success.
+ */
+ DECLCALLBACKMEMBER(int, pfnProbe)(PCRTDVMDISK pDisk, uint32_t *puScore);
+
+ /**
+ * Opens the format to set up all structures.
+ *
+ * @returns IPRT status code.
+ * @param pDisk The disk descriptor.
+ * @param phVolMgrFmt Where to store the volume format data on success.
+ */
+ DECLCALLBACKMEMBER(int, pfnOpen)(PCRTDVMDISK pDisk, PRTDVMFMT phVolMgrFmt);
+
+ /**
+ * Initializes a new volume map.
+ *
+ * @returns IPRT status code.
+ * @param pDisk The disk descriptor.
+ * @param phVolMgrFmt Where to store the volume format data on success.
+ */
+ DECLCALLBACKMEMBER(int, pfnInitialize)(PCRTDVMDISK pDisk, PRTDVMFMT phVolMgrFmt);
+
+ /**
+ * Closes the volume format.
+ *
+ * @returns nothing.
+ * @param hVolMgrFmt The format specific volume manager handle.
+ */
+ DECLCALLBACKMEMBER(void, pfnClose)(RTDVMFMT hVolMgrFmt);
+
+ /**
+ * Gets the number of valid volumes in the map.
+ *
+ * @returns Number of valid volumes in the map or UINT32_MAX on failure.
+ * @param hVolMgrFmt The format specific volume manager handle.
+ */
+ DECLCALLBACKMEMBER(uint32_t, pfnGetValidVolumes)(RTDVMFMT hVolMgrFmt);
+
+ /**
+ * Gets the maximum number of volumes the map can have.
+ *
+ * @returns Maximum number of volumes in the map or 0 on failure.
+ * @param hVolMgrFmt The format specific volume manager handle.
+ */
+ DECLCALLBACKMEMBER(uint32_t, pfnGetMaxVolumes)(RTDVMFMT hVolMgrFmt);
+
+ /**
+ * Get the first valid volume from a map.
+ *
+ * @returns IPRT status code.
+ * @param hVolMgrFmt The format specific volume manager handle.
+ * @param phVolFmt Where to store the volume handle to the first volume
+ * on success.
+ */
+ DECLCALLBACKMEMBER(int, pfnQueryFirstVolume)(RTDVMFMT hVolMgrFmt, PRTDVMVOLUMEFMT phVolFmt);
+
+ /**
+ * Get the first valid volume from a map.
+ *
+ * @returns IPRT status code.
+ * @param hVolMgrFmt The format specific volume manager handle.
+ * @param hVolFmt The current volume.
+ * @param phVolFmtNext Where to store the handle to the format specific
+ * volume data of the next volume on success.
+ */
+ DECLCALLBACKMEMBER(int, pfnQueryNextVolume)(RTDVMFMT hVolMgrFmt, RTDVMVOLUMEFMT hVolFmt, PRTDVMVOLUMEFMT phVolFmtNext);
+
+ /**
+ * Closes a volume handle.
+ *
+ * @returns nothing.
+ * @param hVolFmt The format specific volume handle.
+ */
+ DECLCALLBACKMEMBER(void, pfnVolumeClose)(RTDVMVOLUMEFMT hVolFmt);
+
+ /**
+ * Gets the size of the given volume.
+ *
+ * @returns Size of the volume in bytes or 0 on failure.
+ * @param hVolFmt The format specific volume handle.
+ */
+ DECLCALLBACKMEMBER(uint64_t, pfnVolumeGetSize)(RTDVMVOLUMEFMT hVolFmt);
+
+ /**
+ * Queries the name of the given volume.
+ *
+ * @returns IPRT status code.
+ * @param hVolFmt The format specific volume handle.
+ * @param ppszVolname Where to store the name of the volume on success.
+ */
+ DECLCALLBACKMEMBER(int, pfnVolumeQueryName)(RTDVMVOLUMEFMT hVolFmt, char **ppszVolName);
+
+ /**
+ * Get the type of the given volume.
+ *
+ * @returns The volume type on success, DVMVOLTYPE_INVALID if hVol is invalid.
+ * @param hVolFmt The format specific volume handle.
+ */
+ DECLCALLBACKMEMBER(RTDVMVOLTYPE, pfnVolumeGetType)(RTDVMVOLUMEFMT hVolFmt);
+
+ /**
+ * Get the flags of the given volume.
+ *
+ * @returns The volume flags or UINT64_MAX on failure.
+ * @param hVolFmt The format specific volume handle.
+ */
+ DECLCALLBACKMEMBER(uint64_t, pfnVolumeGetFlags)(RTDVMVOLUMEFMT hVolFmt);
+
+ /**
+ * Read data from the given volume.
+ *
+ * @returns IPRT status code.
+ * @param hVolFmt The format specific volume handle.
+ * @param off Where to start reading from.
+ * @param pvBuf Where to store the read data.
+ * @param cbRead How many bytes to read.
+ */
+ DECLCALLBACKMEMBER(int, pfnVolumeRead)(RTDVMVOLUMEFMT hVolFmt, uint64_t off, void *pvBuf, size_t cbRead);
+
+ /**
+ * Write data to the given volume.
+ *
+ * @returns IPRT status code.
+ * @param hVolFmt The format specific volume handle.
+ * @param off Where to start writing to.
+ * @param pvBuf The data to write.
+ * @param cbWrite How many bytes to write.
+ */
+ DECLCALLBACKMEMBER(int, pfnVolumeWrite)(RTDVMVOLUMEFMT hVolFmt, uint64_t off, const void *pvBuf, size_t cbWrite);
+
+} RTDVMFMTOPS;
+/** Pointer to a DVM ops table. */
+typedef RTDVMFMTOPS *PRTDVMFMTOPS;
+/** Pointer to a const DVM ops table. */
+typedef const RTDVMFMTOPS *PCRTDVMFMTOPS;
+
+/** Converts a LBA number to the byte offset. */
+#define RTDVM_LBA2BYTE(lba, disk) ((lba) * (disk)->cbSector)
+/** Converts a Byte offset to the LBA number. */
+#define RTDVM_BYTE2LBA(off, disk) ((off) / (disk)->cbSector)
+
+/**
+ * Returns the number of sectors in the disk.
+ *
+ * @returns Number of sectors.
+ * @param pDisk The disk descriptor.
+ */
+DECLINLINE(uint64_t) rtDvmDiskGetSectors(PCRTDVMDISK pDisk)
+{
+ return pDisk->cbDisk / pDisk->cbSector;
+}
+
+/**
+ * Read from the disk at the given offset.
+ *
+ * @returns IPRT status code.
+ * @param pDisk The disk descriptor to read from.
+ * @param off Start offset.
+ * @param pvBuf Destination buffer.
+ * @param cbRead How much to read.
+ */
+DECLINLINE(int) rtDvmDiskRead(PCRTDVMDISK pDisk, uint64_t off, void *pvBuf, size_t cbRead)
+{
+ AssertPtrReturn(pDisk, VERR_INVALID_POINTER);
+ AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+ AssertReturn(cbRead > 0, VERR_INVALID_PARAMETER);
+ AssertReturn(off + cbRead <= pDisk->cbDisk, VERR_INVALID_PARAMETER);
+
+ return pDisk->pfnRead(pDisk->pvUser, off, pvBuf, cbRead);
+}
+
+/**
+ * Write to the disk at the given offset.
+ *
+ * @returns IPRT status code.
+ * @param pDisk The disk descriptor to write to.
+ * @param off Start offset.
+ * @param pvBuf Source buffer.
+ * @param cbWrite How much to write.
+ */
+DECLINLINE(int) rtDvmDiskWrite(PCRTDVMDISK pDisk, uint64_t off, const void *pvBuf, size_t cbWrite)
+{
+ AssertPtrReturn(pDisk, VERR_INVALID_POINTER);
+ AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+ AssertReturn(cbWrite > 0, VERR_INVALID_PARAMETER);
+ AssertReturn(off + cbWrite <= pDisk->cbDisk, VERR_INVALID_PARAMETER);
+
+ return pDisk->pfnWrite(pDisk->pvUser, off, pvBuf, cbWrite);
+}
+
+RT_C_DECLS_END
+
+#endif
+
diff --git a/src/VBox/Runtime/include/internal/file.h b/src/VBox/Runtime/include/internal/file.h
index c55efb89d..2541d7a73 100644
--- a/src/VBox/Runtime/include/internal/file.h
+++ b/src/VBox/Runtime/include/internal/file.h
@@ -1,4 +1,4 @@
-/* $Id: file.h $ */
+/* $Id: file.h 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - Internal RTFile header.
*/
@@ -41,7 +41,19 @@ RT_C_DECLS_BEGIN
* Updated on successful return.
* @internal
*/
-int rtFileRecalcAndValidateFlags(uint32_t *pfOpen);
+int rtFileRecalcAndValidateFlags(uint64_t *pfOpen);
+
+
+/**
+ * Internal interface for getting the RTFILE handle of stdin, stdout or stderr.
+ *
+ * This interface will not be exposed and is purely for internal IPRT use.
+ *
+ * @returns Handle or NIL_RTFILE.
+ *
+ * @param enmStdHandle The standard handle.
+ */
+RTFILE rtFileGetStandard(RTHANDLESTD enmStdHandle);
RT_C_DECLS_END
diff --git a/src/VBox/Runtime/include/internal/fileaio.h b/src/VBox/Runtime/include/internal/fileaio.h
index 81172acc6..6ff4ced99 100644
--- a/src/VBox/Runtime/include/internal/fileaio.h
+++ b/src/VBox/Runtime/include/internal/fileaio.h
@@ -1,4 +1,4 @@
-/* $Id: fileaio.h $ */
+/* $Id: fileaio.h 29451 2010-05-13 15:38:48Z vboxsync $ */
/** @file
* IPRT - Internal RTFileAio header.
*/
diff --git a/src/VBox/Runtime/include/internal/fs.h b/src/VBox/Runtime/include/internal/fs.h
index f5ba04293..44fe99fd7 100644
--- a/src/VBox/Runtime/include/internal/fs.h
+++ b/src/VBox/Runtime/include/internal/fs.h
@@ -1,4 +1,4 @@
-/* $Id: fs.h $ */
+/* $Id: fs.h 34002 2010-11-11 17:16:37Z vboxsync $ */
/** @file
* IPRT - Internal RTFs header.
*/
diff --git a/src/VBox/Runtime/include/internal/initterm.h b/src/VBox/Runtime/include/internal/initterm.h
index 28817297d..dbd40f042 100644
--- a/src/VBox/Runtime/include/internal/initterm.h
+++ b/src/VBox/Runtime/include/internal/initterm.h
@@ -1,4 +1,4 @@
-/* $Id: initterm.h $ */
+/* $Id: initterm.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Initialization & Termination.
*/
@@ -38,12 +38,12 @@ RT_C_DECLS_BEGIN
*
* @returns IPRT status code.
*/
-int rtR0InitNative(void);
+DECLHIDDEN(int) rtR0InitNative(void);
/**
* Platform specific termination.
*/
-void rtR0TermNative(void);
+DECLHIDDEN(void) rtR0TermNative(void);
#endif /* IN_RING0 */
diff --git a/src/VBox/Runtime/include/internal/iprt.h b/src/VBox/Runtime/include/internal/iprt.h
index 74646cc21..98a8a9452 100644
--- a/src/VBox/Runtime/include/internal/iprt.h
+++ b/src/VBox/Runtime/include/internal/iprt.h
@@ -1,4 +1,4 @@
-/* $Id: iprt.h $ */
+/* $Id: iprt.h 35662 2011-01-20 18:11:08Z vboxsync $ */
/** @file
* IPRT - Internal header for miscellaneous global defs and types.
*/
diff --git a/src/VBox/Runtime/include/internal/ldr.h b/src/VBox/Runtime/include/internal/ldr.h
index cf51bee07..1274f60a1 100644
--- a/src/VBox/Runtime/include/internal/ldr.h
+++ b/src/VBox/Runtime/include/internal/ldr.h
@@ -1,4 +1,4 @@
-/* $Id: ldr.h $ */
+/* $Id: ldr.h 35183 2010-12-16 13:59:44Z vboxsync $ */
/** @file
* IPRT - Loader Internals.
*/
diff --git a/src/VBox/Runtime/include/internal/ldrELF.h b/src/VBox/Runtime/include/internal/ldrELF.h
index c52cd816a..f6d2d4009 100644
--- a/src/VBox/Runtime/include/internal/ldrELF.h
+++ b/src/VBox/Runtime/include/internal/ldrELF.h
@@ -1,4 +1,4 @@
-/* $Id: ldrELF.h $ */
+/* $Id: ldrELF.h 37560 2011-06-20 14:48:32Z vboxsync $ */
/** @file
* ELF types, current architecture.
*/
diff --git a/src/VBox/Runtime/include/internal/ldrELF32.h b/src/VBox/Runtime/include/internal/ldrELF32.h
index 0873357ec..8ad9b5594 100644
--- a/src/VBox/Runtime/include/internal/ldrELF32.h
+++ b/src/VBox/Runtime/include/internal/ldrELF32.h
@@ -1,4 +1,4 @@
-/* $Id: ldrELF32.h $ */
+/* $Id: ldrELF32.h 37560 2011-06-20 14:48:32Z vboxsync $ */
/** @file
* IPRT - ELF 32-bit header.
*/
diff --git a/src/VBox/Runtime/include/internal/ldrELF64.h b/src/VBox/Runtime/include/internal/ldrELF64.h
index 8a60fd9c5..6500731b6 100644
--- a/src/VBox/Runtime/include/internal/ldrELF64.h
+++ b/src/VBox/Runtime/include/internal/ldrELF64.h
@@ -1,4 +1,4 @@
-/* $Id: ldrELF64.h $ */
+/* $Id: ldrELF64.h 37560 2011-06-20 14:48:32Z vboxsync $ */
/** @file
* IPRT - ELF 64-bit header.
*/
diff --git a/src/VBox/Runtime/include/internal/ldrMZ.h b/src/VBox/Runtime/include/internal/ldrMZ.h
index c6c15c163..c598970ff 100644
--- a/src/VBox/Runtime/include/internal/ldrMZ.h
+++ b/src/VBox/Runtime/include/internal/ldrMZ.h
@@ -1,4 +1,4 @@
-/* $Id: ldrMZ.h $ */
+/* $Id: ldrMZ.h 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT, MZ header.
*/
diff --git a/src/VBox/Runtime/include/internal/ldrMach-O.h b/src/VBox/Runtime/include/internal/ldrMach-O.h
index c75ea6c3f..71b70e585 100644
--- a/src/VBox/Runtime/include/internal/ldrMach-O.h
+++ b/src/VBox/Runtime/include/internal/ldrMach-O.h
@@ -1,4 +1,4 @@
-/* $Id: ldrMach-O.h $ */
+/* $Id: ldrMach-O.h 37560 2011-06-20 14:48:32Z vboxsync $ */
/** @file
* IPRT - Mach-O Structures and Constants.
*/
diff --git a/src/VBox/Runtime/include/internal/ldrPE.h b/src/VBox/Runtime/include/internal/ldrPE.h
index 6b973a2cf..6e008f257 100644
--- a/src/VBox/Runtime/include/internal/ldrPE.h
+++ b/src/VBox/Runtime/include/internal/ldrPE.h
@@ -1,4 +1,4 @@
-/* $Id: ldrPE.h $ */
+/* $Id: ldrPE.h 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Windows NT PE Structures and Constants.
*/
diff --git a/src/VBox/Runtime/include/internal/lockvalidator.h b/src/VBox/Runtime/include/internal/lockvalidator.h
index 793e3ffff..0cc7796f2 100644
--- a/src/VBox/Runtime/include/internal/lockvalidator.h
+++ b/src/VBox/Runtime/include/internal/lockvalidator.h
@@ -1,4 +1,4 @@
-/* $Id: lockvalidator.h $ */
+/* $Id: lockvalidator.h 35499 2011-01-12 08:33:45Z vboxsync $ */
/** @file
* IPRT - Internal RTLockValidator header.
*/
diff --git a/src/VBox/Runtime/include/internal/magics.h b/src/VBox/Runtime/include/internal/magics.h
index 2ef040054..1afbb9d17 100644
--- a/src/VBox/Runtime/include/internal/magics.h
+++ b/src/VBox/Runtime/include/internal/magics.h
@@ -1,10 +1,10 @@
-/* $Id: magics.h $ */
+/* $Id: magics.h 37396 2011-06-09 15:48:59Z vboxsync $ */
/** @file
* IPRT - Internal header defining The Magic Numbers.
*/
/*
- * Copyright (C) 2007-2008 Oracle Corporation
+ * Copyright (C) 2007-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -42,6 +42,14 @@
#define RTDIR_MAGIC UINT32_C(0x19291112)
/** The value of RTDIR::u32Magic after RTDirClose(). */
#define RTDIR_MAGIC_DEAD UINT32_C(0x19950829)
+/** The value of RTDVMINTERNAL::u32Magic. (Dan Brown) */
+#define RTDVM_MAGIC UINT32_C(0x19640622)
+/** The value of RTDVMINTERNAL::u32Magic after close. */
+#define RTDVM_MAGIC_DEAD (~RTDVM_MAGIC)
+/** The value of RTDVMVOLUMEINTERNAL::u32Magic. (Daniel Defoe) */
+#define RTDVMVOLUME_MAGIC UINT32_C(0x16591961)
+/** The value of RTDVMVOLUMEINTERNAL::u32Magic after close. */
+#define RTDVMVOLUME_MAGIC_DEAD UINT32_C(0x17310424)
/** The value of RTFILEAIOCTXINT::u32Magic. (Howard Phillips Lovecraft) */
#define RTFILEAIOCTX_MAGIC UINT32_C(0x18900820)
/** The value of RTFILEAIOCTXINT::u32Magic after RTFileAioCtxDestroy(). */
@@ -50,6 +58,8 @@
#define RTFILEAIOREQ_MAGIC UINT32_C(0x19470921)
/** The value of RTENVINTERNAL::u32Magic. (Rumiko Takahashi) */
#define RTENV_MAGIC UINT32_C(0x19571010)
+/** The value of RTERRVARS::ai32Vars[0]. (Ryuichi Sakamoto) */
+#define RTERRVARS_MAGIC UINT32_C(0x19520117)
/** Magic number for RTHANDLETABLEINT::u32Magic. (Hitomi Kanehara) */
#define RTHANDLETABLE_MAGIC UINT32_C(0x19830808)
/** Magic number for RTHEAPOFFSETINTERNAL::u32Magic. (Neal Town Stephenson) */
@@ -100,6 +110,10 @@
#define RTR0MEMOBJ_MAGIC UINT32_C(0x19611210)
/** RTRANDINT::u32Magic. (Alan Moore) */
#define RTRANDINT_MAGIC UINT32_C(0x19531118)
+/** The value of RTS3::u32Magic. (Edgar Wallace) */
+#define RTS3_MAGIC UINT32_C(0x18750401)
+/** The value of RTS3::u32Magic after RTS3Destroy(). */
+#define RTS3_MAGIC_DEAD UINT32_C(0x19320210)
/** Magic for the event semaphore structure. (Neil Gaiman) */
#define RTSEMEVENT_MAGIC UINT32_C(0x19601110)
/** Magic for the multiple release event semaphore structure. (Isaac Asimov) */
@@ -137,7 +151,17 @@
/** The value of RTSTREAM::u32Magic for a valid stream. */
#define RTSTREAM_MAGIC UINT32_C(0xe44e44ee)
/** Magic value for RTTCPSERVER::u32Magic. (Jan Garbarek) */
-#define RTTCPSERVER_MAGIC UINT32_C(0x19540304)
+#define RTTCPSERVER_MAGIC UINT32_C(0x19470304)
+/** Magic value for RTTCPSERVER::u32Magic. (Harlan Ellison) */
+#define RTUDPSERVER_MAGIC UINT32_C(0x19340527)
+/** The value of RTTAR::u32Magic. (Donald Ervin Knuth) */
+#define RTTAR_MAGIC UINT32_C(0x19380110)
+/** The value of RTTAR::u32Magic after RTTarClose(). */
+#define RTTAR_MAGIC_DEAD ~RTTAR_MAGIC
+/** The value of RTTARFILE::u32Magic. (Abraham Stoker) */
+#define RTTARFILE_MAGIC UINT32_C(0x18471108)
+/** The value of RTTARFILE::u32Magic after RTTarFileClose(). */
+#define RTTARFILE_MAGIC_DEAD UINT32_C(0x19120420)
/** RTTESTINT::u32Magic value. (Daniel Kehlmann) */
#define RTTESTINT_MAGIC UINT32_C(0x19750113)
/** RTTHREADINT::u32Magic value. (Gilbert Keith Chesterton) */
@@ -148,18 +172,10 @@
#define RTTIMER_MAGIC UINT32_C(0x19370910)
/** Magic number for timer low resolution handles. (Saki Hiwatari) */
#define RTTIMERLR_MAGIC UINT32_C(0x19610715)
-/** The value of RTS3::u32Magic. (Edgar Wallace) */
-#define RTS3_MAGIC UINT32_C(0x18750401)
-/** The value of RTS3::u32Magic after RTS3Destroy(). */
-#define RTS3_MAGIC_DEAD UINT32_C(0x19320210)
-/** The value of RTTAR::u32Magic. (Donald Ervin Knuth) */
-#define RTTAR_MAGIC UINT32_C(0x19380110)
-/** The value of RTTAR::u32Magic after RTTarClose(). */
-#define RTTAR_MAGIC_DEAD ~RTTAR_MAGIC
-/** The value of RTTARFILE::u32Magic. (Abraham Stoker) */
-#define RTTARFILE_MAGIC UINT32_C(0x18471108)
-/** The value of RTTARFILE::u32Magic after RTTarFileClose(). */
-#define RTTARFILE_MAGIC_DEAD UINT32_C(0x19120420)
+/** Magic value of RTTRACEBUFINT::u32Magic. (George Orwell) */
+#define RTTRACEBUF_MAGIC UINT32_C(0x19030625)
+/** Magic value of RTTRACEBUFINT::u32Magic after the final release. */
+#define RTTRACEBUF_MAGIC_DEAD UINT32_C(0x19500121)
/** The value of RTVFSOBJINTERNAL::u32Magic. (Yasunari Kawabata) */
#define RTVFSOBJ_MAGIC UINT32_C(0x18990614)
/** The value of RTVFSOBJINTERNAL::u32Magic arter close. */
diff --git a/src/VBox/Runtime/include/internal/mem.h b/src/VBox/Runtime/include/internal/mem.h
index 0db465133..aa9b3c6d4 100644
--- a/src/VBox/Runtime/include/internal/mem.h
+++ b/src/VBox/Runtime/include/internal/mem.h
@@ -1,4 +1,4 @@
-/* $Id: mem.h $ */
+/* $Id: mem.h 33676 2010-11-02 09:48:24Z vboxsync $ */
/** @file
* IPRT - Memory Management.
*/
diff --git a/src/VBox/Runtime/include/internal/memobj.h b/src/VBox/Runtime/include/internal/memobj.h
index 1deff6f9e..a6c0ae997 100644
--- a/src/VBox/Runtime/include/internal/memobj.h
+++ b/src/VBox/Runtime/include/internal/memobj.h
@@ -1,10 +1,10 @@
-/* $Revision: 67140 $ */
+/* $Id: memobj.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Ring-0 Memory Objects.
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -287,7 +287,7 @@ DECLINLINE(bool) rtR0MemObjIsRing3(PRTR0MEMOBJINTERNAL pMem)
* @returns IPRT status code. On failure it is assumed that the object remains valid.
* @param pMem The ring-0 memory object handle to the memory which should be freed.
*/
-int rtR0MemObjNativeFree(PRTR0MEMOBJINTERNAL pMem);
+DECLHIDDEN(int) rtR0MemObjNativeFree(PRTR0MEMOBJINTERNAL pMem);
/**
* Allocates page aligned virtual kernel memory.
@@ -299,7 +299,7 @@ int rtR0MemObjNativeFree(PRTR0MEMOBJINTERNAL pMem);
* @param cb Number of bytes to allocate, page aligned.
* @param fExecutable Flag indicating whether it should be permitted to executed code in the memory object.
*/
-int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable);
+DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable);
/**
* Allocates page aligned virtual kernel memory with physical backing below 4GB.
@@ -311,7 +311,7 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu
* @param cb Number of bytes to allocate, page aligned.
* @param fExecutable Flag indicating whether it should be permitted to executed code in the memory object.
*/
-int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable);
+DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable);
/**
* Allocates page aligned virtual kernel memory with contiguous physical backing below 4GB.
@@ -323,7 +323,7 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut
* @param cb Number of bytes to allocate, page aligned.
* @param fExecutable Flag indicating whether it should be permitted to executed code in the memory object.
*/
-int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable);
+DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable);
/**
* Locks a range of user virtual memory.
@@ -336,7 +336,7 @@ int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu
* and RTMEM_PROT_WRITE.
* @param R0Process The process to lock pages in.
*/
-int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process);
+DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process);
/**
* Locks a range of kernel virtual memory.
@@ -348,7 +348,7 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c
* @param fAccess The desired access, a combination of RTMEM_PROT_READ
* and RTMEM_PROT_WRITE.
*/
-int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess);
+DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess);
/**
* Allocates contiguous page aligned physical memory without (necessarily) any
@@ -362,7 +362,7 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb,
* @param uAlignment The alignment of the reserved memory.
* Supported values are PAGE_SIZE, _2M, _4M and _1G.
*/
-int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment);
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment);
/**
* Allocates non-contiguous page aligned physical memory without (necessarily) any kernel mapping.
@@ -375,7 +375,7 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph
* @param PhysHighest The highest permitable address (inclusive).
* NIL_RTHCPHYS if any address is acceptable.
*/
-int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest);
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest);
/**
* Creates a page aligned, contiguous, physical memory object.
@@ -386,7 +386,7 @@ int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS
* @param cb The size of the object in bytes, page aligned.
* @param uCachePolicy One of the RTMEM_CACHE_XXX modes.
*/
-int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy);
+DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy);
/**
* Reserves kernel virtual address space.
@@ -398,7 +398,7 @@ int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t
* @param cb The number of bytes to reserve, page aligned.
* @param uAlignment The alignment of the reserved memory; PAGE_SIZE, _2M or _4M.
*/
-int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment);
+DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment);
/**
* Reserves user virtual address space in the current process.
@@ -410,7 +410,7 @@ int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, siz
* @param uAlignment The alignment of the reserved memory; PAGE_SIZE, _2M or _4M.
* @param R0Process The process to reserve the memory in.
*/
-int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process);
+DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process);
/**
* Maps a memory object into user virtual address space in the current process.
@@ -430,8 +430,8 @@ int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed,
* zero the entire object is mapped. The value must be
* page aligned.
*/
-int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
- unsigned fProt, size_t offSub, size_t cbSub);
+DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
+ unsigned fProt, size_t offSub, size_t cbSub);
/**
* Maps a memory object into user virtual address space in the current process.
@@ -444,7 +444,7 @@ int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap,
* @param fProt Combination of RTMEM_PROT_* flags (except RTMEM_PROT_NONE).
* @param R0Process The process to map the memory into.
*/
-int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process);
+DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process);
/**
* Change the page level protection of one or more pages in a memory object.
@@ -458,7 +458,7 @@ int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMem
* aligned.
* @param fProt Combination of RTMEM_PROT_* flags.
*/
-int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt);
+DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt);
/**
* Get the physical address of an page in the memory object.
@@ -470,10 +470,10 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu
* @param pMem The ring-0 memory object handle.
* @param iPage The page number within the object (valid).
*/
-RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage);
+DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage);
-PRTR0MEMOBJINTERNAL rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *pv, size_t cb);
-void rtR0MemObjDelete(PRTR0MEMOBJINTERNAL pMem);
+DECLHIDDEN(PRTR0MEMOBJINTERNAL) rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *pv, size_t cb);
+DECLHIDDEN(void) rtR0MemObjDelete(PRTR0MEMOBJINTERNAL pMem);
/** @} */
diff --git a/src/VBox/Runtime/include/internal/path.h b/src/VBox/Runtime/include/internal/path.h
index a1cdb1eed..4c2d6de1b 100644
--- a/src/VBox/Runtime/include/internal/path.h
+++ b/src/VBox/Runtime/include/internal/path.h
@@ -1,4 +1,4 @@
-/* $Id: path.h $ */
+/* $Id: path.h 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - RTPath Internal header.
*/
diff --git a/src/VBox/Runtime/include/internal/pipe.h b/src/VBox/Runtime/include/internal/pipe.h
index e5566d4f3..ec40772c8 100644
--- a/src/VBox/Runtime/include/internal/pipe.h
+++ b/src/VBox/Runtime/include/internal/pipe.h
@@ -1,4 +1,4 @@
-/* $Id: pipe.h $ */
+/* $Id: pipe.h 32131 2010-08-31 11:55:27Z vboxsync $ */
/** @file
* IPRT - Internal RTPipe header.
*/
diff --git a/src/VBox/Runtime/include/internal/process.h b/src/VBox/Runtime/include/internal/process.h
index 463368008..915d243af 100644
--- a/src/VBox/Runtime/include/internal/process.h
+++ b/src/VBox/Runtime/include/internal/process.h
@@ -1,4 +1,4 @@
-/* $Id: process.h $ */
+/* $Id: process.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Internal RTProc header.
*/
@@ -32,12 +32,13 @@
RT_C_DECLS_BEGIN
-extern RTPROCESS g_ProcessSelf;
-extern RTPROCPRIORITY g_enmProcessPriority;
-extern char g_szrtProcExePath[RTPATH_MAX];
-extern size_t g_cchrtProcExePath;
-extern size_t g_cchrtProcDir;
-extern size_t g_offrtProcName;
+extern DECLHIDDEN(RTPROCESS) g_ProcessSelf;
+extern DECLHIDDEN(RTPROCPRIORITY) g_enmProcessPriority;
+extern DECLHIDDEN(char) g_szrtProcExePath[RTPATH_MAX];
+extern DECLHIDDEN(size_t) g_cchrtProcExePath;
+extern DECLHIDDEN(size_t) g_cchrtProcDir;
+extern DECLHIDDEN(size_t) g_offrtProcName;
+extern DECLHIDDEN(bool volatile) g_frtAtExitCalled;
/**
* Validates and sets the process priority.
@@ -48,7 +49,7 @@ extern size_t g_offrtProcName;
* @param enmPriority The priority to validate and set.
* @remark Located in sched.
*/
-int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority);
+DECLHIDDEN(int) rtProcNativeSetPriority(RTPROCPRIORITY enmPriority);
/**
* Determines the full path to the executable image.
diff --git a/src/VBox/Runtime/include/internal/rand.h b/src/VBox/Runtime/include/internal/rand.h
index 2a7522c48..f0d0c8ddf 100644
--- a/src/VBox/Runtime/include/internal/rand.h
+++ b/src/VBox/Runtime/include/internal/rand.h
@@ -1,4 +1,4 @@
-/* $Id: rand.h $ */
+/* $Id: rand.h 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - Internal RTRand header
*/
@@ -149,8 +149,8 @@ typedef struct RTRANDINT
struct RTRandFile
{
- /** The file handle. */
- RTFILE hFile;
+ /** The file handle (native). */
+ intptr_t hFile;
} File;
} u;
} RTRANDINT;
@@ -158,32 +158,16 @@ typedef struct RTRANDINT
RT_C_DECLS_BEGIN
-/**
- * Initialize OS facilities for generating random bytes.
- */
-void rtRandLazyInitNative(void);
-
-/**
- * Generate random bytes using OS facilities.
- *
- * @returns VINF_SUCCESS on success, some error status code on failure.
- * @param pv Where to store the random bytes.
- * @param cb How many random bytes to store.
- */
-int rtRandGenBytesNative(void *pv, size_t cb);
-
-void rtRandGenBytesFallback(void *pv, size_t cb) RT_NO_THROW;
-
-DECLCALLBACK(void) rtRandAdvSynthesizeBytesFromU32(PRTRANDINT pThis, uint8_t *pb, size_t cb);
-DECLCALLBACK(void) rtRandAdvSynthesizeBytesFromU64(PRTRANDINT pThis, uint8_t *pb, size_t cb);
-DECLCALLBACK(uint32_t) rtRandAdvSynthesizeU32FromBytes(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last);
-DECLCALLBACK(uint32_t) rtRandAdvSynthesizeU32FromU64(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last);
-DECLCALLBACK(uint64_t) rtRandAdvSynthesizeU64FromBytes(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last);
-DECLCALLBACK(uint64_t) rtRandAdvSynthesizeU64FromU32(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last);
-DECLCALLBACK(int) rtRandAdvStubSeed(PRTRANDINT pThis, uint64_t u64Seed);
-DECLCALLBACK(int) rtRandAdvStubSaveState(PRTRANDINT pThis, char *pszState, size_t *pcbState);
-DECLCALLBACK(int) rtRandAdvStubRestoreState(PRTRANDINT pThis, char const *pszState);
-DECLCALLBACK(int) rtRandAdvDefaultDestroy(PRTRANDINT pThis);
+DECLHIDDEN(DECLCALLBACK(void)) rtRandAdvSynthesizeBytesFromU32(PRTRANDINT pThis, uint8_t *pb, size_t cb);
+DECLHIDDEN(DECLCALLBACK(void)) rtRandAdvSynthesizeBytesFromU64(PRTRANDINT pThis, uint8_t *pb, size_t cb);
+DECLHIDDEN(DECLCALLBACK(uint32_t)) rtRandAdvSynthesizeU32FromBytes(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last);
+DECLHIDDEN(DECLCALLBACK(uint32_t)) rtRandAdvSynthesizeU32FromU64(PRTRANDINT pThis, uint32_t u32First, uint32_t u32Last);
+DECLHIDDEN(DECLCALLBACK(uint64_t)) rtRandAdvSynthesizeU64FromBytes(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last);
+DECLHIDDEN(DECLCALLBACK(uint64_t)) rtRandAdvSynthesizeU64FromU32(PRTRANDINT pThis, uint64_t u64First, uint64_t u64Last);
+DECLHIDDEN(DECLCALLBACK(int)) rtRandAdvStubSeed(PRTRANDINT pThis, uint64_t u64Seed);
+DECLHIDDEN(DECLCALLBACK(int)) rtRandAdvStubSaveState(PRTRANDINT pThis, char *pszState, size_t *pcbState);
+DECLHIDDEN(DECLCALLBACK(int)) rtRandAdvStubRestoreState(PRTRANDINT pThis, char const *pszState);
+DECLHIDDEN(DECLCALLBACK(int)) rtRandAdvDefaultDestroy(PRTRANDINT pThis);
RT_C_DECLS_END
diff --git a/src/VBox/Runtime/include/internal/sched.h b/src/VBox/Runtime/include/internal/sched.h
index af7fe7cfa..6cb62bcc4 100644
--- a/src/VBox/Runtime/include/internal/sched.h
+++ b/src/VBox/Runtime/include/internal/sched.h
@@ -1,4 +1,4 @@
-/* $Id: sched.h $ */
+/* $Id: sched.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Internal RTSched header.
*/
@@ -40,7 +40,7 @@ RT_C_DECLS_BEGIN
* @returns iprt status code.
* @param enmType The thread type to be assumed for the current thread.
*/
-int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType);
+DECLHIDDEN(int) rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType);
RT_C_DECLS_END
diff --git a/src/VBox/Runtime/include/internal/socket.h b/src/VBox/Runtime/include/internal/socket.h
index 3a7882a88..ec6699780 100644
--- a/src/VBox/Runtime/include/internal/socket.h
+++ b/src/VBox/Runtime/include/internal/socket.h
@@ -1,4 +1,4 @@
-/* $Id: socket.h $ */
+/* $Id: socket.h 32131 2010-08-31 11:55:27Z vboxsync $ */
/** @file
* IPRT - Internal Header for RTSocket.
*/
diff --git a/src/VBox/Runtime/include/internal/strhash.h b/src/VBox/Runtime/include/internal/strhash.h
new file mode 100644
index 000000000..b26096489
--- /dev/null
+++ b/src/VBox/Runtime/include/internal/strhash.h
@@ -0,0 +1,94 @@
+/* $Id: strhash.h 36597 2011-04-06 19:46:15Z vboxsync $ */
+/** @file
+ * IPRT - Internal header containing inline string hashing functions.
+ */
+
+/*
+ * Copyright (C) 2006-2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#ifndef ___internal_strhash_h
+#define ___internal_strhash_h
+
+#include <iprt/types.h>
+
+
+/* sdbm:
+ This algorithm was created for sdbm (a public-domain reimplementation of
+ ndbm) database library. it was found to do well in scrambling bits,
+ causing better distribution of the keys and fewer splits. it also happens
+ to be a good general hashing function with good distribution. the actual
+ function is hash(i) = hash(i - 1) * 65599 + str[i]; what is included below
+ is the faster version used in gawk. [there is even a faster, duff-device
+ version] the magic constant 65599 was picked out of thin air while
+ experimenting with different constants, and turns out to be a prime.
+ this is one of the algorithms used in berkeley db (see sleepycat) and
+ elsewhere. */
+
+/**
+ * Hash string, return hash + length.
+ */
+DECLINLINE(uint32_t) sdbm(const char *str, size_t *pcch)
+{
+ uint8_t *pu8 = (uint8_t *)str;
+ uint32_t hash = 0;
+ int c;
+
+ while ((c = *pu8++))
+ hash = c + (hash << 6) + (hash << 16) - hash;
+
+ *pcch = (uintptr_t)pu8 - (uintptr_t)str - 1;
+ return hash;
+}
+
+
+/**
+ * Hash up to N bytes, return hash + hashed length.
+ */
+DECLINLINE(uint32_t) sdbmN(const char *str, size_t cchMax, size_t *pcch)
+{
+ uint8_t *pu8 = (uint8_t *)str;
+ uint32_t hash = 0;
+ int c;
+
+ while ((c = *pu8++) && cchMax-- > 0)
+ hash = c + (hash << 6) + (hash << 16) - hash;
+
+ *pcch = (uintptr_t)pu8 - (uintptr_t)str - 1;
+ return hash;
+}
+
+/**
+ * Incremental hashing.
+ */
+DECLINLINE(uint32_t) sdbmInc(const char *str, uint32_t hash)
+{
+ uint8_t *pu8 = (uint8_t *)str;
+ int c;
+
+ while ((c = *pu8++))
+ hash = c + (hash << 6) + (hash << 16) - hash;
+
+ return hash;
+}
+
+
+#endif
+
diff --git a/src/VBox/Runtime/include/internal/strict.h b/src/VBox/Runtime/include/internal/strict.h
index eed9a33c2..7dcd11ba1 100644
--- a/src/VBox/Runtime/include/internal/strict.h
+++ b/src/VBox/Runtime/include/internal/strict.h
@@ -1,4 +1,4 @@
-/* $Id: strict.h $ */
+/* $Id: strict.h 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Internal Header Defining Strictness Indicators.
*/
diff --git a/src/VBox/Runtime/include/internal/string.h b/src/VBox/Runtime/include/internal/string.h
index 0cf3b54df..eb57f927d 100644
--- a/src/VBox/Runtime/include/internal/string.h
+++ b/src/VBox/Runtime/include/internal/string.h
@@ -1,4 +1,4 @@
-/* $Id: string.h $ */
+/* $Id: string.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Internal RTStr header.
*/
@@ -47,14 +47,14 @@ RT_C_DECLS_BEGIN
# define RTStrAssertMsgReturn(expr, msg, rc) do { if (!(expr)) return rc; } while (0)
#endif
-size_t rtstrFormatRt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat, va_list *pArgs,
- int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize);
-size_t rtstrFormatType(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat, va_list *pArgs,
- int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize);
+DECLHIDDEN(size_t) rtstrFormatRt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat, va_list *pArgs,
+ int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize);
+DECLHIDDEN(size_t) rtstrFormatType(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, const char **ppszFormat, va_list *pArgs,
+ int cchWidth, int cchPrecision, unsigned fFlags, char chArgSize);
#ifdef RT_WITH_ICONV_CACHE
-void rtStrIconvCacheInit(struct RTTHREADINT *pThread);
-void rtStrIconvCacheDestroy(struct RTTHREADINT *pThread);
+DECLHIDDEN(void) rtStrIconvCacheInit(struct RTTHREADINT *pThread);
+DECLHIDDEN(void) rtStrIconvCacheDestroy(struct RTTHREADINT *pThread);
#endif
/**
@@ -74,11 +74,11 @@ typedef enum RTSTRICONV
RTSTRICONV_END
} RTSTRICONV;
-int rtStrConvert(const char *pchInput, size_t cchInput, const char *pszInputCS,
- char **ppszOutput, size_t cbOutput, const char *pszOutputCS,
- unsigned cFactor, RTSTRICONV enmCacheIdx);
-const char *rtStrGetLocaleCodeset(void);
-int rtUtf8Length(const char *psz, size_t cch, size_t *pcuc, size_t *pcchActual);
+DECLHIDDEN(int) rtStrConvert(const char *pchInput, size_t cchInput, const char *pszInputCS,
+ char **ppszOutput, size_t cbOutput, const char *pszOutputCS,
+ unsigned cFactor, RTSTRICONV enmCacheIdx);
+DECLHIDDEN(const char *) rtStrGetLocaleCodeset(void);
+DECLHIDDEN(int) rtUtf8Length(const char *psz, size_t cch, size_t *pcuc, size_t *pcchActual);
RT_C_DECLS_END
diff --git a/src/VBox/Runtime/include/internal/thread.h b/src/VBox/Runtime/include/internal/thread.h
index c39dc8c00..37b3e4719 100644
--- a/src/VBox/Runtime/include/internal/thread.h
+++ b/src/VBox/Runtime/include/internal/thread.h
@@ -1,4 +1,4 @@
-/* $Id: thread.h $ */
+/* $Id: thread.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Internal RTThread header.
*/
@@ -137,7 +137,7 @@ typedef RTTHREADINT *PRTTHREADINT;
*
* @returns iprt status code.
*/
-int rtThreadNativeInit(void);
+DECLHIDDEN(int) rtThreadNativeInit(void);
/**
* Create a native thread.
@@ -147,7 +147,7 @@ int rtThreadNativeInit(void);
* @param pThreadInt The thread data structure for the thread.
* @param pNativeThread Where to store the native thread identifier.
*/
-int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread);
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread);
/**
* Adopts a thread, this is called immediately after allocating the
@@ -155,7 +155,7 @@ int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
*
* @param pThread Pointer to the thread structure.
*/
-int rtThreadNativeAdopt(PRTTHREADINT pThread);
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread);
/**
* Called from rtThreadDestroy so that the TLS entry and any native data in the
@@ -163,7 +163,7 @@ int rtThreadNativeAdopt(PRTTHREADINT pThread);
*
* @param pThread The thread structure.
*/
-void rtThreadNativeDestroy(PRTTHREADINT pThread);
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread);
/**
* Sets the priority of the thread according to the thread type
@@ -177,7 +177,7 @@ void rtThreadNativeDestroy(PRTTHREADINT pThread);
* @param enmType The thread type.
* @remark Located in sched.
*/
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType);
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType);
#ifdef IN_RING3
# ifdef RT_OS_WINDOWS
@@ -187,29 +187,26 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType);
* It give the Win32/64 backend a chance to terminate alien
* threads properly.
*/
-void rtThreadNativeDetach(void);
+DECLHIDDEN(void) rtThreadNativeDetach(void);
# endif
#endif /* !IN_RING0 */
/* thread.cpp */
-int rtThreadMain(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread, const char *pszThreadName);
-void rtThreadBlocking(PRTTHREADINT pThread, RTTHREADSTATE enmState, uint64_t u64Block,
- const char *pszFile, unsigned uLine, RTUINTPTR uId);
-void rtThreadUnblocked(PRTTHREADINT pThread, RTTHREADSTATE enmCurState);
-uint32_t rtThreadRelease(PRTTHREADINT pThread);
-void rtThreadTerminate(PRTTHREADINT pThread, int rc);
-PRTTHREADINT rtThreadGetByNative(RTNATIVETHREAD NativeThread);
-PRTTHREADINT rtThreadGet(RTTHREAD Thread);
-int rtThreadInit(void);
-void rtThreadTerm(void);
-void rtThreadInsert(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread);
+DECLHIDDEN(int) rtThreadMain(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread, const char *pszThreadName);
+DECLHIDDEN(uint32_t) rtThreadRelease(PRTTHREADINT pThread);
+DECLHIDDEN(void) rtThreadTerminate(PRTTHREADINT pThread, int rc);
+DECLHIDDEN(PRTTHREADINT) rtThreadGetByNative(RTNATIVETHREAD NativeThread);
+DECLHIDDEN(PRTTHREADINT) rtThreadGet(RTTHREAD Thread);
+DECLHIDDEN(int) rtThreadInit(void);
+DECLHIDDEN(void) rtThreadTerm(void);
+DECLHIDDEN(void) rtThreadInsert(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread);
#ifdef IN_RING3
-int rtThreadDoSetProcPriority(RTPROCPRIORITY enmPriority);
+DECLHIDDEN(int) rtThreadDoSetProcPriority(RTPROCPRIORITY enmPriority);
#endif /* !IN_RING0 */
#ifdef IPRT_WITH_GENERIC_TLS
-void rtThreadClearTlsEntry(RTTLS iTls);
-void rtThreadTlsDestruction(PRTTHREADINT pThread); /* in tls-generic.cpp */
+DECLHIDDEN(void) rtThreadClearTlsEntry(RTTLS iTls);
+DECLHIDDEN(void) rtThreadTlsDestruction(PRTTHREADINT pThread); /* in tls-generic.cpp */
#endif
#ifdef ___iprt_asm_h
diff --git a/src/VBox/Runtime/include/internal/time.h b/src/VBox/Runtime/include/internal/time.h
index 9d2895fc8..6d6c4c0b8 100644
--- a/src/VBox/Runtime/include/internal/time.h
+++ b/src/VBox/Runtime/include/internal/time.h
@@ -1,10 +1,10 @@
-/* $Id: time.h $ */
+/* $Id: time.h 36549 2011-04-05 09:28:24Z vboxsync $ */
/** @file
* IPRT - Internal RTTime header
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -33,9 +33,9 @@ RT_C_DECLS_BEGIN
#if defined(IN_RING3) || defined(IN_RC)
-extern uint64_t g_u64ProgramStartNanoTS;
-extern uint64_t g_u64ProgramStartMicroTS;
-extern uint64_t g_u64ProgramStartMilliTS;
+extern DECLHIDDEN(uint64_t) g_u64ProgramStartNanoTS;
+extern DECLHIDDEN(uint64_t) g_u64ProgramStartMicroTS;
+extern DECLHIDDEN(uint64_t) g_u64ProgramStartMilliTS;
#endif
diff --git a/src/VBox/Runtime/nt/NtProcessStartup-stub.cpp b/src/VBox/Runtime/nt/NtProcessStartup-stub.cpp
index fcb3bc21c..279b40726 100644
--- a/src/VBox/Runtime/nt/NtProcessStartup-stub.cpp
+++ b/src/VBox/Runtime/nt/NtProcessStartup-stub.cpp
@@ -1,4 +1,4 @@
-/* $Id: NtProcessStartup-stub.cpp $ */
+/* $Id: NtProcessStartup-stub.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - NtProcessStartup stub to make the link happy.
*/
diff --git a/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp b/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp
index 0f74823bd..f3a8b58fb 100644
--- a/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp
+++ b/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTErrConvertFromNtStatus.cpp $ */
+/* $Id: RTErrConvertFromNtStatus.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Convert NT status codes to iprt status codes.
*/
diff --git a/src/VBox/Runtime/os2/RTErrConvertFromOS2.cpp b/src/VBox/Runtime/os2/RTErrConvertFromOS2.cpp
index edbfb3315..a87a064f0 100644
--- a/src/VBox/Runtime/os2/RTErrConvertFromOS2.cpp
+++ b/src/VBox/Runtime/os2/RTErrConvertFromOS2.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTErrConvertFromOS2.cpp $ */
+/* $Id: RTErrConvertFromOS2.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Convert OS/2 error codes to iprt status codes.
*/
diff --git a/src/VBox/Runtime/r0drv/alloc-r0drv.cpp b/src/VBox/Runtime/r0drv/alloc-r0drv.cpp
index 17b9e8bcf..fe626d1fa 100644
--- a/src/VBox/Runtime/r0drv/alloc-r0drv.cpp
+++ b/src/VBox/Runtime/r0drv/alloc-r0drv.cpp
@@ -1,4 +1,4 @@
-/* $Id: alloc-r0drv.cpp $ */
+/* $Id: alloc-r0drv.cpp 37672 2011-06-28 19:48:17Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Ring-0 Driver.
*/
@@ -179,43 +179,64 @@ RT_EXPORT_SYMBOL(RTMemAllocZVarTag);
RTDECL(void *) RTMemReallocTag(void *pvOld, size_t cbNew, const char *pszTag) RT_NO_THROW
{
- if (!cbNew)
+ PRTMEMHDR pHdrOld;
+
+ /* Free. */
+ if (!cbNew && pvOld)
+ {
RTMemFree(pvOld);
- else if (!pvOld)
+ return NULL;
+ }
+
+ /* Alloc. */
+ if (!pvOld)
return RTMemAllocTag(cbNew, pszTag);
- else
+
+ /*
+ * Realloc.
+ */
+ pHdrOld = (PRTMEMHDR)pvOld - 1;
+ RT_ASSERT_PREEMPTIBLE();
+
+ if (pHdrOld->u32Magic == RTMEMHDR_MAGIC)
{
- PRTMEMHDR pHdrOld = (PRTMEMHDR)pvOld - 1;
- RT_ASSERT_PREEMPTIBLE();
+ PRTMEMHDR pHdrNew;
+
+ /* If there is sufficient space in the old block and we don't cause
+ substantial internal fragmentation, reuse the old block. */
+ if ( pHdrOld->cb >= cbNew + RTR0MEM_FENCE_EXTRA
+ && pHdrOld->cb - (cbNew + RTR0MEM_FENCE_EXTRA) <= 128)
+ {
+ pHdrOld->cbReq = (uint32_t)cbNew; Assert(pHdrOld->cbReq == cbNew);
+#ifdef RTR0MEM_STRICT
+ memcpy((uint8_t *)(pHdrOld + 1) + cbNew, &g_abFence[0], RTR0MEM_FENCE_EXTRA);
+#endif
+ return pvOld;
+ }
- if (pHdrOld->u32Magic == RTMEMHDR_MAGIC)
+ /* Allocate a new block and copy over the content. */
+ pHdrNew = rtR0MemAlloc(cbNew + RTR0MEM_FENCE_EXTRA, 0);
+ if (pHdrNew)
{
- PRTMEMHDR pHdrNew;
- if (pHdrOld->cb >= cbNew && pHdrOld->cb - cbNew <= 128)
- return pvOld;
- pHdrNew = rtR0MemAlloc(cbNew + RTR0MEM_FENCE_EXTRA, 0);
- if (pHdrNew)
- {
- size_t cbCopy = RT_MIN(pHdrOld->cb, pHdrNew->cb);
- memcpy(pHdrNew + 1, pvOld, cbCopy);
+ size_t cbCopy = RT_MIN(pHdrOld->cb, pHdrNew->cb);
+ memcpy(pHdrNew + 1, pvOld, cbCopy);
#ifdef RTR0MEM_STRICT
- pHdrNew->cbReq = (uint32_t)cbNew; Assert(pHdrNew->cbReq == cbNew);
- memcpy((uint8_t *)(pHdrNew + 1) + cbNew, &g_abFence[0], RTR0MEM_FENCE_EXTRA);
- AssertReleaseMsg(!memcmp((uint8_t *)(pHdrOld + 1) + pHdrOld->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA),
- ("pHdr=%p pvOld=%p cb=%zu cbNew=%zu\n"
- "fence: %.*Rhxs\n"
- "expected: %.*Rhxs\n",
- pHdrOld, pvOld, pHdrOld->cb, cbNew,
- RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdrOld + 1) + pHdrOld->cb,
- RTR0MEM_FENCE_EXTRA, &g_abFence[0]));
+ pHdrNew->cbReq = (uint32_t)cbNew; Assert(pHdrNew->cbReq == cbNew);
+ memcpy((uint8_t *)(pHdrNew + 1) + cbNew, &g_abFence[0], RTR0MEM_FENCE_EXTRA);
+ AssertReleaseMsg(!memcmp((uint8_t *)(pHdrOld + 1) + pHdrOld->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA),
+ ("pHdr=%p pvOld=%p cbReq=%u cb=%u cbNew=%zu fFlags=%#x\n"
+ "fence: %.*Rhxs\n"
+ "expected: %.*Rhxs\n",
+ pHdrOld, pvOld, pHdrOld->cbReq, pHdrOld->cb, cbNew, pHdrOld->fFlags,
+ RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdrOld + 1) + pHdrOld->cbReq,
+ RTR0MEM_FENCE_EXTRA, &g_abFence[0]));
#endif
- rtR0MemFree(pHdrOld);
- return pHdrNew + 1;
- }
+ rtR0MemFree(pHdrOld);
+ return pHdrNew + 1;
}
- else
- AssertMsgFailed(("pHdrOld->u32Magic=%RX32 pvOld=%p cbNew=%#zx\n", pHdrOld->u32Magic, pvOld, cbNew));
}
+ else
+ AssertMsgFailed(("pHdrOld->u32Magic=%RX32 pvOld=%p cbNew=%#zx\n", pHdrOld->u32Magic, pvOld, cbNew));
return NULL;
}
@@ -236,11 +257,11 @@ RTDECL(void) RTMemFree(void *pv) RT_NO_THROW
Assert(!(pHdr->fFlags & RTMEMHDR_FLAG_EXEC));
#ifdef RTR0MEM_STRICT
AssertReleaseMsg(!memcmp((uint8_t *)(pHdr + 1) + pHdr->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA),
- ("pHdr=%p pv=%p cb=%zu\n"
+ ("pHdr=%p pv=%p cbReq=%u cb=%u fFlags=%#x\n"
"fence: %.*Rhxs\n"
"expected: %.*Rhxs\n",
- pHdr, pv, pHdr->cb,
- RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cb,
+ pHdr, pv, pHdr->cbReq, pHdr->cb, pHdr->fFlags,
+ RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cbReq,
RTR0MEM_FENCE_EXTRA, &g_abFence[0]));
#endif
rtR0MemFree(pHdr);
@@ -291,11 +312,11 @@ RTDECL(void) RTMemExecFree(void *pv, size_t cb) RT_NO_THROW
Assert(!(pHdr->fFlags & RTMEMHDR_FLAG_ALLOC_EX));
#ifdef RTR0MEM_STRICT
AssertReleaseMsg(!memcmp((uint8_t *)(pHdr + 1) + pHdr->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA),
- ("pHdr=%p pv=%p cb=%zu\n"
+ ("pHdr=%p pv=%p cbReq=%u cb=%u fFlags=%#x\n"
"fence: %.*Rhxs\n"
"expected: %.*Rhxs\n",
- pHdr, pv, pHdr->cb,
- RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cb,
+ pHdr, pv, pHdr->cbReq, pHdr->cb, pHdr->fFlags,
+ RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cbReq,
RTR0MEM_FENCE_EXTRA, &g_abFence[0]));
#endif
rtR0MemFree(pHdr);
@@ -392,11 +413,11 @@ RTDECL(void) RTMemFreeEx(void *pv, size_t cb) RT_NO_THROW
#ifdef RTR0MEM_STRICT
AssertReleaseMsg(!memcmp((uint8_t *)(pHdr + 1) + pHdr->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA),
- ("pHdr=%p pv=%p cb=%zu\n"
+ ("pHdr=%p pv=%p cbReq=%u cb=%u fFlags=%#x\n"
"fence: %.*Rhxs\n"
"expected: %.*Rhxs\n",
- pHdr, pv, pHdr->cb,
- RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cb,
+ pHdr, pv, pHdr->cbReq, pHdr->cb, pHdr->fFlags,
+ RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cbReq,
RTR0MEM_FENCE_EXTRA, &g_abFence[0]));
#endif
rtR0MemFree(pHdr);
diff --git a/src/VBox/Runtime/r0drv/alloc-r0drv.h b/src/VBox/Runtime/r0drv/alloc-r0drv.h
index 3843e1cc9..024c64320 100644
--- a/src/VBox/Runtime/r0drv/alloc-r0drv.h
+++ b/src/VBox/Runtime/r0drv/alloc-r0drv.h
@@ -1,4 +1,4 @@
-/* $Id: alloc-r0drv.h $ */
+/* $Id: alloc-r0drv.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Ring-0 Driver.
*/
@@ -86,13 +86,13 @@ typedef struct RTMEMHDR
* the backend might be using.
* @param ppHdr Where to return the memory header on success.
*/
-int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr);
+DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr);
/**
* Free memory allocated by rtR0MemAllocEx.
* @param pHdr The memory block to free. (Never NULL.)
*/
-void rtR0MemFree(PRTMEMHDR pHdr);
+DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr);
RT_C_DECLS_END
#endif
diff --git a/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp
index 9a65df825..ef63e351f 100644
--- a/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteDebugger-r0drv-darwin.cpp $ */
+/* $Id: RTLogWriteDebugger-r0drv-darwin.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log To Debugger, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp
index 57da5a760..0946d3b4c 100644
--- a/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteStdOut-r0drv-darwin.cpp $ */
+/* $Id: RTLogWriteStdOut-r0drv-darwin.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log To StdOut, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp
index 21c003279..be2d63145 100644
--- a/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: alloc-r0drv-darwin.cpp $ */
+/* $Id: alloc-r0drv-darwin.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Ring-0 Driver, Darwin.
*/
@@ -41,7 +41,7 @@
/**
* OS specific allocation function.
*/
-int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
+DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
{
if (RT_UNLIKELY(fFlags & RTMEMHDR_FLAG_ANY_CTX))
return VERR_NOT_SUPPORTED;
@@ -65,7 +65,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
/**
* OS specific free function.
*/
-void rtR0MemFree(PRTMEMHDR pHdr)
+DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
{
pHdr->u32Magic += 1;
IOFree(pHdr, pHdr->cb + sizeof(*pHdr));
diff --git a/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp
index 14a40addf..3c9e8c0c5 100644
--- a/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: assert-r0drv-darwin.cpp $ */
+/* $Id: assert-r0drv-darwin.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Assertion Workers, Ring-0 Drivers, Darwin.
*/
@@ -40,7 +40,7 @@
#include "internal/assert.h"
-void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
+DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
{
printf("\r\n!!Assertion Failed!!\r\n"
"Expression: %s\r\n"
@@ -49,7 +49,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi
}
-void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
+DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
{
char szMsg[256];
diff --git a/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp
index 253adaf35..d3ba0123f 100644
--- a/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: initterm-r0drv-darwin.cpp $ */
+/* $Id: initterm-r0drv-darwin.cpp 37575 2011-06-21 12:40:01Z vboxsync $ */
/** @file
* IPRT - Initialization & Termination, R0 Driver, Darwin.
*/
@@ -49,7 +49,7 @@ PFNR0DARWINASTPENDING g_pfnR0DarwinAstPending = NULL;
PFNR0DARWINCPUINTERRUPT g_pfnR0DarwinCpuInterrupt = NULL;
-int rtR0InitNative(void)
+DECLHIDDEN(int) rtR0InitNative(void)
{
/*
* Create the lock group.
@@ -89,7 +89,7 @@ int rtR0InitNative(void)
}
-void rtR0TermNative(void)
+DECLHIDDEN(void) rtR0TermNative(void)
{
/*
* Preemption hacks before the lock group.
diff --git a/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp
index e69746daf..bbf3712d4 100644
--- a/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: mach_kernel-r0drv-darwin.cpp $ */
+/* $Id: mach_kernel-r0drv-darwin.cpp 37597 2011-06-22 20:54:05Z vboxsync $ */
/** @file
* IPRT - mach_kernel symbol resolving hack, R0 Driver, Darwin.
*/
@@ -25,7 +25,6 @@
*/
-#define RTMEM_WRAP_TO_EF_APIS
/*******************************************************************************
* Header Files *
*******************************************************************************/
@@ -50,16 +49,6 @@ RT_C_DECLS_END
#include "internal/iprt.h"
#include <iprt/darwin/machkernel.h>
-#ifdef IN_RING0 /* till RTFILE is changed in types.h */
-# include <iprt/types.h>
-typedef struct RTFILENEWINT *RTFILENEW;
-typedef RTFILENEW *PRTFILENEW;
-# undef NIL_RTFILE
-# define RTFILE RTFILENEW
-# define PRTFILE PRTFILENEW
-# define NIL_RTFILE ((RTFILENEW)-1)
-#endif
-
#include <iprt/asm.h>
#include <iprt/assert.h>
#include <iprt/err.h>
@@ -196,7 +185,7 @@ static bool g_fBreakpointOnError = false;
/**
* Darwin kernel file handle data.
*/
-typedef struct RTFILENEWINT
+typedef struct RTFILEINT
{
/** Magic value (RTFILE_MAGIC). */
uint32_t u32Magic;
@@ -208,14 +197,14 @@ typedef struct RTFILENEWINT
vfs_context_t hVfsCtx;
/** The vnode returned by vnode_open. */
vnode_t hVnode;
-} RTFILENEWINT;
-/** Magic number for RTFILENEWINT::u32Magic (To Be Determined). */
+} RTFILEINT;
+/** Magic number for RTFILEINT::u32Magic (To Be Determined). */
#define RTFILE_MAGIC UINT32_C(0x01020304)
-RTDECL(int) RTFileOpen(PRTFILE phFile, const char *pszFilename, uint32_t fOpen)
+RTDECL(int) RTFileOpen(PRTFILE phFile, const char *pszFilename, uint64_t fOpen)
{
- RTFILENEWINT *pThis = (RTFILENEWINT *)RTMemAllocZ(sizeof(*pThis));
+ RTFILEINT *pThis = (RTFILEINT *)RTMemAllocZ(sizeof(*pThis));
if (!pThis)
return VERR_NO_MEMORY;
@@ -285,7 +274,7 @@ RTDECL(int) RTFileClose(RTFILE hFile)
if (hFile == NIL_RTFILE)
return VINF_SUCCESS;
- RTFILENEWINT *pThis = hFile;
+ RTFILEINT *pThis = hFile;
AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
AssertReturn(pThis->u32Magic == RTFILE_MAGIC, VERR_INVALID_HANDLE);
pThis->u32Magic = ~RTFILE_MAGIC;
@@ -299,7 +288,7 @@ RTDECL(int) RTFileClose(RTFILE hFile)
RTDECL(int) RTFileReadAt(RTFILE hFile, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead)
{
- RTFILENEWINT *pThis = hFile;
+ RTFILEINT *pThis = hFile;
AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
AssertReturn(pThis->u32Magic == RTFILE_MAGIC, VERR_INVALID_HANDLE);
diff --git a/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
index 7d7e27f7e..9fad7d833 100644
--- a/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: memobj-r0drv-darwin.cpp $ */
+/* $Id: memobj-r0drv-darwin.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Ring-0 Memory Objects, Darwin.
*/
@@ -225,7 +225,7 @@ static void rtR0MemObjDarwinReadPhys(RTHCPHYS HCPhys, size_t cb, void *pvDst)
* @returns the PTE.
* @param pvPage The virtual address to get the PTE for.
*/
-uint64_t rtR0MemObjDarwinGetPTE(void *pvPage)
+static uint64_t rtR0MemObjDarwinGetPTE(void *pvPage)
{
RTUINT64U u64;
RTCCUINTREG cr3 = ASMGetCR3();
@@ -323,7 +323,7 @@ uint64_t rtR0MemObjDarwinGetPTE(void *pvPage)
#endif /* RT_STRICT */
-int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
+DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
{
PRTR0MEMOBJDARWIN pMemDarwin = (PRTR0MEMOBJDARWIN)pMem;
@@ -523,14 +523,14 @@ static int rtR0MemObjNativeAllocWorker(PPRTR0MEMOBJINTERNAL ppMem, size_t cb,
}
-int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
return rtR0MemObjNativeAllocWorker(ppMem, cb, fExecutable, false /* fContiguous */,
0 /* PhysMask */, UINT64_MAX, RTR0MEMOBJTYPE_PAGE);
}
-int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
/*
* Try IOMallocPhysical/IOMallocAligned first.
@@ -548,7 +548,7 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut
}
-int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
int rc = rtR0MemObjNativeAllocWorker(ppMem, cb, fExecutable, true /* fContiguous */,
~(uint32_t)PAGE_OFFSET_MASK, _4G - PAGE_SIZE,
@@ -566,7 +566,7 @@ int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu
}
-int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
{
/** @todo alignment */
if (uAlignment != PAGE_SIZE)
@@ -595,7 +595,7 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph
}
-int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
{
/** @todo rtR0MemObjNativeAllocPhys / darwin.
* This might be a bit problematic and may very well require having to create our own
@@ -606,7 +606,7 @@ int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS
}
-int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
+DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
{
AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED);
@@ -737,32 +737,32 @@ static int rtR0MemObjNativeLock(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb,
}
-int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
{
return rtR0MemObjNativeLock(ppMem, (void *)R3Ptr, cb, fAccess, (task_t)R0Process);
}
-int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
+DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
{
return rtR0MemObjNativeLock(ppMem, pv, cb, fAccess, kernel_task);
}
-int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
+DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
{
return VERR_NOT_SUPPORTED;
}
-int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
{
return VERR_NOT_SUPPORTED;
}
-int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
- unsigned fProt, size_t offSub, size_t cbSub)
+DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
+ unsigned fProt, size_t offSub, size_t cbSub)
{
AssertReturn(pvFixed == (void *)-1, VERR_NOT_SUPPORTED);
@@ -866,7 +866,7 @@ int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap,
}
-int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
{
/*
* Check for unsupported things.
@@ -925,7 +925,7 @@ int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RT
}
-int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
+DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
{
/* Get the map for the object. */
vm_map_t pVmMap = rtR0MemObjDarwinGetMap(pMem);
@@ -971,7 +971,7 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu
}
-RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
+DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
{
RTHCPHYS PhysAddr;
PRTR0MEMOBJDARWIN pMemDarwin = (PRTR0MEMOBJDARWIN)pMem;
diff --git a/src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp
index 9918f92ca..4dfbf5e7d 100644
--- a/src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: memuserkernel-r0drv-darwin.cpp $ */
+/* $Id: memuserkernel-r0drv-darwin.cpp 36540 2011-04-04 15:58:26Z vboxsync $ */
/** @file
* IPRT - User & Kernel Memory, Ring-0 Driver, Darwin.
*/
@@ -31,6 +31,7 @@
#include "the-darwin-kernel.h"
#include "internal/iprt.h"
#include <iprt/mem.h>
+#include <iprt/assert.h>
#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
# include <iprt/asm-amd64-x86.h>
diff --git a/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp
index f5a731661..173aa397b 100644
--- a/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: mp-r0drv-darwin.cpp $ */
+/* $Id: mp-r0drv-darwin.cpp 37575 2011-06-21 12:40:01Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp
index 355420304..215a009a2 100644
--- a/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: process-r0drv-darwin.cpp $ */
+/* $Id: process-r0drv-darwin.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Process, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp
index a2098bfd2..1d4848b73 100644
--- a/src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: semevent-r0drv-darwin.cpp $ */
+/* $Id: semevent-r0drv-darwin.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Single Release Event Semaphores, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp
index a77d41d0d..53ea3f258 100644
--- a/src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: semeventmulti-r0drv-darwin.cpp $ */
+/* $Id: semeventmulti-r0drv-darwin.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Multiple Release Event Semaphores, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/semfastmutex-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/semfastmutex-r0drv-darwin.cpp
index 407381ec6..d286362b3 100644
--- a/src/VBox/Runtime/r0drv/darwin/semfastmutex-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/semfastmutex-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: semfastmutex-r0drv-darwin.cpp $ */
+/* $Id: semfastmutex-r0drv-darwin.cpp 29255 2010-05-09 18:11:24Z vboxsync $ */
/** @file
* IPRT - Fast Mutex Semaphores, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp
index 2b01e760a..009be81d1 100644
--- a/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: semmutex-r0drv-darwin.cpp $ */
+/* $Id: semmutex-r0drv-darwin.cpp 36192 2011-03-07 16:33:55Z vboxsync $ */
/** @file
* IPRT - Mutex Semaphores, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp
index df46ce0d7..2f6986582 100644
--- a/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: spinlock-r0drv-darwin.cpp $ */
+/* $Id: spinlock-r0drv-darwin.cpp 29255 2010-05-09 18:11:24Z vboxsync $ */
/** @file
* IPRT - Spinlocks, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h b/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h
index 254b1468f..a2bd2b751 100644
--- a/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h
+++ b/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h
@@ -1,4 +1,4 @@
-/* $Id: the-darwin-kernel.h $ */
+/* $Id: the-darwin-kernel.h 37575 2011-06-21 12:40:01Z vboxsync $ */
/** @file
* IPRT - Include all necessary headers for the Darwing kernel.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp
index c71476355..920065af5 100644
--- a/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: thread-r0drv-darwin.cpp $ */
+/* $Id: thread-r0drv-darwin.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Threads, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp
index 41e0f370f..48a10d4ca 100644
--- a/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: thread2-r0drv-darwin.cpp $ */
+/* $Id: thread2-r0drv-darwin.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Threads (Part 2), Ring-0 Driver, Darwin.
*/
@@ -40,7 +40,7 @@
#include "internal/thread.h"
-int rtThreadNativeInit(void)
+DECLHIDDEN(int) rtThreadNativeInit(void)
{
/* No TLS in Ring-0. :-/ */
return VINF_SUCCESS;
@@ -53,7 +53,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void)
}
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
/*
* Convert the priority type to scheduling policies.
@@ -130,13 +130,13 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
}
-int rtThreadNativeAdopt(PRTTHREADINT pThread)
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
{
return VERR_NOT_IMPLEMENTED;
}
-void rtThreadNativeDestroy(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
{
NOREF(pThread);
}
@@ -162,7 +162,7 @@ static void rtThreadNativeMain(void *pvArg, wait_result_t Ignored)
}
-int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
{
RT_ASSERT_PREEMPTIBLE();
diff --git a/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp
index 23b28a100..00effbd19 100644
--- a/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: threadpreempt-r0drv-darwin.cpp $ */
+/* $Id: threadpreempt-r0drv-darwin.cpp 37575 2011-06-21 12:40:01Z vboxsync $ */
/** @file
* IPRT - Thread Preemption, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp
index 913fa711e..487099d07 100644
--- a/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: time-r0drv-darwin.cpp $ */
+/* $Id: time-r0drv-darwin.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Time, Ring-0 Driver, Darwin.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c
index 93de62447..3ebf473a0 100644
--- a/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: alloc-r0drv-freebsd.c $ */
+/* $Id: alloc-r0drv-freebsd.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Ring-0 Driver, FreeBSD.
*/
@@ -51,7 +51,7 @@ MALLOC_DEFINE(M_IPRTHEAP, "iprtheap", "IPRT - heap");
MALLOC_DEFINE(M_IPRTCONT, "iprtcont", "IPRT - contiguous");
-int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
+DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
{
size_t cbAllocated = cb;
PRTMEMHDR pHdr = NULL;
@@ -121,7 +121,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
}
-void rtR0MemFree(PRTMEMHDR pHdr)
+DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
{
pHdr->u32Magic += 1;
diff --git a/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c
index 56f6acaa8..ed8c8f246 100644
--- a/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: assert-r0drv-freebsd.c $ */
+/* $Id: assert-r0drv-freebsd.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Assertion Workers, Ring-0 Drivers, FreeBSD.
*/
@@ -41,7 +41,7 @@
#include "internal/assert.h"
-void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
+DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
{
printf("\r\n!!Assertion Failed!!\r\n"
"Expression: %s\r\n"
@@ -50,7 +50,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi
}
-void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
+DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
{
char szMsg[256];
diff --git a/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c
index 591b77973..60c50be8f 100644
--- a/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: initterm-r0drv-freebsd.c $ */
+/* $Id: initterm-r0drv-freebsd.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Initialization & Termination, Ring-0 Driver, FreeBSD.
*/
@@ -38,14 +38,14 @@
#include "internal/initterm.h"
-int rtR0InitNative(void)
+DECLHIDDEN(int) rtR0InitNative(void)
{
/* nothing to do */
return VINF_SUCCESS;
}
-void rtR0TermNative(void)
+DECLHIDDEN(void) rtR0TermNative(void)
{
/* nothing to undo */
}
diff --git a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
index 7959367f8..1f253f7c1 100644
--- a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: memobj-r0drv-freebsd.c $ */
+/* $Id: memobj-r0drv-freebsd.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Ring-0 Memory Objects, FreeBSD.
*/
@@ -76,9 +76,7 @@ typedef struct RTR0MEMOBJFREEBSD
MALLOC_DEFINE(M_IPRTMOBJ, "iprtmobj", "IPRT - R0MemObj");
-/*******************************************************************************
-* Internal Functions *
-*******************************************************************************/
+
/**
* Gets the virtual memory map the specified object is mapped into.
@@ -119,7 +117,8 @@ static vm_map_t rtR0MemObjFreeBSDGetMap(PRTR0MEMOBJINTERNAL pMem)
}
}
-int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
+
+DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
{
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem;
int rc;
@@ -220,7 +219,8 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
return VINF_SUCCESS;
}
-int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+
+DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
int rc;
size_t cPages = cb >> PAGE_SHIFT;
@@ -308,7 +308,8 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu
return rc;
}
-int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+
+DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
#ifdef USE_KMEM_ALLOC_ATTR
/*
@@ -360,7 +361,7 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut
}
-int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
/* create the object. */
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb);
@@ -387,6 +388,7 @@ int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu
return VERR_NO_MEMORY;
}
+
static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage)
{
pPage->wire_count = 1;
@@ -397,6 +399,7 @@ static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage)
atomic_add_int(&cnt.v_wire_count, 1);
}
+
static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTYPE enmType,
size_t cb,
RTHCPHYS PhysHighest, size_t uAlignment,
@@ -474,7 +477,8 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOB
return rc;
}
-int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
+
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
{
#if 1
return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest, uAlignment, true);
@@ -505,7 +509,7 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph
}
-int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
{
#if 1
return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest, PAGE_SIZE, false);
@@ -515,7 +519,7 @@ int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS
}
-int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
+DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
{
AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED);
@@ -567,7 +571,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTERNAL ppMem, vm_map_t pVmMap
}
-int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
{
return rtR0MemObjNativeLockInMap(ppMem,
&((struct proc *)R0Process)->p_vmspace->vm_map,
@@ -579,7 +583,7 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c
}
-int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
+DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
{
return rtR0MemObjNativeLockInMap(ppMem,
kernel_map,
@@ -669,21 +673,22 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixe
}
-int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
+
+DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
{
return rtR0MemObjNativeReserveInMap(ppMem, pvFixed, cb, uAlignment, NIL_RTR0PROCESS, kernel_map);
}
-int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
{
return rtR0MemObjNativeReserveInMap(ppMem, (void *)R3PtrFixed, cb, uAlignment, R0Process,
&((struct proc *)R0Process)->p_vmspace->vm_map);
}
-int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
- unsigned fProt, size_t offSub, size_t cbSub)
+DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
+ unsigned fProt, size_t offSub, size_t cbSub)
{
AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
@@ -702,7 +707,7 @@ int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap,
/* see http://markmail.org/message/udhq33tefgtyfozs */
-int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
{
/*
* Check for unsupported stuff.
@@ -808,7 +813,7 @@ int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RT
}
-int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
+DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
{
vm_prot_t ProtectionFlags = 0;
vm_offset_t AddrStart = (uintptr_t)pMem->pv + offSub;
@@ -835,7 +840,7 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu
}
-RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
+DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
{
PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem;
diff --git a/src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c
index ce24fb5d3..6bd7c45b9 100644
--- a/src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: memuserkernel-r0drv-freebsd.c $ */
+/* $Id: memuserkernel-r0drv-freebsd.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - User & Kernel Memory, Ring-0 Driver, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c
index a2cffad86..c71c865ad 100644
--- a/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: mp-r0drv-freebsd.c $ */
+/* $Id: mp-r0drv-freebsd.c 37774 2011-07-04 21:19:27Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Ring-0 Driver, FreeBSD.
*/
@@ -163,8 +163,10 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
/* Will panic if no rendezvousing cpus, so check up front. */
if (RTMpGetOnlineCount() > 1)
{
-#if __FreeBSD_version >= 700000
- cpumask_t Mask = ~(cpumask_t)curcpu;
+#if __FreeBSD_version >= 900000
+ cpuset_t Mask;
+#elif __FreeBSD_version >= 700000
+ cpumask_t Mask;
#endif
RTMPARGS Args;
@@ -174,6 +176,12 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
Args.idCpu = RTMpCpuId();
Args.cHits = 0;
#if __FreeBSD_version >= 700000
+# if __FreeBSD_version >= 900000
+ Mask = all_cpus;
+ CPU_CLR(curcpu, &Mask);
+# else
+ Mask = ~(cpumask_t)curcpu;
+# endif
smp_rendezvous_cpus(Mask, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendevous_barrier, &Args);
#else
smp_rendezvous(NULL, rtmpOnOthersFreeBSDWrapper, NULL, &Args);
@@ -203,8 +211,10 @@ static void rtmpOnSpecificFreeBSDWrapper(void *pvArg)
RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
{
-#if __FreeBSD_version >= 700000
- cpumask_t Mask = 1 << idCpu;
+#if __FreeBSD_version >= 900000
+ cpuset_t Mask;
+#elif __FreeBSD_version >= 700000
+ cpumask_t Mask;
#endif
RTMPARGS Args;
@@ -218,7 +228,11 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1
Args.idCpu = idCpu;
Args.cHits = 0;
#if __FreeBSD_version >= 700000
+# if __FreeBSD_version >= 900000
+ CPU_SETOF(idCpu, &Mask);
+# else
Mask = (cpumask_t)1 << idCpu;
+# endif
smp_rendezvous_cpus(Mask, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendevous_barrier, &Args);
#else
smp_rendezvous(NULL, rtmpOnSpecificFreeBSDWrapper, NULL, &Args);
@@ -242,13 +256,21 @@ static void rtmpFreeBSDPokeCallback(void *pvArg)
RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
{
+#if __FreeBSD_version >= 900000
+ cpuset_t Mask;
+#elif __FreeBSD_version >= 700000
cpumask_t Mask;
+#endif
/* Will panic if no rendezvousing cpus, so make sure the cpu is online. */
if (!RTMpIsCpuOnline(idCpu))
return VERR_CPU_NOT_FOUND;
+# if __FreeBSD_version >= 900000
+ CPU_SETOF(idCpu, &Mask);
+# else
Mask = (cpumask_t)1 << idCpu;
+# endif
smp_rendezvous_cpus(Mask, NULL, rtmpFreeBSDPokeCallback, smp_no_rendevous_barrier, NULL);
return VINF_SUCCESS;
diff --git a/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c
index 96af287aa..ac08c3e94 100644
--- a/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: process-r0drv-freebsd.c $ */
+/* $Id: process-r0drv-freebsd.c 18972 2009-04-16 23:43:08Z vboxsync $ */
/** @file
* IPRT - Process Management, Ring-0 Driver, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c
index b2a9a5c91..435c255ce 100644
--- a/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: semevent-r0drv-freebsd.c $ */
+/* $Id: semevent-r0drv-freebsd.c 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Single Release Event Semaphores, Ring-0 Driver, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c
index 253a5b01d..f8ed7800f 100644
--- a/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: semeventmulti-r0drv-freebsd.c $ */
+/* $Id: semeventmulti-r0drv-freebsd.c 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Multiple Release Event Semaphores, Ring-0 Driver, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c
index 2f42336f0..7058b7fd0 100644
--- a/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: semfastmutex-r0drv-freebsd.c $ */
+/* $Id: semfastmutex-r0drv-freebsd.c 25722 2010-01-11 14:22:03Z vboxsync $ */
/** @file
* IPRT - Fast Mutex Semaphores, Ring-0 Driver, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c
index b20b9603f..370f29a75 100644
--- a/src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: semmutex-r0drv-freebsd.c $ */
+/* $Id: semmutex-r0drv-freebsd.c 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Mutex Semaphores, Ring-0 Driver, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h b/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h
index 89e12087b..49d3d5393 100644
--- a/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h
+++ b/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h
@@ -1,4 +1,4 @@
-/* $Id: sleepqueue-r0drv-freebsd.h $ */
+/* $Id: sleepqueue-r0drv-freebsd.h 37305 2011-06-02 12:32:20Z vboxsync $ */
/** @file
* IPRT - FreeBSD Ring-0 Driver Helpers for Abstracting Sleep Queues,
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c
index 97a988e6a..f208aea90 100644
--- a/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: spinlock-r0drv-freebsd.c $ */
+/* $Id: spinlock-r0drv-freebsd.c 29500 2010-05-14 21:43:06Z vboxsync $ */
/** @file
* IPRT - Spinlocks, Ring-0 Driver, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h b/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h
index 718b6741a..4c9fb9261 100644
--- a/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h
+++ b/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h
@@ -1,4 +1,4 @@
-/* $Id: the-freebsd-kernel.h $ */
+/* $Id: the-freebsd-kernel.h 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Ring-0 Driver, The FreeBSD Kernel Headers.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c
index 38474aab3..f58d9dd7d 100644
--- a/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: thread-r0drv-freebsd.c $ */
+/* $Id: thread-r0drv-freebsd.c 35960 2011-02-14 14:52:34Z vboxsync $ */
/** @file
* IPRT - Threads (Part 1), Ring-0 Driver, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c
index 0f42760a1..be9191727 100644
--- a/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: thread2-r0drv-freebsd.c $ */
+/* $Id: thread2-r0drv-freebsd.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Threads (Part 2), Ring-0 Driver, FreeBSD.
*/
@@ -40,7 +40,7 @@
#include "internal/thread.h"
-int rtThreadNativeInit(void)
+DECLHIDDEN(int) rtThreadNativeInit(void)
{
return VINF_SUCCESS;
}
@@ -52,7 +52,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void)
}
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
int iPriority;
@@ -89,7 +89,7 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
}
-int rtThreadNativeAdopt(PRTTHREADINT pThread)
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
{
NOREF(pThread);
/* There is nothing special that needs doing here, but the
@@ -98,7 +98,7 @@ int rtThreadNativeAdopt(PRTTHREADINT pThread)
}
-void rtThreadNativeDestroy(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
{
NOREF(pThread);
}
@@ -125,7 +125,7 @@ static void rtThreadNativeMain(void *pvThreadInt)
}
-int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
{
int rc;
struct proc *pProc;
diff --git a/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c
index 7f356a10c..3d1ff7e78 100644
--- a/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: time-r0drv-freebsd.c $ */
+/* $Id: time-r0drv-freebsd.c 18972 2009-04-16 23:43:08Z vboxsync $ */
/** @file
* IPRT - Time, Ring-0 Driver, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c
index 43f693f48..d8981b9d5 100644
--- a/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c
@@ -1,4 +1,4 @@
-/* $Id: timer-r0drv-freebsd.c $ */
+/* $Id: timer-r0drv-freebsd.c 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Ring-0 Driver, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp
index 925842eb4..100e12e29 100644
--- a/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpIsCpuWorkPending-r0drv-generic.cpp $ */
+/* $Id: RTMpIsCpuWorkPending-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTMpIsCpuWorkPending, Generic.
*/
diff --git a/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp
index a9844aceb..44114a12a 100644
--- a/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpOn-r0drv-generic.cpp $ */
+/* $Id: RTMpOn-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Ring-0 Driver, Generic Stubs.
*/
diff --git a/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp
index 01835679e..e253d3ecf 100644
--- a/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpPokeCpu-r0drv-generic.cpp $ */
+/* $Id: RTMpPokeCpu-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTMpPokeCpu, Generic Implementation.
*/
diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp
index 0d943b3b2..afc70a258 100644
--- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTThreadPreemptDisable-r0drv-generic.cpp $ */
+/* $Id: RTThreadPreemptDisable-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTThreadPreemptDisable, Generic ring-0 driver implementation.
*/
diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp
index 0e00439d0..d496cacfb 100644
--- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTThreadPreemptIsEnabled-r0drv-generic.cpp $ */
+/* $Id: RTThreadPreemptIsEnabled-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTThreadPreemptIsEnabled, Generic ring-0 driver implementation.
*/
diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp
index 1fc9b894f..88e91de25 100644
--- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTThreadPreemptIsPending-r0drv-generic.cpp $ */
+/* $Id: RTThreadPreemptIsPending-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTThreadPreemptIsPending, Generic ring-0 driver implementation.
*/
diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp
index fe94d0226..2288b4d8c 100644
--- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp $ */
+/* $Id: RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTThreadPreemptIsPendingTrusty, Generic ring-0 driver implementation.
*/
diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp
index 9fa8461e1..d327ea6ad 100644
--- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTThreadPreemptRestore-r0drv-generic.cpp $ */
+/* $Id: RTThreadPreemptRestore-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTThreadPreemptRestore, Generic ring-0 driver implementation.
*/
diff --git a/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp
index 0b22a8e57..f4336e557 100644
--- a/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: mpnotification-r0drv-generic.cpp $ */
+/* $Id: mpnotification-r0drv-generic.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Multiprocessor Notifications, Ring-0 Driver, Generic Stubs.
*/
@@ -53,13 +53,13 @@ RTDECL(int) RTMpNotificationDeregister(PFNRTMPNOTIFICATION pfnCallback, void *pv
RT_EXPORT_SYMBOL(RTMpNotificationDeregister);
-int rtR0MpNotificationInit(void)
+DECLHIDDEN(int) rtR0MpNotificationInit(void)
{
return VINF_SUCCESS;
}
-void rtR0MpNotificationTerm(void)
+DECLHIDDEN(void) rtR0MpNotificationTerm(void)
{
}
diff --git a/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c b/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c
index 69f29f24a..8bb2f9739 100644
--- a/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c
+++ b/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c
@@ -1,4 +1,4 @@
-/* $Id: semspinmutex-r0drv-generic.c $ */
+/* $Id: semspinmutex-r0drv-generic.c 33393 2010-10-24 16:17:00Z vboxsync $ */
/** @file
* IPRT - Spinning Mutex Semaphores, Ring-0 Driver, Generic.
*/
diff --git a/src/VBox/Runtime/r0drv/initterm-r0drv.cpp b/src/VBox/Runtime/r0drv/initterm-r0drv.cpp
index ba88e54ef..15ce42f88 100644
--- a/src/VBox/Runtime/r0drv/initterm-r0drv.cpp
+++ b/src/VBox/Runtime/r0drv/initterm-r0drv.cpp
@@ -1,4 +1,4 @@
-/* $Id: initterm-r0drv.cpp $ */
+/* $Id: initterm-r0drv.cpp 36233 2011-03-09 17:05:12Z vboxsync $ */
/** @file
* IPRT - Initialization & Termination, R0 Driver, Common.
*/
@@ -78,9 +78,7 @@ RTR0DECL(int) RTR0Init(unsigned fReserved)
rc = rtR0InitNative();
if (RT_SUCCESS(rc))
{
-#if !defined(RT_OS_LINUX) /** @todo implement thread2-r0drv-linux.c */
rc = rtThreadInit();
-#endif
if (RT_SUCCESS(rc))
{
#ifndef IN_GUEST /* play safe for now */
@@ -96,9 +94,7 @@ RTR0DECL(int) RTR0Init(unsigned fReserved)
if (RT_SUCCESS(rc))
return rc;
#endif
-#if !defined(RT_OS_LINUX) /** @todo implement thread2-r0drv-linux.c */
rtThreadTerm();
-#endif
}
rtR0TermNative();
}
@@ -109,9 +105,7 @@ RT_EXPORT_SYMBOL(RTR0Init);
static void rtR0Term(void)
{
-#if !defined(RT_OS_LINUX) /** @todo implement thread2-r0drv-linux.c */
rtThreadTerm();
-#endif
#ifndef IN_GUEST /* play safe for now */
rtR0PowerNotificationTerm();
rtR0MpNotificationTerm();
diff --git a/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c
index 144d637ea..0bb7b0181 100644
--- a/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteDebugger-r0drv-linux.c $ */
+/* $Id: RTLogWriteDebugger-r0drv-linux.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log To Debugger, Ring-0 Driver, Linux.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
index 2534575bb..2300cff8c 100644
--- a/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: alloc-r0drv-linux.c $ */
+/* $Id: alloc-r0drv-linux.c 36962 2011-05-04 17:43:50Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Ring-0 Driver, Linux.
*/
@@ -76,7 +76,7 @@ static size_t g_cPages;
* API for cleaning up the heap spinlock on IPRT termination.
* This is as RTMemExecDonate specific to AMD64 Linux/GNU.
*/
-void rtR0MemExecCleanup(void)
+DECLHIDDEN(void) rtR0MemExecCleanup(void)
{
# ifdef RTMEMALLOC_EXEC_HEAP_VM_AREA
unsigned i;
@@ -203,7 +203,7 @@ RT_EXPORT_SYMBOL(RTR0MemExecInit);
/**
* OS specific allocation function.
*/
-int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
+DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
{
PRTMEMHDR pHdr;
@@ -239,11 +239,25 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
}
else
{
- if (cb <= PAGE_SIZE || (fFlags & RTMEMHDR_FLAG_ANY_CTX))
+ if (
+#if 1 /* vmalloc has serious performance issues, avoid it. */
+ cb <= PAGE_SIZE*16 - sizeof(*pHdr)
+#else
+ cb <= PAGE_SIZE
+#endif
+ || (fFlags & RTMEMHDR_FLAG_ANY_CTX)
+ )
{
fFlags |= RTMEMHDR_FLAG_KMALLOC;
pHdr = kmalloc(cb + sizeof(*pHdr),
(fFlags & RTMEMHDR_FLAG_ANY_CTX_ALLOC) ? GFP_ATOMIC : GFP_KERNEL);
+ if (RT_UNLIKELY( !pHdr
+ && cb > PAGE_SIZE
+ && !(fFlags & RTMEMHDR_FLAG_ANY_CTX) ))
+ {
+ fFlags &= ~RTMEMHDR_FLAG_KMALLOC;
+ pHdr = vmalloc(cb + sizeof(*pHdr));
+ }
}
else
pHdr = vmalloc(cb + sizeof(*pHdr));
@@ -267,7 +281,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
/**
* OS specific free function.
*/
-void rtR0MemFree(PRTMEMHDR pHdr)
+DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
{
pHdr->u32Magic += 1;
if (pHdr->fFlags & RTMEMHDR_FLAG_KMALLOC)
diff --git a/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c
index db9a1257b..0d5351d14 100644
--- a/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: assert-r0drv-linux.c $ */
+/* $Id: assert-r0drv-linux.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Assertion Workers, Ring-0 Drivers, Linux.
*/
@@ -40,7 +40,7 @@
#include "internal/assert.h"
-void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
+DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
{
printk(KERN_EMERG
"\r\n!!Assertion Failed!!\r\n"
@@ -50,7 +50,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi
}
-void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
+DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
{
char szMsg[256];
diff --git a/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c
index 0d27c022c..d76a42d4c 100644
--- a/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: initterm-r0drv-linux.c $ */
+/* $Id: initterm-r0drv-linux.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Initialization & Termination, R0 Driver, Linux.
*/
@@ -40,17 +40,17 @@
*******************************************************************************/
#ifdef RT_ARCH_AMD64
/* in alloc-r0drv0-linux.c */
-extern void rtR0MemExecCleanup(void);
+DECLHIDDEN(void) rtR0MemExecCleanup(void);
#endif
-int rtR0InitNative(void)
+DECLHIDDEN(int) rtR0InitNative(void)
{
return VINF_SUCCESS;
}
-void rtR0TermNative(void)
+DECLHIDDEN(void) rtR0TermNative(void)
{
#ifdef RT_ARCH_AMD64
rtR0MemExecCleanup();
diff --git a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
index 82f938b0b..2db3df78e 100644
--- a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Revision: 69499 $ */
+/* $Revision: 36555 $ */
/** @file
* IPRT - Ring-0 Memory Objects, Linux.
*/
@@ -97,7 +97,7 @@ static void rtR0MemObjLinuxFreePages(PRTR0MEMOBJLNX pMemLnx);
* @returns The corresponding Linux task.
* @param R0Process IPRT ring-0 process handle.
*/
-struct task_struct *rtR0ProcessToLinuxTask(RTR0PROCESS R0Process)
+static struct task_struct *rtR0ProcessToLinuxTask(RTR0PROCESS R0Process)
{
/** @todo fix rtR0ProcessToLinuxTask!! */
return R0Process == RTR0ProcHandleSelf() ? current : NULL;
@@ -442,7 +442,7 @@ static void rtR0MemObjLinuxVUnmap(PRTR0MEMOBJLNX pMemLnx)
}
-int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
+DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
{
PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)pMem;
@@ -534,7 +534,7 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
}
-int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
PRTR0MEMOBJLNX pMemLnx;
int rc;
@@ -561,7 +561,7 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu
}
-int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
PRTR0MEMOBJLNX pMemLnx;
int rc;
@@ -598,7 +598,7 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut
}
-int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
PRTR0MEMOBJLNX pMemLnx;
int rc;
@@ -743,19 +743,19 @@ static int rtR0MemObjLinuxAllocPhysSub(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTYP
}
-int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
{
return rtR0MemObjLinuxAllocPhysSub(ppMem, RTR0MEMOBJTYPE_PHYS, cb, uAlignment, PhysHighest);
}
-int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
{
return rtR0MemObjLinuxAllocPhysSub(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PAGE_SIZE, PhysHighest);
}
-int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
+DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
{
/*
* All we need to do here is to validate that we can use
@@ -778,7 +778,7 @@ int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t
}
-int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
{
const int cPages = cb >> PAGE_SHIFT;
struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process);
@@ -875,7 +875,7 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c
}
-int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
+DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
{
void *pvLast = (uint8_t *)pv + cb - 1;
size_t const cPages = cb >> PAGE_SHIFT;
@@ -890,12 +890,26 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb,
* Classify the memory and check that we can deal with it.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
- fLinearMapping = virt_addr_valid(pvLast) && virt_addr_valid(pv);
+ fLinearMapping = virt_addr_valid(pvLast) && virt_addr_valid(pv);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
fLinearMapping = VALID_PAGE(virt_to_page(pvLast)) && VALID_PAGE(virt_to_page(pv));
#else
# error "not supported"
#endif
+ /*
+ * kmap()'ed memory. Only relevant for 32-bit Linux kernels with HIGHMEM
+ * enabled. Unfortunately there is no easy way to retrieve the page object
+ * for such temporarily mapped memory, virt_to_page() does not work here.
+ * There is even no function to check if a virtual address is inside the
+ * kmap() area or not :-( kmap_atomic_to_page() looks promising but the test
+ * 'if (vaddr < FIXADDR_START)' if wrong -- the kmap() area is located
+ * below the fixmap area. vmalloc_to_page() would work but is only allowed
+ * for vmalloc'ed memory.
+ */
+#ifdef CONFIG_HIGHMEM
+ if (pv < PKMAP_BASE + LAST_PKMAP*PAGE_SIZE && pvLast >= PKMAP_BASE)
+ return VERR_INVALID_PARAMETER;
+#endif
if (!fLinearMapping)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 19)
@@ -961,7 +975,7 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb,
}
-int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
+DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
const size_t cPages = cb >> PAGE_SHIFT;
@@ -1076,7 +1090,7 @@ static void *rtR0MemObjLinuxDoMmap(RTR3PTR R3PtrFixed, size_t cb, size_t uAlignm
}
-int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
{
PRTR0MEMOBJLNX pMemLnx;
void *pv;
@@ -1114,8 +1128,9 @@ int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed,
}
-int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
- unsigned fProt, size_t offSub, size_t cbSub)
+DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap,
+ void *pvFixed, size_t uAlignment,
+ unsigned fProt, size_t offSub, size_t cbSub)
{
int rc = VERR_NO_MEMORY;
PRTR0MEMOBJLNX pMemLnxToMap = (PRTR0MEMOBJLNX)pMemToMap;
@@ -1249,7 +1264,8 @@ static int rtR0MemObjLinuxFixPte(struct mm_struct *mm, unsigned long ulAddr, RTH
#endif /* VBOX_USE_PAE_HACK */
-int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed,
+ size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
{
struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process);
PRTR0MEMOBJLNX pMemLnxToMap = (PRTR0MEMOBJLNX)pMemToMap;
@@ -1413,7 +1429,7 @@ int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RT
}
-int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
+DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
{
NOREF(pMem);
NOREF(offSub);
@@ -1423,7 +1439,7 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu
}
-RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
+DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
{
PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)pMem;
diff --git a/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c
index 4517fea98..b9c470049 100644
--- a/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: memuserkernel-r0drv-linux.c $ */
+/* $Id: memuserkernel-r0drv-linux.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - User & Kernel Memory, Ring-0 Driver, Linux.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
index 8545960ed..58a8a9e08 100644
--- a/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: mp-r0drv-linux.c $ */
+/* $Id: mp-r0drv-linux.c 37672 2011-06-28 19:48:17Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Ring-0 Driver, Linux.
*/
@@ -35,6 +35,7 @@
#include <iprt/cpuset.h>
#include <iprt/err.h>
#include <iprt/asm.h>
+#include <iprt/thread.h>
#include "r0drv/mp-r0drv.h"
@@ -202,6 +203,9 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
int rc;
RTMPARGS Args;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+ RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
+#endif
Args.pfnWorker = pfnWorker;
Args.pvUser1 = pvUser1;
Args.pvUser2 = pvUser2;
@@ -212,19 +216,13 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
rc = on_each_cpu(rtmpLinuxWrapper, &Args, 1 /* wait */);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
rc = on_each_cpu(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */);
-
#else /* older kernels */
-
-# ifdef preempt_disable
- preempt_disable();
-# endif
+ RTThreadPreemptDisable(&PreemptState);
rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */);
local_irq_disable();
rtmpLinuxWrapper(&Args);
local_irq_enable();
-# ifdef preempt_enable
- preempt_enable();
-# endif
+ RTThreadPreemptRestore(&PreemptState);
#endif /* older kernels */
Assert(rc == 0); NOREF(rc);
return VINF_SUCCESS;
@@ -237,23 +235,20 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
int rc;
RTMPARGS Args;
+ RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
Args.pfnWorker = pfnWorker;
Args.pvUser1 = pvUser1;
Args.pvUser2 = pvUser2;
Args.idCpu = NIL_RTCPUID;
Args.cHits = 0;
-#ifdef preempt_disable
- preempt_disable();
-#endif
+ RTThreadPreemptDisable(&PreemptState);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
rc = smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */);
#else /* older kernels */
rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */);
#endif /* older kernels */
-#ifdef preempt_enable
- preempt_enable();
-#endif
+ RTThreadPreemptRestore(&PreemptState);
Assert(rc == 0); NOREF(rc);
return VINF_SUCCESS;
@@ -287,6 +282,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1
int rc;
RTMPARGS Args;
+ RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
Args.pfnWorker = pfnWorker;
Args.pvUser1 = pvUser1;
Args.pvUser2 = pvUser2;
@@ -296,9 +292,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1
if (!RTMpIsCpuPossible(idCpu))
return VERR_CPU_NOT_FOUND;
-# ifdef preempt_disable
- preempt_disable();
-# endif
+ RTThreadPreemptDisable(&PreemptState);
if (idCpu != RTMpCpuId())
{
if (RTMpIsCpuOnline(idCpu))
@@ -321,9 +315,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1
rtmpLinuxWrapper(&Args);
rc = VINF_SUCCESS;
}
-# ifdef preempt_enable
- preempt_enable();
-# endif
+ RTThreadPreemptRestore(&PreemptState);;
NOREF(rc);
return rc;
diff --git a/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
index dd46f9eba..cd234d239 100644
--- a/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: mpnotification-r0drv-linux.c $ */
+/* $Id: mpnotification-r0drv-linux.c 37672 2011-06-28 19:48:17Z vboxsync $ */
/** @file
* IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Linux.
*/
@@ -34,6 +34,7 @@
#include <iprt/mp.h>
#include <iprt/err.h>
#include <iprt/cpuset.h>
+#include <iprt/thread.h>
#include "r0drv/mp-r0drv.h"
@@ -67,16 +68,63 @@ static RTCPUSET g_MpPendingOfflineSet;
/**
+ * Notification wrapper that updates CPU states and invokes our notification
+ * callbacks.
+ *
+ * @param idCpu The CPU Id.
+ * @param pvUser1 Pointer to the notifier_block (unused).
+ * @param pvUser2 The notification event.
+ * @remarks This can be invoked in interrupt context.
+ */
+static void rtMpNotificationLinuxOnCurrentCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+ unsigned long ulNativeEvent = *(unsigned long *)pvUser2;
+ NOREF(pvUser1);
+
+ AssertRelease(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+ AssertRelease(idCpu == RTMpCpuId()); /* ASSUMES iCpu == RTCPUID */
+
+ switch (ulNativeEvent)
+ {
+# ifdef CPU_DOWN_FAILED
+ case CPU_DOWN_FAILED:
+# if defined(CPU_TASKS_FROZEN) && defined(CPU_DOWN_FAILED_FROZEN)
+ case CPU_DOWN_FAILED_FROZEN:
+# endif
+# endif
+ case CPU_ONLINE:
+# if defined(CPU_TASKS_FROZEN) && defined(CPU_ONLINE_FROZEN)
+ case CPU_ONLINE_FROZEN:
+# endif
+ rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, idCpu);
+ break;
+
+# ifdef CPU_DOWN_PREPARE
+ case CPU_DOWN_PREPARE:
+# if defined(CPU_TASKS_FROZEN) && defined(CPU_DOWN_PREPARE_FROZEN)
+ case CPU_DOWN_PREPARE_FROZEN:
+# endif
+ rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, idCpu);
+ break;
+# endif
+ }
+}
+
+
+/**
* The native callback.
*
- * @returns 0.
+ * @returns NOTIFY_DONE.
* @param pNotifierBlock Pointer to g_NotifierBlock.
* @param ulNativeEvent The native event.
* @param pvCpu The cpu id cast into a pointer value.
+ * @remarks This can fire with preemption enabled and on any CPU.
*/
static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock, unsigned long ulNativeEvent, void *pvCpu)
{
- RTCPUID idCpu = (uintptr_t)pvCpu;
+ int rc;
+ bool fProcessEvent = false;
+ RTCPUID idCpu = (uintptr_t)pvCpu;
NOREF(pNotifierBlock);
/*
@@ -85,8 +133,6 @@ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock,
* use them. Thus we have to test for both CPU_TASKS_FROZEN and
* the individual event variants.
*/
-
- /* ASSUMES iCpu == RTCPUID */
switch (ulNativeEvent)
{
/*
@@ -99,7 +145,7 @@ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock,
case CPU_DOWN_FAILED_FROZEN:
# endif
if (!RTCpuSetIsMember(&g_MpPendingOfflineSet, idCpu))
- return 0;
+ break; /* fProcessEvents = false */
/* fall thru */
# endif
case CPU_ONLINE:
@@ -109,7 +155,7 @@ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock,
# ifdef CPU_DOWN_FAILED
RTCpuSetDel(&g_MpPendingOfflineSet, idCpu);
# endif
- rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, idCpu);
+ fProcessEvent = true;
break;
/*
@@ -122,24 +168,33 @@ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock,
# if defined(CPU_TASKS_FROZEN) && defined(CPU_DOWN_PREPARE_FROZEN)
case CPU_DOWN_PREPARE_FROZEN:
# endif
+ fProcessEvent = true;
# else
case CPU_DEAD:
# if defined(CPU_TASKS_FROZEN) && defined(CPU_DEAD_FROZEN)
case CPU_DEAD_FROZEN:
# endif
+ /* Don't process CPU_DEAD notifications. */
# endif
- rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, idCpu);
# ifdef CPU_DOWN_FAILED
RTCpuSetAdd(&g_MpPendingOfflineSet, idCpu);
# endif
break;
}
+ if (!fProcessEvent)
+ return NOTIFY_DONE;
+
+ /*
+ * Reschedule the callbacks to fire on the specific CPU with preemption disabled.
+ */
+ rc = RTMpOnSpecific(idCpu, rtMpNotificationLinuxOnCurrentCpu, pNotifierBlock, &ulNativeEvent);
+ Assert(RT_SUCCESS(rc)); NOREF(rc);
return NOTIFY_DONE;
}
-int rtR0MpNotificationNativeInit(void)
+DECLHIDDEN(int) rtR0MpNotificationNativeInit(void)
{
int rc;
@@ -153,19 +208,19 @@ int rtR0MpNotificationNativeInit(void)
}
-void rtR0MpNotificationNativeTerm(void)
+DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void)
{
unregister_cpu_notifier(&g_NotifierBlock);
}
#else /* Not supported / Not needed */
-int rtR0MpNotificationNativeInit(void)
+DECLHIDDEN(int) rtR0MpNotificationNativeInit(void)
{
return VINF_SUCCESS;
}
-void rtR0MpNotificationNativeTerm(void)
+DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void)
{
}
diff --git a/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c
index e69aeace2..4c838081a 100644
--- a/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: process-r0drv-linux.c $ */
+/* $Id: process-r0drv-linux.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Process, Ring-0 Driver, Linux.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c
index 2506adc87..de9b2bd83 100644
--- a/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: semevent-r0drv-linux.c $ */
+/* $Id: semevent-r0drv-linux.c 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Single Release Event Semaphores, Ring-0 Driver, Linux.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c
index 74cc39002..23a248544 100644
--- a/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: semeventmulti-r0drv-linux.c $ */
+/* $Id: semeventmulti-r0drv-linux.c 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Multiple Release Event Semaphores, Ring-0 Driver, Linux.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c
index 45d1d5128..e23fdeb0d 100644
--- a/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c
@@ -1,10 +1,10 @@
-/* $Id: semfastmutex-r0drv-linux.c $ */
+/* $Id: semfastmutex-r0drv-linux.c 36979 2011-05-06 11:55:42Z vboxsync $ */
/** @file
* IPRT - Fast Mutex Semaphores, Ring-0 Driver, Linux.
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -35,7 +35,7 @@
#include <iprt/assert.h>
#include <iprt/asm.h>
#include <iprt/err.h>
-#ifdef IPRT_DEBUG_SEMS
+#if defined(RT_STRICT) || defined(IPRT_DEBUG_SEMS)
# include <iprt/thread.h>
#endif
@@ -54,7 +54,7 @@ typedef struct RTSEMFASTMUTEXINTERNAL
uint32_t u32Magic;
/** the linux semaphore. */
struct semaphore Semaphore;
-#ifdef IPRT_DEBUG_SEMS
+#if defined(RT_STRICT) || defined(IPRT_DEBUG_SEMS)
/** For check. */
RTNATIVETHREAD volatile Owner;
#endif
@@ -76,7 +76,7 @@ RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFastMtx)
*/
pThis->u32Magic = RTSEMFASTMUTEX_MAGIC;
sema_init(&pThis->Semaphore, 1);
-#ifdef IPRT_DEBUG_SEMS
+#if defined(RT_STRICT) || defined(IPRT_DEBUG_SEMS)
pThis->Owner = NIL_RTNATIVETHREAD;
#endif
@@ -115,7 +115,7 @@ RTDECL(int) RTSemFastMutexRequest(RTSEMFASTMUTEX hFastMtx)
IPRT_DEBUG_SEMS_STATE(pThis, 'd');
down(&pThis->Semaphore);
-#ifdef IPRT_DEBUG_SEMS
+#if defined(RT_STRICT) || defined(IPRT_DEBUG_SEMS)
IPRT_DEBUG_SEMS_STATE(pThis, 'o');
AssertRelease(pThis->Owner == NIL_RTNATIVETHREAD);
ASMAtomicUoWriteSize(&pThis->Owner, RTThreadNativeSelf());
@@ -134,7 +134,7 @@ RTDECL(int) RTSemFastMutexRelease(RTSEMFASTMUTEX hFastMtx)
AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
AssertMsgReturn(pThis->u32Magic == RTSEMFASTMUTEX_MAGIC, ("u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis), VERR_INVALID_HANDLE);
-#ifdef IPRT_DEBUG_SEMS
+#if defined(RT_STRICT) || defined(IPRT_DEBUG_SEMS)
AssertRelease(pThis->Owner == RTThreadNativeSelf());
ASMAtomicUoWriteSize(&pThis->Owner, NIL_RTNATIVETHREAD);
#endif
diff --git a/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c
index de257acc4..f8c6c8928 100644
--- a/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: semmutex-r0drv-linux.c $ */
+/* $Id: semmutex-r0drv-linux.c 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Mutex Semaphores, Ring-0 Driver, Linux.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c
index e3be185f0..e68b5b0c8 100644
--- a/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: spinlock-r0drv-linux.c $ */
+/* $Id: spinlock-r0drv-linux.c 29250 2010-05-09 17:53:58Z vboxsync $ */
/** @file
* IPRT - Spinlocks, Ring-0 Driver, Linux.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/string.h b/src/VBox/Runtime/r0drv/linux/string.h
index f2f319411..b581ae53a 100644
--- a/src/VBox/Runtime/r0drv/linux/string.h
+++ b/src/VBox/Runtime/r0drv/linux/string.h
@@ -1,4 +1,4 @@
-/* $Id: string.h $ */
+/* $Id: string.h 33012 2010-10-08 15:46:40Z vboxsync $ */
/** @file
* IPRT - wrapper for the linux kernel asm/string.h.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
index 5bd9d0132..a993b5b21 100644
--- a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
+++ b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
@@ -1,4 +1,4 @@
-/* $Id: the-linux-kernel.h $ */
+/* $Id: the-linux-kernel.h 36233 2011-03-09 17:05:12Z vboxsync $ */
/** @file
* IPRT - Include all necessary headers for the Linux kernel.
*/
@@ -118,6 +118,10 @@
#include <asm/uaccess.h>
#include <asm/div64.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
+# include <linux/kthread.h>
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
# ifndef page_to_pfn
# define page_to_pfn(page) ((page) - mem_map)
@@ -363,6 +367,4 @@ DECLINLINE(unsigned long) msecs_to_jiffies(unsigned int cMillies)
# define IPRT_LINUX_HAS_HRTIMER
#endif
-
#endif
-
diff --git a/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
index 44edbc2ac..7ada61e3d 100644
--- a/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: thread-r0drv-linux.c $ */
+/* $Id: thread-r0drv-linux.c 33358 2010-10-22 14:06:43Z vboxsync $ */
/** @file
* IPRT - Threads, Ring-0 Driver, Linux.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
index 381bd2e82..1ac95ea52 100644
--- a/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
@@ -1,10 +1,10 @@
-/* $Id: thread2-r0drv-linux.c $ */
+/* $Id: thread2-r0drv-linux.c 36947 2011-05-03 19:49:12Z vboxsync $ */
/** @file
* IPRT - Threads (Part 2), Ring-0 Driver, Linux.
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -37,10 +37,111 @@
#include "internal/thread.h"
-/** @todo Later.
RTDECL(RTTHREAD) RTThreadSelf(void)
{
return rtThreadGetByNative((RTNATIVETHREAD)current);
}
-*/
+
+
+DECLHIDDEN(int) rtThreadNativeInit(void)
+{
+ return VINF_SUCCESS;
+}
+
+
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
+ /* See comment near MAX_RT_PRIO in linux/sched.h for details on
+ sched_priority. */
+ int iSchedClass = SCHED_NORMAL;
+ struct sched_param Param = { .sched_priority = MAX_PRIO - 1 };
+ switch (enmType)
+ {
+ case RTTHREADTYPE_INFREQUENT_POLLER:
+ Param.sched_priority = MAX_RT_PRIO + 5;
+ break;
+
+ case RTTHREADTYPE_EMULATION:
+ Param.sched_priority = MAX_RT_PRIO + 4;
+ break;
+
+ case RTTHREADTYPE_DEFAULT:
+ Param.sched_priority = MAX_RT_PRIO + 3;
+ break;
+
+ case RTTHREADTYPE_MSG_PUMP:
+ Param.sched_priority = MAX_RT_PRIO + 2;
+ break;
+
+ case RTTHREADTYPE_IO:
+ iSchedClass = SCHED_FIFO;
+ Param.sched_priority = MAX_RT_PRIO - 1;
+ break;
+
+ case RTTHREADTYPE_TIMER:
+ iSchedClass = SCHED_FIFO;
+ Param.sched_priority = 1; /* not 0 just in case */
+ break;
+
+ default:
+ AssertMsgFailed(("enmType=%d\n", enmType));
+ return VERR_INVALID_PARAMETER;
+ }
+
+ sched_setscheduler(current, iSchedClass, &Param);
+#endif
+
+ return VINF_SUCCESS;
+}
+
+
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
+{
+ return VERR_NOT_IMPLEMENTED;
+}
+
+
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
+{
+ NOREF(pThread);
+}
+
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 4)
+/**
+ * Native kernel thread wrapper function.
+ *
+ * This will forward to rtThreadMain and do termination upon return.
+ *
+ * @param pvArg Pointer to the argument package.
+ */
+static int rtThreadNativeMain(void *pvArg)
+{
+ PRTTHREADINT pThread = (PRTTHREADINT)pvArg;
+
+ rtThreadMain(pThread, (RTNATIVETHREAD)current, &pThread->szName[0]);
+ return 0;
+}
+#endif
+
+
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 4)
+ struct task_struct *NativeThread;
+
+ RT_ASSERT_PREEMPTIBLE();
+
+ NativeThread = kthread_run(rtThreadNativeMain, pThreadInt, "iprt-%s", pThreadInt->szName);
+
+ if (IS_ERR(NativeThread))
+ return VERR_GENERAL_FAILURE;
+
+ *pNativeThread = (RTNATIVETHREAD)NativeThread;
+ return VINF_SUCCESS;
+#else
+ return VERR_NOT_IMPLEMENTED;
+#endif
+}
diff --git a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
index c0fb357f2..28312e17c 100644
--- a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: time-r0drv-linux.c $ */
+/* $Id: time-r0drv-linux.c 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Time, Ring-0 Driver, Linux.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c
index efad6b0a8..1d7042838 100644
--- a/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Id: timer-r0drv-linux.c $ */
+/* $Id: timer-r0drv-linux.c 33603 2010-10-29 12:42:24Z vboxsync $ */
/** @file
* IPRT - Timers, Ring-0 Driver, Linux.
*/
diff --git a/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h b/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h
index ba253c680..75c781f9e 100644
--- a/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h
+++ b/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h
@@ -1,4 +1,4 @@
-/* $Id: waitqueue-r0drv-linux.h $ */
+/* $Id: waitqueue-r0drv-linux.h 33630 2010-10-31 16:00:19Z vboxsync $ */
/** @file
* IPRT - Linux Ring-0 Driver Helpers for Abstracting Wait Queues,
*/
diff --git a/src/VBox/Runtime/r0drv/memobj-r0drv.cpp b/src/VBox/Runtime/r0drv/memobj-r0drv.cpp
index 14a4ed4f5..8ec15a27c 100644
--- a/src/VBox/Runtime/r0drv/memobj-r0drv.cpp
+++ b/src/VBox/Runtime/r0drv/memobj-r0drv.cpp
@@ -1,4 +1,4 @@
-/* $Revision: 67140 $ */
+/* $Revision: 36555 $ */
/** @file
* IPRT - Ring-0 Memory Objects, Common Code.
*/
@@ -54,7 +54,7 @@
* @param pv The memory object mapping.
* @param cb The size of the memory object.
*/
-PRTR0MEMOBJINTERNAL rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *pv, size_t cb)
+DECLHIDDEN(PRTR0MEMOBJINTERNAL) rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *pv, size_t cb)
{
PRTR0MEMOBJINTERNAL pNew;
@@ -63,6 +63,7 @@ PRTR0MEMOBJINTERNAL rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *p
cbSelf = sizeof(*pNew);
Assert(cbSelf >= sizeof(*pNew));
Assert(cbSelf == (uint32_t)cbSelf);
+ AssertMsg(RT_ALIGN_Z(cb, PAGE_SIZE) == cb, ("%#zx\n", cb));
/*
* Allocate and initialize the object.
@@ -88,7 +89,7 @@ PRTR0MEMOBJINTERNAL rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *p
*
* @param pMem The incomplete memory object to delete.
*/
-void rtR0MemObjDelete(PRTR0MEMOBJINTERNAL pMem)
+DECLHIDDEN(void) rtR0MemObjDelete(PRTR0MEMOBJINTERNAL pMem)
{
if (pMem)
{
@@ -225,7 +226,12 @@ RT_EXPORT_SYMBOL(RTR0MemObjAddressR3);
/**
* Gets the size of a ring-0 memory object.
*
- * @returns The address of the memory object.
+ * The returned value may differ from the one specified to the API creating the
+ * object because of alignment adjustments. The minimal alignment currently
+ * employed by any API is PAGE_SIZE, so the result can safely be shifted by
+ * PAGE_SHIFT to calculate a page count.
+ *
+ * @returns The object size.
* @returns 0 if the handle is invalid (asserts in strict builds) or if there isn't any mapping.
* @param MemObj The ring-0 memory object handle.
*/
@@ -240,6 +246,7 @@ RTR0DECL(size_t) RTR0MemObjSize(RTR0MEMOBJ MemObj)
pMem = (PRTR0MEMOBJINTERNAL)MemObj;
AssertMsgReturn(pMem->u32Magic == RTR0MEMOBJ_MAGIC, ("%p: %#x\n", pMem, pMem->u32Magic), 0);
AssertMsgReturn(pMem->enmType > RTR0MEMOBJTYPE_INVALID && pMem->enmType < RTR0MEMOBJTYPE_END, ("%p: %d\n", pMem, pMem->enmType), 0);
+ AssertMsg(RT_ALIGN_Z(pMem->cb, PAGE_SIZE) == pMem->cb, ("%#zx\n", pMem->cb));
/* return the size. */
return pMem->cb;
diff --git a/src/VBox/Runtime/r0drv/mp-r0drv.h b/src/VBox/Runtime/r0drv/mp-r0drv.h
index a32ae5d65..81c4b742a 100644
--- a/src/VBox/Runtime/r0drv/mp-r0drv.h
+++ b/src/VBox/Runtime/r0drv/mp-r0drv.h
@@ -1,4 +1,4 @@
-/* $Id: mp-r0drv.h $ */
+/* $Id: mp-r0drv.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Ring-0 Driver, Internal Header.
*/
@@ -58,13 +58,13 @@ typedef struct RTMPARGS
typedef RTMPARGS *PRTMPARGS;
/* Called from initterm-r0drv.cpp: */
-int rtR0MpNotificationInit(void);
-void rtR0MpNotificationTerm(void);
+DECLHIDDEN(int) rtR0MpNotificationInit(void);
+DECLHIDDEN(void) rtR0MpNotificationTerm(void);
/* The following is only relevant when using mpnotifcation-r0drv.cpp: */
-int rtR0MpNotificationNativeInit(void);
-void rtR0MpNotificationNativeTerm(void);
-void rtMpNotificationDoCallbacks(RTMPEVENT enmEvent, RTCPUID idCpu);
+DECLHIDDEN(int) rtR0MpNotificationNativeInit(void);
+DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void);
+DECLHIDDEN(void) rtMpNotificationDoCallbacks(RTMPEVENT enmEvent, RTCPUID idCpu);
RT_C_DECLS_END
diff --git a/src/VBox/Runtime/r0drv/mpnotification-r0drv.c b/src/VBox/Runtime/r0drv/mpnotification-r0drv.c
index ea5a3c11a..d9c7a2422 100644
--- a/src/VBox/Runtime/r0drv/mpnotification-r0drv.c
+++ b/src/VBox/Runtime/r0drv/mpnotification-r0drv.c
@@ -1,4 +1,4 @@
-/* $Id: mpnotification-r0drv.c $ */
+/* $Id: mpnotification-r0drv.c 37211 2011-05-25 11:37:52Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Ring-0 Driver, Event Notifications.
*/
@@ -89,7 +89,7 @@ static uint32_t volatile g_iRTMpGeneration;
* @param idCpu The CPU id the event applies to.
* @param enmEvent The event.
*/
-void rtMpNotificationDoCallbacks(RTMPEVENT enmEvent, RTCPUID idCpu)
+DECLHIDDEN(void) rtMpNotificationDoCallbacks(RTMPEVENT enmEvent, RTCPUID idCpu)
{
PRTMPNOTIFYREG pCur;
RTSPINLOCK hSpinlock;
@@ -277,7 +277,7 @@ RTDECL(int) RTMpNotificationDeregister(PFNRTMPNOTIFICATION pfnCallback, void *pv
RT_EXPORT_SYMBOL(RTMpNotificationDeregister);
-int rtR0MpNotificationInit(void)
+DECLHIDDEN(int) rtR0MpNotificationInit(void)
{
int rc = RTSpinlockCreate((PRTSPINLOCK)&g_hRTMpNotifySpinLock);
if (RT_SUCCESS(rc))
@@ -293,7 +293,7 @@ int rtR0MpNotificationInit(void)
}
-void rtR0MpNotificationTerm(void)
+DECLHIDDEN(void) rtR0MpNotificationTerm(void)
{
PRTMPNOTIFYREG pHead;
RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
@@ -304,7 +304,7 @@ void rtR0MpNotificationTerm(void)
/* pick up the list and the spinlock. */
RTSpinlockAcquire(hSpinlock, &Tmp);
- ASMAtomicWriteSize(&g_hRTMpNotifySpinLock, NIL_RTSPINLOCK);
+ ASMAtomicWriteHandle(&g_hRTMpNotifySpinLock, NIL_RTSPINLOCK);
pHead = g_pRTMpCallbackHead;
g_pRTMpCallbackHead = NULL;
ASMAtomicIncU32(&g_iRTMpGeneration);
diff --git a/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp
index 95d6a112b..11c5143b3 100644
--- a/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteDebugger-r0drv-nt.cpp $ */
+/* $Id: RTLogWriteDebugger-r0drv-nt.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log To Debugger, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp
index fead7554d..2927d6771 100644
--- a/src/VBox/Runtime/r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTTimerGetSystemGranularity-r0drv-nt.cpp $ */
+/* $Id: RTTimerGetSystemGranularity-r0drv-nt.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - RTTimerGetSystemGranularity, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp
index 9f7659a84..9f8e9c16b 100644
--- a/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: alloc-r0drv-nt.cpp $ */
+/* $Id: alloc-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Ring-0 Driver, NT.
*/
@@ -40,7 +40,7 @@
/**
* OS specific allocation function.
*/
-int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
+DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
{
if (fFlags & RTMEMHDR_FLAG_ANY_CTX)
return VERR_NOT_SUPPORTED;
@@ -61,7 +61,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
/**
* OS specific free function.
*/
-void rtR0MemFree(PRTMEMHDR pHdr)
+DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
{
pHdr->u32Magic += 1;
ExFreePool(pHdr);
diff --git a/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp
index 056eabb7d..065ca9d93 100644
--- a/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: assert-r0drv-nt.cpp $ */
+/* $Id: assert-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Assertion Workers, Ring-0 Drivers, NT.
*/
@@ -37,7 +37,7 @@
#include "internal/assert.h"
-void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
+DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
{
DbgPrint("\n!!Assertion Failed!!\n"
"Expression: %s\n"
@@ -46,7 +46,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi
}
-void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
+DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
{
char szMsg[256];
diff --git a/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp
index fc885b288..2c5137d65 100644
--- a/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: initterm-r0drv-nt.cpp $ */
+/* $Id: initterm-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Initialization & Termination, R0 Driver, NT.
*/
@@ -71,7 +71,7 @@ uint32_t g_offrtNtPbDpcQueueDepth;
-int rtR0InitNative(void)
+DECLHIDDEN(int) rtR0InitNative(void)
{
/*
* Init the Nt cpu set.
@@ -263,7 +263,7 @@ int rtR0InitNative(void)
}
-void rtR0TermNative(void)
+DECLHIDDEN(void) rtR0TermNative(void)
{
}
diff --git a/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h b/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h
index e04230faf..2d4c85aeb 100644
--- a/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h
+++ b/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h
@@ -1,4 +1,4 @@
-/* $Id: internal-r0drv-nt.h $ */
+/* $Id: internal-r0drv-nt.h 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Internal Header for the NT Ring-0 Driver Code.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp
index 4a28cb726..0ffa3b2ba 100644
--- a/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: memobj-r0drv-nt.cpp $ */
+/* $Id: memobj-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Ring-0 Memory Objects, NT.
*/
@@ -78,7 +78,7 @@ typedef struct RTR0MEMOBJNT
} RTR0MEMOBJNT, *PRTR0MEMOBJNT;
-int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
+DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
{
PRTR0MEMOBJNT pMemNt = (PRTR0MEMOBJNT)pMem;
@@ -215,7 +215,7 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
}
-int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
AssertMsgReturn(cb <= _1G, ("%#x\n", cb), VERR_OUT_OF_RANGE); /* for safe size_t -> ULONG */
@@ -257,7 +257,7 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu
}
-int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
AssertMsgReturn(cb <= _1G, ("%#x\n", cb), VERR_OUT_OF_RANGE); /* for safe size_t -> ULONG */
@@ -396,13 +396,13 @@ static int rtR0MemObjNativeAllocContEx(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bo
}
-int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
return rtR0MemObjNativeAllocContEx(ppMem, cb, fExecutable, _4G-1, PAGE_SIZE /* alignment */);
}
-int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
{
#ifndef IPRT_TARGET_NT4
/*
@@ -462,7 +462,7 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph
}
-int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
{
#ifndef IPRT_TARGET_NT4
PHYSICAL_ADDRESS Zero;
@@ -494,7 +494,7 @@ int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS
}
-int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
+DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
{
AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED);
@@ -640,7 +640,8 @@ static int rtR0MemObjNtLock(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uin
}
-int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess,
+ RTR0PROCESS R0Process)
{
AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
/* (Can use MmProbeAndLockProcessPages if we need to mess with other processes later.) */
@@ -648,13 +649,13 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c
}
-int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
+DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
{
return rtR0MemObjNtLock(ppMem, pv, cb, fAccess, NIL_RTR0PROCESS);
}
-int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
+DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
{
/*
* MmCreateSection(SEC_RESERVE) + MmMapViewInSystemSpace perhaps?
@@ -663,7 +664,8 @@ int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, siz
}
-int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment,
+ RTR0PROCESS R0Process)
{
/*
* ZeCreateSection(SEC_RESERVE) + ZwMapViewOfSection perhaps?
@@ -799,7 +801,7 @@ static int rtR0MemObjNtMap(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, voi
}
-int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
+DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
unsigned fProt, size_t offSub, size_t cbSub)
{
AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
@@ -807,14 +809,14 @@ int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap,
}
-int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
{
AssertReturn(R0Process == RTR0ProcHandleSelf(), VERR_NOT_SUPPORTED);
return rtR0MemObjNtMap(ppMem, pMemToMap, (void *)R3PtrFixed, uAlignment, fProt, R0Process);
}
-int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
+DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
{
NOREF(pMem);
NOREF(offSub);
@@ -824,7 +826,7 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu
}
-RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
+DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
{
PRTR0MEMOBJNT pMemNt = (PRTR0MEMOBJNT)pMem;
diff --git a/src/VBox/Runtime/r0drv/nt/memuserkernel-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/memuserkernel-r0drv-nt.cpp
index 9abfd83f5..02f411a8e 100644
--- a/src/VBox/Runtime/r0drv/nt/memuserkernel-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/memuserkernel-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: memuserkernel-r0drv-nt.cpp $ */
+/* $Id: memuserkernel-r0drv-nt.cpp 29705 2010-05-20 15:58:39Z vboxsync $ */
/** @file
* IPRT - User & Kernel Memory, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
index fb7287720..da1dcae96 100644
--- a/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: mp-r0drv-nt.cpp $ */
+/* $Id: mp-r0drv-nt.cpp 37379 2011-06-08 14:21:34Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Ring-0 Driver, NT.
*/
@@ -344,11 +344,13 @@ static VOID rtMpNtPokeCpuDummy(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID
#ifndef IPRT_TARGET_NT4
-ULONG_PTR rtMpIpiGenericCall(ULONG_PTR Argument)
+ULONG_PTR rtMpIpiGenericCall(ULONG_PTR Argument)
{
+ NOREF(Argument);
return 0;
}
+
int rtMpSendIpiVista(RTCPUID idCpu)
{
g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0);
@@ -356,19 +358,23 @@ int rtMpSendIpiVista(RTCPUID idCpu)
return VINF_SUCCESS;
}
+
int rtMpSendIpiWin7(RTCPUID idCpu)
{
g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0);
//// g_pfnrtNtHalSendSoftwareInterrupt(idCpu, DISPATCH_LEVEL);
return VINF_SUCCESS;
}
+
#endif /* IPRT_TARGET_NT4 */
+
int rtMpSendIpiDummy(RTCPUID idCpu)
{
return VERR_NOT_IMPLEMENTED;
}
+
RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
{
if (!RTMpIsCpuOnline(idCpu))
diff --git a/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp
index 5e7532447..629e1857a 100644
--- a/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: mpnotification-r0drv-nt.cpp $ */
+/* $Id: mpnotification-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Multiprocessor Event Notifications, Ring-0 Driver, NT.
*/
@@ -124,7 +124,7 @@ static VOID __stdcall rtMpNotificationNtCallback(PVOID pvUser,
}
-int rtR0MpNotificationNativeInit(void)
+DECLHIDDEN(int) rtR0MpNotificationNativeInit(void)
{
/*
* Try resolve the symbols.
@@ -163,7 +163,7 @@ int rtR0MpNotificationNativeInit(void)
}
-void rtR0MpNotificationNativeTerm(void)
+DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void)
{
if ( g_pfnKeDeregisterProcessorChangeCallback
&& g_hCallback)
@@ -175,12 +175,12 @@ void rtR0MpNotificationNativeTerm(void)
#else /* Not supported */
-int rtR0MpNotificationNativeInit(void)
+DECLHIDDEN(int) rtR0MpNotificationNativeInit(void)
{
return VINF_SUCCESS;
}
-void rtR0MpNotificationNativeTerm(void)
+DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void)
{
}
diff --git a/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp
index 934887659..30e5be609 100644
--- a/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: process-r0drv-nt.cpp $ */
+/* $Id: process-r0drv-nt.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Process, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp
index 8cda329eb..fb64eeb1b 100644
--- a/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: semevent-r0drv-nt.cpp $ */
+/* $Id: semevent-r0drv-nt.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Single Release Event Semaphores, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp
index 50830f754..8da0899b7 100644
--- a/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: semeventmulti-r0drv-nt.cpp $ */
+/* $Id: semeventmulti-r0drv-nt.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Multiple Release Event Semaphores, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp
index bd3efc87c..62d7bc0b2 100644
--- a/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: semfastmutex-r0drv-nt.cpp $ */
+/* $Id: semfastmutex-r0drv-nt.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Fast Mutex Semaphores, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp
index 71e02e35c..f3b1cc21b 100644
--- a/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: semmutex-r0drv-nt.cpp $ */
+/* $Id: semmutex-r0drv-nt.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Mutex Semaphores, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp
index 1dc11be23..8f9fdcf65 100644
--- a/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: spinlock-r0drv-nt.cpp $ */
+/* $Id: spinlock-r0drv-nt.cpp 32463 2010-09-14 07:30:11Z vboxsync $ */
/** @file
* IPRT - Spinlocks, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h b/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h
index 3da03794c..ada6354e3 100644
--- a/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h
+++ b/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h
@@ -1,4 +1,4 @@
-/* $Id: the-nt-kernel.h $ */
+/* $Id: the-nt-kernel.h 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Include all necessary headers for the NT kernel.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp
index f120040fa..36a6ea25a 100644
--- a/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: thread-r0drv-nt.cpp $ */
+/* $Id: thread-r0drv-nt.cpp 30359 2010-06-22 09:21:33Z vboxsync $ */
/** @file
* IPRT - Threads, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp
index 03a3ffe0e..e9361862c 100644
--- a/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: thread2-r0drv-nt.cpp $ */
+/* $Id: thread2-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Threads (Part 2), Ring-0 Driver, NT.
*/
@@ -36,7 +36,7 @@
#include "internal/thread.h"
-int rtThreadNativeInit(void)
+DECLHIDDEN(int) rtThreadNativeInit(void)
{
/* No TLS in Ring-0. :-/ */
return VINF_SUCCESS;
@@ -49,7 +49,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void)
}
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
/*
* Convert the IPRT priority type to NT priority.
@@ -81,13 +81,13 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
}
-int rtThreadNativeAdopt(PRTTHREADINT pThread)
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
{
return VERR_NOT_IMPLEMENTED;
}
-void rtThreadNativeDestroy(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
{
NOREF(pThread);
}
@@ -111,7 +111,7 @@ static VOID __stdcall rtThreadNativeMain(PVOID pvArg)
}
-int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
{
/*
* PsCreateSysemThread create a thread an give us a handle in return.
diff --git a/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp
index 965f2cbb9..9545caa23 100644
--- a/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: time-r0drv-nt.cpp $ */
+/* $Id: time-r0drv-nt.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Time, Ring-0 Driver, Nt.
*/
diff --git a/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp
index 4f7c82db4..44aa52f46 100644
--- a/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp
@@ -1,4 +1,4 @@
-/* $Id: timer-r0drv-nt.cpp $ */
+/* $Id: timer-r0drv-nt.cpp 33155 2010-10-15 12:07:44Z vboxsync $ */
/** @file
* IPRT - Timers, Ring-0 Driver, NT.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm b/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm
index 17e370520..dedefeb81 100644
--- a/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm
+++ b/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm
@@ -1,4 +1,4 @@
-; $Id: RTR0AssertPanicSystem-r0drv-os2.asm $
+; $Id: RTR0AssertPanicSystem-r0drv-os2.asm 13306 2008-10-15 21:17:04Z vboxsync $
;; @file
; IPRT - RTR0AssertPanicSystem, Ring-0 Driver, OS/2.
;
diff --git a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm
index e0c94b7f2..2ad429f45 100644
--- a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm
+++ b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm
@@ -1,4 +1,4 @@
-; $Id: RTR0Os2DHQueryDOSVar.asm $
+; $Id: RTR0Os2DHQueryDOSVar.asm 8256 2008-04-21 20:53:28Z vboxsync $
;; @file
; IPRT - DevHelp_GetDOSVar, Ring-0 Driver, OS/2.
;
diff --git a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm
index e1b44d42b..82e221123 100644
--- a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm
+++ b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm
@@ -1,4 +1,4 @@
-; $Id: RTR0Os2DHVMGlobalToProcess.asm $
+; $Id: RTR0Os2DHVMGlobalToProcess.asm 8256 2008-04-21 20:53:28Z vboxsync $
;; @file
; IPRT - DevHelp_VMGlobalToProcess, Ring-0 Driver, OS/2.
;
diff --git a/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp
index 53da24771..c29724032 100644
--- a/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: alloc-r0drv-os2.cpp $ */
+/* $Id: alloc-r0drv-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Ring-0 Driver, OS/2.
*/
@@ -42,7 +42,7 @@
#include "r0drv/alloc-r0drv.h" /** @todo drop the r0drv/alloc-r0drv.cpp stuff on OS/2? */
-int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
+DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
{
if (fFlags & RTMEMHDR_FLAG_ANY_CTX)
return VERR_NOT_SUPPORTED;
@@ -62,7 +62,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
}
-void rtR0MemFree(PRTMEMHDR pHdr)
+DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
{
pHdr->u32Magic += 1;
APIRET rc = KernVMFree(pHdr);
diff --git a/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp
index c3b1a5e00..6eacf9d9a 100644
--- a/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: assert-r0drv-os2.cpp $ */
+/* $Id: assert-r0drv-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Assertion Workers, Ring-0 Drivers, OS/2.
*/
@@ -57,7 +57,7 @@ extern size_t g_cchRTAssertMsg;
static DECLCALLBACK(size_t) rtR0Os2AssertOutputCB(void *pvArg, const char *pachChars, size_t cbChars);
-void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
+DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
{
#if defined(DEBUG_bird)
RTLogComPrintf("\n!!Assertion Failed!!\n"
@@ -74,7 +74,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi
}
-void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
+DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
{
#if defined(DEBUG_bird)
va_list vaCopy;
diff --git a/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm b/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm
index 0e0808aab..4da5eea74 100644
--- a/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm
+++ b/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm
@@ -1,4 +1,4 @@
-; $Id: assertA-r0drv-os2.asm $
+; $Id: assertA-r0drv-os2.asm 8256 2008-04-21 20:53:28Z vboxsync $
;; @file
; IPRT - DevHelp_GetDOSVar, Ring-0 Driver, OS/2.
;
diff --git a/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp
index 9a1872a81..6cd80245e 100644
--- a/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: initterm-r0drv-os2.cpp $ */
+/* $Id: initterm-r0drv-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Initialization & Termination, Ring-0 Driver, OS/2.
*/
@@ -54,7 +54,7 @@ PGINFOSEG g_pGIS = NULL;
RTFAR16 g_fpLIS = {0, 0};
-int rtR0InitNative(void)
+DECLHIDDEN(int) rtR0InitNative(void)
{
/*
* Get the DOS Tables.
@@ -80,7 +80,7 @@ int rtR0InitNative(void)
}
-void rtR0TermNative(void)
+DECLHIDDEN(void) rtR0TermNative(void)
{
/* nothing to do here yet. */
}
diff --git a/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp
index 9dfdae72c..21dd2fe19 100644
--- a/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: memobj-r0drv-os2.cpp $ */
+/* $Id: memobj-r0drv-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Ring-0 Memory Objects, OS/2.
*/
@@ -69,7 +69,7 @@ typedef struct RTR0MEMOBJDARWIN
static void rtR0MemObjFixPageList(KernPageList_t *paPages, ULONG cPages, ULONG cPagesRet);
-int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
+DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
{
PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)pMem;
int rc;
@@ -112,7 +112,7 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
}
-int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
NOREF(fExecutable);
@@ -141,7 +141,7 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu
}
-int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
NOREF(fExecutable);
@@ -170,7 +170,7 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut
}
-int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
NOREF(fExecutable);
@@ -194,7 +194,7 @@ int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu
}
-int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
{
AssertMsgReturn(PhysHighest >= 16 *_1M, ("PhysHigest=%RHp\n", PhysHighest), VERR_NOT_SUPPORTED);
@@ -223,14 +223,14 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph
}
-int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
{
/** @todo rtR0MemObjNativeAllocPhys / darwin. */
return rtR0MemObjNativeAllocPhys(ppMem, cb, PhysHighest, PAGE_SIZE);
}
-int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
+DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
{
AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED);
@@ -248,7 +248,8 @@ int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t
}
-int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess,
+ RTR0PROCESS R0Process)
{
AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
@@ -276,7 +277,7 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c
}
-int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
+DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
{
/* create the object. */
const ULONG cPages = cb >> PAGE_SHIFT;
@@ -300,20 +301,21 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb,
}
-int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
+DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
{
return VERR_NOT_SUPPORTED;
}
-int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment,
+ RTR0PROCESS R0Process)
{
return VERR_NOT_SUPPORTED;
}
-int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
- unsigned fProt, size_t offSub, size_t cbSub)
+DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
+ unsigned fProt, size_t offSub, size_t cbSub)
{
AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);
AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED);
@@ -393,7 +395,7 @@ int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap,
}
-int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
{
AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED);
@@ -483,7 +485,7 @@ int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RT
}
-int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
+DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
{
NOREF(pMem);
NOREF(offSub);
@@ -493,7 +495,7 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu
}
-RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
+DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
{
PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)pMem;
diff --git a/src/VBox/Runtime/r0drv/os2/memuserkernel-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/memuserkernel-r0drv-os2.cpp
index 888b5409a..fd742f134 100644
--- a/src/VBox/Runtime/r0drv/os2/memuserkernel-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/memuserkernel-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: memuserkernel-r0drv-os2.cpp $ */
+/* $Id: memuserkernel-r0drv-os2.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - User & Kernel Memory, Ring-0 Driver, OS/2.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp
index a05d0617e..eac1e4624 100644
--- a/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: process-r0drv-os2.cpp $ */
+/* $Id: process-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */
/** @file
* IPRT - Process Management, Ring-0 Driver, OS/2.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp
index 74aaa2d26..5da10059b 100644
--- a/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: semevent-r0drv-os2.cpp $ */
+/* $Id: semevent-r0drv-os2.cpp 33269 2010-10-20 15:42:28Z vboxsync $ */
/** @file
* IPRT - Single Release Event Semaphores, Ring-0 Driver, OS/2.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp
index fb05a5007..0ef07282e 100644
--- a/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: semeventmulti-r0drv-os2.cpp $ */
+/* $Id: semeventmulti-r0drv-os2.cpp 33155 2010-10-15 12:07:44Z vboxsync $ */
/** @file
* IPRT - Multiple Release Event Semaphores, Ring-0 Driver, OS/2.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp
index d2edff5e8..caf6ddc7a 100644
--- a/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: semfastmutex-r0drv-os2.cpp $ */
+/* $Id: semfastmutex-r0drv-os2.cpp 25722 2010-01-11 14:22:03Z vboxsync $ */
/** @file
* IPRT - Fast Mutex Semaphores, Ring-0 Driver, OS/2.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp
index e239f766a..d2b7b5fc2 100644
--- a/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: spinlock-r0drv-os2.cpp $ */
+/* $Id: spinlock-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */
/** @file
* IPRT - Spinlocks, Ring-0 Driver, OS/2.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h b/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h
index 2057b50bb..f08bd11bf 100644
--- a/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h
+++ b/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h
@@ -1,4 +1,4 @@
-/* $Id: the-os2-kernel.h $ */
+/* $Id: the-os2-kernel.h 20374 2009-06-08 00:43:21Z vboxsync $ */
/** @file
* IPRT - Ring-0 Driver, The OS/2 Kernel Headers.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp
index 64c5308a2..bc68b7af0 100644
--- a/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: thread-r0drv-os2.cpp $ */
+/* $Id: thread-r0drv-os2.cpp 33393 2010-10-24 16:17:00Z vboxsync $ */
/** @file
* IPRT - Threads (Part 1), Ring-0 Driver, OS/2.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp
index 29a7c94be..2e209860c 100644
--- a/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: thread2-r0drv-os2.cpp $ */
+/* $Id: thread2-r0drv-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Threads (Part 2), Ring-0 Driver, Generic Stubs.
*/
@@ -38,7 +38,7 @@
#include "internal/thread.h"
-int rtThreadNativeInit(void)
+DECLHIDDEN(int) rtThreadNativeInit(void)
{
return VINF_SUCCESS;
}
@@ -50,7 +50,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void)
}
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
NOREF(pThread);
NOREF(enmType);
@@ -58,20 +58,20 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
}
-int rtThreadNativeAdopt(PRTTHREADINT pThread)
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
{
NOREF(pThread);
return VERR_NOT_IMPLEMENTED;
}
-void rtThreadNativeDestroy(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
{
NOREF(pThread);
}
-int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
{
NOREF(pNativeThread);
NOREF(pThreadInt);
diff --git a/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp
index 778ee2b0a..ab4bf1b9a 100644
--- a/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: time-r0drv-os2.cpp $ */
+/* $Id: time-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */
/** @file
* IPRT - Time, Ring-0 Driver, OS/2.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp
index ba68fd127..e2d023352 100644
--- a/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: timer-r0drv-os2.cpp $ */
+/* $Id: timer-r0drv-os2.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Ring-0 Driver, OS/2.
*/
diff --git a/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm b/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm
index 474f85767..788bcc907 100644
--- a/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm
+++ b/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm
@@ -1,4 +1,4 @@
-; $Id: timerA-r0drv-os2.asm $
+; $Id: timerA-r0drv-os2.asm 8256 2008-04-21 20:53:28Z vboxsync $
;; @file
; IPRT - DevHelp_VMGlobalToProcess, Ring-0 Driver, OS/2.
;
diff --git a/src/VBox/Runtime/r0drv/power-r0drv.h b/src/VBox/Runtime/r0drv/power-r0drv.h
index 11f5493be..7dacbc91e 100644
--- a/src/VBox/Runtime/r0drv/power-r0drv.h
+++ b/src/VBox/Runtime/r0drv/power-r0drv.h
@@ -1,4 +1,4 @@
-/* $Id: power-r0drv.h $ */
+/* $Id: power-r0drv.h 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Power Management, Ring-0 Driver, Internal Header.
*/
@@ -32,8 +32,8 @@
RT_C_DECLS_BEGIN
/* Called from initterm-r0drv.cpp: */
-int rtR0PowerNotificationInit(void);
-void rtR0PowerNotificationTerm(void);
+DECLHIDDEN(int) rtR0PowerNotificationInit(void);
+DECLHIDDEN(void) rtR0PowerNotificationTerm(void);
RT_C_DECLS_END
diff --git a/src/VBox/Runtime/r0drv/powernotification-r0drv.c b/src/VBox/Runtime/r0drv/powernotification-r0drv.c
index 9e03da213..4ef59ef46 100644
--- a/src/VBox/Runtime/r0drv/powernotification-r0drv.c
+++ b/src/VBox/Runtime/r0drv/powernotification-r0drv.c
@@ -1,4 +1,4 @@
-/* $Id: powernotification-r0drv.c $ */
+/* $Id: powernotification-r0drv.c 37211 2011-05-25 11:37:52Z vboxsync $ */
/** @file
* IPRT - Power Management, Ring-0 Driver, Event Notifications.
*/
@@ -273,7 +273,7 @@ RTDECL(int) RTPowerNotificationDeregister(PFNRTPOWERNOTIFICATION pfnCallback, vo
RT_EXPORT_SYMBOL(RTPowerNotificationDeregister);
-int rtR0PowerNotificationInit(void)
+DECLHIDDEN(int) rtR0PowerNotificationInit(void)
{
int rc = RTSpinlockCreate((PRTSPINLOCK)&g_hRTPowerNotifySpinLock);
if (RT_SUCCESS(rc))
@@ -289,7 +289,7 @@ int rtR0PowerNotificationInit(void)
}
-void rtR0PowerNotificationTerm(void)
+DECLHIDDEN(void) rtR0PowerNotificationTerm(void)
{
PRTPOWERNOTIFYREG pHead;
RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
@@ -300,7 +300,7 @@ void rtR0PowerNotificationTerm(void)
/* pick up the list and the spinlock. */
RTSpinlockAcquire(hSpinlock, &Tmp);
- ASMAtomicWriteSize(&g_hRTPowerNotifySpinLock, NIL_RTSPINLOCK);
+ ASMAtomicWriteHandle(&g_hRTPowerNotifySpinLock, NIL_RTSPINLOCK);
pHead = g_pRTPowerCallbackHead;
g_pRTPowerCallbackHead = NULL;
ASMAtomicIncU32(&g_iRTPowerGeneration);
diff --git a/src/VBox/Runtime/r0drv/solaris/RTLogWriteDebugger-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/RTLogWriteDebugger-r0drv-solaris.c
index 5aa03da81..86b07c181 100644
--- a/src/VBox/Runtime/r0drv/solaris/RTLogWriteDebugger-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/RTLogWriteDebugger-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteDebugger-r0drv-solaris.c $ */
+/* $Id: RTLogWriteDebugger-r0drv-solaris.c 29281 2010-05-09 23:40:43Z vboxsync $ */
/** @file
* IPRT - Log To Debugger, Ring-0 Driver, Solaris.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c
index 55befdcaf..7c1876f9e 100644
--- a/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: assert-r0drv-solaris.c $ */
+/* $Id: assert-r0drv-solaris.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Assertion Workers, Ring-0 Drivers, Solaris.
*/
@@ -40,7 +40,7 @@
#include "internal/assert.h"
-void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
+DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
{
uprintf("\r\n!!Assertion Failed!!\r\n"
"Expression: %s\r\n"
@@ -49,7 +49,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi
}
-void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
+DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)
{
char szMsg[256];
diff --git a/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c
index fce305c06..fec13e31b 100644
--- a/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: initterm-r0drv-solaris.c $ */
+/* $Id: initterm-r0drv-solaris.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Initialization & Termination, R0 Driver, Solaris.
*/
@@ -53,7 +53,7 @@ PFNSOL_untimeout_generic g_pfnrtR0Sol_untimeout_generic = NULL;
PFNSOL_cyclic_reprogram g_pfnrtR0Sol_cyclic_reprogram = NULL;
-int rtR0InitNative(void)
+DECLHIDDEN(int) rtR0InitNative(void)
{
/*
* Initialize vbi (keeping it separate for now)
@@ -102,7 +102,7 @@ int rtR0InitNative(void)
}
-void rtR0TermNative(void)
+DECLHIDDEN(void) rtR0TermNative(void)
{
}
diff --git a/src/VBox/Runtime/r0drv/solaris/memuserkernel-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/memuserkernel-r0drv-solaris.c
index 11b24bd7a..88d50e4d1 100644
--- a/src/VBox/Runtime/r0drv/solaris/memuserkernel-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/memuserkernel-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: memuserkernel-r0drv-solaris.c $ */
+/* $Id: memuserkernel-r0drv-solaris.c 29284 2010-05-10 00:22:16Z vboxsync $ */
/** @file
* IPRT - User & Kernel Memory, Ring-0 Driver, Solaris.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c
new file mode 100644
index 000000000..b3a171a23
--- /dev/null
+++ b/src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c
@@ -0,0 +1,55 @@
+
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <sys/modctl.h>
+
+
+/*******************************************************************************
+* Global Variables *
+*******************************************************************************/
+static struct modlmisc g_rtModuleStubMisc =
+{
+ &mod_miscops, /* extern from kernel */
+ "platform agnostic module"
+};
+
+
+static struct modlinkage g_rtModuleStubModLinkage =
+{
+ MODREV_1, /* loadable module system revision */
+ {
+ &g_rtModuleStubMisc,
+ NULL /* terminate array of linkage structures */
+ }
+};
+
+
+
+int _init(void);
+int _init(void)
+{
+ /* Disable auto unloading. */
+ modctl_t *pModCtl = mod_getctl(&g_rtModuleStubModLinkage);
+ if (pModCtl)
+ pModCtl->mod_loadflags |= MOD_NOAUTOUNLOAD;
+
+ return mod_install(&g_rtModuleStubModLinkage);
+}
+
+
+int _fini(void);
+int _fini(void)
+{
+ return mod_remove(&g_rtModuleStubModLinkage);
+}
+
+
+int _info(struct modinfo *pModInfo);
+int _info(struct modinfo *pModInfo)
+{
+ return mod_info(&g_rtModuleStubModLinkage, pModInfo);
+}
+
diff --git a/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c
index b8921218f..9431c915a 100644
--- a/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: semevent-r0drv-solaris.c $ */
+/* $Id: semevent-r0drv-solaris.c 36392 2011-03-24 11:20:37Z vboxsync $ */
/** @file
* IPRT - Single Release Event Semaphores, Ring-0 Driver, Solaris.
*/
@@ -131,6 +131,7 @@ DECLINLINE(void) rtR0SemEventSolRetain(PRTSEMEVENTINTERNAL pThis)
{
uint32_t cRefs = ASMAtomicIncU32(&pThis->cRefs);
Assert(cRefs && cRefs < 100000);
+ NOREF(cRefs);
}
diff --git a/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c
index 6f7fc5ca7..011369fae 100644
--- a/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: semeventmulti-r0drv-solaris.c $ */
+/* $Id: semeventmulti-r0drv-solaris.c 36392 2011-03-24 11:20:37Z vboxsync $ */
/** @file
* IPRT - Multiple Release Event Semaphores, Ring-0 Driver, Solaris.
*/
@@ -129,6 +129,7 @@ DECLINLINE(void) rtR0SemEventMultiSolRetain(PRTSEMEVENTMULTIINTERNAL pThis)
{
uint32_t cRefs = ASMAtomicIncU32(&pThis->cRefs);
Assert(cRefs && cRefs < 100000);
+ NOREF(cRefs);
}
diff --git a/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h b/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h
index 45fd29aac..d06b26bf0 100644
--- a/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h
+++ b/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h
@@ -1,4 +1,4 @@
-/* $Id: semeventwait-r0drv-solaris.h $ */
+/* $Id: semeventwait-r0drv-solaris.h 36392 2011-03-24 11:20:37Z vboxsync $ */
/** @file
* IPRT - Solaris Ring-0 Driver Helpers for Event Semaphore Waits.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c
index baeaec2f5..ef0f5b602 100644
--- a/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: semfastmutex-r0drv-solaris.c $ */
+/* $Id: semfastmutex-r0drv-solaris.c 29284 2010-05-10 00:22:16Z vboxsync $ */
/** @file
* IPRT - Fast Mutex Semaphores, Ring-0 Driver, Solaris.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/semmutex-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semmutex-r0drv-solaris.c
index 8394c4d3c..65802fe1a 100644
--- a/src/VBox/Runtime/r0drv/solaris/semmutex-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/semmutex-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: semmutex-r0drv-solaris.c $ */
+/* $Id: semmutex-r0drv-solaris.c 36190 2011-03-07 16:28:50Z vboxsync $ */
/** @file
* IPRT - Mutex Semaphores, Ring-0 Driver, Solaris.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c
index a66e63b3c..1b37be6b3 100644
--- a/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: spinlock-r0drv-solaris.c $ */
+/* $Id: spinlock-r0drv-solaris.c 29281 2010-05-09 23:40:43Z vboxsync $ */
/** @file
* IPRT - Spinlocks, Ring-0 Driver, Solaris.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h b/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h
index 7dd607f03..aab14e8fe 100644
--- a/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h
+++ b/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h
@@ -1,4 +1,4 @@
-/* $Id: the-solaris-kernel.h $ */
+/* $Id: the-solaris-kernel.h 33149 2010-10-15 11:26:24Z vboxsync $ */
/** @file
* IPRT - Include all necessary headers for the Solaris kernel.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c
index 524236571..2dad122b2 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: RTMpPokeCpu-r0drv-solaris.c $ */
+/* $Id: RTMpPokeCpu-r0drv-solaris.c 29300 2010-05-10 12:30:43Z vboxsync $ */
/** @file
* IPRT - RTMpPokeCpu, Solaris Implementation.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c
index e6ee0f1a6..2ab6aba0b 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: alloc-r0drv-solaris.c $ */
+/* $Id: alloc-r0drv-solaris.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Ring-0 Driver, Solaris.
*/
@@ -44,7 +44,7 @@
/**
* OS specific allocation function.
*/
-int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
+DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
{
size_t cbAllocated = cb;
PRTMEMHDR pHdr;
@@ -84,7 +84,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)
/**
* OS specific free function.
*/
-void rtR0MemFree(PRTMEMHDR pHdr)
+DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)
{
pHdr->u32Magic += 1;
#ifdef RT_ARCH_AMD64
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c
index 4f0304222..69278261d 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010-2011 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -56,6 +56,9 @@
#include <sys/modctl.h>
#include <sys/machparam.h>
#include <sys/utsname.h>
+#include <sys/ctf_api.h>
+
+#include <iprt/assert.h>
#include "vbi.h"
@@ -75,7 +78,7 @@ static void (*p_contig_free)(void *, size_t) = contig_free;
*/
/* Introduced in v9 */
static int use_kflt = 0;
-page_t *vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr);
+static page_t *vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr, size_t pgsize);
/*
@@ -141,40 +144,6 @@ static int vbi_verbose = 0;
/* Introduced in v8 */
static int vbi_is_initialized = 0;
-/* Introduced in v6 */
-static int vbi_is_nevada = 0;
-
-#ifdef _LP64
-/* 64-bit Solaris 10 offsets */
-/* CPU */
-static int off_s10_cpu_runrun = 232;
-static int off_s10_cpu_kprunrun = 233;
-/* kthread_t */
-static int off_s10_t_preempt = 42;
-
-/* 64-bit Solaris 11 (Nevada/OpenSolaris) offsets */
-/* CPU */
-static int off_s11_cpu_runrun = 216;
-static int off_s11_cpu_kprunrun = 217;
-/* kthread_t */
-static int off_s11_t_preempt = 42;
-#else
-/* 32-bit Solaris 10 offsets */
-/* CPU */
-static int off_s10_cpu_runrun = 124;
-static int off_s10_cpu_kprunrun = 125;
-/* kthread_t */
-static int off_s10_t_preempt = 26;
-
-/* 32-bit Solaris 11 (Nevada/OpenSolaris) offsets */
-/* CPU */
-static int off_s11_cpu_runrun = 112;
-static int off_s11_cpu_kprunrun = 113;
-/* kthread_t */
-static int off_s11_t_preempt = 26;
-#endif
-
-
/* Which offsets will be used */
static int off_cpu_runrun = -1;
static int off_cpu_kprunrun = -1;
@@ -213,6 +182,35 @@ _init(void)
}
#endif
+static int
+vbi_get_ctf_member_offset(ctf_file_t *ctfp, const char *structname, const char *membername, int *offset)
+{
+ AssertReturn(ctfp, CTF_ERR);
+ AssertReturn(structname, CTF_ERR);
+ AssertReturn(membername, CTF_ERR);
+ AssertReturn(offset, CTF_ERR);
+
+ ctf_id_t typeident = ctf_lookup_by_name(ctfp, structname);
+ if (typeident != CTF_ERR)
+ {
+ ctf_membinfo_t memberinfo;
+ bzero(&memberinfo, sizeof(memberinfo));
+ if (ctf_member_info(ctfp, typeident, membername, &memberinfo) != CTF_ERR)
+ {
+ *offset = (memberinfo.ctm_offset >> 3);
+ cmn_err(CE_NOTE, "%s::%s at %d\n", structname, membername, *offset);
+ return (0);
+ }
+ else
+ cmn_err(CE_NOTE, "ctf_member_info failed for struct %s member %s\n", structname, membername);
+ }
+ else
+ cmn_err(CE_NOTE, "ctf_lookup_by_name failed for struct %s\n", structname);
+
+ return (CTF_ERR);
+}
+
+
int
vbi_init(void)
{
@@ -247,7 +245,7 @@ vbi_init(void)
p_contig_free = (void (*)(void *, size_t))
kobj_getsymvalue("contig_free", 1);
if (p_contig_free == NULL) {
- cmn_err(CE_NOTE, " contig_free() not found in kernel\n");
+ cmn_err(CE_NOTE, "contig_free() not found in kernel\n");
return (EINVAL);
}
}
@@ -266,44 +264,33 @@ vbi_init(void)
}
}
-
/*
- * Check if this is S10 or Nevada
+ * CTF probing for fluid, private members.
*/
- if (!strncmp(utsname.release, "5.11", sizeof("5.11") - 1)) {
- /* Nevada detected... */
- vbi_is_nevada = 1;
-
- off_cpu_runrun = off_s11_cpu_runrun;
- off_cpu_kprunrun = off_s11_cpu_kprunrun;
- off_t_preempt = off_s11_t_preempt;
- } else {
- /* Solaris 10 detected... */
- vbi_is_nevada = 0;
+ int err = 0;
+ modctl_t *genunix_modctl = mod_hold_by_name("genunix");
+ if (genunix_modctl)
+ {
+ ctf_file_t *ctfp = ctf_modopen(genunix_modctl->mod_mp, &err);
+ if (ctfp)
+ {
+ do {
+ err = vbi_get_ctf_member_offset(ctfp, "kthread_t", "t_preempt", &off_t_preempt); AssertBreak(!err);
+ err = vbi_get_ctf_member_offset(ctfp, "cpu_t", "cpu_runrun", &off_cpu_runrun); AssertBreak(!err);
+ err = vbi_get_ctf_member_offset(ctfp, "cpu_t", "cpu_kprunrun", &off_cpu_kprunrun); AssertBreak(!err);
+ } while (0);
+ }
- off_cpu_runrun = off_s10_cpu_runrun;
- off_cpu_kprunrun = off_s10_cpu_kprunrun;
- off_t_preempt = off_s10_t_preempt;
+ mod_release_mod(genunix_modctl);
}
-
- /*
- * Sanity checking...
- */
- /* CPU */
- char crr = VBI_CPU_RUNRUN;
- char krr = VBI_CPU_KPRUNRUN;
- if ( (crr < 0 || crr > 1)
- || (krr < 0 || krr > 1)) {
- cmn_err(CE_NOTE, ":CPU structure sanity check failed! OS version mismatch.\n");
- return EINVAL;
+ else
+ {
+ cmn_err(CE_NOTE, "failed to open module genunix.\n");
+ err = EINVAL;
}
- /* Thread */
- char t_preempt = VBI_T_PREEMPT;
- if (t_preempt < 0 || t_preempt > 32) {
- cmn_err(CE_NOTE, ":Thread structure sanity check failed! OS version mismatch.\n");
- return EINVAL;
- }
+ if (err)
+ return (EINVAL);
vbi_is_initialized = 1;
@@ -366,7 +353,7 @@ vbi_internal_alloc(uint64_t *phys, size_t size, uint64_t alignment, int contig)
ptr = contig_alloc(size, &attr, PAGESIZE, 1);
if (ptr == NULL) {
- cmn_err(CE_NOTE, "vbi_internal_alloc() failure for %lu bytes", size);
+ cmn_err(CE_NOTE, "vbi_internal_alloc() failure for %lu bytes contig=%d", size, contig);
return (NULL);
}
@@ -561,7 +548,7 @@ vbi_set_priority(void *thread, int priority)
}
void *
-vbi_thread_create(void *func, void *arg, size_t len, int priority)
+vbi_thread_create(void (*func)(void *), void *arg, size_t len, int priority)
{
kthread_t *t;
@@ -1012,9 +999,7 @@ vbi_user_map(caddr_t *va, uint_t prot, uint64_t *palist, size_t len)
as_rangelock(as);
map_addr(va, len, 0, 0, MAP_SHARED);
if (*va != NULL)
- {
error = as_map(as, *va, len, segvbi_create, &args);
- }
else
error = ENOMEM;
if (error)
@@ -1029,7 +1014,7 @@ vbi_user_map(caddr_t *va, uint_t prot, uint64_t *palist, size_t len)
*/
struct vbi_cpu_watch {
- void (*vbi_cpu_func)();
+ void (*vbi_cpu_func)(void *, int, int);
void *vbi_cpu_arg;
};
@@ -1050,7 +1035,7 @@ vbi_watcher(cpu_setup_t state, int icpu, void *arg)
}
vbi_cpu_watch_t *
-vbi_watch_cpus(void (*func)(), void *arg, int current_too)
+vbi_watch_cpus(void (*func)(void *, int, int), void *arg, int current_too)
{
int c;
vbi_cpu_watch_t *w;
@@ -1210,7 +1195,7 @@ vbi_gtimer_begin(
t->g_func = func;
t->g_cyclic = CYCLIC_NONE;
- omni.cyo_online = (void (*)())vbi_gtimer_online;
+ omni.cyo_online = (void (*)(void *, cpu_t *, cyc_handler_t *, cyc_time_t *))vbi_gtimer_online;
omni.cyo_offline = NULL;
omni.cyo_arg = t;
@@ -1332,11 +1317,11 @@ vbi_pages_alloc(uint64_t *phys, size_t size)
for (int64_t i = 0; i < npages; i++, virtAddr += PAGESIZE)
{
/* get a page from the freelists */
- page_t *ppage = vbi_page_get_fromlist(1 /* freelist */, virtAddr);
+ page_t *ppage = vbi_page_get_fromlist(1 /* freelist */, virtAddr, PAGESIZE);
if (!ppage)
{
/* try from the cachelists */
- ppage = vbi_page_get_fromlist(2 /* cachelist */, virtAddr);
+ ppage = vbi_page_get_fromlist(2 /* cachelist */, virtAddr, PAGESIZE);
if (!ppage)
{
/* damn */
@@ -1433,25 +1418,21 @@ vbi_page_to_pa(page_t **pp_pages, pgcnt_t i)
}
-/*
- * This is revision 9 of the interface.
- */
-page_t *vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr)
+static page_t *
+vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr, size_t pgsize)
{
+ /* pgsize only applies when using the freelist */
seg_t kernseg;
kernseg.s_as = &kas;
page_t *ppage = NULL;
if (freelist == 1)
{
ppage = page_get_freelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr,
- PAGESIZE, 0 /* flags */, NULL /* local group */);
- if (!ppage)
+ pgsize, 0 /* flags */, NULL /* local group */);
+ if (!ppage && use_kflt)
{
- if (use_kflt)
- {
- ppage = page_get_freelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr,
- PAGESIZE, 0x0200 /* PG_KFLT */, NULL /* local group */);
- }
+ ppage = page_get_freelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr,
+ pgsize, 0x0200 /* PG_KFLT */, NULL /* local group */);
}
}
else
@@ -1459,13 +1440,10 @@ page_t *vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr)
/* cachelist */
ppage = page_get_cachelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr,
0 /* flags */, NULL /* local group */);
- if (!ppage)
+ if (!ppage && use_kflt)
{
- if (use_kflt)
- {
- ppage = page_get_cachelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr,
- 0x0200 /* PG_KFLT */, NULL /* local group */);
- }
+ ppage = page_get_cachelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr,
+ 0x0200 /* PG_KFLT */, NULL /* local group */);
}
}
return ppage;
@@ -1473,9 +1451,140 @@ page_t *vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr)
/*
+ * Large page code.
+ */
+
+page_t *
+vbi_large_page_alloc(uint64_t *pphys, size_t pgsize)
+{
+ pgcnt_t const npages = pgsize >> PAGESHIFT;
+ page_t *pproot, *pp, *pplist;
+ pgcnt_t ipage;
+ caddr_t vaddr;
+ seg_t kernseg;
+ int rc;
+
+ /*
+ * Reserve available memory for a large page and create it.
+ */
+ rc = page_resv(npages, KM_NOSLEEP);
+ if (!rc)
+ return NULL;
+
+ rc = page_create_wait(npages, 0 /* flags */);
+ if (!rc) {
+ page_unresv(npages);
+ return NULL;
+ }
+
+ /*
+ * Get a page off the free list. We set vaddr to 0 since we don't know
+ * where the memory is going to be mapped.
+ */
+ vaddr = NULL;
+ kernseg.s_as = &kas;
+ pproot = vbi_page_get_fromlist(1 /* freelist */, vaddr, pgsize);
+ if (!pproot)
+ {
+ page_create_putback(npages);
+ page_unresv(npages);
+ return NULL;
+ }
+ AssertMsg(!(page_pptonum(pproot) & (npages - 1)), ("%p:%lx npages=%lx\n", pproot, page_pptonum(pproot), npages));
+
+ /*
+ * Mark all the sub-pages as non-free and not-hashed-in.
+ * It is paramount that we destroy the list (before freeing it).
+ */
+ pplist = pproot;
+ for (ipage = 0; ipage < npages; ipage++) {
+ pp = pplist;
+ AssertPtr(pp);
+ AssertMsg(page_pptonum(pp) == ipage + page_pptonum(pproot),
+ ("%p:%lx %lx+%lx\n", pp, page_pptonum(pp), ipage, page_pptonum(pproot)));
+ page_sub(&pplist, pp);
+ AssertMsg(PP_ISFREE(pp), ("%p\n", pp));
+ AssertMsg(pp->p_szc == pproot->p_szc, ("%p - %d expected %d \n", pp, pp->p_szc, pproot->p_szc));
+
+ PP_CLRFREE(pp);
+ PP_CLRAGED(pp);
+ }
+
+ *pphys = (uint64_t)page_pptonum(pproot) << PAGESHIFT;
+ AssertMsg(!(*pphys & (pgsize - 1)), ("%llx %zx\n", *pphys, pgsize));
+ return pproot;
+}
+
+void
+vbi_large_page_free(page_t *pproot, size_t pgsize)
+{
+ pgcnt_t const npages = pgsize >> PAGESHIFT;
+ pgcnt_t ipage;
+
+ Assert(page_get_pagecnt(pproot->p_szc) == npages);
+ AssertMsg(!(page_pptonum(pproot) & (npages - 1)), ("%p:%lx npages=%lx\n", pproot, page_pptonum(pproot), npages));
+
+ /*
+ * We need to exclusively lock the sub-pages before freeing
+ * the large one.
+ */
+ for (ipage = 0; ipage < npages; ipage++) {
+ page_t *pp = page_nextn(pproot, ipage);
+ AssertMsg(page_pptonum(pp) == ipage + page_pptonum(pproot),
+ ("%p:%lx %lx+%lx\n", pp, page_pptonum(pp), ipage, page_pptonum(pproot)));
+ AssertMsg(!PP_ISFREE(pp), ("%p\n", pp));
+
+ int rc = page_tryupgrade(pp);
+ if (!rc) {
+ page_unlock(pp);
+ while (!page_lock(pp, SE_EXCL, NULL /* mutex */, P_RECLAIM)) {
+ /*nothing*/;
+ }
+ }
+ }
+
+ /*
+ * Free the large page and unreserve the memory.
+ */
+ page_free_pages(pproot);
+ page_unresv(npages);
+}
+
+int
+vbi_large_page_premap(page_t *pproot, size_t pgsize)
+{
+ pgcnt_t const npages = pgsize >> PAGESHIFT;
+ pgcnt_t ipage;
+
+ Assert(page_get_pagecnt(pproot->p_szc) == npages);
+ AssertMsg(!(page_pptonum(pproot) & (npages - 1)), ("%p:%lx npages=%lx\n", pproot, page_pptonum(pproot), npages));
+
+ /*
+ * We need to downgrade the sub-pages from exclusive to shared locking
+ * because otherwise we cannot <you go figure>.
+ */
+ for (ipage = 0; ipage < npages; ipage++) {
+ page_t *pp = page_nextn(pproot, ipage);
+ AssertMsg(page_pptonum(pp) == ipage + page_pptonum(pproot),
+ ("%p:%lx %lx+%lx\n", pp, page_pptonum(pp), ipage, page_pptonum(pproot)));
+ AssertMsg(!PP_ISFREE(pp), ("%p\n", pp));
+
+ if (page_tryupgrade(pp) == 1)
+ page_downgrade(pp);
+ AssertMsg(!PP_ISFREE(pp), ("%p\n", pp));
+ }
+
+ return 0;
+}
+
+
+/*
* As more functions are added, they should start with a comment indicating
* the revision and above this point in the file and the revision level should
* be increased. Also change vbi_modlmisc at the top of the file.
+ *
+ * NOTE! We'll start care about this if anything in here ever makes it into
+ * the solaris kernel proper.
*/
uint_t vbi_revision_level = 9;
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h
index f2c412a75..5e4b51ce3 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h
@@ -137,7 +137,7 @@ extern void *vbi_proc(void);
* thread functions
*/
extern void vbi_set_priority(void *thread, int priority);
-extern void *vbi_thread_create(void *func, void *arg, size_t len, int priority);
+extern void *vbi_thread_create(void (*func)(void *), void *arg, size_t len, int priority);
extern void vbi_thread_exit(void);
/*
@@ -248,7 +248,7 @@ extern uint_t vbi_revision_level;
* Note there is no guarantee about which CPU the function is invoked on.
*/
typedef struct vbi_cpu_watch vbi_cpu_watch_t;
-extern vbi_cpu_watch_t *vbi_watch_cpus(void (*func)(void), void *arg,
+extern vbi_cpu_watch_t *vbi_watch_cpus(void (*func)(void *, int, int), void *arg,
int current_too);
extern void vbi_ignore_cpus(vbi_cpu_watch_t *);
#pragma weak vbi_watch_cpus
@@ -344,7 +344,7 @@ extern int vbi_is_preempt_pending(void);
/* begin interfaces defined for version 7 */
/*
- * Allocate and free physically limited, aligned as specified continuous or non-continuous memory.
+ * Allocate and free physically limited, aligned as specified continuous or non-continuous memory.
*
* return value is a) NULL if memory below "phys" not available or
* b) virtual address of memory in kernel heap
@@ -368,7 +368,7 @@ extern void vbi_phys_free(void *va, size_t size);
*
* phys on input is set to the physical address of the first page allocated.
*
- * size is the amount to allocate and must be a multiple of PAGESIZE
+ * size is the amount to allocate and must be a multiple of PAGESIZE.
*/
extern page_t **vbi_pages_alloc(uint64_t *phys, size_t size);
@@ -399,6 +399,17 @@ extern int vbi_pages_premap(page_t **pp_pages, size_t size, uint64_t *physaddrs)
extern uint64_t vbi_page_to_pa(page_t **pp_pages, pgcnt_t i);
/* end of interfaces defined for version 8 */
+/*
+ * Allocate, free and map one large page.
+ *
+ * The size of the large page is hardware specific and must be specified
+ * correctly or we'll panic. :-)
+ */
+extern page_t *vbi_large_page_alloc(uint64_t *pphys, size_t pgsize);
+extern void vbi_large_page_free(page_t *ppage, size_t pgsize);
+extern int vbi_large_page_premap(page_t *pproot, size_t pgsize);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c
index d16e9ad6c..4ea9e6796 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: memobj-r0drv-solaris.c $ */
+/* $Id: memobj-r0drv-solaris.c 37281 2011-05-31 21:32:44Z vboxsync $ */
/** @file
* IPRT - Ring-0 Memory Objects, Solaris.
*/
@@ -32,6 +32,7 @@
#include "internal/iprt.h"
#include <iprt/memobj.h>
+#include <iprt/asm.h>
#include <iprt/assert.h>
#include <iprt/err.h>
#include <iprt/log.h>
@@ -56,11 +57,14 @@ typedef struct RTR0MEMOBJSOLARIS
void *pvHandle;
/** Access during locking. */
int fAccess;
+ /** Set if large pages are involved in an RTR0MEMOBJTYPE_PHYS
+ * allocation. */
+ bool fLargePage;
} RTR0MEMOBJSOLARIS, *PRTR0MEMOBJSOLARIS;
-int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
+DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
{
PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)pMem;
@@ -70,20 +74,17 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
vbi_lowmem_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb);
break;
- case RTR0MEMOBJTYPE_CONT:
case RTR0MEMOBJTYPE_PHYS:
- vbi_phys_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb);
+ if (!pMemSolaris->Core.u.Phys.fAllocated)
+ { /* nothing to do here */; }
+ else if (pMemSolaris->fLargePage)
+ vbi_large_page_free(pMemSolaris->pvHandle, pMemSolaris->Core.cb);
+ else
+ vbi_phys_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb);
break;
case RTR0MEMOBJTYPE_PHYS_NC:
-#if 0
- vbi_phys_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb);
-#else
- if (pMemSolaris->Core.u.Phys.fAllocated == true)
- ddi_umem_free(pMemSolaris->Cookie);
- else
- vbi_pages_free(pMemSolaris->pvHandle, pMemSolaris->Core.cb);
-#endif
+ vbi_pages_free(pMemSolaris->pvHandle, pMemSolaris->Core.cb);
break;
case RTR0MEMOBJTYPE_PAGE:
@@ -107,6 +108,7 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
break;
}
+ case RTR0MEMOBJTYPE_CONT: /* we don't use this type here. */
default:
AssertMsgFailed(("enmType=%d\n", pMemSolaris->Core.enmType));
return VERR_INTERNAL_ERROR;
@@ -116,7 +118,7 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
}
-int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
/* Create the object. */
PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_PAGE, NULL, cb);
@@ -130,14 +132,14 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu
return VERR_NO_PAGE_MEMORY;
}
- pMemSolaris->Core.pv = virtAddr;
+ pMemSolaris->Core.pv = virtAddr;
pMemSolaris->pvHandle = NULL;
*ppMem = &pMemSolaris->Core;
return VINF_SUCCESS;
}
-int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
NOREF(fExecutable);
@@ -161,65 +163,42 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut
}
-int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
+DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)
{
NOREF(fExecutable);
return rtR0MemObjNativeAllocPhys(ppMem, cb, _4G - 1, PAGE_SIZE /* alignment */);
}
-int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
{
#if HC_ARCH_BITS == 64
PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_PHYS_NC, NULL, cb);
if (!pMemSolaris)
return VERR_NO_MEMORY;
- /* Allocate physically non-contiguous page-aligned memory. */
- uint64_t physAddr = PhysHighest;
-
-# if 0
- /*
- * The contig_alloc() way of allocating NC pages is broken or does not match our semantics. Refer #4716 for details.
- */
-# if 0
- /* caddr_t virtAddr = vbi_phys_alloc(&physAddr, cb, PAGE_SIZE, 0 /* non-contiguous */);
-# endif
- caddr_t virtAddr = ddi_umem_alloc(cb, DDI_UMEM_SLEEP, &pMemSolaris->Cookie);
- if (RT_UNLIKELY(virtAddr == NULL))
- {
- rtR0MemObjDelete(&pMemSolaris->Core);
- return VERR_NO_MEMORY;
- }
- pMemSolaris->Core.pv = virtAddr;
- pMemSolaris->Core.u.Phys.PhysBase = physAddr;
- pMemSolaris->Core.u.Phys.fAllocated = true;
- pMemSolaris->pvHandle = NULL;
-# else
- void *pvPages = vbi_pages_alloc(&physAddr, cb);
+ uint64_t PhysAddr = PhysHighest;
+ void *pvPages = vbi_pages_alloc(&PhysAddr, cb);
if (!pvPages)
{
LogRel(("rtR0MemObjNativeAllocPhysNC: vbi_pages_alloc failed.\n"));
rtR0MemObjDelete(&pMemSolaris->Core);
return VERR_NO_MEMORY;
}
- pMemSolaris->Core.pv = NULL;
- pMemSolaris->Core.u.Phys.PhysBase = physAddr;
- pMemSolaris->Core.u.Phys.fAllocated = false;
- pMemSolaris->pvHandle = pvPages;
-# endif
+ pMemSolaris->Core.pv = NULL;
+ pMemSolaris->pvHandle = pvPages;
- Assert(!(physAddr & PAGE_OFFSET_MASK));
+ Assert(!(PhysAddr & PAGE_OFFSET_MASK));
*ppMem = &pMemSolaris->Core;
return VINF_SUCCESS;
-#else
- /** @todo rtR0MemObjNativeAllocPhysNC / solaris */
+
+#else /* 32 bit: */
return VERR_NOT_SUPPORTED; /* see the RTR0MemObjAllocPhysNC specs */
#endif
}
-int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
+DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
{
AssertMsgReturn(PhysHighest >= 16 *_1M, ("PhysHigest=%RHp\n", PhysHighest), VERR_NOT_SUPPORTED);
@@ -227,48 +206,71 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph
if (!pMemSolaris)
return VERR_NO_MEMORY;
- AssertCompile(NIL_RTHCPHYS == UINT64_MAX);
-
- /* Allocate physically contiguous memory aligned as specified. */
- uint64_t physAddr = PhysHighest;
- caddr_t virtAddr = vbi_phys_alloc(&physAddr, cb, uAlignment, 1 /* contiguous */);
- if (RT_UNLIKELY(virtAddr == NULL))
+ /*
+ * Allocating one large page gets special treatment.
+ */
+ static uint32_t s_cbLargePage = UINT32_MAX;
+ if (s_cbLargePage == UINT32_MAX)
{
- rtR0MemObjDelete(&pMemSolaris->Core);
- return VERR_NO_CONT_MEMORY;
+#if 0 /* currently not entirely stable, so disabled. */
+ if (page_num_pagesizes() > 1)
+ ASMAtomicWriteU32(&s_cbLargePage, page_get_pagesize(1));
+ else
+#endif
+ ASMAtomicWriteU32(&s_cbLargePage, 0);
}
- Assert(!(physAddr & PAGE_OFFSET_MASK));
- Assert(physAddr < PhysHighest);
- Assert(physAddr + cb <= PhysHighest);
-#if 0
- if (uAlignment != PAGE_SIZE)
+ uint64_t PhysAddr;
+ if ( cb == s_cbLargePage
+ && cb == uAlignment
+ && PhysHighest == NIL_RTHCPHYS)
{
- /* uAlignment is always a multiple of PAGE_SIZE */
- pgcnt_t cPages = (cb + uAlignment - 1) >> PAGE_SHIFT;
- void *pvPage = virtAddr;
- while (cPages-- > 0)
+ /*
+ * Allocate one large page.
+ */
+ void *pvPages = vbi_large_page_alloc(&PhysAddr, cb);
+ if (pvPages)
{
- uint64_t u64Page = vbi_va_to_pa(pvPage);
- if (u64Page & (uAlignment - 1))
- {
- LogRel(("rtR0MemObjNativeAllocPhys: alignment mismatch! cb=%u uAlignment=%u physAddr=%#x\n", cb, uAlignment, u64Page));
- vbi_phys_free(virtAddr, cb);
- rtR0MemObjDelete(&pMemSolaris->Core);
- return VERR_NO_MEMORY;
- }
- pvPage = (void *)((uintptr_t)pvPage + PAGE_SIZE);
+ AssertMsg(!(PhysAddr & (cb - 1)), ("%RHp\n", PhysAddr));
+ pMemSolaris->Core.pv = NULL;
+ pMemSolaris->Core.u.Phys.PhysBase = PhysAddr;
+ pMemSolaris->Core.u.Phys.fAllocated = true;
+ pMemSolaris->pvHandle = pvPages;
+ pMemSolaris->fLargePage = true;
+
+ *ppMem = &pMemSolaris->Core;
+ return VINF_SUCCESS;
}
}
-#endif
- pMemSolaris->Core.pv = virtAddr;
- pMemSolaris->Core.u.Cont.Phys = physAddr;
- pMemSolaris->pvHandle = NULL;
- *ppMem = &pMemSolaris->Core;
- return VINF_SUCCESS;
+ else
+ {
+ /*
+ * Allocate physically contiguous memory aligned as specified.
+ */
+ AssertCompile(NIL_RTHCPHYS == UINT64_MAX);
+ PhysAddr = PhysHighest;
+ caddr_t pvMem = vbi_phys_alloc(&PhysAddr, cb, uAlignment, 1 /* contiguous */);
+ if (RT_LIKELY(pvMem))
+ {
+ Assert(!(PhysAddr & PAGE_OFFSET_MASK));
+ Assert(PhysAddr < PhysHighest);
+ Assert(PhysAddr + cb <= PhysHighest);
+
+ pMemSolaris->Core.pv = pvMem;
+ pMemSolaris->Core.u.Phys.PhysBase = PhysAddr;
+ pMemSolaris->Core.u.Phys.fAllocated = true;
+ pMemSolaris->pvHandle = NULL;
+ pMemSolaris->fLargePage = false;
+
+ *ppMem = &pMemSolaris->Core;
+ return VINF_SUCCESS;
+ }
+ }
+ rtR0MemObjDelete(&pMemSolaris->Core);
+ return VERR_NO_CONT_MEMORY;
}
-int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
+DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)
{
AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED);
@@ -278,15 +280,16 @@ int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t
return VERR_NO_MEMORY;
/* There is no allocation here, it needs to be mapped somewhere first. */
- pMemSolaris->Core.u.Phys.fAllocated = false;
- pMemSolaris->Core.u.Phys.PhysBase = Phys;
+ pMemSolaris->Core.u.Phys.fAllocated = false;
+ pMemSolaris->Core.u.Phys.PhysBase = Phys;
pMemSolaris->Core.u.Phys.uCachePolicy = uCachePolicy;
*ppMem = &pMemSolaris->Core;
return VINF_SUCCESS;
}
-int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess,
+ RTR0PROCESS R0Process)
{
AssertReturn(R0Process == RTR0ProcHandleSelf(), VERR_INVALID_PARAMETER);
NOREF(fAccess);
@@ -296,14 +299,13 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c
if (!pMemSolaris)
return VERR_NO_MEMORY;
+ /* Lock down user pages. */
int fPageAccess = S_READ;
if (fAccess & RTMEM_PROT_WRITE)
fPageAccess = S_WRITE;
if (fAccess & RTMEM_PROT_EXEC)
fPageAccess = S_EXEC;
void *pvPageList = NULL;
-
- /* Lock down user pages */
int rc = vbi_lock_va((caddr_t)R3Ptr, cb, fPageAccess, &pvPageList);
if (rc != 0)
{
@@ -312,15 +314,16 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c
return VERR_LOCK_FAILED;
}
- pMemSolaris->Core.u.Lock.R0Process = (RTR0PROCESS)vbi_proc();
- pMemSolaris->pvHandle = pvPageList;
- pMemSolaris->fAccess = fPageAccess;
+ /* Fill in the object attributes and return successfully. */
+ pMemSolaris->Core.u.Lock.R0Process = R0Process;
+ pMemSolaris->pvHandle = pvPageList;
+ pMemSolaris->fAccess = fPageAccess;
*ppMem = &pMemSolaris->Core;
return VINF_SUCCESS;
}
-int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
+DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)
{
NOREF(fAccess);
@@ -328,6 +331,7 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb,
if (!pMemSolaris)
return VERR_NO_MEMORY;
+ /* Lock down kernel pages. */
int fPageAccess = S_READ;
if (fAccess & RTMEM_PROT_WRITE)
fPageAccess = S_WRITE;
@@ -342,6 +346,7 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb,
return VERR_LOCK_FAILED;
}
+ /* Fill in the object attributes and return successfully. */
pMemSolaris->Core.u.Lock.R0Process = NIL_RTR0PROCESS;
pMemSolaris->pvHandle = pvPageList;
pMemSolaris->fAccess = fPageAccess;
@@ -350,7 +355,7 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb,
}
-int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
+DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
{
PRTR0MEMOBJSOLARIS pMemSolaris;
@@ -358,7 +363,7 @@ int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, siz
* Use xalloc.
*/
void *pv = vmem_xalloc(heap_arena, cb, uAlignment, 0 /*phase*/, 0 /*nocross*/,
- NULL /*minaddr*/, NULL /*maxaddr*/, VM_SLEEP);
+ NULL /*minaddr*/, NULL /*maxaddr*/, VM_SLEEP);
if (RT_UNLIKELY(!pv))
return VERR_NO_MEMORY;
@@ -377,94 +382,111 @@ int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, siz
}
-int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
{
return VERR_NOT_SUPPORTED;
}
-int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
- unsigned fProt, size_t offSub, size_t cbSub)
+
+DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
+ unsigned fProt, size_t offSub, size_t cbSub)
{
/** @todo rtR0MemObjNativeMapKernel / Solaris - Should be fairly simple alloc kernel memory and memload it. */
return VERR_NOT_SUPPORTED;
}
-int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
+DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMemToMap, RTR3PTR R3PtrFixed,
+ size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
{
+ /*
+ * Fend off things we cannot do.
+ */
AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED);
AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
if (uAlignment != PAGE_SIZE)
return VERR_NOT_SUPPORTED;
- PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap;
- size_t cb = pMemToMapSolaris->Core.cb;
- void *pv = pMemToMapSolaris->Core.pv;
- pgcnt_t cPages = (cb + PAGE_SIZE - 1) >> PAGE_SHIFT;
+ /*
+ * Get parameters from the source object.
+ */
+ PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap;
+ void *pv = pMemToMapSolaris->Core.pv;
+ size_t cb = pMemToMapSolaris->Core.cb;
+ pgcnt_t cPages = cb >> PAGE_SHIFT;
- /* Create the mapping object */
- PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_MAPPING, pv, cb);
+ /*
+ * Create the mapping object
+ */
+ PRTR0MEMOBJSOLARIS pMemSolaris;
+ pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_MAPPING, pv, cb);
if (RT_UNLIKELY(!pMemSolaris))
return VERR_NO_MEMORY;
+ int rc = VINF_SUCCESS;
uint64_t *paPhysAddrs = kmem_zalloc(sizeof(uint64_t) * cPages, KM_SLEEP);
- if (RT_UNLIKELY(!paPhysAddrs))
- return VERR_NO_MEMORY;
-
- if ( pMemToMapSolaris->Core.enmType == RTR0MEMOBJTYPE_PHYS_NC
- && pMemSolaris->Core.u.Phys.fAllocated == false)
+ if (RT_LIKELY(paPhysAddrs))
{
/*
- * The PhysNC object has no kernel mapping backing it. The call to vbi_pages_premap()
- * prepares the physical pages to be mapped into user or kernel space.
+ * Prepare the pages according to type.
*/
- int rc = vbi_pages_premap(pMemToMapSolaris->pvHandle, cb, paPhysAddrs);
- if (rc)
+ if (pMemToMapSolaris->Core.enmType == RTR0MEMOBJTYPE_PHYS_NC)
+ rc = vbi_pages_premap(pMemToMapSolaris->pvHandle, cb, paPhysAddrs);
+ else if ( pMemToMapSolaris->Core.enmType == RTR0MEMOBJTYPE_PHYS
+ && pMemToMapSolaris->fLargePage)
{
- LogRel(("rtR0MemObjNativeMapUser: vbi_pages_premap failed. rc=%d\n", rc));
- kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages);
- rtR0MemObjDelete(&pMemSolaris->Core);
- return VERR_MAP_FAILED;
+ RTHCPHYS Phys = pMemToMapSolaris->Core.u.Phys.PhysBase;
+ for (pgcnt_t iPage = 0; iPage < cPages; iPage++, Phys += PAGE_SIZE)
+ paPhysAddrs[iPage] = Phys;
+ rc = vbi_large_page_premap(pMemToMapSolaris->pvHandle, cb);
}
- }
- else
- {
- /*
- * All other memory object types have allocated memory with kernel mappings.
- */
- for (pgcnt_t iPage = 0; iPage < cPages; iPage++)
+ else
{
- paPhysAddrs[iPage] = vbi_va_to_pa(pv);
- if (RT_UNLIKELY(paPhysAddrs[iPage] == -(uint64_t)1))
+ /* Have kernel mapping, just translate virtual to physical. */
+ AssertPtr(pv);
+ rc = 0;
+ for (pgcnt_t iPage = 0; iPage < cPages; iPage++)
{
- LogRel(("rtR0MemObjNativeMapUser: no page to map.\n"));
- kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages);
- rtR0MemObjDelete(&pMemSolaris->Core);
- return VERR_MAP_FAILED;
+ paPhysAddrs[iPage] = vbi_va_to_pa(pv);
+ if (RT_UNLIKELY(paPhysAddrs[iPage] == -(uint64_t)1))
+ {
+ LogRel(("rtR0MemObjNativeMapUser: no page to map.\n"));
+ rc = -1;
+ break;
+ }
+ pv = (void *)((uintptr_t)pv + PAGE_SIZE);
}
- pv = (void *)((uintptr_t)pv + PAGE_SIZE);
}
- }
+ if (!rc)
+ {
+ /*
+ * Perform the actual mapping.
+ */
+ caddr_t UserAddr = NULL;
+ rc = vbi_user_map(&UserAddr, fProt, paPhysAddrs, cb);
+ if (!rc)
+ {
+ pMemSolaris->Core.u.Mapping.R0Process = R0Process;
+ pMemSolaris->Core.pv = UserAddr;
- caddr_t virtAddr = NULL;
- int rc = vbi_user_map(&virtAddr, fProt, paPhysAddrs, cb);
- if (rc != 0)
- {
- LogRel(("rtR0MemObjNativeMapUser: vbi mapping failure.\n"));
+ *ppMem = &pMemSolaris->Core;
+ kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages);
+ return VINF_SUCCESS;
+ }
+
+ LogRel(("rtR0MemObjNativeMapUser: vbi_user_map failed.\n"));
+ }
+ rc = VERR_MAP_FAILED;
kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages);
- rtR0MemObjDelete(&pMemSolaris->Core);
- return VERR_MAP_FAILED;
}
-
- pMemSolaris->Core.u.Mapping.R0Process = (RTR0PROCESS)vbi_proc();
- pMemSolaris->Core.pv = virtAddr;
- *ppMem = &pMemSolaris->Core;
- kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages);
- return VINF_SUCCESS;
+ else
+ rc = VERR_NO_MEMORY;
+ rtR0MemObjDelete(&pMemSolaris->Core);
+ return rc;
}
-int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
+DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt)
{
NOREF(pMem);
NOREF(offSub);
@@ -474,12 +496,20 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu
}
-RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
+DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
{
PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)pMem;
switch (pMemSolaris->Core.enmType)
{
+ case RTR0MEMOBJTYPE_PHYS_NC:
+ if (pMemSolaris->Core.u.Phys.fAllocated)
+ {
+ uint8_t *pb = (uint8_t *)pMemSolaris->Core.pv + ((size_t)iPage << PAGE_SHIFT);
+ return vbi_va_to_pa(pb);
+ }
+ return vbi_page_to_pa(pMemSolaris->pvHandle, iPage);
+
case RTR0MEMOBJTYPE_PAGE:
case RTR0MEMOBJTYPE_LOW:
case RTR0MEMOBJTYPE_LOCK:
@@ -497,16 +527,7 @@ RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage)
case RTR0MEMOBJTYPE_CONT:
case RTR0MEMOBJTYPE_PHYS:
- return pMemSolaris->Core.u.Cont.Phys + (iPage << PAGE_SHIFT);
-
- case RTR0MEMOBJTYPE_PHYS_NC:
- if (pMemSolaris->Core.u.Phys.fAllocated == true)
- {
- uint8_t *pb = (uint8_t *)pMemSolaris->Core.pv + ((size_t)iPage << PAGE_SHIFT);
- return vbi_va_to_pa(pb);
- }
- return vbi_page_to_pa(pMemSolaris->pvHandle, iPage);
-
+ AssertFailed(); /* handled by the caller */
case RTR0MEMOBJTYPE_RES_VIRT:
default:
return NIL_RTHCPHYS;
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c
index 11106cd54..a281c0011 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: mp-r0drv-solaris.c $ */
+/* $Id: mp-r0drv-solaris.c 37062 2011-05-13 10:18:29Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Ring-0 Driver, Solaris.
*/
@@ -173,6 +173,13 @@ static int rtmpOnAllSolarisWrapper(void *uArg, void *uIgnored1, void *uIgnored2)
{
PRTMPARGS pArgs = (PRTMPARGS)(uArg);
+ /*
+ * Solaris CPU cross calls execute on offline CPUs too. Check our CPU cache
+ * set and ignore if it's offline.
+ */
+ if (!RTMpIsCpuOnline(RTMpCpuId()))
+ return 0;
+
pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2);
NOREF(uIgnored1);
@@ -278,6 +285,9 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1
if (idCpu >= vbi_cpu_count())
return VERR_CPU_NOT_FOUND;
+ if (RT_UNLIKELY(!RTMpIsCpuOnline(idCpu)))
+ return RTMpIsCpuPresent(idCpu) ? VERR_CPU_OFFLINE : VERR_CPU_NOT_FOUND;
+
Args.pfnWorker = pfnWorker;
Args.pvUser1 = pvUser1;
Args.pvUser2 = pvUser2;
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c
index dc2eb4817..65d31989c 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: mpnotification-r0drv-solaris.c $ */
+/* $Id: mpnotification-r0drv-solaris.c 37274 2011-05-31 11:47:51Z vboxsync $ */
/** @file
* IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Solaris.
*/
@@ -33,6 +33,8 @@
#include <iprt/err.h>
#include <iprt/mp.h>
#include <iprt/cpuset.h>
+#include <iprt/string.h>
+#include <iprt/thread.h>
#include "r0drv/mp-r0drv.h"
@@ -48,28 +50,56 @@ static vbi_cpu_watch_t *g_hVbiCpuWatch = NULL;
RTCPUSET g_rtMpSolarisCpuSet;
-static void rtMpNotificationSolarisCallback(void *pvUser, int iCpu, int online)
+static void rtMpNotificationSolarisOnCurrentCpu(void *pvArgs, void *uIgnored1, void *uIgnored2)
{
- NOREF(pvUser);
+ NOREF(uIgnored1);
+ NOREF(uIgnored2);
+
+ PRTMPARGS pArgs = (PRTMPARGS)(pvArgs);
+ AssertRelease(pArgs && pArgs->idCpu == RTMpCpuId());
+ Assert(pArgs->pvUser2);
+ Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
- /* ASSUMES iCpu == RTCPUID */
+ int online = *(int *)pArgs->pvUser2;
if (online)
{
- RTCpuSetAdd(&g_rtMpSolarisCpuSet, iCpu);
- rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, iCpu);
+ RTCpuSetAdd(&g_rtMpSolarisCpuSet, pArgs->idCpu);
+ rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, pArgs->idCpu);
}
else
{
- RTCpuSetDel(&g_rtMpSolarisCpuSet, iCpu);
- rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, iCpu);
+ RTCpuSetDel(&g_rtMpSolarisCpuSet, pArgs->idCpu);
+ rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, pArgs->idCpu);
}
}
-int rtR0MpNotificationNativeInit(void)
+static void rtMpNotificationSolarisCallback(void *pvUser, int iCpu, int online)
+{
+ vbi_preempt_disable();
+
+ RTMPARGS Args;
+ RT_ZERO(Args);
+ Args.pvUser1 = pvUser;
+ Args.pvUser2 = &online;
+ Args.idCpu = iCpu;
+
+ /*
+ * If we're not on the target CPU, schedule (synchronous) the event notification callback
+ * to run on the target CPU i.e. the one pertaining to the MP event.
+ */
+ bool fRunningOnTargetCpu = iCpu == RTMpCpuId(); /* ASSUMES iCpu == RTCPUID */
+ if (fRunningOnTargetCpu)
+ rtMpNotificationSolarisOnCurrentCpu(&Args, NULL /* pvIgnored1 */, NULL /* pvIgnored2 */);
+ else
+ vbi_execute_on_one(rtMpNotificationSolarisOnCurrentCpu, &Args, iCpu);
+
+ vbi_preempt_enable();
+}
+
+
+DECLHIDDEN(int) rtR0MpNotificationNativeInit(void)
{
- if (vbi_revision_level < 2)
- return VERR_NOT_SUPPORTED;
if (g_hVbiCpuWatch != NULL)
return VERR_WRONG_ORDER;
@@ -84,9 +114,9 @@ int rtR0MpNotificationNativeInit(void)
}
-void rtR0MpNotificationNativeTerm(void)
+DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void)
{
- if (vbi_revision_level >= 2 && g_hVbiCpuWatch != NULL)
+ if (g_hVbiCpuWatch != NULL)
vbi_ignore_cpus(g_hVbiCpuWatch);
g_hVbiCpuWatch = NULL;
}
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c
index dbfb639c8..3e3b61179 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: process-r0drv-solaris.c $ */
+/* $Id: process-r0drv-solaris.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Process Management, Ring-0 Driver, Solaris.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c
index 9fbf4eff5..ab31c4b70 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: thread-r0drv-solaris.c $ */
+/* $Id: thread-r0drv-solaris.c 29281 2010-05-09 23:40:43Z vboxsync $ */
/** @file
* IPRT - Threads, Ring-0 Driver, Solaris.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c
index 383e33ac8..90958120d 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: thread2-r0drv-solaris.c $ */
+/* $Id: thread2-r0drv-solaris.c 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Threads (Part 2), Ring-0 Driver, Solaris.
*/
@@ -38,7 +38,7 @@
-int rtThreadNativeInit(void)
+DECLHIDDEN(int) rtThreadNativeInit(void)
{
return VINF_SUCCESS;
}
@@ -50,7 +50,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void)
}
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
int iPriority;
switch (enmType)
@@ -71,7 +71,7 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
}
-int rtThreadNativeAdopt(PRTTHREADINT pThread)
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
{
NOREF(pThread);
/* There is nothing special that needs doing here, but the
@@ -80,7 +80,7 @@ int rtThreadNativeAdopt(PRTTHREADINT pThread)
}
-void rtThreadNativeDestroy(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
{
NOREF(pThread);
}
@@ -100,7 +100,7 @@ static void rtThreadNativeMain(void *pvThreadInt)
}
-int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
{
void *pvKernThread;
RT_ASSERT_PREEMPTIBLE();
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c
index d8db73fd1..e0b6f903c 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: time-r0drv-solaris.c $ */
+/* $Id: time-r0drv-solaris.c 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Time, Ring-0 Driver, Solaris.
*/
diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c
index feef551da..da5a41622 100644
--- a/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: timer-r0drv-solaris.c $ */
+/* $Id: timer-r0drv-solaris.c 37275 2011-05-31 11:48:14Z vboxsync $ */
/** @file
* IPRT - Timer, Ring-0 Driver, Solaris.
*/
@@ -112,8 +112,6 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
*/
if (!RTTIMER_FLAGS_ARE_VALID(fFlags))
return VERR_INVALID_PARAMETER;
- if (vbi_revision_level < 2)
- return VERR_NOT_SUPPORTED;
if ( (fFlags & RTTIMER_FLAGS_CPU_SPECIFIC)
&& (fFlags & RTTIMER_FLAGS_CPU_ALL) != RTTIMER_FLAGS_CPU_ALL
diff --git a/src/VBox/Runtime/r3/alloc-ef-cpp.cpp b/src/VBox/Runtime/r3/alloc-ef-cpp.cpp
index 43ddf34c4..566e564a7 100644
--- a/src/VBox/Runtime/r3/alloc-ef-cpp.cpp
+++ b/src/VBox/Runtime/r3/alloc-ef-cpp.cpp
@@ -1,4 +1,4 @@
-/* $Id: alloc-ef-cpp.cpp $ */
+/* $Id: alloc-ef-cpp.cpp 31252 2010-07-30 15:38:52Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, C++ electric fence.
*/
diff --git a/src/VBox/Runtime/r3/alloc-ef.cpp b/src/VBox/Runtime/r3/alloc-ef.cpp
index 1c45c35d6..e3d3b892e 100644
--- a/src/VBox/Runtime/r3/alloc-ef.cpp
+++ b/src/VBox/Runtime/r3/alloc-ef.cpp
@@ -1,4 +1,4 @@
-/* $Id: alloc-ef.cpp $ */
+/* $Id: alloc-ef.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, electric fence.
*/
diff --git a/src/VBox/Runtime/r3/alloc-ef.h b/src/VBox/Runtime/r3/alloc-ef.h
index d7f630a01..d90dc6328 100644
--- a/src/VBox/Runtime/r3/alloc-ef.h
+++ b/src/VBox/Runtime/r3/alloc-ef.h
@@ -1,4 +1,4 @@
-/* $Id: alloc-ef.h $ */
+/* $Id: alloc-ef.h 34291 2010-11-23 16:06:11Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, electric fence.
*/
diff --git a/src/VBox/Runtime/r3/alloc.cpp b/src/VBox/Runtime/r3/alloc.cpp
index c8ddb7ea7..e790feabc 100644
--- a/src/VBox/Runtime/r3/alloc.cpp
+++ b/src/VBox/Runtime/r3/alloc.cpp
@@ -1,4 +1,4 @@
-/* $Id: alloc.cpp $ */
+/* $Id: alloc.cpp 36597 2011-04-06 19:46:15Z vboxsync $ */
/** @file
* IPRT - Memory Allocation.
*/
@@ -33,6 +33,12 @@
# define RTALLOC_USE_EFENCE 1
#endif
+/*#define RTMEMALLOC_USE_TRACKER*/
+/* Don't enable the tracker when building the minimal IPRT. */
+#ifdef RT_MINI
+# undef RTMEMALLOC_USE_TRACKER
+#endif
+
/*******************************************************************************
* Header Files *
@@ -72,6 +78,8 @@
#undef RTMemDupEx
#undef RTMemDupExTag
+#undef RTALLOC_USE_EFENCE
+
RTDECL(void *) RTMemTmpAllocTag(size_t cb, const char *pszTag) RT_NO_THROW
{
@@ -177,22 +185,11 @@ RTDECL(void *) RTMemReallocTag(void *pvOld, size_t cbNew, const char *pszTag) R
#else /* !RTALLOC_USE_EFENCE */
-# ifdef RTALLOC_USE_TRACKER
- void *pv;
- if (!pvOld)
- {
- if (cbNew)
- pv = RTMemTrackerHdrAlloc(realloc(pvOld, cbNew + sizeof(RTMEMTRACKERHDR)), cbNew,
- pszTag, RTMEMTRACKERMETHOD_REALLOC);
- else
- pv = NULL;
- }
- else
- {
- RTMemTrackerHdrReallocPrep(pvOld, 0, pszTag, RTMEMTRACKERMETHOD_REALLOC);
- pv = RTMemTrackerHdrRealloc(realloc(pvOld, cbNew + sizeof(RTMEMTRACKERHDR)), cbNew, pvOld,
- pszTag, RTMEMTRACKERMETHOD_REALLOC);
- }
+# ifdef RTMEMALLOC_USE_TRACKER
+ void *pvRealOld = RTMemTrackerHdrReallocPrep(pvOld, 0, pszTag);
+ size_t cbRealNew = cbNew || !pvRealOld ? cbNew + sizeof(RTMEMTRACKERHDR) : 0;
+ void *pvNew = realloc(pvRealOld, cbRealNew);
+ void *pv = RTMemTrackerHdrReallocDone(pvNew, cbNew, pvOld, pszTag);
# else
void *pv = realloc(pvOld, cbNew);
# endif
@@ -212,7 +209,7 @@ RTDECL(void) RTMemFree(void *pv) RT_NO_THROW
#ifdef RTALLOC_USE_EFENCE
rtR3MemFree("Free", RTMEMTYPE_RTMEMFREE, pv, ASMReturnAddress(), NULL, 0, NULL);
#else
-# ifdef RTALLOC_USE_TRACKER
+# ifdef RTMEMALLOC_USE_TRACKER
pv = RTMemTrackerHdrFree(pv, 0, NULL, RTMEMTRACKERMETHOD_FREE);
# endif
free(pv);
diff --git a/src/VBox/Runtime/r3/darwin/RTPathUserDocuments-darwin.cpp b/src/VBox/Runtime/r3/darwin/RTPathUserDocuments-darwin.cpp
new file mode 100644
index 000000000..dd9d11133
--- /dev/null
+++ b/src/VBox/Runtime/r3/darwin/RTPathUserDocuments-darwin.cpp
@@ -0,0 +1,55 @@
+/* $Id: RTPathUserDocuments-darwin.cpp 36611 2011-04-07 10:35:29Z vboxsync $ */
+/** @file
+ * IPRT - RTPathUserDocuments, darwin ring-3.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/path.h>
+#include <iprt/err.h>
+#include <iprt/assert.h>
+
+#include <CoreServices/CoreServices.h>
+
+RTDECL(int) RTPathUserDocuments(char *pszPath, size_t cchPath)
+{
+ /*
+ * Validate input
+ */
+ AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
+ AssertReturn(cchPath, VERR_INVALID_PARAMETER);
+
+ FSRef ref;
+ OSErr err = FSFindFolder(kOnAppropriateDisk, kDocumentsFolderType, false /* createFolder */, &ref);
+ if (err != noErr)
+ return VERR_PATH_NOT_FOUND;
+
+ err = FSRefMakePath(&ref, (UInt8*)pszPath, cchPath);
+ if (err != noErr)
+ return VERR_PATH_NOT_FOUND;
+
+ return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/Runtime/r3/darwin/RTSystemQueryDmiString-darwin.cpp b/src/VBox/Runtime/r3/darwin/RTSystemQueryDmiString-darwin.cpp
index 064bdcbf1..bea8c0aec 100644
--- a/src/VBox/Runtime/r3/darwin/RTSystemQueryDmiString-darwin.cpp
+++ b/src/VBox/Runtime/r3/darwin/RTSystemQueryDmiString-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSystemQueryDmiString-darwin.cpp $ */
+/* $Id: RTSystemQueryDmiString-darwin.cpp 29560 2010-05-17 15:08:09Z vboxsync $ */
/** @file
* IPRT - RTSystemQueryDmiString, darwin ring-3.
*/
diff --git a/src/VBox/Runtime/r3/darwin/filelock-darwin.cpp b/src/VBox/Runtime/r3/darwin/filelock-darwin.cpp
index f588963e1..614095074 100644
--- a/src/VBox/Runtime/r3/darwin/filelock-darwin.cpp
+++ b/src/VBox/Runtime/r3/darwin/filelock-darwin.cpp
@@ -1,10 +1,10 @@
-/* $Id: filelock-darwin.cpp $ */
+/* $Id: filelock-darwin.cpp 37597 2011-06-22 20:54:05Z vboxsync $ */
/** @file
* IPRT - File Locking, POSIX.
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -49,7 +49,7 @@
-RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int) RTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
{
Assert(offLock >= 0);
@@ -82,7 +82,7 @@ RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t
fl.l_pid = 0;
Assert(RTFILE_LOCK_WAIT);
- if (fcntl(File, (fLock & RTFILE_LOCK_WAIT) ? F_SETLKW : F_SETLK, &fl) >= 0)
+ if (fcntl(RTFileToNative(hFile), (fLock & RTFILE_LOCK_WAIT) ? F_SETLKW : F_SETLK, &fl) >= 0)
return VINF_SUCCESS;
int iErr = errno;
if (iErr == ENOTSUP)
@@ -101,7 +101,7 @@ RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t
f |= LOCK_EX;
else
f |= LOCK_SH;
- if (!flock(File, f))
+ if (!flock(RTFileToNative(hFile), f))
return VINF_SUCCESS;
iErr = errno;
if (iErr == EWOULDBLOCK)
@@ -116,14 +116,14 @@ RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t
}
-RTR3DECL(int) RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int) RTFileChangeLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
{
/** @todo We never returns VERR_FILE_NOT_LOCKED for now. */
- return RTFileLock(File, fLock, offLock, cbLock);
+ return RTFileLock(hFile, fLock, offLock, cbLock);
}
-RTR3DECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int) RTFileUnlock(RTFILE hFile, int64_t offLock, uint64_t cbLock)
{
Assert(offLock >= 0);
@@ -147,14 +147,14 @@ RTR3DECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
fl.l_len = (off_t)cbLock;
fl.l_pid = 0;
- if (fcntl(File, F_SETLK, &fl) >= 0)
+ if (fcntl(RTFileToNative(hFile), F_SETLK, &fl) >= 0)
return VINF_SUCCESS;
int iErr = errno;
if (iErr == ENOTSUP)
{
/* A SMB hack, see RTFileLock. */
- if (!flock(File, LOCK_UN))
+ if (!flock(RTFileToNative(hFile), LOCK_UN))
return VINF_SUCCESS;
}
diff --git a/src/VBox/Runtime/r3/darwin/mp-darwin.cpp b/src/VBox/Runtime/r3/darwin/mp-darwin.cpp
index a03ca41e5..ec1c158e1 100644
--- a/src/VBox/Runtime/r3/darwin/mp-darwin.cpp
+++ b/src/VBox/Runtime/r3/darwin/mp-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: mp-darwin.cpp $ */
+/* $Id: mp-darwin.cpp 36232 2011-03-09 16:41:09Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Darwin.
*/
diff --git a/src/VBox/Runtime/r3/darwin/pathhost-darwin.cpp b/src/VBox/Runtime/r3/darwin/pathhost-darwin.cpp
index 0f575fbae..33452bfcb 100644
--- a/src/VBox/Runtime/r3/darwin/pathhost-darwin.cpp
+++ b/src/VBox/Runtime/r3/darwin/pathhost-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: pathhost-darwin.cpp $ */
+/* $Id: pathhost-darwin.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Path Conversions, Darwin.
*
diff --git a/src/VBox/Runtime/r3/darwin/rtProcInitExePath-darwin.cpp b/src/VBox/Runtime/r3/darwin/rtProcInitExePath-darwin.cpp
index 103e70b44..e9bb2f278 100644
--- a/src/VBox/Runtime/r3/darwin/rtProcInitExePath-darwin.cpp
+++ b/src/VBox/Runtime/r3/darwin/rtProcInitExePath-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: rtProcInitExePath-darwin.cpp $ */
+/* $Id: rtProcInitExePath-darwin.cpp 28929 2010-04-30 11:26:46Z vboxsync $ */
/** @file
* IPRT - rtProcInitName, Darwin.
*/
diff --git a/src/VBox/Runtime/r3/darwin/sched-darwin.cpp b/src/VBox/Runtime/r3/darwin/sched-darwin.cpp
index cc7dee645..1a7cc421c 100644
--- a/src/VBox/Runtime/r3/darwin/sched-darwin.cpp
+++ b/src/VBox/Runtime/r3/darwin/sched-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: sched-darwin.cpp $ */
+/* $Id: sched-darwin.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Scheduling, Darwin.
*/
@@ -220,7 +220,7 @@ static int rtSchedDarwinGetBasePriority(void)
}
-int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
{
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
@@ -254,7 +254,7 @@ int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
}
-int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
+DECLHIDDEN(int) rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
{
Assert(enmPriority > RTPROCPRIORITY_INVALID && enmPriority < RTPROCPRIORITY_LAST);
@@ -275,7 +275,7 @@ int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
}
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
Assert(pThread->Core.Key == pthread_self());
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
diff --git a/src/VBox/Runtime/r3/darwin/time-darwin.cpp b/src/VBox/Runtime/r3/darwin/time-darwin.cpp
index 38878c634..762c9a0d1 100644
--- a/src/VBox/Runtime/r3/darwin/time-darwin.cpp
+++ b/src/VBox/Runtime/r3/darwin/time-darwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: time-darwin.cpp $ */
+/* $Id: time-darwin.cpp 34921 2010-12-09 19:46:36Z vboxsync $ */
/** @file
* IPRT - Time, Darwin.
*/
diff --git a/src/VBox/Runtime/r3/dir.cpp b/src/VBox/Runtime/r3/dir.cpp
index c3e687881..a901dbb57 100644
--- a/src/VBox/Runtime/r3/dir.cpp
+++ b/src/VBox/Runtime/r3/dir.cpp
@@ -1,4 +1,4 @@
-/* $Id: dir.cpp $ */
+/* $Id: dir.cpp 34015 2010-11-12 00:15:05Z vboxsync $ */
/** @file
* IPRT - Directory Manipulation, Part 1.
*/
diff --git a/src/VBox/Runtime/r3/dir2.cpp b/src/VBox/Runtime/r3/dir2.cpp
index cad6d8763..13369dae4 100644
--- a/src/VBox/Runtime/r3/dir2.cpp
+++ b/src/VBox/Runtime/r3/dir2.cpp
@@ -1,4 +1,4 @@
-/* $Id: dir2.cpp $ */
+/* $Id: dir2.cpp 34015 2010-11-12 00:15:05Z vboxsync $ */
/** @file
* IPRT - Directory Manipulation, Part 2.
*/
diff --git a/src/VBox/Runtime/r3/fileio.cpp b/src/VBox/Runtime/r3/fileio.cpp
index 38ec784f6..dd2b5356b 100644
--- a/src/VBox/Runtime/r3/fileio.cpp
+++ b/src/VBox/Runtime/r3/fileio.cpp
@@ -1,4 +1,4 @@
-/* $Id: fileio.cpp $ */
+/* $Id: fileio.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - File I/O.
*/
@@ -106,7 +106,7 @@ RTR3DECL(int) RTFileSetForceFlags(unsigned fOpenForAccess, unsigned fSet, unsig
* Updated on successful return.
* @internal
*/
-int rtFileRecalcAndValidateFlags(uint32_t *pfOpen)
+int rtFileRecalcAndValidateFlags(uint64_t *pfOpen)
{
/*
* Recalc.
@@ -127,20 +127,20 @@ int rtFileRecalcAndValidateFlags(uint32_t *pfOpen)
fOpen &= ~g_fOpenReadWriteMask;
break;
default:
- AssertMsgFailed(("Invalid RW value, fOpen=%#x\n", fOpen));
+ AssertMsgFailed(("Invalid RW value, fOpen=%#llx\n", fOpen));
return VERR_INVALID_PARAMETER;
}
/*
* Validate .
*/
- AssertMsgReturn(fOpen & RTFILE_O_ACCESS_MASK, ("Missing RTFILE_O_READ/WRITE: fOpen=%#x\n", fOpen), VERR_INVALID_PARAMETER);
+ AssertMsgReturn(fOpen & RTFILE_O_ACCESS_MASK, ("Missing RTFILE_O_READ/WRITE: fOpen=%#llx\n", fOpen), VERR_INVALID_PARAMETER);
#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
- AssertMsgReturn(!(fOpen & (~RTFILE_O_VALID_MASK | RTFILE_O_NON_BLOCK)), ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
+ AssertMsgReturn(!(fOpen & (~(uint64_t)RTFILE_O_VALID_MASK | RTFILE_O_NON_BLOCK)), ("%#llx\n", fOpen), VERR_INVALID_PARAMETER);
#else
- AssertMsgReturn(!(fOpen & ~RTFILE_O_VALID_MASK), ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
+ AssertMsgReturn(!(fOpen & ~(uint64_t)RTFILE_O_VALID_MASK), ("%#llx\n", fOpen), VERR_INVALID_PARAMETER);
#endif
- AssertMsgReturn((fOpen & (RTFILE_O_TRUNCATE | RTFILE_O_WRITE)) != RTFILE_O_TRUNCATE, ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
+ AssertMsgReturn((fOpen & (RTFILE_O_TRUNCATE | RTFILE_O_WRITE)) != RTFILE_O_TRUNCATE, ("%#llx\n", fOpen), VERR_INVALID_PARAMETER);
switch (fOpen & RTFILE_O_ACTION_MASK)
{
@@ -149,13 +149,13 @@ int rtFileRecalcAndValidateFlags(uint32_t *pfOpen)
fOpen |= RTFILE_O_OPEN;
break;
case RTFILE_O_OPEN:
- AssertMsgReturn(!(RTFILE_O_NOT_CONTENT_INDEXED & fOpen), ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
+ AssertMsgReturn(!(RTFILE_O_NOT_CONTENT_INDEXED & fOpen), ("%#llx\n", fOpen), VERR_INVALID_PARAMETER);
case RTFILE_O_OPEN_CREATE:
case RTFILE_O_CREATE:
case RTFILE_O_CREATE_REPLACE:
break;
default:
- AssertMsgFailed(("Invalid action value: fOpen=%#x\n", fOpen));
+ AssertMsgFailed(("Invalid action value: fOpen=%#llx\n", fOpen));
return VERR_INVALID_PARAMETER;
}
@@ -175,7 +175,7 @@ int rtFileRecalcAndValidateFlags(uint32_t *pfOpen)
case RTFILE_O_DENY_NOT_DELETE | RTFILE_O_DENY_WRITE | RTFILE_O_DENY_READ:
break;
default:
- AssertMsgFailed(("Invalid deny value: fOpen=%#x\n", fOpen));
+ AssertMsgFailed(("Invalid deny value: fOpen=%#llx\n", fOpen));
return VERR_INVALID_PARAMETER;
}
diff --git a/src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp b/src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp
index cb04eaa8d..78eb7fe81 100644
--- a/src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp
+++ b/src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp
@@ -1,4 +1,4 @@
-/* $Id: fileaio-freebsd.cpp $ */
+/* $Id: fileaio-freebsd.cpp 37774 2011-07-04 21:19:27Z vboxsync $ */
/** @file
* IPRT - File async I/O, native implementation for the FreeBSD host platform.
*/
@@ -199,7 +199,7 @@ DECLINLINE(int) rtFileAioReqPrepareTransfer(RTFILEAIOREQ hReq, RTFILE hFile,
pReqInt->AioCB.aio_sigevent.sigev_notify = SIGEV_KEVENT;
pReqInt->AioCB.aio_sigevent.sigev_value.sival_ptr = pReqInt;
pReqInt->AioCB.aio_lio_opcode = uTransferDirection;
- pReqInt->AioCB.aio_fildes = (int)hFile;
+ pReqInt->AioCB.aio_fildes = RTFileToNative(hFile);
pReqInt->AioCB.aio_offset = off;
pReqInt->AioCB.aio_nbytes = cbTransfer;
pReqInt->AioCB.aio_buf = pvBuf;
@@ -235,7 +235,7 @@ RTDECL(int) RTFileAioReqPrepareFlush(RTFILEAIOREQ hReq, RTFILE hFile, void *pvUs
RTFILEAIOREQ_NOT_STATE_RETURN_RC(pReqInt, SUBMITTED, VERR_FILE_AIO_IN_PROGRESS);
pReqInt->fFlush = true;
- pReqInt->AioCB.aio_fildes = (int)hFile;
+ pReqInt->AioCB.aio_fildes = RTFileToNative(hFile);
pReqInt->AioCB.aio_offset = 0;
pReqInt->AioCB.aio_nbytes = 0;
pReqInt->AioCB.aio_buf = NULL;
diff --git a/src/VBox/Runtime/r3/freebsd/mp-freebsd.cpp b/src/VBox/Runtime/r3/freebsd/mp-freebsd.cpp
index 8296025b0..b6481a30f 100644
--- a/src/VBox/Runtime/r3/freebsd/mp-freebsd.cpp
+++ b/src/VBox/Runtime/r3/freebsd/mp-freebsd.cpp
@@ -1,4 +1,4 @@
-/* $Id: mp-freebsd.cpp $ */
+/* $Id: mp-freebsd.cpp 36232 2011-03-09 16:41:09Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r3/freebsd/rtProcInitExePath-freebsd.cpp b/src/VBox/Runtime/r3/freebsd/rtProcInitExePath-freebsd.cpp
index 55112775d..a1f4e6669 100644
--- a/src/VBox/Runtime/r3/freebsd/rtProcInitExePath-freebsd.cpp
+++ b/src/VBox/Runtime/r3/freebsd/rtProcInitExePath-freebsd.cpp
@@ -1,4 +1,4 @@
-/* $Id: rtProcInitExePath-freebsd.cpp $ */
+/* $Id: rtProcInitExePath-freebsd.cpp 28929 2010-04-30 11:26:46Z vboxsync $ */
/** @file
* IPRT - rtProcInitName, FreeBSD.
*/
diff --git a/src/VBox/Runtime/r3/fs.cpp b/src/VBox/Runtime/r3/fs.cpp
index 9dc46b599..5637ecd89 100644
--- a/src/VBox/Runtime/r3/fs.cpp
+++ b/src/VBox/Runtime/r3/fs.cpp
@@ -1,4 +1,4 @@
-/* $Id: fs.cpp $ */
+/* $Id: fs.cpp 34015 2010-11-12 00:15:05Z vboxsync $ */
/** @file
* IPRT - File System.
*/
diff --git a/src/VBox/Runtime/r3/generic/semspinmutex-r3-generic.cpp b/src/VBox/Runtime/r3/generic/semspinmutex-r3-generic.cpp
index 1c0e46037..1efc9b236 100644
--- a/src/VBox/Runtime/r3/generic/semspinmutex-r3-generic.cpp
+++ b/src/VBox/Runtime/r3/generic/semspinmutex-r3-generic.cpp
@@ -1,4 +1,4 @@
-/* $Id: semspinmutex-r3-generic.cpp $ */
+/* $Id: semspinmutex-r3-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Spinning Mutex Semaphores, Ring-3, Generic.
*/
diff --git a/src/VBox/Runtime/r3/init.cpp b/src/VBox/Runtime/r3/init.cpp
index 32d6b55d4..b37c2501b 100644
--- a/src/VBox/Runtime/r3/init.cpp
+++ b/src/VBox/Runtime/r3/init.cpp
@@ -1,4 +1,4 @@
-/* $Id: init.cpp $ */
+/* $Id: init.cpp 36549 2011-04-05 09:28:24Z vboxsync $ */
/** @file
* IPRT - Init Ring-3.
*/
@@ -74,44 +74,50 @@
* Global Variables *
*******************************************************************************/
/** The number of calls to RTR3Init. */
-static int32_t volatile g_cUsers = 0;
+static int32_t volatile g_cUsers = 0;
/** Whether we're currently initializing the IPRT. */
-static bool volatile g_fInitializing = false;
+static bool volatile g_fInitializing = false;
/** The process path.
* This is used by RTPathExecDir and RTProcGetExecutablePath and set by rtProcInitName. */
-char g_szrtProcExePath[RTPATH_MAX];
+DECLHIDDEN(char) g_szrtProcExePath[RTPATH_MAX];
/** The length of g_szrtProcExePath. */
-size_t g_cchrtProcExePath;
+DECLHIDDEN(size_t) g_cchrtProcExePath;
/** The length of directory path component of g_szrtProcExePath. */
-size_t g_cchrtProcDir;
+DECLHIDDEN(size_t) g_cchrtProcDir;
/** The offset of the process name into g_szrtProcExePath. */
-size_t g_offrtProcName;
+DECLHIDDEN(size_t) g_offrtProcName;
/**
* Program start nanosecond TS.
*/
-uint64_t g_u64ProgramStartNanoTS;
+DECLHIDDEN(uint64_t) g_u64ProgramStartNanoTS;
/**
* Program start microsecond TS.
*/
-uint64_t g_u64ProgramStartMicroTS;
+DECLHIDDEN(uint64_t) g_u64ProgramStartMicroTS;
/**
* Program start millisecond TS.
*/
-uint64_t g_u64ProgramStartMilliTS;
+DECLHIDDEN(uint64_t) g_u64ProgramStartMilliTS;
/**
* The process identifier of the running process.
*/
-RTPROCESS g_ProcessSelf = NIL_RTPROCESS;
+DECLHIDDEN(RTPROCESS) g_ProcessSelf = NIL_RTPROCESS;
/**
* The current process priority.
*/
-RTPROCPRIORITY g_enmProcessPriority = RTPROCPRIORITY_DEFAULT;
+DECLHIDDEN(RTPROCPRIORITY) g_enmProcessPriority = RTPROCPRIORITY_DEFAULT;
+
+/**
+ * Set if the atexit callback has been called, i.e. indicating
+ * that the process is terminating.
+ */
+DECLHIDDEN(bool volatile) g_frtAtExitCalled = false;
#ifdef IPRT_WITH_ALIGNMENT_CHECKS
/**
@@ -130,6 +136,8 @@ RTDATADECL(bool) g_fRTAlignmentChecks = false;
*/
static void rtR3ExitCallback(void)
{
+ ASMAtomicWriteBool(&g_frtAtExitCalled, true);
+
if (g_cUsers > 0)
{
PRTLOGGER pLogger = RTLogGetDefaultInstance();
diff --git a/src/VBox/Runtime/r3/isofs.cpp b/src/VBox/Runtime/r3/isofs.cpp
index eca523d26..f783cc674 100644
--- a/src/VBox/Runtime/r3/isofs.cpp
+++ b/src/VBox/Runtime/r3/isofs.cpp
@@ -1,4 +1,4 @@
-/* $Id: isofs.cpp $ */
+/* $Id: isofs.cpp 34406 2010-11-26 16:45:34Z vboxsync $ */
/** @file
* IPRT - ISO 9660 file system handling.
*/
diff --git a/src/VBox/Runtime/r3/linux/RTProcIsRunningByName-linux.cpp b/src/VBox/Runtime/r3/linux/RTProcIsRunningByName-linux.cpp
index 5582cef91..065856c2e 100644
--- a/src/VBox/Runtime/r3/linux/RTProcIsRunningByName-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/RTProcIsRunningByName-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTProcIsRunningByName-linux.cpp $ */
+/* $Id: RTProcIsRunningByName-linux.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTProcIsRunningByName, Linux implementation.
*/
diff --git a/src/VBox/Runtime/r3/linux/RTSystemQueryDmiString-linux.cpp b/src/VBox/Runtime/r3/linux/RTSystemQueryDmiString-linux.cpp
index 056a6ade3..91cfbcd66 100644
--- a/src/VBox/Runtime/r3/linux/RTSystemQueryDmiString-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/RTSystemQueryDmiString-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSystemQueryDmiString-linux.cpp $ */
+/* $Id: RTSystemQueryDmiString-linux.cpp 29642 2010-05-18 14:44:56Z vboxsync $ */
/** @file
* IPRT - RTSystemQueryDmiString, linux ring-3.
*/
diff --git a/src/VBox/Runtime/r3/linux/RTThreadGetNativeState-linux.cpp b/src/VBox/Runtime/r3/linux/RTThreadGetNativeState-linux.cpp
index 2a7c13964..ff65d2575 100644
--- a/src/VBox/Runtime/r3/linux/RTThreadGetNativeState-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/RTThreadGetNativeState-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTThreadGetNativeState-linux.cpp $ */
+/* $Id: RTThreadGetNativeState-linux.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTThreadGetNativeState, linux implementation.
*/
diff --git a/src/VBox/Runtime/r3/linux/fileaio-linux.cpp b/src/VBox/Runtime/r3/linux/fileaio-linux.cpp
index d7e0da480..4a268633e 100644
--- a/src/VBox/Runtime/r3/linux/fileaio-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/fileaio-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: fileaio-linux.cpp $ */
+/* $Id: fileaio-linux.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - File async I/O, native implementation for the Linux host platform.
*/
@@ -104,7 +104,7 @@ typedef struct LNXKAIOIOCB
/** Request priority. */
int16_t i16Priority;
/** The file descriptor. */
- uint32_t File;
+ uint32_t uFileDesc;
/** The userspace pointer to the buffer containing/receiving the data. */
void *pvBuf;
#ifdef RT_ARCH_X86
@@ -378,7 +378,7 @@ DECLINLINE(int) rtFileAioReqPrepareTransfer(RTFILEAIOREQ hReq, RTFILE hFile,
* Setup the control block and clear the finished flag.
*/
pReqInt->AioCB.u16IoOpCode = uTransferDirection;
- pReqInt->AioCB.File = (uint32_t)hFile;
+ pReqInt->AioCB.uFileDesc = RTFileToNative(hFile);
pReqInt->AioCB.off = off;
pReqInt->AioCB.cbTransfer = cbTransfer;
pReqInt->AioCB.pvBuf = pvBuf;
diff --git a/src/VBox/Runtime/r3/linux/mp-linux.cpp b/src/VBox/Runtime/r3/linux/mp-linux.cpp
index 54304abad..fa7001a7c 100644
--- a/src/VBox/Runtime/r3/linux/mp-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/mp-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: mp-linux.cpp $ */
+/* $Id: mp-linux.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Linux.
*/
diff --git a/src/VBox/Runtime/r3/linux/rtProcInitExePath-linux.cpp b/src/VBox/Runtime/r3/linux/rtProcInitExePath-linux.cpp
index 3ab0860b0..50a12f24f 100644
--- a/src/VBox/Runtime/r3/linux/rtProcInitExePath-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/rtProcInitExePath-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: rtProcInitExePath-linux.cpp $ */
+/* $Id: rtProcInitExePath-linux.cpp 28929 2010-04-30 11:26:46Z vboxsync $ */
/** @file
* IPRT - rtProcInitName, Linux.
*/
diff --git a/src/VBox/Runtime/r3/linux/sched-linux.cpp b/src/VBox/Runtime/r3/linux/sched-linux.cpp
index b1d19093c..824f79759 100644
--- a/src/VBox/Runtime/r3/linux/sched-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/sched-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: sched-linux.cpp $ */
+/* $Id: sched-linux.cpp 36912 2011-05-02 14:23:01Z vboxsync $ */
/** @file
* IPRT - Scheduling, POSIX.
*/
@@ -467,7 +467,7 @@ static void *rtSchedNativeProberThread(void *pvUser)
* @returns iprt status code.
* @param enmType The thread type to be assumed for the current thread.
*/
-int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
{
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
@@ -548,7 +548,7 @@ static void *rtSchedNativeValidatorThread(void *pvUser)
* @returns iprt status code.
* @param enmPriority The priority to validate and set.
*/
-int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
+DECLHIDDEN(int) rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
{
Assert(enmPriority > RTPROCPRIORITY_INVALID && enmPriority < RTPROCPRIORITY_LAST);
@@ -599,7 +599,7 @@ int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
* @param pThread The thread in question.
* @param enmType The thread type.
*/
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
/* sanity */
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
diff --git a/src/VBox/Runtime/r3/linux/semevent-linux.cpp b/src/VBox/Runtime/r3/linux/semevent-linux.cpp
index 9982d3e83..a35020fc3 100644
--- a/src/VBox/Runtime/r3/linux/semevent-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/semevent-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: semevent-linux.cpp $ */
+/* $Id: semevent-linux.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Event Semaphore, Linux (2.6.x+).
*/
diff --git a/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp b/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp
index c98f4ab26..ac74d4780 100644
--- a/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: semeventmulti-linux.cpp $ */
+/* $Id: semeventmulti-linux.cpp 37211 2011-05-25 11:37:52Z vboxsync $ */
/** @file
* IPRT - Multiple Release Event Semaphore, Linux (2.6.x+).
*/
@@ -174,7 +174,7 @@ RTDECL(int) RTSemEventMultiDestroy(RTSEMEVENTMULTI hEventMultiSem)
/*
* Invalidate the semaphore and wake up anyone waiting on it.
*/
- ASMAtomicWriteSize(&pThis->u32Magic, RTSEMEVENTMULTI_MAGIC + 1);
+ ASMAtomicWriteU32(&pThis->u32Magic, RTSEMEVENTMULTI_MAGIC + 1);
if (ASMAtomicXchgS32(&pThis->iState, -1) == 1)
{
sys_futex(&pThis->iState, FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
diff --git a/src/VBox/Runtime/r3/linux/semmutex-linux.cpp b/src/VBox/Runtime/r3/linux/semmutex-linux.cpp
index 1be76f4e7..16a28270f 100644
--- a/src/VBox/Runtime/r3/linux/semmutex-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/semmutex-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: semmutex-linux.cpp $ */
+/* $Id: semmutex-linux.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Mutex Semaphore, Linux (2.6.x+).
*/
diff --git a/src/VBox/Runtime/r3/linux/sysfs.cpp b/src/VBox/Runtime/r3/linux/sysfs.cpp
index aa1060ac3..49bba0e5a 100644
--- a/src/VBox/Runtime/r3/linux/sysfs.cpp
+++ b/src/VBox/Runtime/r3/linux/sysfs.cpp
@@ -1,4 +1,4 @@
-/* $Id: sysfs.cpp $ */
+/* $Id: sysfs.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Linux sysfs access.
*/
diff --git a/src/VBox/Runtime/r3/linux/thread-affinity-linux.cpp b/src/VBox/Runtime/r3/linux/thread-affinity-linux.cpp
new file mode 100644
index 000000000..1cbefafc6
--- /dev/null
+++ b/src/VBox/Runtime/r3/linux/thread-affinity-linux.cpp
@@ -0,0 +1,95 @@
+/* $Id: thread-affinity-linux.cpp 37170 2011-05-20 17:15:07Z vboxsync $ */
+/** @file
+ * IPRT - Thread Affinity, Linux ring-3 implementation.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+#include <features.h>
+#if __GLIBC_PREREQ(2,4)
+
+#include <sched.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+
+#include <iprt/thread.h>
+#include "internal/iprt.h"
+
+#include <iprt/assert.h>
+#include <iprt/cpuset.h>
+#include <iprt/err.h>
+#include <iprt/mp.h>
+
+
+
+RTR3DECL(int) RTThreadSetAffinity(PCRTCPUSET pCpuSet)
+{
+ /* convert */
+ cpu_set_t LnxCpuSet;
+ CPU_ZERO(&LnxCpuSet);
+ if (!pCpuSet)
+ for (unsigned iCpu = 0; iCpu < CPU_SETSIZE; iCpu++)
+ CPU_SET(iCpu, &LnxCpuSet);
+ else
+ for (unsigned iCpu = 0; iCpu < RT_MIN(CPU_SETSIZE, RTCPUSET_MAX_CPUS); iCpu++)
+ if (RTCpuSetIsMemberByIndex(pCpuSet, iCpu))
+ CPU_SET(iCpu, &LnxCpuSet);
+
+ int rc = pthread_setaffinity_np(pthread_self(), sizeof(LnxCpuSet), &LnxCpuSet);
+ if (!rc)
+ return VINF_SUCCESS;
+ rc = errno;
+ if (rc == ENOENT)
+ return VERR_CPU_NOT_FOUND;
+ return RTErrConvertFromErrno(errno);
+}
+
+
+RTR3DECL(int) RTThreadGetAffinity(PRTCPUSET pCpuSet)
+{
+ cpu_set_t LnxCpuSet;
+ int rc = pthread_getaffinity_np(pthread_self(), sizeof(LnxCpuSet), &LnxCpuSet);
+ if (rc != 0)
+ return RTErrConvertFromErrno(errno);
+
+ /* convert */
+ RTCpuSetEmpty(pCpuSet);
+ for (unsigned iCpu = 0; iCpu < RT_MIN(CPU_SETSIZE, RTCPUSET_MAX_CPUS); iCpu++)
+ if (CPU_ISSET(iCpu, &LnxCpuSet))
+ RTCpuSetAddByIndex(pCpuSet, iCpu);
+
+ return VINF_SUCCESS;
+}
+
+#else
+# include "../../generic/RTThreadGetAffinity-stub-generic.cpp"
+# include "../../generic/RTThreadSetAffinity-stub-generic.cpp"
+#endif
+
diff --git a/src/VBox/Runtime/r3/linux/time-linux.cpp b/src/VBox/Runtime/r3/linux/time-linux.cpp
index a9de927e7..b9be9e532 100644
--- a/src/VBox/Runtime/r3/linux/time-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/time-linux.cpp
@@ -1,4 +1,4 @@
-/* $Id: time-linux.cpp $ */
+/* $Id: time-linux.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Time, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/os2/filelock-os2.cpp b/src/VBox/Runtime/r3/os2/filelock-os2.cpp
index 734bb1807..c6317f43b 100644
--- a/src/VBox/Runtime/r3/os2/filelock-os2.cpp
+++ b/src/VBox/Runtime/r3/os2/filelock-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: filelock-os2.cpp $ */
+/* $Id: filelock-os2.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - File Locking, OS/2.
*/
diff --git a/src/VBox/Runtime/r3/os2/mp-os2.cpp b/src/VBox/Runtime/r3/os2/mp-os2.cpp
index 00260ca01..ea4b14cc9 100644
--- a/src/VBox/Runtime/r3/os2/mp-os2.cpp
+++ b/src/VBox/Runtime/r3/os2/mp-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: mp-os2.cpp $ */
+/* $Id: mp-os2.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, OS/2.
*/
diff --git a/src/VBox/Runtime/r3/os2/pipe-os2.cpp b/src/VBox/Runtime/r3/os2/pipe-os2.cpp
index b3fbecf1d..b84b3226d 100644
--- a/src/VBox/Runtime/r3/os2/pipe-os2.cpp
+++ b/src/VBox/Runtime/r3/os2/pipe-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: pipe-os2.cpp $ */
+/* $Id: pipe-os2.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Anonymous Pipes, OS/2 Implementation.
*/
diff --git a/src/VBox/Runtime/r3/os2/poll-os2.cpp b/src/VBox/Runtime/r3/os2/poll-os2.cpp
index 890cdc8cd..988cad5d8 100644
--- a/src/VBox/Runtime/r3/os2/poll-os2.cpp
+++ b/src/VBox/Runtime/r3/os2/poll-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: poll-os2.cpp $ */
+/* $Id: poll-os2.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Polling I/O Handles, OS/2 Implementation.
*/
diff --git a/src/VBox/Runtime/r3/os2/rtProcInitExePath-os2.cpp b/src/VBox/Runtime/r3/os2/rtProcInitExePath-os2.cpp
index 26ee5b49f..a991619e7 100644
--- a/src/VBox/Runtime/r3/os2/rtProcInitExePath-os2.cpp
+++ b/src/VBox/Runtime/r3/os2/rtProcInitExePath-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: rtProcInitExePath-os2.cpp $ */
+/* $Id: rtProcInitExePath-os2.cpp 28929 2010-04-30 11:26:46Z vboxsync $ */
/** @file
* IPRT - rtProcInitName, OS/2.
*/
diff --git a/src/VBox/Runtime/r3/os2/sched-os2.cpp b/src/VBox/Runtime/r3/os2/sched-os2.cpp
index 60bd3b83e..b38b5bb42 100644
--- a/src/VBox/Runtime/r3/os2/sched-os2.cpp
+++ b/src/VBox/Runtime/r3/os2/sched-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: sched-os2.cpp $ */
+/* $Id: sched-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Scheduling, OS/2
*/
@@ -189,7 +189,7 @@ static const PROCPRIORITY *g_pProcessPriority = &g_aDefaultPriority;
* @returns iprt status code.
* @param enmType The thread type to be assumed for the current thread.
*/
-int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
{
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
return VINF_SUCCESS;
@@ -205,7 +205,7 @@ int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
* @param enmPriority The priority to validate and set.
* @remark Located in sched.
*/
-int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
+DECLHIDDEN(int) rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
{
Assert(enmPriority > RTPROCPRIORITY_INVALID && enmPriority < RTPROCPRIORITY_LAST);
return VINF_SUCCESS;
@@ -224,7 +224,7 @@ int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
* @param enmType The thread type.
* @remark Located in sched.
*/
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
AssertMsg(g_pProcessPriority && g_pProcessPriority->aTypes[enmType].enmType == enmType,
diff --git a/src/VBox/Runtime/r3/os2/sems-os2.cpp b/src/VBox/Runtime/r3/os2/sems-os2.cpp
index 09042b79e..e41511b99 100644
--- a/src/VBox/Runtime/r3/os2/sems-os2.cpp
+++ b/src/VBox/Runtime/r3/os2/sems-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: sems-os2.cpp $ */
+/* $Id: sems-os2.cpp 33393 2010-10-24 16:17:00Z vboxsync $ */
/** @file
* IPRT - Semaphores, OS/2.
*/
diff --git a/src/VBox/Runtime/r3/os2/thread-os2.cpp b/src/VBox/Runtime/r3/os2/thread-os2.cpp
index 76c30288c..8b85f4324 100644
--- a/src/VBox/Runtime/r3/os2/thread-os2.cpp
+++ b/src/VBox/Runtime/r3/os2/thread-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: thread-os2.cpp $ */
+/* $Id: thread-os2.cpp 37154 2011-05-19 12:54:32Z vboxsync $ */
/** @file
* IPRT - Threads, OS/2.
*/
@@ -63,7 +63,7 @@ static PRTTHREADINT *g_ppCurThread;
static void rtThreadNativeMain(void *pvArgs);
-int rtThreadNativeInit(void)
+DECLHIDDEN(int) rtThreadNativeInit(void)
{
/*
* Allocate thread local memory.
@@ -77,7 +77,7 @@ int rtThreadNativeInit(void)
}
-int rtThreadNativeAdopt(PRTTHREADINT pThread)
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
{
/*
* Block SIGALRM - required for timer-posix.cpp.
@@ -94,7 +94,7 @@ int rtThreadNativeAdopt(PRTTHREADINT pThread)
}
-void rtThreadNativeDestroy(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
{
if (pThread == *g_ppCurThread)
*g_ppCurThread = NULL;
@@ -133,7 +133,7 @@ static void rtThreadNativeMain(void *pvArgs)
}
-int rtThreadNativeCreate(PRTTHREADINT pThread, PRTNATIVETHREAD pNativeThread)
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThread, PRTNATIVETHREAD pNativeThread)
{
/*
* Default stack size.
@@ -198,7 +198,12 @@ RTDECL(bool) RTThreadYield(void)
}
-RTDECL(uint64_t) RTThreadGetAffinity(void)
+RTR3DECL(int) RTThreadGetAffinity(PRTCPUSET pCpuSet)
+{
+ return VINF_SUCCESS;
+}
+
+RTR3DECL(int) RTThreadGetAffinity(PRTCPUSET pCpuSet)
{
union
{
@@ -206,21 +211,24 @@ RTDECL(uint64_t) RTThreadGetAffinity(void)
MPAFFINITY mpaff;
} u;
- int rc = DosQueryThreadAffinity(AFNTY_THREAD, &u.mpaff);
- if (rc)
- u.u64 = 1;
- return u.u64;
+ APIRET rc = DosQueryThreadAffinity(AFNTY_THREAD, &u.mpaff);
+ if (!rc)
+ {
+ RTCpuSetFromU64(pCpuSet, u.u64);
+ return VINF_SUCCESS;
+ }
+ return RTErrConvertFromOS2(rc);
}
-RTDECL(int) RTThreadSetAffinity(uint64_t u64Mask)
+RTR3DECL(int) RTThreadSetAffinity(PCRTCPUSET pCpuSet)
{
union
{
uint64_t u64;
MPAFFINITY mpaff;
} u;
- u.u64 = u64Mask;
+ u.u64 = pCpuSet ? RTCpuSetToU64(pCpuSet) : UINT64_MAX;
int rc = DosSetThreadAffinity(&u.mpaff);
if (!rc)
return VINF_SUCCESS;
diff --git a/src/VBox/Runtime/r3/os2/time-os2.cpp b/src/VBox/Runtime/r3/os2/time-os2.cpp
index 13fcad048..d39e1fc24 100644
--- a/src/VBox/Runtime/r3/os2/time-os2.cpp
+++ b/src/VBox/Runtime/r3/os2/time-os2.cpp
@@ -1,4 +1,4 @@
-/* $Id: time-os2.cpp $ */
+/* $Id: time-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */
/** @file
* IPRT - Time, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/path.cpp b/src/VBox/Runtime/r3/path.cpp
index 591f0556d..28661291e 100644
--- a/src/VBox/Runtime/r3/path.cpp
+++ b/src/VBox/Runtime/r3/path.cpp
@@ -1,4 +1,4 @@
-/* $Id: path.cpp $ */
+/* $Id: path.cpp 35225 2010-12-17 13:54:46Z vboxsync $ */
/** @file
* IPRT - Path Manipulation.
*/
diff --git a/src/VBox/Runtime/r3/posix/RTFileQueryFsSizes-posix.cpp b/src/VBox/Runtime/r3/posix/RTFileQueryFsSizes-posix.cpp
index d87bb4e0a..8d8b92f7d 100644
--- a/src/VBox/Runtime/r3/posix/RTFileQueryFsSizes-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/RTFileQueryFsSizes-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTFileQueryFsSizes-posix.cpp $ */
+/* $Id: RTFileQueryFsSizes-posix.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - File I/O, RTFileFsQuerySizes, POSIX.
*/
@@ -47,7 +47,7 @@ RTR3DECL(int) RTFileQueryFsSizes(RTFILE hFile, PRTFOFF pcbTotal, RTFOFF *pcbFree
{
struct statvfs StatVFS;
RT_ZERO(StatVFS);
- if (fstatvfs(hFile, &StatVFS))
+ if (fstatvfs(RTFileToNative(hFile), &StatVFS))
return RTErrConvertFromErrno(errno);
/*
diff --git a/src/VBox/Runtime/r3/posix/RTHandleGetStandard-posix.cpp b/src/VBox/Runtime/r3/posix/RTHandleGetStandard-posix.cpp
index aa12323b4..31bc53409 100644
--- a/src/VBox/Runtime/r3/posix/RTHandleGetStandard-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/RTHandleGetStandard-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTHandleGetStandard-posix.cpp $ */
+/* $Id: RTHandleGetStandard-posix.cpp 33973 2010-11-11 11:10:10Z vboxsync $ */
/** @file
* IPRT - RTHandleGetStandard, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/RTMemProtect-posix.cpp b/src/VBox/Runtime/r3/posix/RTMemProtect-posix.cpp
index 87055143d..7ea5a44d0 100644
--- a/src/VBox/Runtime/r3/posix/RTMemProtect-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/RTMemProtect-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMemProtect-posix.cpp $ */
+/* $Id: RTMemProtect-posix.cpp 33269 2010-10-20 15:42:28Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/RTMpGetCount-posix.cpp b/src/VBox/Runtime/r3/posix/RTMpGetCount-posix.cpp
index 4e2e116dd..740e437b5 100644
--- a/src/VBox/Runtime/r3/posix/RTMpGetCount-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/RTMpGetCount-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTMpGetCount-posix.cpp $ */
+/* $Id: RTMpGetCount-posix.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTMpGetCount, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/RTPathUserDocuments-posix.cpp b/src/VBox/Runtime/r3/posix/RTPathUserDocuments-posix.cpp
new file mode 100644
index 000000000..d048e3f99
--- /dev/null
+++ b/src/VBox/Runtime/r3/posix/RTPathUserDocuments-posix.cpp
@@ -0,0 +1,52 @@
+/* $Id: RTPathUserDocuments-posix.cpp 36611 2011-04-07 10:35:29Z vboxsync $ */
+/** @file
+ * IPRT - RTPathUserDocuments, posix ring-3.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/path.h>
+#include <iprt/err.h>
+#include <iprt/assert.h>
+
+RTDECL(int) RTPathUserDocuments(char *pszPath, size_t cchPath)
+{
+ /*
+ * Validate input
+ */
+ AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
+ AssertReturn(cchPath, VERR_INVALID_PARAMETER);
+
+ int rc = RTPathUserHome(pszPath, cchPath);
+ if (RT_FAILURE(rc))
+ return rc;
+
+ rc = RTPathAppend(pszPath, cchPath, "Documents");
+ if (RT_FAILURE(rc))
+ *pszPath = '\0';
+
+ return rc;
+}
+
diff --git a/src/VBox/Runtime/r3/posix/RTPathUserHome-posix.cpp b/src/VBox/Runtime/r3/posix/RTPathUserHome-posix.cpp
index d39fd6c6b..8111dd987 100644
--- a/src/VBox/Runtime/r3/posix/RTPathUserHome-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/RTPathUserHome-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTPathUserHome-posix.cpp $ */
+/* $Id: RTPathUserHome-posix.cpp 33602 2010-10-29 12:39:54Z vboxsync $ */
/** @file
* IPRT - Path Manipulation, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/RTSystemQueryOSInfo-posix.cpp b/src/VBox/Runtime/r3/posix/RTSystemQueryOSInfo-posix.cpp
index b37d921e0..8e17a976a 100644
--- a/src/VBox/Runtime/r3/posix/RTSystemQueryOSInfo-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/RTSystemQueryOSInfo-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSystemQueryOSInfo-posix.cpp $ */
+/* $Id: RTSystemQueryOSInfo-posix.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTSystemQueryOSInfo, POSIX implementation.
*/
diff --git a/src/VBox/Runtime/r3/posix/RTSystemQueryTotalRam-posix.cpp b/src/VBox/Runtime/r3/posix/RTSystemQueryTotalRam-posix.cpp
index a75d2d54d..a52065855 100644
--- a/src/VBox/Runtime/r3/posix/RTSystemQueryTotalRam-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/RTSystemQueryTotalRam-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSystemQueryTotalRam-posix.cpp $ */
+/* $Id: RTSystemQueryTotalRam-posix.cpp 33503 2010-10-27 13:12:57Z vboxsync $ */
/** @file
* IPRT - RTSystemQueryTotalRam, windows ring-3.
*/
diff --git a/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp b/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp
index 96915feac..43f628271 100644
--- a/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/RTTimeNow-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTTimeNow-posix.cpp $ */
+/* $Id: RTTimeNow-posix.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTTimeNow, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/RTTimeSet-posix.cpp b/src/VBox/Runtime/r3/posix/RTTimeSet-posix.cpp
index 3bebb9ac4..32a09a975 100644
--- a/src/VBox/Runtime/r3/posix/RTTimeSet-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/RTTimeSet-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTTimeSet-posix.cpp $ */
+/* $Id: RTTimeSet-posix.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTTimeSet, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/dir-posix.cpp b/src/VBox/Runtime/r3/posix/dir-posix.cpp
index 52a839099..17c67c025 100644
--- a/src/VBox/Runtime/r3/posix/dir-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/dir-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: dir-posix.cpp $ */
+/* $Id: dir-posix.cpp 36167 2011-03-04 12:33:39Z vboxsync $ */
/** @file
* IPRT - Directory manipulation, POSIX.
*/
@@ -90,6 +90,7 @@ RTDECL(int) RTDirCreate(const char *pszPath, RTFMODE fMode)
if (mkdir(pszNativePath, fMode & RTFS_UNIX_MASK))
{
rc = errno;
+ bool fVerifyIsDir = true;
#ifdef RT_OS_SOLARIS
/*
* mkdir on nfs mount points has been/is busted in various
@@ -100,12 +101,31 @@ RTDECL(int) RTDirCreate(const char *pszPath, RTFMODE fMode)
if ( rc == ENOSYS
|| rc == EACCES)
{
+ rc = RTErrConvertFromErrno(rc);
+ fVerifyIsDir = false; /* We'll check if it's a dir ourselves since we're going to stat() anyway. */
struct stat st;
if (!stat(pszNativePath, &st))
- rc = EEXIST;
+ {
+ rc = VERR_ALREADY_EXISTS;
+ if (!S_ISDIR(st.st_mode))
+ rc = VERR_IS_A_FILE;
+ }
}
-#endif
+ else
+ rc = RTErrConvertFromErrno(rc);
+#else
rc = RTErrConvertFromErrno(rc);
+#endif
+ if ( rc == VERR_ALREADY_EXISTS
+ && fVerifyIsDir == true)
+ {
+ /*
+ * Verify that it really exists as a directory.
+ */
+ struct stat st;
+ if (!stat(pszNativePath, &st) && !S_ISDIR(st.st_mode))
+ rc = VERR_IS_A_FILE;
+ }
}
}
@@ -253,7 +273,10 @@ static int rtDirReadMore(PRTDIR pDir)
if (rc)
{
rc = RTErrConvertFromErrno(rc);
- AssertRC(rc);
+ /** @todo Consider translating ENOENT (The current
+ * position of the directory stream is invalid)
+ * differently. */
+ AssertMsg(rc == VERR_FILE_NOT_FOUND, ("%Rrc\n", rc));
return rc;
}
if (!pResult)
diff --git a/src/VBox/Runtime/r3/posix/env-posix.cpp b/src/VBox/Runtime/r3/posix/env-posix.cpp
index 3134d7644..fe30150b5 100644
--- a/src/VBox/Runtime/r3/posix/env-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/env-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: env-posix.cpp $ */
+/* $Id: env-posix.cpp 33464 2010-10-26 12:27:50Z vboxsync $ */
/** @file
* IPRT - Environment, Posix.
*/
diff --git a/src/VBox/Runtime/r3/posix/errvars-posix.cpp b/src/VBox/Runtime/r3/posix/errvars-posix.cpp
new file mode 100644
index 000000000..aa2a2b273
--- /dev/null
+++ b/src/VBox/Runtime/r3/posix/errvars-posix.cpp
@@ -0,0 +1,78 @@
+/* $Id: errvars-posix.cpp 37233 2011-05-27 13:31:57Z vboxsync $ */
+/** @file
+ * IPRT - Save and Restore Error Variables, POSIX Ring-3.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <netdb.h>
+#include <errno.h>
+
+#include <iprt/err.h>
+#include "internal/iprt.h"
+
+#include <iprt/assert.h>
+#include "internal/magics.h"
+
+
+
+RTDECL(PRTERRVARS) RTErrVarsSave(PRTERRVARS pVars)
+{
+ pVars->ai32Vars[0] = RTERRVARS_MAGIC;
+ pVars->ai32Vars[1] = errno;
+ pVars->ai32Vars[2] = h_errno;
+ return pVars;
+}
+
+
+RTDECL(void) RTErrVarsRestore(PCRTERRVARS pVars)
+{
+ AssertReturnVoid(pVars->ai32Vars[0] == RTERRVARS_MAGIC);
+ h_errno = pVars->ai32Vars[2];
+ errno = pVars->ai32Vars[1];
+}
+
+
+RTDECL(bool) RTErrVarsAreEqual(PCRTERRVARS pVars1, PCRTERRVARS pVars2)
+{
+ Assert(pVars1->ai32Vars[0] == RTERRVARS_MAGIC);
+ Assert(pVars2->ai32Vars[0] == RTERRVARS_MAGIC);
+
+ return pVars1->ai32Vars[0] == pVars2->ai32Vars[0]
+ && pVars1->ai32Vars[1] == pVars2->ai32Vars[1]
+ && pVars1->ai32Vars[2] == pVars2->ai32Vars[2];
+}
+
+
+RTDECL(bool) RTErrVarsHaveChanged(PCRTERRVARS pVars)
+{
+ Assert(pVars->ai32Vars[0] == RTERRVARS_MAGIC);
+
+ return pVars->ai32Vars[0] != RTERRVARS_MAGIC
+ || pVars->ai32Vars[1] != errno
+ || pVars->ai32Vars[2] != h_errno;
+}
+
diff --git a/src/VBox/Runtime/r3/posix/fileaio-posix.cpp b/src/VBox/Runtime/r3/posix/fileaio-posix.cpp
index 9628da115..d4302f1a5 100644
--- a/src/VBox/Runtime/r3/posix/fileaio-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/fileaio-posix.cpp
@@ -1,10 +1,10 @@
-/* $Id: fileaio-posix.cpp $ */
+/* $Id: fileaio-posix.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - File async I/O, native implementation for POSIX compliant host platforms.
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -406,7 +406,7 @@ DECLINLINE(int) rtFileAioReqPrepareTransfer(RTFILEAIOREQ hReq, RTFILE hFile,
memset(&pReqInt->AioCB, 0, sizeof(struct aiocb));
pReqInt->fFlush = false;
pReqInt->AioCB.aio_lio_opcode = uTransferDirection;
- pReqInt->AioCB.aio_fildes = (int)hFile;
+ pReqInt->AioCB.aio_fildes = RTFileToNative(hFile);
pReqInt->AioCB.aio_offset = off;
pReqInt->AioCB.aio_nbytes = cbTransfer;
pReqInt->AioCB.aio_buf = pvBuf;
@@ -444,7 +444,7 @@ RTDECL(int) RTFileAioReqPrepareFlush(RTFILEAIOREQ hReq, RTFILE hFile, void *pvUs
Assert(hFile != NIL_RTFILE);
pReqInt->fFlush = true;
- pReqInt->AioCB.aio_fildes = (int)hFile;
+ pReqInt->AioCB.aio_fildes = RTFileToNative(hFile);
pReqInt->AioCB.aio_offset = 0;
pReqInt->AioCB.aio_nbytes = 0;
pReqInt->AioCB.aio_buf = NULL;
diff --git a/src/VBox/Runtime/r3/posix/fileio-posix.cpp b/src/VBox/Runtime/r3/posix/fileio-posix.cpp
index 3f0a37cfe..83ac8ab06 100644
--- a/src/VBox/Runtime/r3/posix/fileio-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/fileio-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: fileio-posix.cpp $ */
+/* $Id: fileio-posix.cpp 37679 2011-06-29 08:24:44Z vboxsync $ */
/** @file
* IPRT - File I/O, POSIX, Part 1.
*/
@@ -92,7 +92,7 @@ RTDECL(bool) RTFileExists(const char *pszPath)
}
-RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
+RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint64_t fOpen)
{
/*
* Validate input.
@@ -110,7 +110,7 @@ RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
#ifndef O_NONBLOCK
if (fOpen & RTFILE_O_NON_BLOCK)
{
- AssertMsgFailed(("Invalid parameters! fOpen=%#x\n", fOpen));
+ AssertMsgFailed(("Invalid parameters! fOpen=%#llx\n", fOpen));
return VERR_INVALID_PARAMETER;
}
#endif
@@ -176,7 +176,7 @@ RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
fOpenMode |= fOpen & RTFILE_O_APPEND ? O_APPEND | O_RDWR : O_RDWR;
break;
default:
- AssertMsgFailed(("RTFileOpen received an invalid RW value, fOpen=%#x\n", fOpen));
+ AssertMsgFailed(("RTFileOpen received an invalid RW value, fOpen=%#llx\n", fOpen));
return VERR_INVALID_PARAMETER;
}
@@ -321,9 +321,9 @@ RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
*/
if (iErr == 0)
{
- *pFile = (RTFILE)fh;
- Assert((int)*pFile == fh);
- LogFlow(("RTFileOpen(%p:{%RTfile}, %p:{%s}, %#x): returns %Rrc\n",
+ *pFile = (RTFILE)(uintptr_t)fh;
+ Assert((intptr_t)*pFile == fh);
+ LogFlow(("RTFileOpen(%p:{%RTfile}, %p:{%s}, %#llx): returns %Rrc\n",
pFile, *pFile, pszFilename, pszFilename, fOpen, rc));
return VINF_SUCCESS;
}
@@ -334,7 +334,7 @@ RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
}
-RTR3DECL(int) RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess)
+RTR3DECL(int) RTFileOpenBitBucket(PRTFILE phFile, uint64_t fAccess)
{
AssertReturn( fAccess == RTFILE_O_READ
|| fAccess == RTFILE_O_WRITE
@@ -344,11 +344,11 @@ RTR3DECL(int) RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess)
}
-RTR3DECL(int) RTFileClose(RTFILE File)
+RTR3DECL(int) RTFileClose(RTFILE hFile)
{
- if (File == NIL_RTFILE)
+ if (hFile == NIL_RTFILE)
return VINF_SUCCESS;
- if (close((int)File) == 0)
+ if (close(RTFileToNative(hFile)) == 0)
return VINF_SUCCESS;
return RTErrConvertFromErrno(errno);
}
@@ -356,8 +356,8 @@ RTR3DECL(int) RTFileClose(RTFILE File)
RTR3DECL(int) RTFileFromNative(PRTFILE pFile, RTHCINTPTR uNative)
{
- if ( uNative < 0
- || (RTFILE)uNative != (RTUINTPTR)uNative)
+ AssertCompile(sizeof(uNative) == sizeof(*pFile));
+ if (uNative < 0)
{
AssertMsgFailed(("%p\n", uNative));
*pFile = NIL_RTFILE;
@@ -368,10 +368,31 @@ RTR3DECL(int) RTFileFromNative(PRTFILE pFile, RTHCINTPTR uNative)
}
-RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE File)
+RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE hFile)
{
- AssertReturn(File != NIL_RTFILE, -1);
- return (RTHCINTPTR)File;
+ AssertReturn(hFile != NIL_RTFILE, -1);
+ return (intptr_t)hFile;
+}
+
+
+RTFILE rtFileGetStandard(RTHANDLESTD enmStdHandle)
+{
+ int fd;
+ switch (enmStdHandle)
+ {
+ case RTHANDLESTD_INPUT: fd = 0; break;
+ case RTHANDLESTD_OUTPUT: fd = 1; break;
+ case RTHANDLESTD_ERROR: fd = 2; break;
+ break;
+ default:
+ AssertFailedReturn(NIL_RTFILE);
+ }
+
+ struct stat st;
+ int rc = fstat(fd, &st);
+ if (rc == -1)
+ return NIL_RTFILE;
+ return (RTFILE)(intptr_t)fd;
}
@@ -389,7 +410,7 @@ RTR3DECL(int) RTFileDelete(const char *pszFilename)
}
-RTR3DECL(int) RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64_t *poffActual)
+RTR3DECL(int) RTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod, uint64_t *poffActual)
{
static const unsigned aSeekRecode[] =
{
@@ -416,7 +437,7 @@ RTR3DECL(int) RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64
return VERR_NOT_SUPPORTED;
}
- off_t offCurrent = lseek((int)File, (off_t)offSeek, aSeekRecode[uMethod]);
+ off_t offCurrent = lseek(RTFileToNative(hFile), (off_t)offSeek, aSeekRecode[uMethod]);
if (offCurrent != ~0)
{
if (poffActual)
@@ -427,7 +448,7 @@ RTR3DECL(int) RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64
}
-RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead)
+RTR3DECL(int) RTFileRead(RTFILE hFile, void *pvBuf, size_t cbToRead, size_t *pcbRead)
{
if (cbToRead <= 0)
return VINF_SUCCESS;
@@ -435,7 +456,7 @@ RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcb
/*
* Attempt read.
*/
- ssize_t cbRead = read((int)File, pvBuf, cbToRead);
+ ssize_t cbRead = read(RTFileToNative(hFile), pvBuf, cbToRead);
if (cbRead >= 0)
{
if (pcbRead)
@@ -446,7 +467,7 @@ RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcb
/* Caller expects all to be read. */
while ((ssize_t)cbToRead > cbRead)
{
- ssize_t cbReadPart = read((int)File, (char*)pvBuf + cbRead, cbToRead - cbRead);
+ ssize_t cbReadPart = read(RTFileToNative(hFile), (char*)pvBuf + cbRead, cbToRead - cbRead);
if (cbReadPart <= 0)
{
if (cbReadPart == 0)
@@ -463,7 +484,7 @@ RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcb
}
-RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
+RTR3DECL(int) RTFileWrite(RTFILE hFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
{
if (cbToWrite <= 0)
return VINF_SUCCESS;
@@ -471,7 +492,7 @@ RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, siz
/*
* Attempt write.
*/
- ssize_t cbWritten = write((int)File, pvBuf, cbToWrite);
+ ssize_t cbWritten = write(RTFileToNative(hFile), pvBuf, cbToWrite);
if (cbWritten >= 0)
{
if (pcbWritten)
@@ -482,7 +503,7 @@ RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, siz
/* Caller expects all to be write. */
while ((ssize_t)cbToWrite > cbWritten)
{
- ssize_t cbWrittenPart = write((int)File, (const char *)pvBuf + cbWritten, cbToWrite - cbWritten);
+ ssize_t cbWrittenPart = write(RTFileToNative(hFile), (const char *)pvBuf + cbWritten, cbToWrite - cbWritten);
if (cbWrittenPart <= 0)
return RTErrConvertFromErrno(errno);
cbWritten += cbWrittenPart;
@@ -494,7 +515,7 @@ RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, siz
}
-RTR3DECL(int) RTFileSetSize(RTFILE File, uint64_t cbSize)
+RTR3DECL(int) RTFileSetSize(RTFILE hFile, uint64_t cbSize)
{
/*
* Validate offset.
@@ -507,23 +528,23 @@ RTR3DECL(int) RTFileSetSize(RTFILE File, uint64_t cbSize)
}
#if defined(_MSC_VER) || (defined(RT_OS_OS2) && (!defined(__INNOTEK_LIBC__) || __INNOTEK_LIBC__ < 0x006))
- if (chsize((int)File, (off_t)cbSize) == 0)
+ if (chsize(RTFileToNative(hFile), (off_t)cbSize) == 0)
#else
/* This relies on a non-standard feature of FreeBSD, Linux, and OS/2
* LIBC v0.6 and higher. (SuS doesn't define ftruncate() and size bigger
* than the file.)
*/
- if (ftruncate((int)File, (off_t)cbSize) == 0)
+ if (ftruncate(RTFileToNative(hFile), (off_t)cbSize) == 0)
#endif
return VINF_SUCCESS;
return RTErrConvertFromErrno(errno);
}
-RTR3DECL(int) RTFileGetSize(RTFILE File, uint64_t *pcbSize)
+RTR3DECL(int) RTFileGetSize(RTFILE hFile, uint64_t *pcbSize)
{
struct stat st;
- if (!fstat((int)File, &st))
+ if (!fstat(RTFileToNative(hFile), &st))
{
*pcbSize = st.st_size;
return VINF_SUCCESS;
@@ -532,21 +553,13 @@ RTR3DECL(int) RTFileGetSize(RTFILE File, uint64_t *pcbSize)
}
-/**
- * Determine the maximum file size.
- *
- * @returns IPRT status code.
- * @param File Handle to the file.
- * @param pcbMax Where to store the max file size.
- * @see RTFileGetMaxSize.
- */
-RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax)
+RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE hFile, PRTFOFF pcbMax)
{
/*
* Save the current location
*/
uint64_t offOld;
- int rc = RTFileSeek(File, 0, RTFILE_SEEK_CURRENT, &offOld);
+ int rc = RTFileSeek(hFile, 0, RTFILE_SEEK_CURRENT, &offOld);
if (RT_FAILURE(rc))
return rc;
@@ -566,10 +579,10 @@ RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax)
{
if (pcbMax)
*pcbMax = offLow;
- return RTFileSeek(File, offOld, RTFILE_SEEK_BEGIN, NULL);
+ return RTFileSeek(hFile, offOld, RTFILE_SEEK_BEGIN, NULL);
}
- rc = RTFileSeek(File, offLow + cbInterval, RTFILE_SEEK_BEGIN, NULL);
+ rc = RTFileSeek(hFile, offLow + cbInterval, RTFILE_SEEK_BEGIN, NULL);
if (RT_FAILURE(rc))
offHigh = offLow + cbInterval;
else
@@ -578,11 +591,11 @@ RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax)
}
-RTR3DECL(bool) RTFileIsValid(RTFILE File)
+RTR3DECL(bool) RTFileIsValid(RTFILE hFile)
{
- if (File != NIL_RTFILE)
+ if (hFile != NIL_RTFILE)
{
- int fFlags = fcntl(File, F_GETFD);
+ int fFlags = fcntl(RTFileToNative(hFile), F_GETFD);
if (fFlags >= 0)
return true;
}
@@ -590,24 +603,24 @@ RTR3DECL(bool) RTFileIsValid(RTFILE File)
}
-RTR3DECL(int) RTFileFlush(RTFILE File)
+RTR3DECL(int) RTFileFlush(RTFILE hFile)
{
- if (fsync((int)File))
+ if (fsync(RTFileToNative(hFile)))
return RTErrConvertFromErrno(errno);
return VINF_SUCCESS;
}
-RTR3DECL(int) RTFileIoCtl(RTFILE File, unsigned long ulRequest, void *pvData, unsigned cbData, int *piRet)
+RTR3DECL(int) RTFileIoCtl(RTFILE hFile, unsigned long ulRequest, void *pvData, unsigned cbData, int *piRet)
{
- int rc = ioctl((int)File, ulRequest, pvData);
+ int rc = ioctl(RTFileToNative(hFile), ulRequest, pvData);
if (piRet)
*piRet = rc;
return rc >= 0 ? VINF_SUCCESS : RTErrConvertFromErrno(errno);
}
-RTR3DECL(int) RTFileSetMode(RTFILE File, RTFMODE fMode)
+RTR3DECL(int) RTFileSetMode(RTFILE hFile, RTFMODE fMode)
{
/*
* Normalize the mode and call the API.
@@ -616,10 +629,10 @@ RTR3DECL(int) RTFileSetMode(RTFILE File, RTFMODE fMode)
if (!rtFsModeIsValid(fMode))
return VERR_INVALID_PARAMETER;
- if (fchmod((int)File, fMode & RTFS_UNIX_MASK))
+ if (fchmod(RTFileToNative(hFile), fMode & RTFS_UNIX_MASK))
{
int rc = RTErrConvertFromErrno(errno);
- Log(("RTFileSetMode(%RTfile,%RTfmode): returns %Rrc\n", File, fMode, rc));
+ Log(("RTFileSetMode(%RTfile,%RTfmode): returns %Rrc\n", hFile, fMode, rc));
return rc;
}
return VINF_SUCCESS;
diff --git a/src/VBox/Runtime/r3/posix/fileio2-posix.cpp b/src/VBox/Runtime/r3/posix/fileio2-posix.cpp
index 5808300b2..6b6dee219 100644
--- a/src/VBox/Runtime/r3/posix/fileio2-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/fileio2-posix.cpp
@@ -1,10 +1,10 @@
-/* $Id: fileio2-posix.cpp $ */
+/* $Id: fileio2-posix.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - File I/O, POSIX, Part 2.
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -68,21 +68,13 @@ extern int futimes(int __fd, __const struct timeval __tvp[2]) __THROW;
-RTR3DECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
+RTR3DECL(int) RTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
{
/*
* Validate input.
*/
- if (File == NIL_RTFILE)
- {
- AssertMsgFailed(("Invalid File=%RTfile\n", File));
- return VERR_INVALID_PARAMETER;
- }
- if (!pObjInfo)
- {
- AssertMsgFailed(("Invalid pObjInfo=%p\n", pObjInfo));
- return VERR_INVALID_PARAMETER;
- }
+ AssertReturn(hFile != NIL_RTFILE, VERR_INVALID_PARAMETER);
+ AssertPtrReturn(pObjInfo, VERR_INVALID_PARAMETER);
if ( enmAdditionalAttribs < RTFSOBJATTRADD_NOTHING
|| enmAdditionalAttribs > RTFSOBJATTRADD_LAST)
{
@@ -94,10 +86,10 @@ RTR3DECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD
* Query file info.
*/
struct stat Stat;
- if (fstat((int)File, &Stat))
+ if (fstat(RTFileToNative(hFile), &Stat))
{
int rc = RTErrConvertFromErrno(errno);
- Log(("RTFileQueryInfo(%RTfile,,%d): returns %Rrc\n", File, enmAdditionalAttribs, rc));
+ Log(("RTFileQueryInfo(%RTfile,,%d): returns %Rrc\n", hFile, enmAdditionalAttribs, rc));
return rc;
}
@@ -134,12 +126,12 @@ RTR3DECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD
return VERR_INTERNAL_ERROR;
}
- LogFlow(("RTFileQueryInfo(%RTfile,,%d): returns VINF_SUCCESS\n", File, enmAdditionalAttribs));
+ LogFlow(("RTFileQueryInfo(%RTfile,,%d): returns VINF_SUCCESS\n", hFile, enmAdditionalAttribs));
return VINF_SUCCESS;
}
-RTR3DECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
+RTR3DECL(int) RTFileSetTimes(RTFILE hFile, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime)
{
/*
@@ -162,17 +154,17 @@ RTR3DECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC
else
{
RTFSOBJINFO ObjInfo;
- int rc = RTFileQueryInfo(File, &ObjInfo, RTFSOBJATTRADD_UNIX);
+ int rc = RTFileQueryInfo(hFile, &ObjInfo, RTFSOBJATTRADD_UNIX);
if (RT_FAILURE(rc))
return rc;
RTTimeSpecGetTimeval(pAccessTime ? pAccessTime : &ObjInfo.AccessTime, &aTimevals[0]);
RTTimeSpecGetTimeval(pModificationTime ? pModificationTime : &ObjInfo.ModificationTime, &aTimevals[1]);
}
- if (futimes((int)File, aTimevals))
+ if (futimes(RTFileToNative(hFile), aTimevals))
{
int rc = RTErrConvertFromErrno(errno);
- Log(("RTFileSetTimes(%RTfile,%p,%p,,): returns %Rrc\n", File, pAccessTime, pModificationTime, rc));
+ Log(("RTFileSetTimes(%RTfile,%p,%p,,): returns %Rrc\n", hFile, pAccessTime, pModificationTime, rc));
return rc;
}
return VINF_SUCCESS;
diff --git a/src/VBox/Runtime/r3/posix/filelock-posix.cpp b/src/VBox/Runtime/r3/posix/filelock-posix.cpp
index 261c41a6f..9b1f3630f 100644
--- a/src/VBox/Runtime/r3/posix/filelock-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/filelock-posix.cpp
@@ -1,10 +1,10 @@
-/* $Id: filelock-posix.cpp $ */
+/* $Id: filelock-posix.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - File Locking, POSIX.
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -49,7 +49,7 @@
-RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int) RTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
{
Assert(offLock >= 0);
@@ -82,7 +82,7 @@ RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t
fl.l_pid = 0;
Assert(RTFILE_LOCK_WAIT);
- if (fcntl(File, (fLock & RTFILE_LOCK_WAIT) ? F_SETLKW : F_SETLK, &fl) >= 0)
+ if (fcntl(RTFileToNative(hFile), (fLock & RTFILE_LOCK_WAIT) ? F_SETLKW : F_SETLK, &fl) >= 0)
return VINF_SUCCESS;
int iErr = errno;
@@ -94,14 +94,14 @@ RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t
}
-RTR3DECL(int) RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int) RTFileChangeLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
{
/** @todo We never returns VERR_FILE_NOT_LOCKED for now. */
- return RTFileLock(File, fLock, offLock, cbLock);
+ return RTFileLock(hFile, fLock, offLock, cbLock);
}
-RTR3DECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int) RTFileUnlock(RTFILE hFile, int64_t offLock, uint64_t cbLock)
{
Assert(offLock >= 0);
@@ -125,7 +125,7 @@ RTR3DECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
fl.l_len = (off_t)cbLock;
fl.l_pid = 0;
- if (fcntl(File, F_SETLK, &fl) >= 0)
+ if (fcntl(RTFileToNative(hFile), F_SETLK, &fl) >= 0)
return VINF_SUCCESS;
/* @todo check error codes for non existing lock. */
diff --git a/src/VBox/Runtime/r3/posix/fs-posix.cpp b/src/VBox/Runtime/r3/posix/fs-posix.cpp
index 6354ebeb2..2dcd9ffe3 100644
--- a/src/VBox/Runtime/r3/posix/fs-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/fs-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: fs-posix.cpp $ */
+/* $Id: fs-posix.cpp 35015 2010-12-13 14:36:50Z vboxsync $ */
/** @file
* IPRT - File System, Linux.
*/
diff --git a/src/VBox/Runtime/r3/posix/fs2-posix.cpp b/src/VBox/Runtime/r3/posix/fs2-posix.cpp
index 38dafcf17..63da69235 100644
--- a/src/VBox/Runtime/r3/posix/fs2-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/fs2-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: fs2-posix.cpp $ */
+/* $Id: fs2-posix.cpp 34015 2010-11-12 00:15:05Z vboxsync $ */
/** @file
* IPRT - File System Helpers, POSIX, Part 2.
*/
diff --git a/src/VBox/Runtime/r3/posix/fs3-posix.cpp b/src/VBox/Runtime/r3/posix/fs3-posix.cpp
index 94c3fb5a3..32882521b 100644
--- a/src/VBox/Runtime/r3/posix/fs3-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/fs3-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: fs3-posix.cpp $ */
+/* $Id: fs3-posix.cpp 34015 2010-11-12 00:15:05Z vboxsync $ */
/** @file
* IPRT - File System Helpers, POSIX, Part 3.
*/
diff --git a/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp b/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp
index 61ce35783..62cc939d8 100644
--- a/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: ldrNative-posix.cpp $ */
+/* $Id: ldrNative-posix.cpp 35191 2010-12-16 15:25:20Z vboxsync $ */
/** @file
* IPRT - Binary Image Loader, POSIX native.
*/
diff --git a/src/VBox/Runtime/r3/posix/path-posix.cpp b/src/VBox/Runtime/r3/posix/path-posix.cpp
index fc3b2cc8a..33fbd9079 100644
--- a/src/VBox/Runtime/r3/posix/path-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/path-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: path-posix.cpp $ */
+/* $Id: path-posix.cpp 36906 2011-05-01 16:35:12Z vboxsync $ */
/** @file
* IPRT - Path Manipulation, POSIX, Part 1.
*/
@@ -335,10 +335,10 @@ RTR3DECL(int) RTPathSetMode(const char *pszPath, RTFMODE fMode)
static bool rtPathSame(const char *pszNativeSrc, const char *pszNativeDst)
{
struct stat SrcStat;
- if (stat(pszNativeSrc, &SrcStat))
+ if (lstat(pszNativeSrc, &SrcStat))
return false;
struct stat DstStat;
- if (stat(pszNativeDst, &DstStat))
+ if (lstat(pszNativeDst, &DstStat))
return false;
Assert(SrcStat.st_dev && DstStat.st_dev);
Assert(SrcStat.st_ino && DstStat.st_ino);
@@ -380,11 +380,11 @@ DECLHIDDEN(int) rtPathPosixRename(const char *pszSrc, const char *pszDst, unsign
* We have to check this first to avoid getting errnous VERR_ALREADY_EXISTS
* errors from the next step.
*
- * There are race conditions here (perhaps unlikely ones but still), but I'm
+ * There are race conditions here (perhaps unlikely ones, but still), but I'm
* afraid there is little with can do to fix that.
*/
struct stat SrcStat;
- if (stat(pszNativeSrc, &SrcStat))
+ if (lstat(pszNativeSrc, &SrcStat))
rc = RTErrConvertFromErrno(errno);
else if (!fFileType)
rc = VINF_SUCCESS;
@@ -402,7 +402,7 @@ DECLHIDDEN(int) rtPathPosixRename(const char *pszSrc, const char *pszDst, unsign
* Another race condition btw.
*/
struct stat DstStat;
- if (stat(pszNativeDst, &DstStat))
+ if (lstat(pszNativeDst, &DstStat))
rc = errno == ENOENT ? VINF_SUCCESS : RTErrConvertFromErrno(errno);
else
{
@@ -445,7 +445,7 @@ DECLHIDDEN(int) rtPathPosixRename(const char *pszSrc, const char *pszDst, unsign
}
else
{
- if (stat(pszNativeDst, &DstStat))
+ if (lstat(pszNativeDst, &DstStat))
rc = errno != ENOENT ? RTErrConvertFromErrno(errno) : VINF_SUCCESS;
else if (S_ISDIR(DstStat.st_mode))
rc = VERR_ALREADY_EXISTS;
diff --git a/src/VBox/Runtime/r3/posix/path2-posix.cpp b/src/VBox/Runtime/r3/posix/path2-posix.cpp
index abc2ce29a..e4a0c7b9c 100644
--- a/src/VBox/Runtime/r3/posix/path2-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/path2-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: path2-posix.cpp $ */
+/* $Id: path2-posix.cpp 34230 2010-11-22 10:06:48Z vboxsync $ */
/** @file
* IPRT - Path Manipulation, POSIX, Part 2 - RTPathQueryInfo.
*/
diff --git a/src/VBox/Runtime/r3/posix/pathhost-posix.cpp b/src/VBox/Runtime/r3/posix/pathhost-posix.cpp
index 39a072441..a5af14150 100644
--- a/src/VBox/Runtime/r3/posix/pathhost-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/pathhost-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: pathhost-posix.cpp $ */
+/* $Id: pathhost-posix.cpp 37563 2011-06-20 19:47:47Z vboxsync $ */
/** @file
* IPRT - Path Conversions, POSIX.
*/
@@ -31,6 +31,7 @@
#define LOG_GROUP RTLOGGROUP_PATH
#include "internal/iprt.h"
#include "internal/path.h"
+#include "internal/string.h"
#include "internal/thread.h"
#include <iprt/env.h>
diff --git a/src/VBox/Runtime/r3/posix/pipe-posix.cpp b/src/VBox/Runtime/r3/posix/pipe-posix.cpp
index e225b1b1f..868849340 100644
--- a/src/VBox/Runtime/r3/posix/pipe-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/pipe-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: pipe-posix.cpp $ */
+/* $Id: pipe-posix.cpp 33104 2010-10-13 12:46:59Z vboxsync $ */
/** @file
* IPRT - Anonymous Pipes, POSIX Implementation.
*/
diff --git a/src/VBox/Runtime/r3/posix/poll-posix.cpp b/src/VBox/Runtime/r3/posix/poll-posix.cpp
index ff1249684..14be608c0 100644
--- a/src/VBox/Runtime/r3/posix/poll-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/poll-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: poll-posix.cpp $ */
+/* $Id: poll-posix.cpp 31453 2010-08-08 13:30:35Z vboxsync $ */
/** @file
* IPRT - Polling I/O Handles, POSIX Implementation.
*/
diff --git a/src/VBox/Runtime/r3/posix/process-creation-posix.cpp b/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
index 6690baf58..ccbba43b6 100644
--- a/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: process-creation-posix.cpp $ */
+/* $Id: process-creation-posix.cpp 37499 2011-06-16 14:46:47Z vboxsync $ */
/** @file
* IPRT - Process Creation, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/process-posix.cpp b/src/VBox/Runtime/r3/posix/process-posix.cpp
index 6fff7b0c9..993bff093 100644
--- a/src/VBox/Runtime/r3/posix/process-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/process-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: process-posix.cpp $ */
+/* $Id: process-posix.cpp 33602 2010-10-29 12:39:54Z vboxsync $ */
/** @file
* IPRT - Process, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/rand-posix.cpp b/src/VBox/Runtime/r3/posix/rand-posix.cpp
index 44870e5be..8e02b0a60 100644
--- a/src/VBox/Runtime/r3/posix/rand-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/rand-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: rand-posix.cpp $ */
+/* $Id: rand-posix.cpp 37596 2011-06-22 19:30:06Z vboxsync $ */
/** @file
* IPRT - Random Numbers and Byte Streams, POSIX.
*/
@@ -78,7 +78,7 @@ static DECLCALLBACK(int) rtRandAdvPosixDestroy(PRTRANDINT pThis)
{
pThis->u32Magic = ~RTRANDINT_MAGIC;
int fd = pThis->u.File.hFile;
- pThis->u.File.hFile = NIL_RTFILE;
+ pThis->u.File.hFile = -1;
RTMemFree(pThis);
close(fd);
return VINF_SUCCESS;
diff --git a/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp b/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp
index 6cc6f888a..4977aab03 100644
--- a/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: rtmempage-exec-mmap-heap-posix.cpp $ */
+/* $Id: rtmempage-exec-mmap-heap-posix.cpp 33279 2010-10-20 21:37:58Z vboxsync $ */
/** @file
* IPRT - RTMemPage*, POSIX with heap.
*/
diff --git a/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-posix.cpp b/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-posix.cpp
index 1b2466953..498402d8d 100644
--- a/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: rtmempage-exec-mmap-posix.cpp $ */
+/* $Id: rtmempage-exec-mmap-posix.cpp 33676 2010-11-02 09:48:24Z vboxsync $ */
/** @file
* IPRT - RTMemPage*, POSIX with mmap only.
*/
diff --git a/src/VBox/Runtime/r3/posix/sched-posix.cpp b/src/VBox/Runtime/r3/posix/sched-posix.cpp
index fbc607d02..bf5cde765 100644
--- a/src/VBox/Runtime/r3/posix/sched-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/sched-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: sched-posix.cpp $ */
+/* $Id: sched-posix.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Scheduling, POSIX.
*/
@@ -508,7 +508,7 @@ static void *rtSchedNativeProberThread(void *pvUser)
* @returns iprt status code.
* @param enmType The thread type to be assumed for the current thread.
*/
-int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
{
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
@@ -643,7 +643,7 @@ static void *rtSchedNativeValidatorThread(void *pvUser)
* @returns iprt status code.
* @param enmPriority The priority to validate and set.
*/
-int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
+DECLHIDDEN(int) rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
{
Assert(enmPriority > RTPROCPRIORITY_INVALID && enmPriority < RTPROCPRIORITY_LAST);
@@ -739,7 +739,7 @@ int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
* @param Thread The thread in question.
* @param enmType The thread type.
*/
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
Assert(enmType == g_pProcessPriority->paTypes[enmType].enmType);
diff --git a/src/VBox/Runtime/r3/posix/semevent-posix.cpp b/src/VBox/Runtime/r3/posix/semevent-posix.cpp
index ceeab84e6..501ae683c 100644
--- a/src/VBox/Runtime/r3/posix/semevent-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/semevent-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: semevent-posix.cpp $ */
+/* $Id: semevent-posix.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Event Semaphore, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp b/src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp
index 0fad8eeec..efe9bdc7f 100644
--- a/src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/semeventmulti-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: semeventmulti-posix.cpp $ */
+/* $Id: semeventmulti-posix.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Multiple Release Event Semaphore, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/semmutex-posix.cpp b/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
index e1e82558e..ea845d2ad 100644
--- a/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: semmutex-posix.cpp $ */
+/* $Id: semmutex-posix.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Mutex Semaphore, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/semrw-posix.cpp b/src/VBox/Runtime/r3/posix/semrw-posix.cpp
index 86473b522..edca8d669 100644
--- a/src/VBox/Runtime/r3/posix/semrw-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/semrw-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: semrw-posix.cpp $ */
+/* $Id: semrw-posix.cpp 30111 2010-06-09 12:14:59Z vboxsync $ */
/** @file
* IPRT - Read-Write Semaphore, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/symlink-posix.cpp b/src/VBox/Runtime/r3/posix/symlink-posix.cpp
index 61f7c5973..e4c00c0f8 100644
--- a/src/VBox/Runtime/r3/posix/symlink-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/symlink-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: symlink-posix.cpp $ */
+/* $Id: symlink-posix.cpp 33426 2010-10-25 14:32:38Z vboxsync $ */
/** @file
* IPRT - Symbolic Links, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/thread-posix.cpp b/src/VBox/Runtime/r3/posix/thread-posix.cpp
index c7158f4cb..316894532 100644
--- a/src/VBox/Runtime/r3/posix/thread-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/thread-posix.cpp
@@ -1,10 +1,10 @@
-/* $Id: thread-posix.cpp $ */
+/* $Id: thread-posix.cpp 37733 2011-07-01 15:41:37Z vboxsync $ */
/** @file
* IPRT - Threads, POSIX.
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -52,9 +52,6 @@
#include <iprt/log.h>
#include <iprt/assert.h>
#include <iprt/asm.h>
-#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
-# include <iprt/asm-amd64-x86.h>
-#endif
#include <iprt/err.h>
#include <iprt/string.h>
#include "internal/thread.h"
@@ -89,7 +86,7 @@ static void rtThreadKeyDestruct(void *pvValue);
static void rtThreadPosixPokeSignal(int iSignal);
-int rtThreadNativeInit(void)
+DECLHIDDEN(int) rtThreadNativeInit(void)
{
/*
* Allocate the TLS (key in posix terms) where we store the pointer to
@@ -188,7 +185,7 @@ static void rtThreadPosixPokeSignal(int iSignal)
*
* @param pThread Pointer to the thread structure.
*/
-int rtThreadNativeAdopt(PRTTHREADINT pThread)
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
{
/*
* Block SIGALRM - required for timer-posix.cpp.
@@ -211,7 +208,7 @@ int rtThreadNativeAdopt(PRTTHREADINT pThread)
}
-void rtThreadNativeDestroy(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
{
if (pThread == (PRTTHREADINT)pthread_getspecific(g_SelfKey))
pthread_setspecific(g_SelfKey, NULL);
@@ -263,7 +260,7 @@ static void *rtThreadNativeMain(void *pvArgs)
}
-int rtThreadNativeCreate(PRTTHREADINT pThread, PRTNATIVETHREAD pNativeThread)
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThread, PRTNATIVETHREAD pNativeThread)
{
/*
* Set the default stack size.
@@ -314,89 +311,6 @@ RTDECL(RTTHREAD) RTThreadSelf(void)
}
-RTDECL(RTNATIVETHREAD) RTThreadNativeSelf(void)
-{
- return (RTNATIVETHREAD)pthread_self();
-}
-
-
-RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
-{
- LogFlow(("RTThreadSleep: cMillies=%d\n", cMillies));
- if (!cMillies)
- {
- /* pthread_yield() isn't part of SuS, thus this fun. */
-#ifdef RT_OS_DARWIN
- pthread_yield_np();
-#elif defined(RT_OS_FREEBSD) /* void pthread_yield */
- pthread_yield();
-#elif defined(RT_OS_SOLARIS)
- sched_yield();
-#else
- if (!pthread_yield())
-#endif
- {
- LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", VINF_SUCCESS, cMillies));
- return VINF_SUCCESS;
- }
- }
- else
- {
- struct timespec ts;
- struct timespec tsrem = {0,0};
-
- ts.tv_nsec = (cMillies % 1000) * 1000000;
- ts.tv_sec = cMillies / 1000;
- if (!nanosleep(&ts, &tsrem))
- {
- LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", VINF_SUCCESS, cMillies));
- return VINF_SUCCESS;
- }
- }
-
- int rc = RTErrConvertFromErrno(errno);
- LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", rc, cMillies));
- return rc;
-}
-
-
-RTDECL(bool) RTThreadYield(void)
-{
-#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
- uint64_t u64TS = ASMReadTSC();
-#endif
-#ifdef RT_OS_DARWIN
- pthread_yield_np();
-#elif defined(RT_OS_SOLARIS)
- sched_yield();
-#else
- pthread_yield();
-#endif
-#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
- u64TS = ASMReadTSC() - u64TS;
- bool fRc = u64TS > 1500;
- LogFlow(("RTThreadYield: returning %d (%llu ticks)\n", fRc, u64TS));
-#else
- bool fRc = true; /* PORTME: Add heuristics for determining whether the cpus was yielded. */
-#endif
- return fRc;
-}
-
-
-RTR3DECL(uint64_t) RTThreadGetAffinity(void)
-{
- return 1;
-}
-
-
-RTR3DECL(int) RTThreadSetAffinity(uint64_t u64Mask)
-{
- if (u64Mask != 1)
- return VERR_INVALID_PARAMETER;
- return VINF_SUCCESS;
-}
-
-
#ifdef RTTHREAD_POSIX_WITH_POKE
RTDECL(int) RTThreadPoke(RTTHREAD hThread)
{
@@ -432,6 +346,7 @@ RTR3DECL(int) RTThreadGetExecutionTimeMilli(uint64_t *pKernelTime, uint64_t *pUs
return VINF_SUCCESS;
#elif defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
+ /* on Linux, getrusage(RUSAGE_THREAD, ...) is available since 2.6.26 */
struct timespec ts;
int rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
if (rc)
diff --git a/src/VBox/Runtime/r3/posix/thread2-posix.cpp b/src/VBox/Runtime/r3/posix/thread2-posix.cpp
new file mode 100644
index 000000000..2a8f5e8b7
--- /dev/null
+++ b/src/VBox/Runtime/r3/posix/thread2-posix.cpp
@@ -0,0 +1,116 @@
+/* $Id: thread2-posix.cpp 37733 2011-07-01 15:41:37Z vboxsync $ */
+/** @file
+ * IPRT - Threads part 2, POSIX.
+ */
+
+/*
+ * Copyright (C) 2006-2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#define LOG_GROUP RTLOGGROUP_THREAD
+#include <errno.h>
+#include <pthread.h>
+#include <unistd.h>
+#if defined(RT_OS_SOLARIS)
+# include <sched.h>
+#endif
+
+#include <iprt/thread.h>
+#include <iprt/log.h>
+#include <iprt/asm.h>
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+# include <iprt/asm-amd64-x86.h>
+#endif
+#include <iprt/err.h>
+#include "internal/thread.h"
+
+
+RTDECL(RTNATIVETHREAD) RTThreadNativeSelf(void)
+{
+ return (RTNATIVETHREAD)pthread_self();
+}
+
+
+RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
+{
+ LogFlow(("RTThreadSleep: cMillies=%d\n", cMillies));
+ if (!cMillies)
+ {
+ /* pthread_yield() isn't part of SuS, thus this fun. */
+#ifdef RT_OS_DARWIN
+ pthread_yield_np();
+#elif defined(RT_OS_FREEBSD) /* void pthread_yield */
+ pthread_yield();
+#elif defined(RT_OS_SOLARIS)
+ sched_yield();
+#else
+ if (!pthread_yield())
+#endif
+ {
+ LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", VINF_SUCCESS, cMillies));
+ return VINF_SUCCESS;
+ }
+ }
+ else
+ {
+ struct timespec ts;
+ struct timespec tsrem = {0,0};
+
+ ts.tv_nsec = (cMillies % 1000) * 1000000;
+ ts.tv_sec = cMillies / 1000;
+ if (!nanosleep(&ts, &tsrem))
+ {
+ LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", VINF_SUCCESS, cMillies));
+ return VINF_SUCCESS;
+ }
+ }
+
+ int rc = RTErrConvertFromErrno(errno);
+ LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", rc, cMillies));
+ return rc;
+}
+
+
+RTDECL(bool) RTThreadYield(void)
+{
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+ uint64_t u64TS = ASMReadTSC();
+#endif
+#ifdef RT_OS_DARWIN
+ pthread_yield_np();
+#elif defined(RT_OS_SOLARIS)
+ sched_yield();
+#else
+ pthread_yield();
+#endif
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+ u64TS = ASMReadTSC() - u64TS;
+ bool fRc = u64TS > 1500;
+ LogFlow(("RTThreadYield: returning %d (%llu ticks)\n", fRc, u64TS));
+#else
+ bool fRc = true; /* PORTME: Add heuristics for determining whether the cpus was yielded. */
+#endif
+ return fRc;
+}
+
diff --git a/src/VBox/Runtime/r3/posix/time-posix.cpp b/src/VBox/Runtime/r3/posix/time-posix.cpp
index bdb3dcb72..179911465 100644
--- a/src/VBox/Runtime/r3/posix/time-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/time-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: time-posix.cpp $ */
+/* $Id: time-posix.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Time, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/timer-posix.cpp b/src/VBox/Runtime/r3/posix/timer-posix.cpp
index 3f851e53b..e3644e1e2 100644
--- a/src/VBox/Runtime/r3/posix/timer-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/timer-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: timer-posix.cpp $ */
+/* $Id: timer-posix.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Timer, POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/tls-posix.cpp b/src/VBox/Runtime/r3/posix/tls-posix.cpp
index c8005a59f..17dd255c5 100644
--- a/src/VBox/Runtime/r3/posix/tls-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/tls-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: tls-posix.cpp $ */
+/* $Id: tls-posix.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Thread Local Storage (TLS), POSIX.
*/
diff --git a/src/VBox/Runtime/r3/posix/utf8-posix.cpp b/src/VBox/Runtime/r3/posix/utf8-posix.cpp
index a8a7de617..1c72c4390 100644
--- a/src/VBox/Runtime/r3/posix/utf8-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/utf8-posix.cpp
@@ -1,4 +1,4 @@
-/* $Id: utf8-posix.cpp $ */
+/* $Id: utf8-posix.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - UTF-8 helpers, POSIX.
*/
@@ -56,7 +56,7 @@ AssertCompile(sizeof(iconv_t) <= sizeof(void *));
*
* @returns Pointer to read-only string with the codeset name.
*/
-const char *rtStrGetLocaleCodeset(void)
+DECLHIDDEN(const char *) rtStrGetLocaleCodeset(void)
{
return nl_langinfo(CODESET);
}
@@ -69,7 +69,7 @@ const char *rtStrGetLocaleCodeset(void)
*
* @param pThread The thread in question.
*/
-void rtStrIconvCacheInit(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtStrIconvCacheInit(PRTTHREADINT pThread)
{
for (size_t i = 0; i < RT_ELEMENTS(pThread->ahIconvs); i++)
pThread->ahIconvs[i] = (iconv_t)-1;
@@ -80,7 +80,7 @@ void rtStrIconvCacheInit(PRTTHREADINT pThread)
*
* @param pThread The thread in question.
*/
-void rtStrIconvCacheDestroy(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtStrIconvCacheDestroy(PRTTHREADINT pThread)
{
for (size_t i = 0; i < RT_ELEMENTS(pThread->ahIconvs); i++)
{
@@ -408,9 +408,9 @@ DECLINLINE(int) rtStrConvertWrapper(const char *pchInput, size_t cchInput, const
* @param cFactor Input vs. output size factor.
* @param enmCacheIdx The iconv cache index.
*/
-int rtStrConvert(const char *pchInput, size_t cchInput, const char *pszInputCS,
- char **ppszOutput, size_t cbOutput, const char *pszOutputCS,
- unsigned cFactor, RTSTRICONV enmCacheIdx)
+DECLHIDDEN(int) rtStrConvert(const char *pchInput, size_t cchInput, const char *pszInputCS,
+ char **ppszOutput, size_t cbOutput, const char *pszOutputCS,
+ unsigned cFactor, RTSTRICONV enmCacheIdx)
{
Assert(enmCacheIdx >= 0 && enmCacheIdx < RTSTRICONV_END);
return rtStrConvertWrapper(pchInput, cchInput, pszInputCS,
diff --git a/src/VBox/Runtime/r3/process.cpp b/src/VBox/Runtime/r3/process.cpp
index 7be307f32..73607065f 100644
--- a/src/VBox/Runtime/r3/process.cpp
+++ b/src/VBox/Runtime/r3/process.cpp
@@ -1,4 +1,4 @@
-/* $Id: process.cpp $ */
+/* $Id: process.cpp 33806 2010-11-05 17:20:15Z vboxsync $ */
/** @file
* IPRT - Process, Common.
*/
diff --git a/src/VBox/Runtime/r3/socket.cpp b/src/VBox/Runtime/r3/socket.cpp
index b989e28cf..e09ead6df 100644
--- a/src/VBox/Runtime/r3/socket.cpp
+++ b/src/VBox/Runtime/r3/socket.cpp
@@ -1,10 +1,10 @@
-/* $Id: socket.cpp $ */
+/* $Id: socket.cpp 37196 2011-05-24 14:50:05Z vboxsync $ */
/** @file
* IPRT - Network Sockets.
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -220,6 +220,83 @@ int rtSocketResolverError(void)
/**
+ * Converts from a native socket address to a generic IPRT network address.
+ *
+ * @returns IPRT status code.
+ * @param pSrc The source address.
+ * @param cbSrc The size of the source address.
+ * @param pAddr Where to return the generic IPRT network
+ * address.
+ */
+static int rtSocketNetAddrFromAddr(RTSOCKADDRUNION const *pSrc, size_t cbSrc, PRTNETADDR pAddr)
+{
+ /*
+ * Convert the address.
+ */
+ if ( cbSrc == sizeof(struct sockaddr_in)
+ && pSrc->Addr.sa_family == AF_INET)
+ {
+ RT_ZERO(*pAddr);
+ pAddr->enmType = RTNETADDRTYPE_IPV4;
+ pAddr->uPort = RT_N2H_U16(pSrc->Ipv4.sin_port);
+ pAddr->uAddr.IPv4.u = pSrc->Ipv4.sin_addr.s_addr;
+ }
+#ifdef IPRT_WITH_TCPIP_V6
+ else if ( cbSrc == sizeof(struct sockaddr_in6)
+ && pSrc->Addr.sa_family == AF_INET6)
+ {
+ RT_ZERO(*pAddr);
+ pAddr->enmType = RTNETADDRTYPE_IPV6;
+ pAddr->uPort = RT_N2H_U16(pSrc->Ipv6.sin6_port);
+ pAddr->uAddr.IPv6.au32[0] = pSrc->Ipv6.sin6_addr.s6_addr32[0];
+ pAddr->uAddr.IPv6.au32[1] = pSrc->Ipv6.sin6_addr.s6_addr32[1];
+ pAddr->uAddr.IPv6.au32[2] = pSrc->Ipv6.sin6_addr.s6_addr32[2];
+ pAddr->uAddr.IPv6.au32[3] = pSrc->Ipv6.sin6_addr.s6_addr32[3];
+ }
+#endif
+ else
+ return VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED;
+ return VINF_SUCCESS;
+}
+
+
+/**
+ * Converts from a generic IPRT network address to a native socket address.
+ *
+ * @returns IPRT status code.
+ * @param pAddr Pointer to the generic IPRT network address.
+ * @param pDst The source address.
+ * @param cbSrc The size of the source address.
+ */
+static int rtSocketAddrFromNetAddr(PCRTNETADDR pAddr, RTSOCKADDRUNION *pDst, size_t cbDst)
+{
+ RT_BZERO(pDst, cbDst);
+ if ( pAddr->enmType == RTNETADDRTYPE_IPV4
+ && cbDst >= sizeof(struct sockaddr_in))
+ {
+ pDst->Addr.sa_family = AF_INET;
+ pDst->Ipv4.sin_port = RT_H2N_U16(pAddr->uPort);
+ pDst->Ipv4.sin_addr.s_addr = pAddr->uAddr.IPv4.u;
+ }
+#ifdef IPRT_WITH_TCPIP_V6
+ else if ( pAddr->enmType == RTNETADDRTYPE_IPV6
+ && cbDst >= sizeof(struct sockaddr_in6))
+ {
+ pDst->Addr.sa_family = AF_INET6;
+ pDst->Ipv6.sin6_port = RT_H2N_U16(pAddr->uPort);
+ pSrc->Ipv6.sin6_addr.s6_addr32[0] = pAddr->uAddr.IPv6.au32[0];
+ pSrc->Ipv6.sin6_addr.s6_addr32[1] = pAddr->uAddr.IPv6.au32[1];
+ pSrc->Ipv6.sin6_addr.s6_addr32[2] = pAddr->uAddr.IPv6.au32[2];
+ pSrc->Ipv6.sin6_addr.s6_addr32[3] = pAddr->uAddr.IPv6.au32[3];
+ }
+#endif
+ else
+ return VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED;
+ return VINF_SUCCESS;
+}
+
+
+/**
* Tries to lock the socket for exclusive usage by the calling thread.
*
* Call rtSocketUnlock() to unlock.
@@ -504,6 +581,64 @@ RTDECL(int) RTSocketSetInheritance(RTSOCKET hSocket, bool fInheritable)
}
+RTDECL(int) RTSocketParseInetAddress(const char *pszAddress, unsigned uPort, PRTNETADDR pAddr)
+{
+ int rc;
+
+ /*
+ * Validate input.
+ */
+ AssertReturn(uPort > 0, VERR_INVALID_PARAMETER);
+ AssertPtrReturn(pszAddress, VERR_INVALID_POINTER);
+
+#ifdef RT_OS_WINDOWS
+ /*
+ * Initialize WinSock and check version.
+ */
+ WORD wVersionRequested = MAKEWORD(1, 1);
+ WSADATA wsaData;
+ rc = WSAStartup(wVersionRequested, &wsaData);
+ if (wsaData.wVersion != wVersionRequested)
+ {
+ AssertMsgFailed(("Wrong winsock version\n"));
+ return VERR_NOT_SUPPORTED;
+ }
+#endif
+
+ /*
+ * Resolve the address.
+ */
+ /** @todo this only supports IPv4, and IPv6 support needs to be added.
+ * It probably needs to be converted to getnameinfo(). */
+ struct hostent *pHostEnt = NULL;
+ pHostEnt = gethostbyname(pszAddress);
+ if (!pHostEnt)
+ {
+ struct in_addr InAddr;
+ InAddr.s_addr = inet_addr(pszAddress);
+ pHostEnt = gethostbyaddr((char *)&InAddr, 4, AF_INET);
+ if (!pHostEnt)
+ {
+ rc = rtSocketResolverError();
+ AssertMsgFailed(("Could not resolve '%s', rc=%Rrc\n", pszAddress, rc));
+ return rc;
+ }
+ }
+
+ if (pHostEnt->h_addrtype == AF_INET)
+ {
+ RT_ZERO(*pAddr);
+ pAddr->enmType = RTNETADDRTYPE_IPV4;
+ pAddr->uPort = uPort;
+ pAddr->uAddr.IPv4.u = ((struct in_addr *)pHostEnt->h_addr)->s_addr;
+ }
+ else
+ return VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED;
+
+ return VINF_SUCCESS;
+}
+
+
RTDECL(int) RTSocketRead(RTSOCKET hSocket, void *pvBuffer, size_t cbBuffer, size_t *pcbRead)
{
/*
@@ -573,6 +708,60 @@ RTDECL(int) RTSocketRead(RTSOCKET hSocket, void *pvBuffer, size_t cbBuffer, size
}
+RTDECL(int) RTSocketReadFrom(RTSOCKET hSocket, void *pvBuffer, size_t cbBuffer, size_t *pcbRead, PRTNETADDR pSrcAddr)
+{
+ /*
+ * Validate input.
+ */
+ RTSOCKETINT *pThis = hSocket;
+ AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->u32Magic == RTSOCKET_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(cbBuffer > 0, VERR_INVALID_PARAMETER);
+ AssertPtr(pvBuffer);
+ AssertPtr(pcbRead);
+ AssertReturn(rtSocketTryLock(pThis), VERR_CONCURRENT_ACCESS);
+
+ int rc = rtSocketSwitchBlockingMode(pThis, true /* fBlocking */);
+ if (RT_FAILURE(rc))
+ return rc;
+
+ /*
+ * Read data.
+ */
+ size_t cbRead = 0;
+ size_t cbToRead = cbBuffer;
+ rtSocketErrorReset();
+ RTSOCKADDRUNION u;
+#ifdef RT_OS_WINDOWS
+ int cbNow = cbToRead >= INT_MAX/2 ? INT_MAX/2 : (int)cbToRead;
+ int cbAddr = sizeof(u);
+#else
+ size_t cbNow = cbToRead;
+ socklen_t cbAddr = sizeof(u);
+#endif
+ ssize_t cbBytesRead = recvfrom(pThis->hNative, (char *)pvBuffer + cbRead, cbNow, MSG_NOSIGNAL, &u.Addr, &cbAddr);
+ if (cbBytesRead <= 0)
+ {
+ rc = rtSocketError();
+ Assert(RT_FAILURE_NP(rc) || cbBytesRead == 0);
+ if (RT_SUCCESS_NP(rc))
+ {
+ *pcbRead = 0;
+ rc = VINF_SUCCESS;
+ }
+ }
+ else
+ {
+ if (pSrcAddr)
+ rc = rtSocketNetAddrFromAddr(&u, cbAddr, pSrcAddr);
+ *pcbRead = cbBytesRead;
+ }
+
+ rtSocketUnlock(pThis);
+ return rc;
+}
+
+
RTDECL(int) RTSocketWrite(RTSOCKET hSocket, const void *pvBuffer, size_t cbBuffer)
{
/*
@@ -642,6 +831,60 @@ RTDECL(int) RTSocketWrite(RTSOCKET hSocket, const void *pvBuffer, size_t cbBuffe
}
+RTDECL(int) RTSocketWriteTo(RTSOCKET hSocket, const void *pvBuffer, size_t cbBuffer, PCRTNETADDR pAddr)
+{
+ /*
+ * Validate input.
+ */
+ RTSOCKETINT *pThis = hSocket;
+ AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
+ AssertReturn(pThis->u32Magic == RTSOCKET_MAGIC, VERR_INVALID_HANDLE);
+
+ /* no locking since UDP reads may be done concurrently to writes, and
+ * this is the normal use case of this code. */
+
+ int rc = rtSocketSwitchBlockingMode(pThis, true /* fBlocking */);
+ if (RT_FAILURE(rc))
+ return rc;
+
+ /* Figure out destination address. */
+ struct sockaddr *pSA = NULL;
+#ifdef RT_OS_WINDOWS
+ int cbSA = 0;
+#else
+ socklen_t cbSA = 0;
+#endif
+ RTSOCKADDRUNION u;
+ if (pAddr)
+ {
+ rc = rtSocketAddrFromNetAddr(pAddr, &u, sizeof(u));
+ if (RT_FAILURE(rc))
+ return rc;
+ pSA = &u.Addr;
+ cbSA = sizeof(u);
+ }
+
+ /*
+ * Must write all at once, otherwise it is a failure.
+ */
+#ifdef RT_OS_WINDOWS
+ int cbNow = cbBuffer >= INT_MAX / 2 ? INT_MAX / 2 : (int)cbBuffer;
+#else
+ size_t cbNow = cbBuffer >= SSIZE_MAX ? SSIZE_MAX : cbBuffer;
+#endif
+ ssize_t cbWritten = sendto(pThis->hNative, (const char *)pvBuffer, cbNow, MSG_NOSIGNAL, pSA, cbSA);
+ if (RT_LIKELY((size_t)cbWritten == cbBuffer && cbWritten >= 0))
+ rc = VINF_SUCCESS;
+ else if (cbWritten < 0)
+ rc = rtSocketError();
+ else
+ rc = VERR_TOO_MUCH_DATA;
+
+ rtSocketUnlock(pThis);
+ return rc;
+}
+
+
RTDECL(int) RTSocketSgWrite(RTSOCKET hSocket, PCRTSGBUF pSgBuf)
{
/*
@@ -1084,47 +1327,6 @@ RTDECL(int) RTSocketShutdown(RTSOCKET hSocket, bool fRead, bool fWrite)
}
-/**
- * Converts from a native socket address to a generic IPRT network address.
- *
- * @returns IPRT status code.
- * @param pSrc The source address.
- * @param cbSrc The size of the source address.
- * @param pAddr Where to return the generic IPRT network
- * address.
- */
-static int rtSocketConvertAddress(RTSOCKADDRUNION const *pSrc, size_t cbSrc, PRTNETADDR pAddr)
-{
- /*
- * Convert the address.
- */
- if ( cbSrc == sizeof(struct sockaddr_in)
- && pSrc->Addr.sa_family == AF_INET)
- {
- RT_ZERO(*pAddr);
- pAddr->enmType = RTNETADDRTYPE_IPV4;
- pAddr->uPort = RT_N2H_U16(pSrc->Ipv4.sin_port);
- pAddr->uAddr.IPv4.u = pSrc->Ipv4.sin_addr.s_addr;
- }
-#ifdef IPRT_WITH_TCPIP_V6
- else if ( cbSrc == sizeof(struct sockaddr_in6)
- && pSrc->Addr.sa_family == AF_INET6)
- {
- RT_ZERO(*pAddr);
- pAddr->enmType = RTNETADDRTYPE_IPV6;
- pAddr->uPort = RT_N2H_U16(pSrc->Ipv6.sin6_port);
- pAddr->uAddr.IPv6.au32[0] = pSrc->Ipv6.sin6_addr.s6_addr32[0];
- pAddr->uAddr.IPv6.au32[1] = pSrc->Ipv6.sin6_addr.s6_addr32[1];
- pAddr->uAddr.IPv6.au32[2] = pSrc->Ipv6.sin6_addr.s6_addr32[2];
- pAddr->uAddr.IPv6.au32[3] = pSrc->Ipv6.sin6_addr.s6_addr32[3];
- }
-#endif
- else
- return VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED;
- return VINF_SUCCESS;
-}
-
-
RTDECL(int) RTSocketGetLocalAddress(RTSOCKET hSocket, PRTNETADDR pAddr)
{
/*
@@ -1147,7 +1349,7 @@ RTDECL(int) RTSocketGetLocalAddress(RTSOCKET hSocket, PRTNETADDR pAddr)
#endif
RT_ZERO(u);
if (getsockname(pThis->hNative, &u.Addr, &cbAddr) == 0)
- rc = rtSocketConvertAddress(&u, cbAddr, pAddr);
+ rc = rtSocketNetAddrFromAddr(&u, cbAddr, pAddr);
else
rc = rtSocketError();
@@ -1177,7 +1379,7 @@ RTDECL(int) RTSocketGetPeerAddress(RTSOCKET hSocket, PRTNETADDR pAddr)
#endif
RT_ZERO(u);
if (getpeername(pThis->hNative, &u.Addr, &cbAddr) == 0)
- rc = rtSocketConvertAddress(&u, cbAddr, pAddr);
+ rc = rtSocketNetAddrFromAddr(&u, cbAddr, pAddr);
else
rc = rtSocketError();
diff --git a/src/VBox/Runtime/r3/solaris/RTSystemQueryDmiString-solaris.cpp b/src/VBox/Runtime/r3/solaris/RTSystemQueryDmiString-solaris.cpp
index 0dc82edbd..3f5634264 100644
--- a/src/VBox/Runtime/r3/solaris/RTSystemQueryDmiString-solaris.cpp
+++ b/src/VBox/Runtime/r3/solaris/RTSystemQueryDmiString-solaris.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSystemQueryDmiString-solaris.cpp $ */
+/* $Id: RTSystemQueryDmiString-solaris.cpp 29560 2010-05-17 15:08:09Z vboxsync $ */
/** @file
* IPRT - RTSystemQueryDmiString, solaris ring-3.
*/
diff --git a/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp b/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp
index 6f6b1c7fe..d20d8497a 100644
--- a/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp
+++ b/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp
@@ -1,10 +1,10 @@
-/* $Id: coredumper-solaris.cpp $ */
+/* $Id: coredumper-solaris.cpp 37631 2011-06-24 13:25:07Z vboxsync $ */
/** @file
- * IPRT Testcase - Core Dumper.
+ * IPRT - Custom Core Dumper, Solaris.
*/
/*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -24,21 +24,22 @@
* terms and conditions of either the GPL or the CDDL or both.
*/
+
/*******************************************************************************
* Header Files *
*******************************************************************************/
-#define LOG_GROUP LOG_GROUP_CORE_DUMPER
-#include <VBox/log.h>
+#define LOG_GROUP RTLOGGROUP_DEFAULT
#include <iprt/coredumper.h>
-#include <iprt/types.h>
-#include <iprt/file.h>
-#include <iprt/err.h>
+
+#include <iprt/asm.h>
#include <iprt/dir.h>
+#include <iprt/err.h>
+#include <iprt/log.h>
+#include <iprt/param.h>
#include <iprt/path.h>
+#include <iprt/process.h>
#include <iprt/string.h>
#include <iprt/thread.h>
-#include <iprt/param.h>
-#include <iprt/asm.h>
#include "coredumper-solaris.h"
#ifdef RT_OS_SOLARIS
@@ -61,6 +62,7 @@
#include "internal/ldrELF.h"
#include "internal/ldrELF64.h"
+
/*******************************************************************************
* Globals *
*******************************************************************************/
@@ -126,67 +128,96 @@ static bool IsBigEndian()
/**
* Reads from a file making sure an interruption doesn't cause a failure.
*
- * @param hFile Handle to the file to read.
+ * @param fd Handle to the file to read.
* @param pv Where to store the read data.
* @param cbToRead Size of data to read.
*
* @return IPRT status code.
*/
-static int ReadFileNoIntr(RTFILE hFile, void *pv, size_t cbToRead)
+static int ReadFileNoIntr(int fd, void *pv, size_t cbToRead)
{
- int rc = VERR_READ_ERROR;
- while (1)
+ for (;;)
{
- rc = RTFileRead(hFile, pv, cbToRead, NULL /* Read all */);
- if (rc == VERR_INTERRUPTED)
- continue;
- break;
+ ssize_t cbRead = read(fd, pv, cbToRead);
+ if (cbRead < 0)
+ {
+ if (errno == EINTR)
+ continue;
+ return RTErrConvertFromErrno(errno);
+ }
+ if ((size_t)cbRead == cbToRead)
+ return VINF_SUCCESS;
+ if ((size_t)cbRead > cbToRead)
+ return VERR_INTERNAL_ERROR_3;
+ if (cbRead == 0)
+ return VERR_EOF;
+ pv = (uint8_t *)pv + cbRead;
+ cbToRead -= cbRead;
}
- return rc;
}
/**
* Writes to a file making sure an interruption doesn't cause a failure.
*
- * @param hFile Handle to the file to write.
+ * @param fd Handle to the file to write to.
* @param pv Pointer to what to write.
- * @param cbToRead Size of data to write.
+ * @param cbToWrite Size of data to write.
*
* @return IPRT status code.
*/
-static int WriteFileNoIntr(RTFILE hFile, const void *pcv, size_t cbToRead)
+static int WriteFileNoIntr(int fd, const void *pv, size_t cbToWrite)
{
- int rc = VERR_READ_ERROR;
- while (1)
+ for (;;)
{
- rc = RTFileWrite(hFile, pcv, cbToRead, NULL /* Write all */);
- if (rc == VERR_INTERRUPTED)
- continue;
- break;
+ ssize_t cbWritten = write(fd, pv, cbToWrite);
+ if (cbWritten < 0)
+ {
+ if (errno == EINTR)
+ continue;
+ return RTErrConvertFromErrno(errno);
+ }
+ if ((size_t)cbWritten == cbToWrite)
+ return VINF_SUCCESS;
+ if ((size_t)cbWritten > cbToWrite)
+ return VERR_INTERNAL_ERROR_2;
+ pv = (uint8_t const *)pv + cbWritten;
+ cbToWrite -= cbWritten;
}
- return rc;
}
/**
* Read from a given offset in the process' address space.
*
- * @param pVBoxProc Pointer to the VBox process.
+ * @param pSolProc Pointer to the solaris process.
* @param pv Where to read the data into.
* @param cb Size of the read buffer.
* @param off Offset to read from.
*
* @return VINF_SUCCESS, if all the given bytes was read in, otherwise VERR_READ_ERROR.
*/
-static ssize_t ProcReadAddrSpace(PVBOXPROCESS pVBoxProc, RTFOFF off, void *pvBuf, size_t cbToRead)
+static ssize_t ProcReadAddrSpace(PRTSOLCOREPROCESS pSolProc, RTFOFF off, void *pvBuf, size_t cbToRead)
{
- while (1)
+ for (;;)
{
- int rc = RTFileReadAt(pVBoxProc->hAs, off, pvBuf, cbToRead, NULL);
- if (rc == VERR_INTERRUPTED)
- continue;
- return rc;
+ ssize_t cbRead = pread(pSolProc->fdAs, pvBuf, cbToRead, off);
+ if (cbRead < 0)
+ {
+ if (errno == EINTR)
+ continue;
+ return RTErrConvertFromErrno(errno);
+ }
+ if ((size_t)cbRead == cbToRead)
+ return VINF_SUCCESS;
+ if ((size_t)cbRead > cbToRead)
+ return VERR_INTERNAL_ERROR_4;
+ if (cbRead == 0)
+ return VERR_EOF;
+
+ pvBuf = (uint8_t *)pvBuf + cbRead;
+ cbToRead -= cbRead;
+ off += cbRead;
}
}
@@ -194,36 +225,52 @@ static ssize_t ProcReadAddrSpace(PVBOXPROCESS pVBoxProc, RTFOFF off, void *pvBuf
/**
* Determines if the current process' architecture is suitable for dumping core.
*
- * @param pVBoxProc Pointer to the VBox process.
+ * @param pSolProc Pointer to the solaris process.
*
* @return true if the architecture matches the current one.
*/
-static inline bool IsProcessArchNative(PVBOXPROCESS pVBoxProc)
+static inline bool IsProcessArchNative(PRTSOLCOREPROCESS pSolProc)
{
- return pVBoxProc->ProcInfo.pr_dmodel == PR_MODEL_NATIVE;
+ return pSolProc->ProcInfo.pr_dmodel == PR_MODEL_NATIVE;
}
/**
- * Helper function to get the size of a file given it's path.
+ * Helper function to get the size_t compatible file size from a file
+ * descriptor.
*
- * @param pszPath Pointer to the full path of the file.
+ * @return The file size (in bytes).
+ * @param fd The file descriptor.
+ */
+static size_t GetFileSizeByFd(int fd)
+{
+ struct stat st;
+ if (fstat(fd, &st) == 0)
+ return st.st_size < ~(size_t)0 ? (size_t)st.st_size : ~(size_t)0;
+
+ CORELOGRELSYS((CORELOG_NAME "GetFileSizeByFd: fstat failed rc=%Rrc\n", RTErrConvertFromErrno(errno)));
+ return 0;
+}
+
+
+/**
+ * Helper function to get the size_t compatible size of a file given its path.
*
- * @return The size of the file in bytes.
+ * @return The file size (in bytes).
+ * @param pszPath Pointer to the full path of the file.
*/
-static size_t GetFileSize(const char *pszPath)
+static size_t GetFileSizeByName(const char *pszPath)
{
- uint64_t cb = 0;
int fd = open(pszPath, O_RDONLY);
- if (fd >= 0)
+ if (fd < 0)
{
- RTFILE hFile = fd;
- RTFileGetSize(hFile, &cb);
- RTFileClose(hFile);
+ CORELOGRELSYS((CORELOG_NAME "GetFileSizeByName: failed to open %s rc=%Rrc\n", pszPath, RTErrConvertFromErrno(errno)));
+ return 0;
}
- else
- CORELOGRELSYS((CORELOG_NAME "GetFileSize: failed to open %s rc=%Rrc\n", pszPath, RTErrConvertFromErrno(fd)));
- return cb < ~(size_t)0 ? (size_t)cb : ~(size_t)0;
+
+ size_t cb = GetFileSizeByFd(fd);
+ close(fd);
+ return cb;
}
@@ -232,24 +279,25 @@ static size_t GetFileSize(const char *pszPath)
* This is meant to be called once, as a single-large anonymously
* mapped memory area which will be used during the core dumping routines.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @return IPRT status code.
*/
-static int AllocMemoryArea(PVBOXCORE pVBoxCore)
+static int AllocMemoryArea(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore->pvCore == NULL, VERR_ALREADY_EXISTS);
+ AssertReturn(pSolCore->pvCore == NULL, VERR_ALREADY_EXISTS);
- struct VBOXSOLPREALLOCTABLE
+ static struct
{
const char *pszFilePath; /* Proc based path */
size_t cbHeader; /* Size of header */
size_t cbEntry; /* Size of each entry in file */
size_t cbAccounting; /* Size of each accounting entry per entry */
- } aPreAllocTable[] = {
- { "/proc/%d/map", 0, sizeof(prmap_t), sizeof(VBOXSOLMAPINFO) },
+ } const s_aPreAllocTable[] =
+ {
+ { "/proc/%d/map", 0, sizeof(prmap_t), sizeof(RTSOLCOREMAPINFO) },
{ "/proc/%d/auxv", 0, 0, 0 },
- { "/proc/%d/lpsinfo", sizeof(prheader_t), sizeof(lwpsinfo_t), sizeof(VBOXSOLTHREADINFO) },
+ { "/proc/%d/lpsinfo", sizeof(prheader_t), sizeof(lwpsinfo_t), sizeof(RTSOLCORETHREADINFO) },
{ "/proc/%d/lstatus", 0, 0, 0 },
{ "/proc/%d/ldt", 0, 0, 0 },
{ "/proc/%d/cred", sizeof(prcred_t), sizeof(gid_t), 0 },
@@ -257,25 +305,25 @@ static int AllocMemoryArea(PVBOXCORE pVBoxCore)
};
size_t cb = 0;
- for (int i = 0; i < (int)RT_ELEMENTS(aPreAllocTable); i++)
+ for (unsigned i = 0; i < RT_ELEMENTS(s_aPreAllocTable); i++)
{
char szPath[PATH_MAX];
- RTStrPrintf(szPath, sizeof(szPath), aPreAllocTable[i].pszFilePath, (int)pVBoxCore->VBoxProc.Process);
- size_t cbFile = GetFileSize(szPath);
+ RTStrPrintf(szPath, sizeof(szPath), s_aPreAllocTable[i].pszFilePath, (int)pSolCore->SolProc.Process);
+ size_t cbFile = GetFileSizeByName(szPath);
cb += cbFile;
if ( cbFile > 0
- && aPreAllocTable[i].cbEntry > 0)
+ && s_aPreAllocTable[i].cbEntry > 0)
{
- cb += ((cbFile - aPreAllocTable[i].cbHeader) / aPreAllocTable[i].cbEntry) * (aPreAllocTable[i].cbAccounting > 0 ?
- aPreAllocTable[i].cbAccounting : 1);
- cb += aPreAllocTable[i].cbHeader;
+ cb += ((cbFile - s_aPreAllocTable[i].cbHeader) / s_aPreAllocTable[i].cbEntry)
+ * (s_aPreAllocTable[i].cbAccounting > 0 ? s_aPreAllocTable[i].cbAccounting : 1);
+ cb += s_aPreAllocTable[i].cbHeader;
}
}
/*
* Make room for our own mapping accountant entry which will also be included in the core.
*/
- cb += sizeof(VBOXSOLMAPINFO);
+ cb += sizeof(RTSOLCOREMAPINFO);
/*
* Allocate the required space, plus some extra room.
@@ -285,58 +333,55 @@ static int AllocMemoryArea(PVBOXCORE pVBoxCore)
if (pv != MAP_FAILED)
{
CORELOG((CORELOG_NAME "AllocMemoryArea: memory area of %u bytes allocated.\n", cb));
- pVBoxCore->pvCore = pv;
- pVBoxCore->pvFree = pv;
- pVBoxCore->cbCore = cb;
+ pSolCore->pvCore = pv;
+ pSolCore->pvFree = pv;
+ pSolCore->cbCore = cb;
return VINF_SUCCESS;
}
- else
- {
- CORELOGRELSYS((CORELOG_NAME "AllocMemoryArea: failed cb=%u\n", cb));
- return VERR_NO_MEMORY;
- }
+ CORELOGRELSYS((CORELOG_NAME "AllocMemoryArea: failed cb=%u\n", cb));
+ return VERR_NO_MEMORY;
}
/**
* Free memory area used by the core object.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*/
-static void FreeMemoryArea(PVBOXCORE pVBoxCore)
+static void FreeMemoryArea(PRTSOLCORE pSolCore)
{
- AssertReturnVoid(pVBoxCore);
- AssertReturnVoid(pVBoxCore->pvCore);
- AssertReturnVoid(pVBoxCore->cbCore > 0);
+ AssertReturnVoid(pSolCore);
+ AssertReturnVoid(pSolCore->pvCore);
+ AssertReturnVoid(pSolCore->cbCore > 0);
- munmap(pVBoxCore->pvCore, pVBoxCore->cbCore);
- CORELOG((CORELOG_NAME "FreeMemoryArea: memory area of %u bytes freed.\n", pVBoxCore->cbCore));
+ munmap(pSolCore->pvCore, pSolCore->cbCore);
+ CORELOG((CORELOG_NAME "FreeMemoryArea: memory area of %u bytes freed.\n", pSolCore->cbCore));
- pVBoxCore->pvCore = NULL;
- pVBoxCore->pvFree= NULL;
- pVBoxCore->cbCore = 0;
+ pSolCore->pvCore = NULL;
+ pSolCore->pvFree= NULL;
+ pSolCore->cbCore = 0;
}
/**
* Get a chunk from the area of allocated memory.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param cb Size of requested chunk.
*
* @return Pointer to allocated memory, or NULL on failure.
*/
-static void *GetMemoryChunk(PVBOXCORE pVBoxCore, size_t cb)
+static void *GetMemoryChunk(PRTSOLCORE pSolCore, size_t cb)
{
- AssertReturn(pVBoxCore, NULL);
- AssertReturn(pVBoxCore->pvCore, NULL);
- AssertReturn(pVBoxCore->pvFree, NULL);
+ AssertReturn(pSolCore, NULL);
+ AssertReturn(pSolCore->pvCore, NULL);
+ AssertReturn(pSolCore->pvFree, NULL);
- size_t cbAllocated = (char *)pVBoxCore->pvFree - (char *)pVBoxCore->pvCore;
- if (cbAllocated < pVBoxCore->cbCore)
+ size_t cbAllocated = (char *)pSolCore->pvFree - (char *)pSolCore->pvCore;
+ if (cbAllocated < pSolCore->cbCore)
{
- char *pb = (char *)pVBoxCore->pvFree;
- pVBoxCore->pvFree = pb + cb;
+ char *pb = (char *)pSolCore->pvFree;
+ pSolCore->pvFree = pb + cb;
return pb;
}
@@ -347,7 +392,7 @@ static void *GetMemoryChunk(PVBOXCORE pVBoxCore, size_t cb)
/**
* Reads the proc file's content into a newly allocated buffer.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param pszFileFmt Only the name of the file to read from (/proc/<pid> will be prepended)
* @param ppv Where to store the allocated buffer.
* @param pcb Where to store size of the buffer.
@@ -356,25 +401,22 @@ static void *GetMemoryChunk(PVBOXCORE pVBoxCore, size_t cb)
* returned with pointed to values of @c ppv, @c pcb set to NULL and 0
* respectively.
*/
-static int ProcReadFileInto(PVBOXCORE pVBoxCore, const char *pszProcFileName, void **ppv, size_t *pcb)
+static int ProcReadFileInto(PRTSOLCORE pSolCore, const char *pszProcFileName, void **ppv, size_t *pcb)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
char szPath[PATH_MAX];
- RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/%s", (int)pVBoxCore->VBoxProc.Process, pszProcFileName);
+ RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/%s", (int)pSolCore->SolProc.Process, pszProcFileName);
int rc = VINF_SUCCESS;
int fd = open(szPath, O_RDONLY);
if (fd >= 0)
{
- RTFILE hFile = fd;
- uint64_t u64Size;
- RTFileGetSize(hFile, &u64Size);
- *pcb = u64Size < ~(size_t)0 ? u64Size : ~(size_t)0;
+ *pcb = GetFileSizeByFd(fd);
if (*pcb > 0)
{
- *ppv = GetMemoryChunk(pVBoxCore, *pcb);
+ *ppv = GetMemoryChunk(pSolCore, *pcb);
if (*ppv)
- rc = ReadFileNoIntr(hFile, *ppv, *pcb);
+ rc = ReadFileNoIntr(fd, *ppv, *pcb);
else
rc = VERR_NO_MEMORY;
}
@@ -384,7 +426,7 @@ static int ProcReadFileInto(PVBOXCORE pVBoxCore, const char *pszProcFileName, vo
*ppv = NULL;
rc = VINF_SUCCESS;
}
- RTFileClose(hFile);
+ close(fd);
}
else
{
@@ -398,26 +440,25 @@ static int ProcReadFileInto(PVBOXCORE pVBoxCore, const char *pszProcFileName, vo
/**
* Read process information (format psinfo_t) from /proc.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @return IPRT status code.
*/
-static int ProcReadInfo(PVBOXCORE pVBoxCore)
+static int ProcReadInfo(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
char szPath[PATH_MAX];
int rc = VINF_SUCCESS;
- RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/psinfo", (int)pVBoxProc->Process);
+ RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/psinfo", (int)pSolProc->Process);
int fd = open(szPath, O_RDONLY);
if (fd >= 0)
{
- RTFILE hFile = fd;
size_t cbProcInfo = sizeof(psinfo_t);
- rc = ReadFileNoIntr(hFile, &pVBoxProc->ProcInfo, cbProcInfo);
- RTFileClose(hFile);
+ rc = ReadFileNoIntr(fd, &pSolProc->ProcInfo, cbProcInfo);
+ close(fd);
}
else
{
@@ -432,29 +473,27 @@ static int ProcReadInfo(PVBOXCORE pVBoxCore)
/**
* Read process status (format pstatus_t) from /proc.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @return IPRT status code.
*/
-static int ProcReadStatus(PVBOXCORE pVBoxCore)
+static int ProcReadStatus(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
char szPath[PATH_MAX];
int rc = VINF_SUCCESS;
- RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/status", (int)pVBoxProc->Process);
+ RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/status", (int)pSolProc->Process);
int fd = open(szPath, O_RDONLY);
if (fd >= 0)
{
- RTFILE hFile = fd;
- size_t cbRead;
size_t cbProcStatus = sizeof(pstatus_t);
- AssertCompile(sizeof(pstatus_t) == sizeof(pVBoxProc->ProcStatus));
- rc = ReadFileNoIntr(hFile, &pVBoxProc->ProcStatus, cbProcStatus);
- RTFileClose(hFile);
+ AssertCompile(sizeof(pstatus_t) == sizeof(pSolProc->ProcStatus));
+ rc = ReadFileNoIntr(fd, &pSolProc->ProcStatus, cbProcStatus);
+ close(fd);
}
else
{
@@ -468,38 +507,38 @@ static int ProcReadStatus(PVBOXCORE pVBoxCore)
/**
* Read process credential information (format prcred_t + array of guid_t)
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @remarks Should not be called before successful call to @see AllocMemoryArea()
* @return IPRT status code.
*/
-static int ProcReadCred(PVBOXCORE pVBoxCore)
+static int ProcReadCred(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
- return ProcReadFileInto(pVBoxCore, "cred", &pVBoxProc->pvCred, &pVBoxProc->cbCred);
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
+ return ProcReadFileInto(pSolCore, "cred", &pSolProc->pvCred, &pSolProc->cbCred);
}
/**
* Read process privilege information (format prpriv_t + array of priv_chunk_t)
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @remarks Should not be called before successful call to @see AllocMemoryArea()
* @return IPRT status code.
*/
-static int ProcReadPriv(PVBOXCORE pVBoxCore)
+static int ProcReadPriv(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
- int rc = ProcReadFileInto(pVBoxCore, "priv", (void **)&pVBoxProc->pPriv, &pVBoxProc->cbPriv);
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
+ int rc = ProcReadFileInto(pSolCore, "priv", (void **)&pSolProc->pPriv, &pSolProc->cbPriv);
if (RT_FAILURE(rc))
return rc;
- pVBoxProc->pcPrivImpl = getprivimplinfo();
- if (!pVBoxProc->pcPrivImpl)
+ pSolProc->pcPrivImpl = getprivimplinfo();
+ if (!pSolProc->pcPrivImpl)
{
CORELOGRELSYS((CORELOG_NAME "ProcReadPriv: getprivimplinfo returned NULL.\n"));
return VERR_INVALID_STATE;
@@ -511,36 +550,36 @@ static int ProcReadPriv(PVBOXCORE pVBoxCore)
/**
* Read process LDT information (format array of struct ssd) from /proc.
*
- * @param pVBoxProc Pointer to the core object.
+ * @param pSolProc Pointer to the core object.
*
* @remarks Should not be called before successful call to @see AllocMemoryArea()
* @return IPRT status code.
*/
-static int ProcReadLdt(PVBOXCORE pVBoxCore)
+static int ProcReadLdt(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
- return ProcReadFileInto(pVBoxCore, "ldt", &pVBoxProc->pvLdt, &pVBoxProc->cbLdt);
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
+ return ProcReadFileInto(pSolCore, "ldt", &pSolProc->pvLdt, &pSolProc->cbLdt);
}
/**
* Read process auxiliary vectors (format auxv_t) for the process.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @remarks Should not be called before successful call to @see AllocMemoryArea()
* @return IPRT status code.
*/
-static int ProcReadAuxVecs(PVBOXCORE pVBoxCore)
+static int ProcReadAuxVecs(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
char szPath[PATH_MAX];
int rc = VINF_SUCCESS;
- RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/auxv", (int)pVBoxProc->Process);
+ RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/auxv", (int)pSolProc->Process);
int fd = open(szPath, O_RDONLY);
if (fd < 0)
{
@@ -549,40 +588,35 @@ static int ProcReadAuxVecs(PVBOXCORE pVBoxCore)
return rc;
}
- RTFILE hFile = fd;
- uint64_t u64Size;
- RTFileGetSize(hFile, &u64Size);
- size_t cbAuxFile = u64Size < ~(size_t)0 ? u64Size : ~(size_t)0;
+ size_t cbAuxFile = GetFileSizeByFd(fd);
if (cbAuxFile >= sizeof(auxv_t))
{
- pVBoxProc->pAuxVecs = (auxv_t*)GetMemoryChunk(pVBoxCore, cbAuxFile + sizeof(auxv_t));
- if (pVBoxProc->pAuxVecs)
+ pSolProc->pAuxVecs = (auxv_t*)GetMemoryChunk(pSolCore, cbAuxFile + sizeof(auxv_t));
+ if (pSolProc->pAuxVecs)
{
- rc = ReadFileNoIntr(hFile, pVBoxProc->pAuxVecs, cbAuxFile);
+ rc = ReadFileNoIntr(fd, pSolProc->pAuxVecs, cbAuxFile);
if (RT_SUCCESS(rc))
{
/* Terminate list of vectors */
- pVBoxProc->cAuxVecs = cbAuxFile / sizeof(auxv_t);
+ pSolProc->cAuxVecs = cbAuxFile / sizeof(auxv_t);
CORELOG((CORELOG_NAME "ProcReadAuxVecs: cbAuxFile=%u auxv_t size %d cAuxVecs=%u\n", cbAuxFile, sizeof(auxv_t),
- pVBoxProc->cAuxVecs));
- if (pVBoxProc->cAuxVecs > 0)
+ pSolProc->cAuxVecs));
+ if (pSolProc->cAuxVecs > 0)
{
- pVBoxProc->pAuxVecs[pVBoxProc->cAuxVecs].a_type = AT_NULL;
- pVBoxProc->pAuxVecs[pVBoxProc->cAuxVecs].a_un.a_val = 0L;
- RTFileClose(hFile);
+ pSolProc->pAuxVecs[pSolProc->cAuxVecs].a_type = AT_NULL;
+ pSolProc->pAuxVecs[pSolProc->cAuxVecs].a_un.a_val = 0L;
+ close(fd);
return VINF_SUCCESS;
}
- else
- {
- CORELOGRELSYS((CORELOG_NAME "ProcReadAuxVecs: Invalid vector count %u\n", pVBoxProc->cAuxVecs));
- rc = VERR_READ_ERROR;
- }
+
+ CORELOGRELSYS((CORELOG_NAME "ProcReadAuxVecs: Invalid vector count %u\n", pSolProc->cAuxVecs));
+ rc = VERR_READ_ERROR;
}
else
CORELOGRELSYS((CORELOG_NAME "ProcReadAuxVecs: ReadFileNoIntr failed. rc=%Rrc cbAuxFile=%u\n", rc, cbAuxFile));
- pVBoxProc->pAuxVecs = NULL;
- pVBoxProc->cAuxVecs = 0;
+ pSolProc->pAuxVecs = NULL;
+ pSolProc->cAuxVecs = 0;
}
else
{
@@ -596,7 +630,7 @@ static int ProcReadAuxVecs(PVBOXCORE pVBoxCore)
rc = VERR_READ_ERROR;
}
- RTFileClose(hFile);
+ close(fd);
return rc;
}
@@ -604,12 +638,12 @@ static int ProcReadAuxVecs(PVBOXCORE pVBoxCore)
/*
* Find an element in the process' auxiliary vector.
*/
-static long GetAuxVal(PVBOXPROCESS pVBoxProc, int Type)
+static long GetAuxVal(PRTSOLCOREPROCESS pSolProc, int Type)
{
- AssertReturn(pVBoxProc, -1);
- if (pVBoxProc->pAuxVecs)
+ AssertReturn(pSolProc, -1);
+ if (pSolProc->pAuxVecs)
{
- auxv_t *pAuxVec = pVBoxProc->pAuxVecs;
+ auxv_t *pAuxVec = pSolProc->pAuxVecs;
for (; pAuxVec->a_type != AT_NULL; pAuxVec++)
{
if (pAuxVec->a_type == Type)
@@ -623,64 +657,59 @@ static long GetAuxVal(PVBOXPROCESS pVBoxProc, int Type)
/**
* Read the process mappings (format prmap_t array).
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @remarks Should not be called before successful call to @see AllocMemoryArea()
* @return IPRT status code.
*/
-static int ProcReadMappings(PVBOXCORE pVBoxCore)
+static int ProcReadMappings(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
char szPath[PATH_MAX];
int rc = VINF_SUCCESS;
- RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/map", (int)pVBoxProc->Process);
- int fd = open(szPath, O_RDONLY);
- if (fd < 0)
+ RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/map", (int)pSolProc->Process);
+ int fdMap = open(szPath, O_RDONLY);
+ if (fdMap < 0)
{
- rc = RTErrConvertFromErrno(fd);
+ rc = RTErrConvertFromErrno(errno);
CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: failed to open %s. rc=%Rrc\n", szPath, rc));
return rc;
}
- RTFILE hFile = fd;
- RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/as", (int)pVBoxProc->Process);
- fd = open(szPath, O_RDONLY);
- if (fd >= 0)
+ RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/as", (int)pSolProc->Process);
+ pSolProc->fdAs = open(szPath, O_RDONLY);
+ if (pSolProc->fdAs >= 0)
{
- pVBoxProc->hAs = fd;
-
/*
* Allocate and read all the prmap_t objects from proc.
*/
- uint64_t u64Size;
- RTFileGetSize(hFile, &u64Size);
- size_t cbMapFile = u64Size < ~(size_t)0 ? u64Size : ~(size_t)0;
+ size_t cbMapFile = GetFileSizeByFd(fdMap);
if (cbMapFile >= sizeof(prmap_t))
{
- prmap_t *pMap = (prmap_t*)GetMemoryChunk(pVBoxCore, cbMapFile);
+ prmap_t *pMap = (prmap_t*)GetMemoryChunk(pSolCore, cbMapFile);
if (pMap)
{
- rc = ReadFileNoIntr(hFile, pMap, cbMapFile);
+ rc = ReadFileNoIntr(fdMap, pMap, cbMapFile);
if (RT_SUCCESS(rc))
{
- pVBoxProc->cMappings = cbMapFile / sizeof(prmap_t);
- if (pVBoxProc->cMappings > 0)
+ pSolProc->cMappings = cbMapFile / sizeof(prmap_t);
+ if (pSolProc->cMappings > 0)
{
/*
- * Allocate for each prmap_t object, a corresponding VBOXSOLMAPINFO object.
+ * Allocate for each prmap_t object, a corresponding RTSOLCOREMAPINFO object.
*/
- pVBoxProc->pMapInfoHead = (PVBOXSOLMAPINFO)GetMemoryChunk(pVBoxCore, pVBoxProc->cMappings * sizeof(VBOXSOLMAPINFO));
- if (pVBoxProc->pMapInfoHead)
+ pSolProc->pMapInfoHead = (PRTSOLCOREMAPINFO)GetMemoryChunk(pSolCore, pSolProc->cMappings * sizeof(RTSOLCOREMAPINFO));
+ if (pSolProc->pMapInfoHead)
{
/*
* Associate the prmap_t with the mapping info object.
*/
- Assert(pVBoxProc->pMapInfoHead == NULL);
- PVBOXSOLMAPINFO pCur = pVBoxProc->pMapInfoHead;
- PVBOXSOLMAPINFO pPrev = NULL;
- for (uint64_t i = 0; i < pVBoxProc->cMappings; i++, pMap++, pCur++)
+ /*Assert(pSolProc->pMapInfoHead == NULL); - does not make sense */
+ PRTSOLCOREMAPINFO pCur = pSolProc->pMapInfoHead;
+ PRTSOLCOREMAPINFO pPrev = NULL;
+ for (uint64_t i = 0; i < pSolProc->cMappings; i++, pMap++, pCur++)
{
memcpy(&pCur->pMap, pMap, sizeof(pCur->pMap));
if (pPrev)
@@ -696,7 +725,7 @@ static int ProcReadMappings(PVBOXCORE pVBoxCore)
while (k < pCur->pMap.pr_size)
{
size_t cb = RT_MIN(sizeof(achBuf), pCur->pMap.pr_size - k);
- int rc2 = ProcReadAddrSpace(pVBoxProc, pCur->pMap.pr_vaddr + k, &achBuf, cb);
+ int rc2 = ProcReadAddrSpace(pSolProc, pCur->pMap.pr_vaddr + k, &achBuf, cb);
if (RT_FAILURE(rc2))
{
CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: skipping mapping. vaddr=%#x rc=%Rrc\n",
@@ -721,22 +750,20 @@ static int ProcReadMappings(PVBOXCORE pVBoxCore)
if (pPrev)
pPrev->pNext = NULL;
- RTFileClose(hFile);
- RTFileClose(pVBoxProc->hAs);
- pVBoxProc->hAs = NIL_RTFILE;
- CORELOG((CORELOG_NAME "ProcReadMappings: successfully read in %u mappings\n", pVBoxProc->cMappings));
+ close(fdMap);
+ close(pSolProc->fdAs);
+ pSolProc->fdAs = -1;
+ CORELOG((CORELOG_NAME "ProcReadMappings: successfully read in %u mappings\n", pSolProc->cMappings));
return VINF_SUCCESS;
}
- else
- {
- CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: GetMemoryChunk failed %u\n",
- pVBoxProc->cMappings * sizeof(VBOXSOLMAPINFO)));
- rc = VERR_NO_MEMORY;
- }
+
+ CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: GetMemoryChunk failed %u\n",
+ pSolProc->cMappings * sizeof(RTSOLCOREMAPINFO)));
+ rc = VERR_NO_MEMORY;
}
else
{
- CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: Invalid mapping count %u\n", pVBoxProc->cMappings));
+ CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: Invalid mapping count %u\n", pSolProc->cMappings));
rc = VERR_READ_ERROR;
}
}
@@ -750,13 +777,13 @@ static int ProcReadMappings(PVBOXCORE pVBoxCore)
}
}
- RTFileClose(pVBoxProc->hAs);
- pVBoxProc->hAs = NIL_RTFILE;
+ close(pSolProc->fdAs);
+ pSolProc->fdAs = -1;
}
else
CORELOGRELSYS((CORELOG_NAME "ProcReadMappings: failed to open %s. rc=%Rrc\n", szPath, rc));
- RTFileClose(hFile);
+ close(fdMap);
return rc;
}
@@ -764,17 +791,17 @@ static int ProcReadMappings(PVBOXCORE pVBoxCore)
/**
* Reads the thread information for all threads in the process.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @remarks Should not be called before successful call to @see AllocMemoryArea()
* @return IPRT status code.
*/
-static int ProcReadThreads(PVBOXCORE pVBoxCore)
+static int ProcReadThreads(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
- AssertReturn(pVBoxProc->pCurThreadCtx, VERR_NO_DATA);
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
+ AssertReturn(pSolProc->pCurThreadCtx, VERR_NO_DATA);
/*
* Read the information for threads.
@@ -782,7 +809,7 @@ static int ProcReadThreads(PVBOXCORE pVBoxCore)
*/
size_t cbInfoHdrAndData;
void *pvInfoHdr = NULL;
- int rc = ProcReadFileInto(pVBoxCore, "lpsinfo", &pvInfoHdr, &cbInfoHdrAndData);
+ int rc = ProcReadFileInto(pSolCore, "lpsinfo", &pvInfoHdr, &cbInfoHdrAndData);
if (RT_SUCCESS(rc))
{
/*
@@ -791,7 +818,7 @@ static int ProcReadThreads(PVBOXCORE pVBoxCore)
*/
void *pvStatusHdr = NULL;
size_t cbStatusHdrAndData;
- rc = ProcReadFileInto(pVBoxCore, "lstatus", &pvStatusHdr, &cbStatusHdrAndData);
+ rc = ProcReadFileInto(pSolCore, "lstatus", &pvStatusHdr, &cbStatusHdrAndData);
if (RT_SUCCESS(rc))
{
prheader_t *pInfoHdr = (prheader_t *)pvInfoHdr;
@@ -843,12 +870,12 @@ static int ProcReadThreads(PVBOXCORE pVBoxCore)
cInfo = pInfoHdr->pr_nent;
cStatus = pInfoHdr->pr_nent;
- size_t cbThreadInfo = RT_MAX(cStatus, cInfo) * sizeof(VBOXSOLTHREADINFO);
- pVBoxProc->pThreadInfoHead = (PVBOXSOLTHREADINFO)GetMemoryChunk(pVBoxCore, cbThreadInfo);
- if (pVBoxProc->pThreadInfoHead)
+ size_t cbThreadInfo = RT_MAX(cStatus, cInfo) * sizeof(RTSOLCORETHREADINFO);
+ pSolProc->pThreadInfoHead = (PRTSOLCORETHREADINFO)GetMemoryChunk(pSolCore, cbThreadInfo);
+ if (pSolProc->pThreadInfoHead)
{
- PVBOXSOLTHREADINFO pCur = pVBoxProc->pThreadInfoHead;
- PVBOXSOLTHREADINFO pPrev = NULL;
+ PRTSOLCORETHREADINFO pCur = pSolProc->pThreadInfoHead;
+ PRTSOLCORETHREADINFO pPrev = NULL;
for (uint64_t i = 0; i < cInfo; i++, pCur++)
{
pCur->Info = *pInfo;
@@ -860,16 +887,16 @@ static int ProcReadThreads(PVBOXCORE pVBoxCore)
* when the core dump got initiated before whatever signal caused it.
*/
if ( pStatus /* noid droid */
- && pStatus->pr_lwpid == (id_t)pVBoxProc->hCurThread)
+ && pStatus->pr_lwpid == (id_t)pSolProc->hCurThread)
{
- AssertCompile(sizeof(pStatus->pr_reg) == sizeof(pVBoxProc->pCurThreadCtx->uc_mcontext.gregs));
- AssertCompile(sizeof(pStatus->pr_fpreg) == sizeof(pVBoxProc->pCurThreadCtx->uc_mcontext.fpregs));
- memcpy(&pStatus->pr_reg, &pVBoxProc->pCurThreadCtx->uc_mcontext.gregs, sizeof(pStatus->pr_reg));
- memcpy(&pStatus->pr_fpreg, &pVBoxProc->pCurThreadCtx->uc_mcontext.fpregs, sizeof(pStatus->pr_fpreg));
+ AssertCompile(sizeof(pStatus->pr_reg) == sizeof(pSolProc->pCurThreadCtx->uc_mcontext.gregs));
+ AssertCompile(sizeof(pStatus->pr_fpreg) == sizeof(pSolProc->pCurThreadCtx->uc_mcontext.fpregs));
+ memcpy(&pStatus->pr_reg, &pSolProc->pCurThreadCtx->uc_mcontext.gregs, sizeof(pStatus->pr_reg));
+ memcpy(&pStatus->pr_fpreg, &pSolProc->pCurThreadCtx->uc_mcontext.fpregs, sizeof(pStatus->pr_fpreg));
- AssertCompile(sizeof(pStatus->pr_lwphold) == sizeof(pVBoxProc->pCurThreadCtx->uc_sigmask));
- memcpy(&pStatus->pr_lwphold, &pVBoxProc->pCurThreadCtx->uc_sigmask, sizeof(pStatus->pr_lwphold));
- pStatus->pr_ustack = (uintptr_t)&pVBoxProc->pCurThreadCtx->uc_stack;
+ AssertCompile(sizeof(pStatus->pr_lwphold) == sizeof(pSolProc->pCurThreadCtx->uc_sigmask));
+ memcpy(&pStatus->pr_lwphold, &pSolProc->pCurThreadCtx->uc_sigmask, sizeof(pStatus->pr_lwphold));
+ pStatus->pr_ustack = (uintptr_t)&pSolProc->pCurThreadCtx->uc_stack;
CORELOG((CORELOG_NAME "ProcReadThreads: patched dumper thread context with pre-dump time context.\n"));
}
@@ -892,7 +919,7 @@ static int ProcReadThreads(PVBOXCORE pVBoxCore)
pPrev->pNext = NULL;
CORELOG((CORELOG_NAME "ProcReadThreads: successfully read %u threads.\n", cInfo));
- pVBoxProc->cThreads = cInfo;
+ pSolProc->cThreads = cInfo;
return VINF_SUCCESS;
}
else
@@ -926,43 +953,43 @@ static int ProcReadThreads(PVBOXCORE pVBoxCore)
* Reads miscellaneous information that is collected as part of a core file.
* This may include platform name, zone name and other OS-specific information.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @return IPRT status code.
*/
-static int ProcReadMiscInfo(PVBOXCORE pVBoxCore)
+static int ProcReadMiscInfo(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
#ifdef RT_OS_SOLARIS
/*
* Read the platform name, uname string and zone name.
*/
- int rc = sysinfo(SI_PLATFORM, pVBoxProc->szPlatform, sizeof(pVBoxProc->szPlatform));
+ int rc = sysinfo(SI_PLATFORM, pSolProc->szPlatform, sizeof(pSolProc->szPlatform));
if (rc == -1)
{
CORELOGRELSYS((CORELOG_NAME "ProcReadMiscInfo: sysinfo failed. rc=%d errno=%d\n", rc, errno));
return VERR_GENERAL_FAILURE;
}
- pVBoxProc->szPlatform[sizeof(pVBoxProc->szPlatform) - 1] = '\0';
+ pSolProc->szPlatform[sizeof(pSolProc->szPlatform) - 1] = '\0';
- rc = uname(&pVBoxProc->UtsName);
+ rc = uname(&pSolProc->UtsName);
if (rc == -1)
{
CORELOGRELSYS((CORELOG_NAME "ProcReadMiscInfo: uname failed. rc=%d errno=%d\n", rc, errno));
return VERR_GENERAL_FAILURE;
}
- rc = getzonenamebyid(pVBoxProc->ProcInfo.pr_zoneid, pVBoxProc->szZoneName, sizeof(pVBoxProc->szZoneName));
+ rc = getzonenamebyid(pSolProc->ProcInfo.pr_zoneid, pSolProc->szZoneName, sizeof(pSolProc->szZoneName));
if (rc < 0)
{
CORELOGRELSYS((CORELOG_NAME "ProcReadMiscInfo: getzonenamebyid failed. rc=%d errno=%d zoneid=%d\n", rc, errno,
- pVBoxProc->ProcInfo.pr_zoneid));
+ pSolProc->ProcInfo.pr_zoneid));
return VERR_GENERAL_FAILURE;
}
- pVBoxProc->szZoneName[sizeof(pVBoxProc->szZoneName) - 1] = '\0';
+ pSolProc->szZoneName[sizeof(pSolProc->szZoneName) - 1] = '\0';
rc = VINF_SUCCESS;
#else
@@ -976,16 +1003,16 @@ static int ProcReadMiscInfo(PVBOXCORE pVBoxCore)
* On Solaris use the old-style procfs interfaces but the core file still should have this
* info. for backward and GDB compatibility, hence the need for this ugly function.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param pInfo Pointer to the old prpsinfo_t structure to update.
*/
-static void GetOldProcessInfo(PVBOXCORE pVBoxCore, prpsinfo_t *pInfo)
+static void GetOldProcessInfo(PRTSOLCORE pSolCore, prpsinfo_t *pInfo)
{
- AssertReturnVoid(pVBoxCore);
+ AssertReturnVoid(pSolCore);
AssertReturnVoid(pInfo);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
- psinfo_t *pSrc = &pVBoxProc->ProcInfo;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
+ psinfo_t *pSrc = &pSolProc->ProcInfo;
memset(pInfo, 0, sizeof(prpsinfo_t));
pInfo->pr_state = pSrc->pr_lwp.pr_state;
pInfo->pr_zomb = (pInfo->pr_state == SZOMB);
@@ -1032,20 +1059,20 @@ static void GetOldProcessInfo(PVBOXCORE pVBoxCore, prpsinfo_t *pInfo)
* On Solaris use the old-style procfs interfaces but the core file still should have this
* info. for backward and GDB compatibility, hence the need for this ugly function.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param pInfo Pointer to the thread info.
* @param pStatus Pointer to the thread status.
* @param pDst Pointer to the old-style status structure to update.
*
*/
-static void GetOldProcessStatus(PVBOXCORE pVBoxCore, lwpsinfo_t *pInfo, lwpstatus_t *pStatus, prstatus_t *pDst)
+static void GetOldProcessStatus(PRTSOLCORE pSolCore, lwpsinfo_t *pInfo, lwpstatus_t *pStatus, prstatus_t *pDst)
{
- AssertReturnVoid(pVBoxCore);
+ AssertReturnVoid(pSolCore);
AssertReturnVoid(pInfo);
AssertReturnVoid(pStatus);
AssertReturnVoid(pDst);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
memset(pDst, 0, sizeof(prstatus_t));
if (pStatus->pr_flags & PR_STOPPED)
pDst->pr_flags = 0x0001;
@@ -1095,20 +1122,20 @@ static void GetOldProcessStatus(PVBOXCORE pVBoxCore, lwpsinfo_t *pInfo, lwpstatu
memcpy(pDst->pr_sysarg, pStatus->pr_sysarg, sizeof(pDst->pr_sysarg));
RTStrCopy(pDst->pr_clname, sizeof(pDst->pr_clname), pStatus->pr_clname);
- pDst->pr_nlwp = pVBoxProc->ProcStatus.pr_nlwp;
- pDst->pr_sigpend = pVBoxProc->ProcStatus.pr_sigpend;
- pDst->pr_pid = pVBoxProc->ProcStatus.pr_pid;
- pDst->pr_ppid = pVBoxProc->ProcStatus.pr_ppid;
- pDst->pr_pgrp = pVBoxProc->ProcStatus.pr_pgid;
- pDst->pr_sid = pVBoxProc->ProcStatus.pr_sid;
- pDst->pr_utime = pVBoxProc->ProcStatus.pr_utime;
- pDst->pr_stime = pVBoxProc->ProcStatus.pr_stime;
- pDst->pr_cutime = pVBoxProc->ProcStatus.pr_cutime;
- pDst->pr_cstime = pVBoxProc->ProcStatus.pr_cstime;
- pDst->pr_brkbase = (caddr_t)pVBoxProc->ProcStatus.pr_brkbase;
- pDst->pr_brksize = pVBoxProc->ProcStatus.pr_brksize;
- pDst->pr_stkbase = (caddr_t)pVBoxProc->ProcStatus.pr_stkbase;
- pDst->pr_stksize = pVBoxProc->ProcStatus.pr_stksize;
+ pDst->pr_nlwp = pSolProc->ProcStatus.pr_nlwp;
+ pDst->pr_sigpend = pSolProc->ProcStatus.pr_sigpend;
+ pDst->pr_pid = pSolProc->ProcStatus.pr_pid;
+ pDst->pr_ppid = pSolProc->ProcStatus.pr_ppid;
+ pDst->pr_pgrp = pSolProc->ProcStatus.pr_pgid;
+ pDst->pr_sid = pSolProc->ProcStatus.pr_sid;
+ pDst->pr_utime = pSolProc->ProcStatus.pr_utime;
+ pDst->pr_stime = pSolProc->ProcStatus.pr_stime;
+ pDst->pr_cutime = pSolProc->ProcStatus.pr_cutime;
+ pDst->pr_cstime = pSolProc->ProcStatus.pr_cstime;
+ pDst->pr_brkbase = (caddr_t)pSolProc->ProcStatus.pr_brkbase;
+ pDst->pr_brksize = pSolProc->ProcStatus.pr_brksize;
+ pDst->pr_stkbase = (caddr_t)pSolProc->ProcStatus.pr_stkbase;
+ pDst->pr_stksize = pSolProc->ProcStatus.pr_stksize;
pDst->pr_processor = (short)pInfo->pr_onpro;
pDst->pr_bind = (short)pInfo->pr_bindpro;
@@ -1119,19 +1146,19 @@ static void GetOldProcessStatus(PVBOXCORE pVBoxCore, lwpsinfo_t *pInfo, lwpstatu
/**
* Callback for rtCoreDumperForEachThread to suspend a thread.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param pvThreadInfo Opaque pointer to thread information.
*
* @return IPRT status code.
*/
-static int suspendThread(PVBOXCORE pVBoxCore, void *pvThreadInfo)
+static int suspendThread(PRTSOLCORE pSolCore, void *pvThreadInfo)
{
AssertPtrReturn(pvThreadInfo, VERR_INVALID_POINTER);
- NOREF(pVBoxCore);
+ NOREF(pSolCore);
lwpsinfo_t *pThreadInfo = (lwpsinfo_t *)pvThreadInfo;
CORELOG((CORELOG_NAME ":suspendThread %d\n", (lwpid_t)pThreadInfo->pr_lwpid));
- if ((lwpid_t)pThreadInfo->pr_lwpid != pVBoxCore->VBoxProc.hCurThread)
+ if ((lwpid_t)pThreadInfo->pr_lwpid != pSolCore->SolProc.hCurThread)
_lwp_suspend(pThreadInfo->pr_lwpid);
return VINF_SUCCESS;
}
@@ -1140,19 +1167,19 @@ static int suspendThread(PVBOXCORE pVBoxCore, void *pvThreadInfo)
/**
* Callback for rtCoreDumperForEachThread to resume a thread.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param pvThreadInfo Opaque pointer to thread information.
*
* @return IPRT status code.
*/
-static int resumeThread(PVBOXCORE pVBoxCore, void *pvThreadInfo)
+static int resumeThread(PRTSOLCORE pSolCore, void *pvThreadInfo)
{
AssertPtrReturn(pvThreadInfo, VERR_INVALID_POINTER);
- NOREF(pVBoxCore);
+ NOREF(pSolCore);
lwpsinfo_t *pThreadInfo = (lwpsinfo_t *)pvThreadInfo;
CORELOG((CORELOG_NAME ":resumeThread %d\n", (lwpid_t)pThreadInfo->pr_lwpid));
- if ((lwpid_t)pThreadInfo->pr_lwpid != (lwpid_t)pVBoxCore->VBoxProc.hCurThread)
+ if ((lwpid_t)pThreadInfo->pr_lwpid != (lwpid_t)pSolCore->SolProc.hCurThread)
_lwp_continue(pThreadInfo->pr_lwpid);
return VINF_SUCCESS;
}
@@ -1161,44 +1188,42 @@ static int resumeThread(PVBOXCORE pVBoxCore, void *pvThreadInfo)
/**
* Calls a thread worker function for all threads in the process as described by /proc
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param pcThreads Number of threads read.
* @param pfnWorker Callback function for each thread.
*
* @return IPRT status code.
*/
-static int rtCoreDumperForEachThread(PVBOXCORE pVBoxCore, uint64_t *pcThreads, PFNCORETHREADWORKER pfnWorker)
+static int rtCoreDumperForEachThread(PRTSOLCORE pSolCore, uint64_t *pcThreads, PFNRTSOLCORETHREADWORKER pfnWorker)
{
- AssertPtrReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertPtrReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
/*
* Read the information for threads.
* Format: prheader_t + array of lwpsinfo_t's.
*/
char szLpsInfoPath[PATH_MAX];
- RTStrPrintf(szLpsInfoPath, sizeof(szLpsInfoPath), "/proc/%d/lpsinfo", (int)pVBoxProc->Process);
+ RTStrPrintf(szLpsInfoPath, sizeof(szLpsInfoPath), "/proc/%d/lpsinfo", (int)pSolProc->Process);
int rc = VINF_SUCCESS;
int fd = open(szLpsInfoPath, O_RDONLY);
if (fd >= 0)
{
- RTFILE hFile = fd;
- uint64_t u64Size;
- RTFileGetSize(hFile, &u64Size);
- size_t cbInfoHdrAndData = u64Size < ~(size_t)0 ? u64Size : ~(size_t)0;
- void *pvInfoHdr = mmap(NULL, cbInfoHdrAndData, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1 /* fd */, 0 /* offset */);
+ size_t cbInfoHdrAndData = GetFileSizeByFd(fd);
+ void *pvInfoHdr = mmap(NULL, cbInfoHdrAndData, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
+ -1 /* fd */, 0 /* offset */);
if (pvInfoHdr != MAP_FAILED)
{
- rc = RTFileRead(hFile, pvInfoHdr, cbInfoHdrAndData, NULL);
+ rc = ReadFileNoIntr(fd, pvInfoHdr, cbInfoHdrAndData);
if (RT_SUCCESS(rc))
{
prheader_t *pHeader = (prheader_t *)pvInfoHdr;
lwpsinfo_t *pThreadInfo = (lwpsinfo_t *)((uintptr_t)pvInfoHdr + sizeof(prheader_t));
for (long i = 0; i < pHeader->pr_nent; i++)
{
- pfnWorker(pVBoxCore, pThreadInfo);
+ pfnWorker(pSolCore, pThreadInfo);
pThreadInfo = (lwpsinfo_t *)((uintptr_t)pThreadInfo + pHeader->pr_entsize);
}
if (pcThreads)
@@ -1209,7 +1234,7 @@ static int rtCoreDumperForEachThread(PVBOXCORE pVBoxCore, uint64_t *pcThreads,
}
else
rc = VERR_NO_MEMORY;
- RTFileClose(hFile);
+ close(fd);
}
else
rc = RTErrConvertFromErrno(rc);
@@ -1221,26 +1246,26 @@ static int rtCoreDumperForEachThread(PVBOXCORE pVBoxCore, uint64_t *pcThreads,
/**
* Resume all threads of this process.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @return IPRT status code..
*/
-static int rtCoreDumperResumeThreads(PVBOXCORE pVBoxCore)
+static int rtCoreDumperResumeThreads(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
#if 1
uint64_t cThreads;
- return rtCoreDumperForEachThread(pVBoxCore, &cThreads, resumeThread);
+ return rtCoreDumperForEachThread(pSolCore, &cThreads, resumeThread);
#else
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
char szCurThread[128];
char szPath[PATH_MAX];
PRTDIR pDir = NULL;
- RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/lwp", (int)pVBoxProc->Process);
- RTStrPrintf(szCurThread, sizeof(szCurThread), "%d", (int)pVBoxProc->hCurThread);
+ RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/lwp", (int)pSolProc->Process);
+ RTStrPrintf(szCurThread, sizeof(szCurThread), "%d", (int)pSolProc->hCurThread);
int32_t cRunningThreads = 0;
int rc = RTDirOpen(&pDir, szPath);
@@ -1280,13 +1305,13 @@ static int rtCoreDumperResumeThreads(PVBOXCORE pVBoxCore)
/**
* Stop all running threads of this process except the current one.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @return IPRT status code.
*/
-static int rtCoreDumperSuspendThreads(PVBOXCORE pVBoxCore)
+static int rtCoreDumperSuspendThreads(PRTSOLCORE pSolCore)
{
- AssertPtrReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertPtrReturn(pSolCore, VERR_INVALID_POINTER);
/*
* This function tries to ensures while we suspend threads, no newly spawned threads
@@ -1302,7 +1327,7 @@ static int rtCoreDumperSuspendThreads(PVBOXCORE pVBoxCore)
size_t cb = 0;
for (cTries = 0; cTries < RT_ELEMENTS(aThreads); cTries++)
{
- rc = rtCoreDumperForEachThread(pVBoxCore, &aThreads[cTries], suspendThread);
+ rc = rtCoreDumperForEachThread(pSolCore, &aThreads[cTries], suspendThread);
if (RT_FAILURE(rc))
break;
}
@@ -1314,14 +1339,14 @@ static int rtCoreDumperSuspendThreads(PVBOXCORE pVBoxCore)
}
return rc;
#else
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
char szCurThread[128];
char szPath[PATH_MAX];
PRTDIR pDir = NULL;
- RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/lwp", (int)pVBoxProc->Process);
- RTStrPrintf(szCurThread, sizeof(szCurThread), "%d", (int)pVBoxProc->hCurThread);
+ RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/lwp", (int)pSolProc->Process);
+ RTStrPrintf(szCurThread, sizeof(szCurThread), "%d", (int)pSolProc->hCurThread);
int rc = -1;
uint32_t cThreads = 0;
@@ -1390,20 +1415,20 @@ static inline size_t ElfNoteHeaderSize(size_t cb)
/**
* Write an ELF NOTE header into the core file.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param Type Type of this NOTE section.
* @param pcv Opaque pointer to the data, if NULL only computes size.
* @param cb Size of the data.
*
* @return IPRT status code.
*/
-static int ElfWriteNoteHeader(PVBOXCORE pVBoxCore, uint_t Type, const void *pcv, size_t cb)
+static int ElfWriteNoteHeader(PRTSOLCORE pSolCore, uint_t Type, const void *pcv, size_t cb)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
AssertReturn(pcv, VERR_INVALID_POINTER);
AssertReturn(cb > 0, VERR_NO_DATA);
- AssertReturn(pVBoxCore->pfnWriter, VERR_WRITE_ERROR);
- AssertReturn(pVBoxCore->hCoreFile, VERR_INVALID_HANDLE);
+ AssertReturn(pSolCore->pfnWriter, VERR_WRITE_ERROR);
+ AssertReturn(pSolCore->fdCoreFile >= 0, VERR_INVALID_HANDLE);
int rc = VERR_GENERAL_FAILURE;
#ifdef RT_OS_SOLARIS
@@ -1427,14 +1452,14 @@ static int ElfWriteNoteHeader(PVBOXCORE pVBoxCore, uint_t Type, const void *pcv,
/*
* Write note header and description.
*/
- rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, &ElfNoteHdr, sizeof(ElfNoteHdr));
+ rc = pSolCore->pfnWriter(pSolCore->fdCoreFile, &ElfNoteHdr, sizeof(ElfNoteHdr));
if (RT_SUCCESS(rc))
{
- rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, pcv, cb);
+ rc = pSolCore->pfnWriter(pSolCore->fdCoreFile, pcv, cb);
if (RT_SUCCESS(rc))
{
if (cbAlign > cb)
- rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, s_achPad, cbAlign - cb);
+ rc = pSolCore->pfnWriter(pSolCore->fdCoreFile, s_achPad, cbAlign - cb);
}
}
@@ -1451,24 +1476,24 @@ static int ElfWriteNoteHeader(PVBOXCORE pVBoxCore, uint_t Type, const void *pcv,
* Computes the size of NOTE section for the given core type.
* Solaris has two types of program header information (new and old).
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param enmType Type of core file information required.
*
* @return Size of NOTE section.
*/
-static size_t ElfNoteSectionSize(PVBOXCORE pVBoxCore, VBOXSOLCORETYPE enmType)
+static size_t ElfNoteSectionSize(PRTSOLCORE pSolCore, RTSOLCORETYPE enmType)
{
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
size_t cb = 0;
switch (enmType)
{
case enmOldEra:
{
cb += ElfNoteHeaderSize(sizeof(prpsinfo_t));
- cb += ElfNoteHeaderSize(pVBoxProc->cAuxVecs * sizeof(auxv_t));
- cb += ElfNoteHeaderSize(strlen(pVBoxProc->szPlatform));
+ cb += ElfNoteHeaderSize(pSolProc->cAuxVecs * sizeof(auxv_t));
+ cb += ElfNoteHeaderSize(strlen(pSolProc->szPlatform));
- PVBOXSOLTHREADINFO pThreadInfo = pVBoxProc->pThreadInfoHead;
+ PRTSOLCORETHREADINFO pThreadInfo = pSolProc->pThreadInfoHead;
while (pThreadInfo)
{
if (pThreadInfo->pStatus)
@@ -1486,23 +1511,23 @@ static size_t ElfNoteSectionSize(PVBOXCORE pVBoxCore, VBOXSOLCORETYPE enmType)
{
cb += ElfNoteHeaderSize(sizeof(psinfo_t));
cb += ElfNoteHeaderSize(sizeof(pstatus_t));
- cb += ElfNoteHeaderSize(pVBoxProc->cAuxVecs * sizeof(auxv_t));
- cb += ElfNoteHeaderSize(strlen(pVBoxProc->szPlatform) + 1);
+ cb += ElfNoteHeaderSize(pSolProc->cAuxVecs * sizeof(auxv_t));
+ cb += ElfNoteHeaderSize(strlen(pSolProc->szPlatform) + 1);
cb += ElfNoteHeaderSize(sizeof(struct utsname));
cb += ElfNoteHeaderSize(sizeof(core_content_t));
- cb += ElfNoteHeaderSize(pVBoxProc->cbCred);
+ cb += ElfNoteHeaderSize(pSolProc->cbCred);
- if (pVBoxProc->pPriv)
- cb += ElfNoteHeaderSize(PRIV_PRPRIV_SIZE(pVBoxProc->pPriv)); /* Ought to be same as cbPriv!? */
+ if (pSolProc->pPriv)
+ cb += ElfNoteHeaderSize(PRIV_PRPRIV_SIZE(pSolProc->pPriv)); /* Ought to be same as cbPriv!? */
- if (pVBoxProc->pcPrivImpl)
- cb += ElfNoteHeaderSize(PRIV_IMPL_INFO_SIZE(pVBoxProc->pcPrivImpl));
+ if (pSolProc->pcPrivImpl)
+ cb += ElfNoteHeaderSize(PRIV_IMPL_INFO_SIZE(pSolProc->pcPrivImpl));
- cb += ElfNoteHeaderSize(strlen(pVBoxProc->szZoneName) + 1);
- if (pVBoxProc->cbLdt > 0)
- cb += ElfNoteHeaderSize(pVBoxProc->cbLdt);
+ cb += ElfNoteHeaderSize(strlen(pSolProc->szZoneName) + 1);
+ if (pSolProc->cbLdt > 0)
+ cb += ElfNoteHeaderSize(pSolProc->cbLdt);
- PVBOXSOLTHREADINFO pThreadInfo = pVBoxProc->pThreadInfoHead;
+ PRTSOLCORETHREADINFO pThreadInfo = pSolProc->pThreadInfoHead;
while (pThreadInfo)
{
cb += ElfNoteHeaderSize(sizeof(lwpsinfo_t));
@@ -1530,20 +1555,20 @@ static size_t ElfNoteSectionSize(PVBOXCORE pVBoxCore, VBOXSOLCORETYPE enmType)
* Write the note section for the given era into the core file.
* Solaris has two types of program header information (new and old).
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param enmType Type of core file information required.
*
* @return IPRT status code.
*/
-static int ElfWriteNoteSection(PVBOXCORE pVBoxCore, VBOXSOLCORETYPE enmType)
+static int ElfWriteNoteSection(PRTSOLCORE pSolCore, RTSOLCORETYPE enmType)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
int rc = VERR_GENERAL_FAILURE;
#ifdef RT_OS_SOLARIS
- typedef int (*PFNELFWRITENOTEHDR)(PVBOXCORE pVBoxCore, uint_t, const void *pcv, size_t cb);
+ typedef int (*PFNELFWRITENOTEHDR)(PRTSOLCORE pSolCore, uint_t, const void *pcv, size_t cb);
typedef struct ELFWRITENOTE
{
const char *pszType;
@@ -1558,14 +1583,14 @@ static int ElfWriteNoteSection(PVBOXCORE pVBoxCore, VBOXSOLCORETYPE enmType)
{
ELFWRITENOTE aElfNotes[] =
{
- { "NT_PRPSINFO", NT_PRPSINFO, &pVBoxProc->ProcInfoOld, sizeof(prpsinfo_t) },
- { "NT_AUXV", NT_AUXV, pVBoxProc->pAuxVecs, pVBoxProc->cAuxVecs * sizeof(auxv_t) },
- { "NT_PLATFORM", NT_PLATFORM, pVBoxProc->szPlatform, strlen(pVBoxProc->szPlatform) + 1 }
+ { "NT_PRPSINFO", NT_PRPSINFO, &pSolProc->ProcInfoOld, sizeof(prpsinfo_t) },
+ { "NT_AUXV", NT_AUXV, pSolProc->pAuxVecs, pSolProc->cAuxVecs * sizeof(auxv_t) },
+ { "NT_PLATFORM", NT_PLATFORM, pSolProc->szPlatform, strlen(pSolProc->szPlatform) + 1 }
};
for (unsigned i = 0; i < RT_ELEMENTS(aElfNotes); i++)
{
- rc = ElfWriteNoteHeader(pVBoxCore, aElfNotes[i].Type, aElfNotes[i].pcv, aElfNotes[i].cb);
+ rc = ElfWriteNoteHeader(pSolCore, aElfNotes[i].Type, aElfNotes[i].pcv, aElfNotes[i].cb);
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "ElfWriteNoteSection: ElfWriteNoteHeader failed for %s. rc=%Rrc\n", aElfNotes[i].pszType, rc));
@@ -1577,18 +1602,18 @@ static int ElfWriteNoteSection(PVBOXCORE pVBoxCore, VBOXSOLCORETYPE enmType)
* Write old-style thread info., they contain nothing about zombies,
* so we just skip if there is no status information for them.
*/
- PVBOXSOLTHREADINFO pThreadInfo = pVBoxProc->pThreadInfoHead;
+ PRTSOLCORETHREADINFO pThreadInfo = pSolProc->pThreadInfoHead;
for (; pThreadInfo; pThreadInfo = pThreadInfo->pNext)
{
if (!pThreadInfo->pStatus)
continue;
prstatus_t OldProcessStatus;
- GetOldProcessStatus(pVBoxCore, &pThreadInfo->Info, pThreadInfo->pStatus, &OldProcessStatus);
- rc = ElfWriteNoteHeader(pVBoxCore, NT_PRSTATUS, &OldProcessStatus, sizeof(prstatus_t));
+ GetOldProcessStatus(pSolCore, &pThreadInfo->Info, pThreadInfo->pStatus, &OldProcessStatus);
+ rc = ElfWriteNoteHeader(pSolCore, NT_PRSTATUS, &OldProcessStatus, sizeof(prstatus_t));
if (RT_SUCCESS(rc))
{
- rc = ElfWriteNoteHeader(pVBoxCore, NT_PRFPREG, &pThreadInfo->pStatus->pr_fpreg, sizeof(prfpregset_t));
+ rc = ElfWriteNoteHeader(pSolCore, NT_PRFPREG, &pThreadInfo->pStatus->pr_fpreg, sizeof(prfpregset_t));
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "ElfWriteSegment: ElfWriteNote failed for NT_PRFPREF. rc=%Rrc\n", rc));
@@ -1608,21 +1633,21 @@ static int ElfWriteNoteSection(PVBOXCORE pVBoxCore, VBOXSOLCORETYPE enmType)
{
ELFWRITENOTE aElfNotes[] =
{
- { "NT_PSINFO", NT_PSINFO, &pVBoxProc->ProcInfo, sizeof(psinfo_t) },
- { "NT_PSTATUS", NT_PSTATUS, &pVBoxProc->ProcStatus, sizeof(pstatus_t) },
- { "NT_AUXV", NT_AUXV, pVBoxProc->pAuxVecs, pVBoxProc->cAuxVecs * sizeof(auxv_t) },
- { "NT_PLATFORM", NT_PLATFORM, pVBoxProc->szPlatform, strlen(pVBoxProc->szPlatform) + 1 },
- { "NT_UTSNAME", NT_UTSNAME, &pVBoxProc->UtsName, sizeof(struct utsname) },
- { "NT_CONTENT", NT_CONTENT, &pVBoxProc->CoreContent, sizeof(core_content_t) },
- { "NT_PRCRED", NT_PRCRED, pVBoxProc->pvCred, pVBoxProc->cbCred },
- { "NT_PRPRIV", NT_PRPRIV, pVBoxProc->pPriv, PRIV_PRPRIV_SIZE(pVBoxProc->pPriv) },
- { "NT_PRPRIVINFO", NT_PRPRIVINFO, pVBoxProc->pcPrivImpl, PRIV_IMPL_INFO_SIZE(pVBoxProc->pcPrivImpl) },
- { "NT_ZONENAME", NT_ZONENAME, pVBoxProc->szZoneName, strlen(pVBoxProc->szZoneName) + 1 }
+ { "NT_PSINFO", NT_PSINFO, &pSolProc->ProcInfo, sizeof(psinfo_t) },
+ { "NT_PSTATUS", NT_PSTATUS, &pSolProc->ProcStatus, sizeof(pstatus_t) },
+ { "NT_AUXV", NT_AUXV, pSolProc->pAuxVecs, pSolProc->cAuxVecs * sizeof(auxv_t) },
+ { "NT_PLATFORM", NT_PLATFORM, pSolProc->szPlatform, strlen(pSolProc->szPlatform) + 1 },
+ { "NT_UTSNAME", NT_UTSNAME, &pSolProc->UtsName, sizeof(struct utsname) },
+ { "NT_CONTENT", NT_CONTENT, &pSolProc->CoreContent, sizeof(core_content_t) },
+ { "NT_PRCRED", NT_PRCRED, pSolProc->pvCred, pSolProc->cbCred },
+ { "NT_PRPRIV", NT_PRPRIV, pSolProc->pPriv, PRIV_PRPRIV_SIZE(pSolProc->pPriv) },
+ { "NT_PRPRIVINFO", NT_PRPRIVINFO, pSolProc->pcPrivImpl, PRIV_IMPL_INFO_SIZE(pSolProc->pcPrivImpl) },
+ { "NT_ZONENAME", NT_ZONENAME, pSolProc->szZoneName, strlen(pSolProc->szZoneName) + 1 }
};
for (unsigned i = 0; i < RT_ELEMENTS(aElfNotes); i++)
{
- rc = ElfWriteNoteHeader(pVBoxCore, aElfNotes[i].Type, aElfNotes[i].pcv, aElfNotes[i].cb);
+ rc = ElfWriteNoteHeader(pSolCore, aElfNotes[i].Type, aElfNotes[i].pcv, aElfNotes[i].cb);
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "ElfWriteNoteSection: ElfWriteNoteHeader failed for %s. rc=%Rrc\n", aElfNotes[i].pszType, rc));
@@ -1634,10 +1659,10 @@ static int ElfWriteNoteSection(PVBOXCORE pVBoxCore, VBOXSOLCORETYPE enmType)
* Write new-style thread info., missing lwpstatus_t indicates it's a zombie thread
* we only dump the lwpsinfo_t in that case.
*/
- PVBOXSOLTHREADINFO pThreadInfo = pVBoxProc->pThreadInfoHead;
+ PRTSOLCORETHREADINFO pThreadInfo = pSolProc->pThreadInfoHead;
for (; pThreadInfo; pThreadInfo = pThreadInfo->pNext)
{
- rc = ElfWriteNoteHeader(pVBoxCore, NT_LWPSINFO, &pThreadInfo->Info, sizeof(lwpsinfo_t));
+ rc = ElfWriteNoteHeader(pSolCore, NT_LWPSINFO, &pThreadInfo->Info, sizeof(lwpsinfo_t));
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "ElfWriteNoteSection: ElfWriteNoteHeader for NT_LWPSINFO failed. rc=%Rrc\n", rc));
@@ -1646,7 +1671,7 @@ static int ElfWriteNoteSection(PVBOXCORE pVBoxCore, VBOXSOLCORETYPE enmType)
if (pThreadInfo->pStatus)
{
- rc = ElfWriteNoteHeader(pVBoxCore, NT_LWPSTATUS, pThreadInfo->pStatus, sizeof(lwpstatus_t));
+ rc = ElfWriteNoteHeader(pSolCore, NT_LWPSTATUS, pThreadInfo->pStatus, sizeof(lwpstatus_t));
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "ElfWriteNoteSection: ElfWriteNoteHeader for NT_LWPSTATUS failed. rc=%Rrc\n", rc));
@@ -1674,16 +1699,16 @@ static int ElfWriteNoteSection(PVBOXCORE pVBoxCore, VBOXSOLCORETYPE enmType)
/**
* Write mappings into the core file.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @return IPRT status code.
*/
-static int ElfWriteMappings(PVBOXCORE pVBoxCore)
+static int ElfWriteMappings(PRTSOLCORE pSolCore)
{
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
int rc = VERR_GENERAL_FAILURE;
- PVBOXSOLMAPINFO pMapInfo = pVBoxProc->pMapInfoHead;
+ PRTSOLCOREMAPINFO pMapInfo = pSolProc->pMapInfoHead;
while (pMapInfo)
{
if (!pMapInfo->fError)
@@ -1693,14 +1718,14 @@ static int ElfWriteMappings(PVBOXCORE pVBoxCore)
while (k < pMapInfo->pMap.pr_size)
{
size_t cb = RT_MIN(sizeof(achBuf), pMapInfo->pMap.pr_size - k);
- int rc2 = ProcReadAddrSpace(pVBoxProc, pMapInfo->pMap.pr_vaddr + k, &achBuf, cb);
+ int rc2 = ProcReadAddrSpace(pSolProc, pMapInfo->pMap.pr_vaddr + k, &achBuf, cb);
if (RT_FAILURE(rc2))
{
CORELOGRELSYS((CORELOG_NAME "ElfWriteMappings: Failed to read mapping, can't recover. Bye. rc=%Rrc\n", rc));
return VERR_INVALID_STATE;
}
- rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, achBuf, sizeof(achBuf));
+ rc = pSolCore->pfnWriter(pSolCore->fdCoreFile, achBuf, sizeof(achBuf));
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "ElfWriteMappings: pfnWriter failed. rc=%Rrc\n", rc));
@@ -1716,7 +1741,7 @@ static int ElfWriteMappings(PVBOXCORE pVBoxCore)
memcpy(achBuf, &pMapInfo->fError, sizeof(pMapInfo->fError));
if (sizeof(achBuf) != pMapInfo->pMap.pr_size)
CORELOGRELSYS((CORELOG_NAME "ElfWriteMappings: Huh!? something is wrong!\n"));
- rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, &achBuf, sizeof(achBuf));
+ rc = pSolCore->pfnWriter(pSolCore->fdCoreFile, &achBuf, sizeof(achBuf));
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "ElfWriteMappings: pfnWriter(2) failed. rc=%Rrc\n", rc));
@@ -1734,25 +1759,25 @@ static int ElfWriteMappings(PVBOXCORE pVBoxCore)
/**
* Write program headers for all mappings into the core file.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @return IPRT status code.
*/
-static int ElfWriteMappingHeaders(PVBOXCORE pVBoxCore)
+static int ElfWriteMappingHeaders(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
Elf_Phdr ProgHdr;
RT_ZERO(ProgHdr);
ProgHdr.p_type = PT_LOAD;
int rc = VERR_GENERAL_FAILURE;
- PVBOXSOLMAPINFO pMapInfo = pVBoxProc->pMapInfoHead;
+ PRTSOLCOREMAPINFO pMapInfo = pSolProc->pMapInfoHead;
while (pMapInfo)
{
ProgHdr.p_vaddr = pMapInfo->pMap.pr_vaddr; /* Virtual address of this mapping in the process address space */
- ProgHdr.p_offset = pVBoxCore->offWrite; /* Where this mapping is located in the core file */
+ ProgHdr.p_offset = pSolCore->offWrite; /* Where this mapping is located in the core file */
ProgHdr.p_memsz = pMapInfo->pMap.pr_size; /* Size of the memory image of the mapping */
ProgHdr.p_filesz = pMapInfo->pMap.pr_size; /* Size of the file image of the mapping */
@@ -1767,14 +1792,14 @@ static int ElfWriteMappingHeaders(PVBOXCORE pVBoxCore)
if (pMapInfo->fError)
ProgHdr.p_flags |= PF_SUNW_FAILURE;
- rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, &ProgHdr, sizeof(ProgHdr));
+ rc = pSolCore->pfnWriter(pSolCore->fdCoreFile, &ProgHdr, sizeof(ProgHdr));
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "ElfWriteMappingHeaders: pfnWriter failed. rc=%Rrc\n", rc));
return rc;
}
- pVBoxCore->offWrite += ProgHdr.p_filesz;
+ pSolCore->offWrite += ProgHdr.p_filesz;
pMapInfo = pMapInfo->pNext;
}
return rc;
@@ -1785,31 +1810,31 @@ static int ElfWriteMappingHeaders(PVBOXCORE pVBoxCore)
* Write a prepared core file using a user-passed in writer function, requires all threads
* to be in suspended state (i.e. called after CreateCore).
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
* @param pfnWriter Pointer to the writer function to override default writer (NULL uses default).
*
* @remarks Resumes all suspended threads, unless it's an invalid core. This
* function must be called only -after- rtCoreDumperCreateCore().
- * @return VBox status.
+ * @return IPRT status.
*/
-static int rtCoreDumperWriteCore(PVBOXCORE pVBoxCore, PFNCOREWRITER pfnWriter)
+static int rtCoreDumperWriteCore(PRTSOLCORE pSolCore, PFNRTCOREWRITER pfnWriter)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
- if (!pVBoxCore->fIsValid)
+ if (!pSolCore->fIsValid)
return VERR_INVALID_STATE;
if (pfnWriter)
- pVBoxCore->pfnWriter = pfnWriter;
+ pSolCore->pfnWriter = pfnWriter;
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
char szPath[PATH_MAX];
int rc = VINF_SUCCESS;
/*
* Open the process address space file.
*/
- RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/as", (int)pVBoxProc->Process);
+ RTStrPrintf(szPath, sizeof(szPath), "/proc/%d/as", (int)pSolProc->Process);
int fd = open(szPath, O_RDONLY);
if (fd < 0)
{
@@ -1818,23 +1843,23 @@ static int rtCoreDumperWriteCore(PVBOXCORE pVBoxCore, PFNCOREWRITER pfnWriter)
goto WriteCoreDone;
}
- pVBoxProc->hAs = fd;
+ pSolProc->fdAs = fd;
/*
* Create the core file.
*/
- fd = open(pVBoxCore->szCorePath, O_CREAT | O_TRUNC | O_RDWR, S_IRUSR);
+ fd = open(pSolCore->szCorePath, O_CREAT | O_TRUNC | O_RDWR, S_IRUSR);
if (fd < 0)
{
rc = RTErrConvertFromErrno(fd);
- CORELOGRELSYS((CORELOG_NAME "WriteCore: failed to open %s. rc=%Rrc\n", pVBoxCore->szCorePath, rc));
+ CORELOGRELSYS((CORELOG_NAME "WriteCore: failed to open %s. rc=%Rrc\n", pSolCore->szCorePath, rc));
goto WriteCoreDone;
}
- pVBoxCore->hCoreFile = fd;
+ pSolCore->fdCoreFile = fd;
- pVBoxCore->offWrite = 0;
- uint32_t cProgHdrs = pVBoxProc->cMappings + 2; /* two PT_NOTE program headers (old, new style) */
+ pSolCore->offWrite = 0;
+ uint32_t cProgHdrs = pSolProc->cMappings + 2; /* two PT_NOTE program headers (old, new style) */
/*
* Write the ELF header.
@@ -1863,7 +1888,7 @@ static int rtCoreDumperWriteCore(PVBOXCORE pVBoxCore, PFNCOREWRITER pfnWriter)
ElfHdr.e_phoff = sizeof(ElfHdr);
ElfHdr.e_phentsize = sizeof(Elf_Phdr);
ElfHdr.e_shentsize = sizeof(Elf_Shdr);
- rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, &ElfHdr, sizeof(ElfHdr));
+ rc = pSolCore->pfnWriter(pSolCore->fdCoreFile, &ElfHdr, sizeof(ElfHdr));
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "WriteCore: pfnWriter failed writing ELF header. rc=%Rrc\n", rc));
@@ -1881,10 +1906,10 @@ static int rtCoreDumperWriteCore(PVBOXCORE pVBoxCore, PFNCOREWRITER pfnWriter)
/*
* Write old-style NOTE program header.
*/
- pVBoxCore->offWrite += sizeof(ElfHdr) + cProgHdrs * sizeof(ProgHdr);
- ProgHdr.p_offset = pVBoxCore->offWrite;
- ProgHdr.p_filesz = ElfNoteSectionSize(pVBoxCore, enmOldEra);
- rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, &ProgHdr, sizeof(ProgHdr));
+ pSolCore->offWrite += sizeof(ElfHdr) + cProgHdrs * sizeof(ProgHdr);
+ ProgHdr.p_offset = pSolCore->offWrite;
+ ProgHdr.p_filesz = ElfNoteSectionSize(pSolCore, enmOldEra);
+ rc = pSolCore->pfnWriter(pSolCore->fdCoreFile, &ProgHdr, sizeof(ProgHdr));
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "WriteCore: pfnWriter failed writing old-style ELF program Header. rc=%Rrc\n", rc));
@@ -1894,10 +1919,10 @@ static int rtCoreDumperWriteCore(PVBOXCORE pVBoxCore, PFNCOREWRITER pfnWriter)
/*
* Write new-style NOTE program header.
*/
- pVBoxCore->offWrite += ProgHdr.p_filesz;
- ProgHdr.p_offset = pVBoxCore->offWrite;
- ProgHdr.p_filesz = ElfNoteSectionSize(pVBoxCore, enmNewEra);
- rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, &ProgHdr, sizeof(ProgHdr));
+ pSolCore->offWrite += ProgHdr.p_filesz;
+ ProgHdr.p_offset = pSolCore->offWrite;
+ ProgHdr.p_filesz = ElfNoteSectionSize(pSolCore, enmNewEra);
+ rc = pSolCore->pfnWriter(pSolCore->fdCoreFile, &ProgHdr, sizeof(ProgHdr));
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "WriteCore: pfnWriter failed writing new-style ELF program header. rc=%Rrc\n", rc));
@@ -1907,8 +1932,8 @@ static int rtCoreDumperWriteCore(PVBOXCORE pVBoxCore, PFNCOREWRITER pfnWriter)
/*
* Write program headers per mapping.
*/
- pVBoxCore->offWrite += ProgHdr.p_filesz;
- rc = ElfWriteMappingHeaders(pVBoxCore);
+ pSolCore->offWrite += ProgHdr.p_filesz;
+ rc = ElfWriteMappingHeaders(pSolCore);
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "Write: ElfWriteMappings failed. rc=%Rrc\n", rc));
@@ -1918,7 +1943,7 @@ static int rtCoreDumperWriteCore(PVBOXCORE pVBoxCore, PFNCOREWRITER pfnWriter)
/*
* Write old-style note section.
*/
- rc = ElfWriteNoteSection(pVBoxCore, enmOldEra);
+ rc = ElfWriteNoteSection(pSolCore, enmOldEra);
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "WriteCore: ElfWriteNoteSection old-style failed. rc=%Rrc\n", rc));
@@ -1928,7 +1953,7 @@ static int rtCoreDumperWriteCore(PVBOXCORE pVBoxCore, PFNCOREWRITER pfnWriter)
/*
* Write new-style section.
*/
- rc = ElfWriteNoteSection(pVBoxCore, enmNewEra);
+ rc = ElfWriteNoteSection(pSolCore, enmNewEra);
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "WriteCore: ElfWriteNoteSection new-style failed. rc=%Rrc\n", rc));
@@ -1938,7 +1963,7 @@ static int rtCoreDumperWriteCore(PVBOXCORE pVBoxCore, PFNCOREWRITER pfnWriter)
/*
* Write all mappings.
*/
- rc = ElfWriteMappings(pVBoxCore);
+ rc = ElfWriteMappings(pSolCore);
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "WriteCore: ElfWriteMappings failed. rc=%Rrc\n", rc));
@@ -1947,19 +1972,19 @@ static int rtCoreDumperWriteCore(PVBOXCORE pVBoxCore, PFNCOREWRITER pfnWriter)
WriteCoreDone:
- if (pVBoxCore->hCoreFile != NIL_RTFILE) /* Initialized in rtCoreDumperCreateCore() */
+ if (pSolCore->fdCoreFile != -1) /* Initialized in rtCoreDumperCreateCore() */
{
- RTFileClose(pVBoxCore->hCoreFile);
- pVBoxCore->hCoreFile = NIL_RTFILE;
+ close(pSolCore->fdCoreFile);
+ pSolCore->fdCoreFile = -1;
}
- if (pVBoxProc->hAs != NIL_RTFILE) /* Initialized in rtCoreDumperCreateCore() */
+ if (pSolProc->fdAs != -1) /* Initialized in rtCoreDumperCreateCore() */
{
- RTFileClose(pVBoxProc->hAs);
- pVBoxProc->hAs = NIL_RTFILE;
+ close(pSolProc->fdAs);
+ pSolProc->fdAs = -1;
}
- rtCoreDumperResumeThreads(pVBoxCore);
+ rtCoreDumperResumeThreads(pSolCore);
return rc;
}
@@ -1969,7 +1994,7 @@ WriteCoreDone:
* all threads which can lead to things like spurious wakeups of threads (if and when threads
* are ultimately resumed en-masse) already suspended while calling this function.
*
- * @param pVBoxCore Pointer to a core object.
+ * @param pSolCore Pointer to a core object.
* @param pContext Pointer to the caller context thread.
* @param pszCoreFilePath Path to the core file. If NULL is passed, the global
* path specified in RTCoreDumperSetup() would be used.
@@ -1977,29 +2002,29 @@ WriteCoreDone:
* @remarks Halts all threads.
* @return IPRT status code.
*/
-static int rtCoreDumperCreateCore(PVBOXCORE pVBoxCore, ucontext_t *pContext, const char *pszCoreFilePath)
+static int rtCoreDumperCreateCore(PRTSOLCORE pSolCore, ucontext_t *pContext, const char *pszCoreFilePath)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
AssertReturn(pContext, VERR_INVALID_POINTER);
/*
* Initialize core structures.
*/
- memset(pVBoxCore, 0, sizeof(VBOXCORE));
- pVBoxCore->pfnReader = &ReadFileNoIntr;
- pVBoxCore->pfnWriter = &WriteFileNoIntr;
- pVBoxCore->fIsValid = false;
- pVBoxCore->hCoreFile = NIL_RTFILE;
-
- PVBOXPROCESS pVBoxProc = &pVBoxCore->VBoxProc;
- pVBoxProc->Process = RTProcSelf();
- pVBoxProc->hCurThread = _lwp_self(); /* thr_self() */
- pVBoxProc->hAs = NIL_RTFILE;
- pVBoxProc->pCurThreadCtx = pContext;
- pVBoxProc->CoreContent = CC_CONTENT_DEFAULT;
-
- RTProcGetExecutablePath(pVBoxProc->szExecPath, sizeof(pVBoxProc->szExecPath)); /* this gets full path not just name */
- pVBoxProc->pszExecName = RTPathFilename(pVBoxProc->szExecPath);
+ memset(pSolCore, 0, sizeof(RTSOLCORE));
+ pSolCore->pfnReader = &ReadFileNoIntr;
+ pSolCore->pfnWriter = &WriteFileNoIntr;
+ pSolCore->fIsValid = false;
+ pSolCore->fdCoreFile = -1;
+
+ PRTSOLCOREPROCESS pSolProc = &pSolCore->SolProc;
+ pSolProc->Process = RTProcSelf();
+ pSolProc->hCurThread = _lwp_self(); /* thr_self() */
+ pSolProc->fdAs = -1;
+ pSolProc->pCurThreadCtx = pContext;
+ pSolProc->CoreContent = CC_CONTENT_DEFAULT;
+
+ RTProcGetExecutablePath(pSolProc->szExecPath, sizeof(pSolProc->szExecPath)); /* this gets full path not just name */
+ pSolProc->pszExecName = RTPathFilename(pSolProc->szExecPath);
/*
* If a path has been specified, use it. Otherwise use the global path.
@@ -2015,42 +2040,42 @@ static int rtCoreDumperCreateCore(PVBOXCORE pVBoxCore, ucontext_t *pContext, con
if (g_szCoreDumpFile[0] == '\0')
{
/* We cannot call RTPathAbs*() as they call getcwd() which calls malloc. */
- RTStrPrintf(pVBoxCore->szCorePath, sizeof(pVBoxCore->szCorePath), "%s/core.vb.%s.%d",
- g_szCoreDumpDir, pVBoxProc->pszExecName, (int)pVBoxProc->Process);
+ RTStrPrintf(pSolCore->szCorePath, sizeof(pSolCore->szCorePath), "%s/core.vb.%s.%d",
+ g_szCoreDumpDir, pSolProc->pszExecName, (int)pSolProc->Process);
}
else
- RTStrPrintf(pVBoxCore->szCorePath, sizeof(pVBoxCore->szCorePath), "%s/core.vb.%s", g_szCoreDumpDir, g_szCoreDumpFile);
+ RTStrPrintf(pSolCore->szCorePath, sizeof(pSolCore->szCorePath), "%s/core.vb.%s", g_szCoreDumpDir, g_szCoreDumpFile);
}
else
- RTStrCopy(pVBoxCore->szCorePath, sizeof(pVBoxCore->szCorePath), pszCoreFilePath);
+ RTStrCopy(pSolCore->szCorePath, sizeof(pSolCore->szCorePath), pszCoreFilePath);
- CORELOG((CORELOG_NAME "CreateCore: Taking Core %s from Thread %d\n", pVBoxCore->szCorePath, (int)pVBoxProc->hCurThread));
+ CORELOG((CORELOG_NAME "CreateCore: Taking Core %s from Thread %d\n", pSolCore->szCorePath, (int)pSolProc->hCurThread));
/*
* Quiesce the process.
*/
- int rc = rtCoreDumperSuspendThreads(pVBoxCore);
+ int rc = rtCoreDumperSuspendThreads(pSolCore);
if (RT_SUCCESS(rc))
{
- rc = ProcReadInfo(pVBoxCore);
+ rc = ProcReadInfo(pSolCore);
if (RT_SUCCESS(rc))
{
- GetOldProcessInfo(pVBoxCore, &pVBoxProc->ProcInfoOld);
- if (IsProcessArchNative(pVBoxProc))
+ GetOldProcessInfo(pSolCore, &pSolProc->ProcInfoOld);
+ if (IsProcessArchNative(pSolProc))
{
/*
* Read process status, information such as number of active LWPs will be invalid since we just quiesced the process.
*/
- rc = ProcReadStatus(pVBoxCore);
+ rc = ProcReadStatus(pSolCore);
if (RT_SUCCESS(rc))
{
- rc = AllocMemoryArea(pVBoxCore);
+ rc = AllocMemoryArea(pSolCore);
if (RT_SUCCESS(rc))
{
struct COREACCUMULATOR
{
const char *pszName;
- PFNCOREACCUMULATOR pfnAcc;
+ PFNRTSOLCOREACCUMULATOR pfnAcc;
bool fOptional;
} aAccumulators[] =
{
@@ -2065,7 +2090,7 @@ static int rtCoreDumperCreateCore(PVBOXCORE pVBoxCore, ucontext_t *pContext, con
for (unsigned i = 0; i < RT_ELEMENTS(aAccumulators); i++)
{
- rc = aAccumulators[i].pfnAcc(pVBoxCore);
+ rc = aAccumulators[i].pfnAcc(pSolCore);
if (RT_FAILURE(rc))
{
CORELOGRELSYS((CORELOG_NAME "CreateCore: %s failed. rc=%Rrc\n", aAccumulators[i].pszName, rc));
@@ -2076,11 +2101,11 @@ static int rtCoreDumperCreateCore(PVBOXCORE pVBoxCore, ucontext_t *pContext, con
if (RT_SUCCESS(rc))
{
- pVBoxCore->fIsValid = true;
+ pSolCore->fIsValid = true;
return VINF_SUCCESS;
}
- FreeMemoryArea(pVBoxCore);
+ FreeMemoryArea(pSolCore);
}
else
CORELOGRELSYS((CORELOG_NAME "CreateCore: AllocMemoryArea failed. rc=%Rrc\n", rc));
@@ -2100,7 +2125,7 @@ static int rtCoreDumperCreateCore(PVBOXCORE pVBoxCore, ucontext_t *pContext, con
/*
* Resume threads on failure.
*/
- rtCoreDumperResumeThreads(pVBoxCore);
+ rtCoreDumperResumeThreads(pSolCore);
}
else
CORELOG((CORELOG_NAME "CreateCore: SuspendAllThreads failed. Thread bomb!?! rc=%Rrc\n", rc));
@@ -2112,18 +2137,18 @@ static int rtCoreDumperCreateCore(PVBOXCORE pVBoxCore, ucontext_t *pContext, con
/**
* Destroy an existing core object.
*
- * @param pVBoxCore Pointer to the core object.
+ * @param pSolCore Pointer to the core object.
*
* @return IPRT status code.
*/
-static int rtCoreDumperDestroyCore(PVBOXCORE pVBoxCore)
+static int rtCoreDumperDestroyCore(PRTSOLCORE pSolCore)
{
- AssertReturn(pVBoxCore, VERR_INVALID_POINTER);
- if (!pVBoxCore->fIsValid)
+ AssertReturn(pSolCore, VERR_INVALID_POINTER);
+ if (!pSolCore->fIsValid)
return VERR_INVALID_STATE;
- FreeMemoryArea(pVBoxCore);
- pVBoxCore->fIsValid = false;
+ FreeMemoryArea(pSolCore);
+ pSolCore->fIsValid = false;
return VINF_SUCCESS;
}
@@ -2151,18 +2176,18 @@ static int rtCoreDumperTakeDump(ucontext_t *pContext, const char *pszOutputFile)
* from before taking the snapshot until writing the core is completely finished.
* Any errors would resume all threads if they were halted.
*/
- VBOXCORE VBoxCore;
- RT_ZERO(VBoxCore);
- int rc = rtCoreDumperCreateCore(&VBoxCore, pContext, pszOutputFile);
+ RTSOLCORE SolCore;
+ RT_ZERO(SolCore);
+ int rc = rtCoreDumperCreateCore(&SolCore, pContext, pszOutputFile);
if (RT_SUCCESS(rc))
{
- rc = rtCoreDumperWriteCore(&VBoxCore, &WriteFileNoIntr);
+ rc = rtCoreDumperWriteCore(&SolCore, &WriteFileNoIntr);
if (RT_SUCCESS(rc))
- CORELOGRELSYS((CORELOG_NAME "Core dumped in %s\n", VBoxCore.szCorePath));
+ CORELOGRELSYS((CORELOG_NAME "Core dumped in %s\n", SolCore.szCorePath));
else
- CORELOGRELSYS((CORELOG_NAME "TakeDump: WriteCore failed. szCorePath=%s rc=%Rrc\n", VBoxCore.szCorePath, rc));
+ CORELOGRELSYS((CORELOG_NAME "TakeDump: WriteCore failed. szCorePath=%s rc=%Rrc\n", SolCore.szCorePath, rc));
- rtCoreDumperDestroyCore(&VBoxCore);
+ rtCoreDumperDestroyCore(&SolCore);
}
else
CORELOGRELSYS((CORELOG_NAME "TakeDump: CreateCore failed. rc=%Rrc\n", rc));
@@ -2320,6 +2345,18 @@ RTDECL(int) RTCoreDumperSetup(const char *pszOutputDir, uint32_t fFlags)
| RTCOREDUMPER_FLAGS_LIVE_CORE)),
VERR_INVALID_PARAMETER);
+
+ /*
+ * Setup/change the core dump directory if specified.
+ */
+ RT_ZERO(g_szCoreDumpDir);
+ if (pszOutputDir)
+ {
+ if (!RTDirExists(pszOutputDir))
+ return VERR_NOT_A_DIRECTORY;
+ RTStrCopy(g_szCoreDumpDir, sizeof(g_szCoreDumpDir), pszOutputDir);
+ }
+
/*
* Install core dump signal handler only if the flags changed or if it's the first time.
*/
@@ -2352,10 +2389,6 @@ RTDECL(int) RTCoreDumperSetup(const char *pszOutputDir, uint32_t fFlags)
ASMAtomicWriteBool(&g_fCoreDumpSignalSetup, true);
}
- RT_ZERO(g_szCoreDumpDir);
- if (pszOutputDir)
- RTStrCopy(g_szCoreDumpDir, sizeof(g_szCoreDumpDir), pszOutputDir);
-
return VINF_SUCCESS;
}
diff --git a/src/VBox/Runtime/r3/solaris/coredumper-solaris.h b/src/VBox/Runtime/r3/solaris/coredumper-solaris.h
index 92626cd8d..f18c90d0f 100644
--- a/src/VBox/Runtime/r3/solaris/coredumper-solaris.h
+++ b/src/VBox/Runtime/r3/solaris/coredumper-solaris.h
@@ -1,10 +1,10 @@
-/* $Id: coredumper-solaris.h $ */
+/* $Id: coredumper-solaris.h 37631 2011-06-24 13:25:07Z vboxsync $ */
/** @file
- * IPRT Testcase - Core dump, header.
+ * IPRT - Custom Core Dumper, Solaris.
*/
/*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -24,8 +24,7 @@
* terms and conditions of either the GPL or the CDDL or both.
*/
-#include <iprt/process.h>
-#include <iprt/file.h>
+#include <iprt/types.h>
#ifdef RT_OS_SOLARIS
# if defined(RT_ARCH_X86) && _FILE_OFFSET_BITS==64
@@ -61,98 +60,99 @@
#ifdef RT_OS_SOLARIS
/**
- * VBOXSOLMAPINFO: Memory mapping description.
+ * Memory mapping descriptor employed by the solaris core dumper.
*/
-typedef struct VBOXSOLMAPINFO
+typedef struct RTSOLCOREMAPINFO
{
- prmap_t pMap; /* Proc description of this mapping */
- int fError; /* Any error reading this mapping (errno) */
- struct VBOXSOLMAPINFO *pNext; /* Pointer to the next mapping */
-} VBOXSOLMAPINFO;
-typedef VBOXSOLMAPINFO *PVBOXSOLMAPINFO;
+ prmap_t pMap; /**< Proc description of this mapping */
+ int fError; /**< Any error reading this mapping (errno) */
+ struct RTSOLCOREMAPINFO *pNext; /**< Pointer to the next mapping */
+} RTSOLCOREMAPINFO;
+/** Pointer to a solaris memory mapping descriptor. */
+typedef RTSOLCOREMAPINFO *PRTSOLCOREMAPINFO;
/**
- * VBOXSOLCORETYPE: Whether this is an old or new style core.
+ * Whether this is an old or new style solaris core.
*/
-typedef enum VBOXSOLCORETYPE
+typedef enum RTSOLCORETYPE
{
- enmOldEra = 0x01d, /* old */
- enmNewEra = 0x5c1f1 /* sci-fi */
-} VBOXSOLCORETYPE;
+ enmOldEra = 0x01d, /**< old */
+ enmNewEra = 0x5c1f1 /**< sci-fi */
+} RTSOLCORETYPE;
/**
- * VBOXSOLTHREADINFO: Per-Thread information.
+ * Per-Thread information employed by the solaris core dumper.
*/
-typedef struct VBOXSOLTHREADINFO
+typedef struct RTSOLCORETHREADINFO
{
- lwpsinfo_t Info; /* Proc description of this thread */
- lwpstatus_t *pStatus; /* Proc description of this thread's status (can be NULL, zombie lwp) */
- struct VBOXSOLTHREADINFO *pNext; /* Pointer to the next thread */
-} VBOXSOLTHREADINFO;
-typedef VBOXSOLTHREADINFO *PVBOXSOLTHREADINFO;
+ lwpsinfo_t Info; /**< Proc description of this thread */
+ lwpstatus_t *pStatus; /**< Proc description of this thread's status (can be NULL, zombie lwp) */
+ struct RTSOLCORETHREADINFO *pNext; /**< Pointer to the next thread */
+} RTSOLCORETHREADINFO;
+typedef RTSOLCORETHREADINFO *PRTSOLCORETHREADINFO;
#endif
/**
- * VBOXPROCESS: Current (also the core target) process information.
+ * Current (also the core target) process information.
*/
-typedef struct VBOXPROCESS
+typedef struct RTSOLCOREPROCESS
{
- RTPROCESS Process; /* The pid of the process */
- char szExecPath[PATH_MAX]; /* Path of the executable */
- char *pszExecName; /* Name of the executable file */
+ RTPROCESS Process; /**< The pid of the process */
+ char szExecPath[PATH_MAX]; /**< Path of the executable */
+ char *pszExecName; /**< Name of the executable file */
#ifdef RT_OS_SOLARIS
- psinfo_t ProcInfo; /* Process info. */
- prpsinfo_t ProcInfoOld; /* Process info. Older version (for GDB compat.) */
- pstatus_t ProcStatus; /* Process status info. */
- thread_t hCurThread; /* The current thread */
- ucontext_t *pCurThreadCtx; /* Context info. of current thread before starting to dump */
- RTFILE hAs; /* proc/<pid/as file handle */
- auxv_t *pAuxVecs; /* Aux vector of process */
- int cAuxVecs; /* Number of aux vector entries */
- PVBOXSOLMAPINFO pMapInfoHead; /* Pointer to the head of list of mappings */
- uint32_t cMappings; /* Number of mappings (count of pMapInfoHead list) */
- PVBOXSOLTHREADINFO pThreadInfoHead; /* Pointer to the head of list of threads */
- uint64_t cThreads; /* Number of threads (count of pThreadInfoHead list) */
- char szPlatform[SYS_NMLN]; /* Platform name */
- char szZoneName[ZONENAME_MAX]; /* Zone name */
- struct utsname UtsName; /* UTS name */
- void *pvCred; /* Process credential info. */
- size_t cbCred; /* Size of process credential info. */
- void *pvLdt; /* Process LDT info. */
- size_t cbLdt; /* Size of the LDT info. */
- prpriv_t *pPriv; /* Process privilege info. */
- size_t cbPriv; /* Size of process privilege info. */
- const priv_impl_info_t *pcPrivImpl; /* Process privilege implementation info. (opaque handle) */
- core_content_t CoreContent; /* What information goes in the core */
+ psinfo_t ProcInfo; /**< Process info. */
+ prpsinfo_t ProcInfoOld; /**< Process info. Older version (for GDB compat.) */
+ pstatus_t ProcStatus; /**< Process status info. */
+ thread_t hCurThread; /**< The current thread */
+ ucontext_t *pCurThreadCtx; /**< Context info. of current thread before starting to dump */
+ int fdAs; /**< proc/pid/as file handle */
+ auxv_t *pAuxVecs; /**< Aux vector of process */
+ int cAuxVecs; /**< Number of aux vector entries */
+ PRTSOLCOREMAPINFO pMapInfoHead; /**< Pointer to the head of list of mappings */
+ uint32_t cMappings; /**< Number of mappings (count of pMapInfoHead list) */
+ PRTSOLCORETHREADINFO pThreadInfoHead; /**< Pointer to the head of list of threads */
+ uint64_t cThreads; /**< Number of threads (count of pThreadInfoHead list) */
+ char szPlatform[SYS_NMLN]; /**< Platform name */
+ char szZoneName[ZONENAME_MAX]; /**< Zone name */
+ struct utsname UtsName; /**< UTS name */
+ void *pvCred; /**< Process credential info. */
+ size_t cbCred; /**< Size of process credential info. */
+ void *pvLdt; /**< Process LDT info. */
+ size_t cbLdt; /**< Size of the LDT info. */
+ prpriv_t *pPriv; /**< Process privilege info. */
+ size_t cbPriv; /**< Size of process privilege info. */
+ const priv_impl_info_t *pcPrivImpl; /**< Process privilege implementation info. (opaque handle) */
+ core_content_t CoreContent; /**< What information goes in the core */
#else
# error Port Me!
#endif
-} VBOXPROCESS;
-typedef VBOXPROCESS *PVBOXPROCESS;
+} RTSOLCOREPROCESS;
+typedef RTSOLCOREPROCESS *PRTSOLCOREPROCESS;
-typedef int (*PFNCOREREADER)(RTFILE hFile, void *pv, size_t cb);
-typedef int (*PFNCOREWRITER)(RTFILE hFile, const void *pcv, size_t cb);
+typedef int (*PFNRTCOREREADER)(int fdFile, void *pv, size_t cb);
+typedef int (*PFNRTCOREWRITER)(int fdhFile, const void *pcv, size_t cb);
/**
- * VBOXCORE: Core file object.
+ * The solaris core file object.
*/
-typedef struct VBOXCORE
+typedef struct RTSOLCORE
{
- char szCorePath[PATH_MAX]; /* Path of the core file */
- VBOXPROCESS VBoxProc; /* Current process information */
- void *pvCore; /* Pointer to memory area during dumping */
- size_t cbCore; /* Size of memory area during dumping */
- void *pvFree; /* Pointer to base of free range in preallocated memory area */
- bool fIsValid; /* Whether core information has been fully collected */
- PFNCOREREADER pfnReader; /* Reader function */
- PFNCOREWRITER pfnWriter; /* Writer function */
- RTFILE hCoreFile; /* Core file (used only while writing the core) */
- RTFOFF offWrite; /* Segment/section offset (used only while writing the core) */
-} VBOXCORE;
-typedef VBOXCORE *PVBOXCORE;
+ char szCorePath[PATH_MAX]; /**< Path of the core file */
+ RTSOLCOREPROCESS SolProc; /**< Current process information */
+ void *pvCore; /**< Pointer to memory area during dumping */
+ size_t cbCore; /**< Size of memory area during dumping */
+ void *pvFree; /**< Pointer to base of free range in preallocated memory area */
+ bool fIsValid; /**< Whether core information has been fully collected */
+ PFNRTCOREREADER pfnReader; /**< Reader function */
+ PFNRTCOREWRITER pfnWriter; /**< Writer function */
+ int fdCoreFile; /**< Core file (used only while writing the core) */
+ RTFOFF offWrite; /**< Segment/section offset (used only while writing the core) */
+} RTSOLCORE;
+typedef RTSOLCORE *PRTSOLCORE;
-typedef int (*PFNCOREACCUMULATOR)(PVBOXCORE pVBoxCore);
-typedef int (*PFNCORETHREADWORKER)(PVBOXCORE pVBoxCore, void *pvThreadInfo);
+typedef int (*PFNRTSOLCOREACCUMULATOR)(PRTSOLCORE pSolCore);
+typedef int (*PFNRTSOLCORETHREADWORKER)(PRTSOLCORE pSolCore, void *pvThreadInfo);
diff --git a/src/VBox/Runtime/r3/solaris/fileaio-solaris.cpp b/src/VBox/Runtime/r3/solaris/fileaio-solaris.cpp
index d8b6fb416..152ebee68 100644
--- a/src/VBox/Runtime/r3/solaris/fileaio-solaris.cpp
+++ b/src/VBox/Runtime/r3/solaris/fileaio-solaris.cpp
@@ -1,4 +1,4 @@
-/* $Id: fileaio-solaris.cpp $ */
+/* $Id: fileaio-solaris.cpp 30238 2010-06-16 11:34:44Z vboxsync $ */
/** @file
* IPRT - File async I/O, native implementation for the Solaris host platform.
*/
diff --git a/src/VBox/Runtime/r3/solaris/mp-solaris.cpp b/src/VBox/Runtime/r3/solaris/mp-solaris.cpp
index 0f2c6fdf0..5101f20bc 100644
--- a/src/VBox/Runtime/r3/solaris/mp-solaris.cpp
+++ b/src/VBox/Runtime/r3/solaris/mp-solaris.cpp
@@ -1,4 +1,4 @@
-/* $Id: mp-solaris.cpp $ */
+/* $Id: mp-solaris.cpp 29269 2010-05-09 21:24:06Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Solaris.
*/
diff --git a/src/VBox/Runtime/r3/solaris/rtProcInitExePath-solaris.cpp b/src/VBox/Runtime/r3/solaris/rtProcInitExePath-solaris.cpp
index 40baf8c25..f14a3404b 100644
--- a/src/VBox/Runtime/r3/solaris/rtProcInitExePath-solaris.cpp
+++ b/src/VBox/Runtime/r3/solaris/rtProcInitExePath-solaris.cpp
@@ -1,4 +1,4 @@
-/* $Id: rtProcInitExePath-solaris.cpp $ */
+/* $Id: rtProcInitExePath-solaris.cpp 28929 2010-04-30 11:26:46Z vboxsync $ */
/** @file
* IPRT - rtProcInitName, Solaris.
*/
diff --git a/src/VBox/Runtime/r3/solaris/thread-affinity-solaris.cpp b/src/VBox/Runtime/r3/solaris/thread-affinity-solaris.cpp
new file mode 100644
index 000000000..b2bd2b4c5
--- /dev/null
+++ b/src/VBox/Runtime/r3/solaris/thread-affinity-solaris.cpp
@@ -0,0 +1,94 @@
+/* $Id: thread-affinity-solaris.cpp 37156 2011-05-19 13:11:14Z vboxsync $ */
+/** @file
+ * IPRT - Thread Affinity, Solaris ring-3 implementation.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/thread.h>
+#include "internal/iprt.h"
+
+#include <iprt/assert.h>
+#include <iprt/cpuset.h>
+#include <iprt/err.h>
+#include <iprt/mp.h>
+
+#include <sys/types.h>
+#include <sys/processor.h>
+#include <sys/procset.h>
+#include <unistd.h>
+#include <errno.h>
+
+
+/* Note! The current implementation can only bind to a single CPU. */
+
+
+RTR3DECL(int) RTThreadSetAffinity(PCRTCPUSET pCpuSet)
+{
+ int rc;
+ if (pCpuSet == NULL)
+ rc = processor_bind(P_LWPID, P_MYID, PBIND_NONE, NULL);
+ else
+ {
+ RTCPUSET PresentSet;
+ int cCpusInSet = RTCpuSetCount(pCpuSet);
+ if (cCpusInSet == 1)
+ {
+ unsigned iCpu = 0;
+ while ( iCpu < RTCPUSET_MAX_CPUS
+ && !RTCpuSetIsMemberByIndex(pCpuSet, iCpu))
+ iCpu++;
+ rc = processor_bind(P_LWPID, P_MYID, iCpu, NULL);
+ }
+ else if ( cCpusInSet == RTCPUSET_MAX_CPUS
+ || RTCpuSetIsEqual(pCpuSet, RTMpGetPresentSet(&PresentSet)))
+ rc = processor_bind(P_LWPID, P_MYID, PBIND_NONE, NULL);
+ else
+ return VERR_NOT_SUPPORTED;
+ }
+ if (!rc)
+ return VINF_SUCCESS;
+ return RTErrConvertFromErrno(errno);
+}
+
+
+RTR3DECL(int) RTThreadGetAffinity(PRTCPUSET pCpuSet)
+{
+ processorid_t iOldCpu;
+ int rc = processor_bind(P_LWPID, P_MYID, PBIND_QUERY, &iOldCpu);
+ if (rc)
+ return RTErrConvertFromErrno(errno);
+ if (iOldCpu == PBIND_NONE)
+ RTMpGetPresentSet(pCpuSet);
+ else
+ {
+ RTCpuSetEmpty(pCpuSet);
+ if (RTCpuSetAdd(pCpuSet, iOldCpu) != 0)
+ return VERR_INTERNAL_ERROR_5;
+ }
+ return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/Runtime/r3/stream.cpp b/src/VBox/Runtime/r3/stream.cpp
index a3af65d40..52c997397 100644
--- a/src/VBox/Runtime/r3/stream.cpp
+++ b/src/VBox/Runtime/r3/stream.cpp
@@ -1,4 +1,4 @@
-/* $Id: stream.cpp $ */
+/* $Id: stream.cpp 32464 2010-09-14 08:48:32Z vboxsync $ */
/** @file
* IPRT - I/O Stream.
*/
diff --git a/src/VBox/Runtime/r3/tcp.cpp b/src/VBox/Runtime/r3/tcp.cpp
index 8f47eda56..9f96f71f8 100644
--- a/src/VBox/Runtime/r3/tcp.cpp
+++ b/src/VBox/Runtime/r3/tcp.cpp
@@ -1,4 +1,4 @@
-/* $Id: tcp.cpp $ */
+/* $Id: tcp.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - TCP/IP.
*/
diff --git a/src/VBox/Runtime/r3/test.cpp b/src/VBox/Runtime/r3/test.cpp
index d3e850f63..c7ce69f03 100644
--- a/src/VBox/Runtime/r3/test.cpp
+++ b/src/VBox/Runtime/r3/test.cpp
@@ -1,4 +1,4 @@
-/* $Id: test.cpp $ */
+/* $Id: test.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Testcase Framework.
*/
diff --git a/src/VBox/Runtime/r3/testi.cpp b/src/VBox/Runtime/r3/testi.cpp
index e143e3c1e..e6db79d6b 100644
--- a/src/VBox/Runtime/r3/testi.cpp
+++ b/src/VBox/Runtime/r3/testi.cpp
@@ -1,4 +1,4 @@
-/* $Id: testi.cpp $ */
+/* $Id: testi.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Testcase Framework, the implicit test handle API variation.
*/
diff --git a/src/VBox/Runtime/r3/udp.cpp b/src/VBox/Runtime/r3/udp.cpp
new file mode 100644
index 000000000..de9016e93
--- /dev/null
+++ b/src/VBox/Runtime/r3/udp.cpp
@@ -0,0 +1,726 @@
+/* $Id: udp.cpp 37197 2011-05-24 14:56:02Z vboxsync $ */
+/** @file
+ * IPRT - UDP/IP.
+ */
+
+/*
+ * Copyright (C) 2006-2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#ifdef RT_OS_WINDOWS
+# include <winsock2.h>
+#else
+# include <sys/types.h>
+# include <sys/socket.h>
+# include <errno.h>
+# include <netinet/in.h>
+# include <netinet/udp.h>
+# include <arpa/inet.h>
+# include <netdb.h>
+#endif
+#include <limits.h>
+
+#include "internal/iprt.h"
+#include <iprt/udp.h>
+
+#include <iprt/asm.h>
+#include <iprt/assert.h>
+#include <iprt/err.h>
+#include <iprt/mempool.h>
+#include <iprt/mem.h>
+#include <iprt/string.h>
+#include <iprt/socket.h>
+#include <iprt/thread.h>
+#include <iprt/time.h>
+
+#include "internal/magics.h"
+#include "internal/socket.h"
+
+
+/*******************************************************************************
+* Defined Constants And Macros *
+*******************************************************************************/
+/* fixup backlevel OSes. */
+#if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
+# define socklen_t int
+#endif
+
+
+/*******************************************************************************
+* Structures and Typedefs *
+*******************************************************************************/
+/**
+ * UDP Server state.
+ */
+typedef enum RTUDPSERVERSTATE
+{
+ /** Invalid. */
+ RTUDPSERVERSTATE_INVALID = 0,
+ /** Created. */
+ RTUDPSERVERSTATE_CREATED,
+ /** Thread for incoming datagrams is starting up. */
+ RTUDPSERVERSTATE_STARTING,
+ /** Waiting for incoming datagrams. */
+ RTUDPSERVERSTATE_WAITING,
+ /** Handling an incoming datagram. */
+ RTUDPSERVERSTATE_RECEIVING,
+ /** Thread terminating. */
+ RTUDPSERVERSTATE_STOPPING,
+ /** Thread terminated. */
+ RTUDPSERVERSTATE_STOPPED,
+ /** Final cleanup before being unusable. */
+ RTUDPSERVERSTATE_DESTROYING
+} RTUDPSERVERSTATE;
+
+/*
+ * Internal representation of the UDP Server handle.
+ */
+typedef struct RTUDPSERVER
+{
+ /** The magic value (RTUDPSERVER_MAGIC). */
+ uint32_t volatile u32Magic;
+ /** The server state. */
+ RTUDPSERVERSTATE volatile enmState;
+ /** The server thread. */
+ RTTHREAD Thread;
+ /** The server socket. */
+ RTSOCKET volatile hSocket;
+ /** The datagram receiver function. */
+ PFNRTUDPSERVE pfnServe;
+ /** Argument to pfnServer. */
+ void *pvUser;
+} RTUDPSERVER;
+
+
+/*******************************************************************************
+* Internal Functions *
+*******************************************************************************/
+static DECLCALLBACK(int) rtUdpServerThread(RTTHREAD ThreadSelf, void *pvServer);
+static int rtUdpServerListen(PRTUDPSERVER pServer);
+static int rtUdpServerListenCleanup(PRTUDPSERVER pServer);
+static int rtUdpServerDestroySocket(RTSOCKET volatile *pSock, const char *pszMsg);
+static int rtUdpClose(RTSOCKET Sock, const char *pszMsg);
+
+
+/**
+ * Atomicly updates a socket variable.
+ * @returns The old handle value.
+ * @param phSock The socket handle variable to update.
+ * @param hSock The new socket handle value.
+ */
+DECLINLINE(RTSOCKET) rtUdpAtomicXchgSock(RTSOCKET volatile *phSock, const RTSOCKET hNew)
+{
+ RTSOCKET hRet;
+ ASMAtomicXchgHandle(phSock, hNew, &hRet);
+ return hRet;
+}
+
+
+/**
+ * Tries to change the UDP server state.
+ */
+DECLINLINE(bool) rtUdpServerTrySetState(PRTUDPSERVER pServer, RTUDPSERVERSTATE enmStateNew, RTUDPSERVERSTATE enmStateOld)
+{
+ bool fRc;
+ ASMAtomicCmpXchgSize(&pServer->enmState, enmStateNew, enmStateOld, fRc);
+ return fRc;
+}
+
+/**
+ * Changes the UDP server state.
+ */
+DECLINLINE(void) rtUdpServerSetState(PRTUDPSERVER pServer, RTUDPSERVERSTATE enmStateNew, RTUDPSERVERSTATE enmStateOld)
+{
+ bool fRc;
+ ASMAtomicCmpXchgSize(&pServer->enmState, enmStateNew, enmStateOld, fRc);
+ Assert(fRc); NOREF(fRc);
+}
+
+
+/**
+ * Closes a socket.
+ *
+ * @returns IPRT status code.
+ */
+static int rtUdpServerDestroySocket(RTSOCKET volatile *pSock, const char *pszMsg)
+{
+ RTSOCKET hSocket = rtUdpAtomicXchgSock(pSock, NIL_RTSOCKET);
+ if (hSocket != NIL_RTSOCKET)
+ {
+ return rtUdpClose(hSocket, pszMsg);
+ }
+ return VINF_UDP_SERVER_NO_CLIENT;
+}
+
+
+/**
+ * Create single datagram at a time UDP Server in a separate thread.
+ *
+ * The thread will loop waiting for datagrams and call pfnServe for
+ * each of the incoming datagrams in turn. The pfnServe function can
+ * return VERR_UDP_SERVER_STOP too terminate this loop. RTUdpServerDestroy()
+ * should be used to terminate the server.
+ *
+ * @returns iprt status code.
+ * @param pszAddress The address for creating a datagram socket.
+ * If NULL or empty string the server is bound to all interfaces.
+ * @param uPort The port for creating a datagram socket.
+ * @param enmType The thread type.
+ * @param pszThrdName The name of the worker thread.
+ * @param pfnServe The function which will handle incoming datagrams.
+ * @param pvUser User argument passed to pfnServe.
+ * @param ppServer Where to store the serverhandle.
+ */
+RTR3DECL(int) RTUdpServerCreate(const char *pszAddress, unsigned uPort, RTTHREADTYPE enmType, const char *pszThrdName,
+ PFNRTUDPSERVE pfnServe, void *pvUser, PPRTUDPSERVER ppServer)
+{
+ /*
+ * Validate input.
+ */
+ AssertReturn(uPort > 0, VERR_INVALID_PARAMETER);
+ AssertPtrReturn(pfnServe, VERR_INVALID_POINTER);
+ AssertPtrReturn(pszThrdName, VERR_INVALID_POINTER);
+ AssertPtrReturn(ppServer, VERR_INVALID_POINTER);
+
+ /*
+ * Create the server.
+ */
+ PRTUDPSERVER pServer;
+ int rc = RTUdpServerCreateEx(pszAddress, uPort, &pServer);
+ if (RT_SUCCESS(rc))
+ {
+ /*
+ * Create the listener thread.
+ */
+ RTMemPoolRetain(pServer);
+ pServer->enmState = RTUDPSERVERSTATE_STARTING;
+ pServer->pvUser = pvUser;
+ pServer->pfnServe = pfnServe;
+ rc = RTThreadCreate(&pServer->Thread, rtUdpServerThread, pServer, 0, enmType, /*RTTHREADFLAGS_WAITABLE*/0, pszThrdName);
+ if (RT_SUCCESS(rc))
+ {
+ /* done */
+ if (ppServer)
+ *ppServer = pServer;
+ else
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+ return rc;
+ }
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+
+ /*
+ * Destroy the server.
+ */
+ rtUdpServerSetState(pServer, RTUDPSERVERSTATE_CREATED, RTUDPSERVERSTATE_STARTING);
+ RTUdpServerDestroy(pServer);
+ }
+
+ return rc;
+}
+
+
+/**
+ * Server thread, loops waiting for datagrams until it's terminated.
+ *
+ * @returns iprt status code. (ignored).
+ * @param ThreadSelf Thread handle.
+ * @param pvServer Server handle.
+ */
+static DECLCALLBACK(int) rtUdpServerThread(RTTHREAD ThreadSelf, void *pvServer)
+{
+ PRTUDPSERVER pServer = (PRTUDPSERVER)pvServer;
+ int rc;
+ if (rtUdpServerTrySetState(pServer, RTUDPSERVERSTATE_WAITING, RTUDPSERVERSTATE_STARTING))
+ rc = rtUdpServerListen(pServer);
+ else
+ rc = rtUdpServerListenCleanup(pServer);
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+ NOREF(ThreadSelf);
+ return VINF_SUCCESS;
+}
+
+
+/**
+ * Create single datagram at a time UDP Server.
+ * The caller must call RTUdpServerReceive() to actually start the server.
+ *
+ * @returns iprt status code.
+ * @param pszAddress The address for creating a datagram socket.
+ * If NULL the server is bound to all interfaces.
+ * @param uPort The port for creating a datagram socket.
+ * @param ppServer Where to store the serverhandle.
+ */
+RTR3DECL(int) RTUdpServerCreateEx(const char *pszAddress, uint32_t uPort, PPRTUDPSERVER ppServer)
+{
+ int rc;
+
+ /*
+ * Validate input.
+ */
+ AssertReturn(uPort > 0, VERR_INVALID_PARAMETER);
+ AssertPtrReturn(ppServer, VERR_INVALID_PARAMETER);
+
+#ifdef RT_OS_WINDOWS
+ /*
+ * Initialize WinSock and check version.
+ */
+ WORD wVersionRequested = MAKEWORD(1, 1);
+ WSADATA wsaData;
+ rc = WSAStartup(wVersionRequested, &wsaData);
+ if (wsaData.wVersion != wVersionRequested)
+ {
+ AssertMsgFailed(("Wrong winsock version\n"));
+ return VERR_NOT_SUPPORTED;
+ }
+#endif
+
+ /*
+ * Get host listening address.
+ */
+ struct hostent *pHostEnt = NULL;
+ if (pszAddress != NULL && *pszAddress)
+ {
+ pHostEnt = gethostbyname(pszAddress);
+ if (!pHostEnt)
+ {
+ struct in_addr InAddr;
+ InAddr.s_addr = inet_addr(pszAddress);
+ pHostEnt = gethostbyaddr((char *)&InAddr, 4, AF_INET);
+ if (!pHostEnt)
+ {
+ rc = rtSocketResolverError();
+ return rc;
+ }
+ }
+ }
+
+ /*
+ * Setting up socket.
+ */
+ RTSOCKET Sock;
+ rc = rtSocketCreate(&Sock, AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ if (RT_SUCCESS(rc))
+ {
+ RTSocketSetInheritance(Sock, false /*fInheritable*/);
+
+ /*
+ * Set socket options.
+ */
+ int fFlag = 1;
+ if (!rtSocketSetOpt(Sock, SOL_SOCKET, SO_REUSEADDR, &fFlag, sizeof(fFlag)))
+ {
+ /*
+ * Set socket family, address and port.
+ */
+ struct sockaddr_in LocalAddr;
+ RT_ZERO(LocalAddr);
+ LocalAddr.sin_family = AF_INET;
+ LocalAddr.sin_port = htons(uPort);
+ /* if address not specified, use INADDR_ANY. */
+ if (!pHostEnt)
+ LocalAddr.sin_addr.s_addr = INADDR_ANY;
+ else
+ LocalAddr.sin_addr = *((struct in_addr *)pHostEnt->h_addr);
+
+ /*
+ * Bind a name to the socket.
+ */
+ rc = rtSocketBind(Sock, (struct sockaddr *)&LocalAddr, sizeof(LocalAddr));
+ if (RT_SUCCESS(rc))
+ {
+ /*
+ * Create the server handle.
+ */
+ PRTUDPSERVER pServer = (PRTUDPSERVER)RTMemPoolAlloc(RTMEMPOOL_DEFAULT, sizeof(*pServer));
+ if (pServer)
+ {
+ pServer->u32Magic = RTUDPSERVER_MAGIC;
+ pServer->enmState = RTUDPSERVERSTATE_CREATED;
+ pServer->Thread = NIL_RTTHREAD;
+ pServer->hSocket = Sock;
+ pServer->pfnServe = NULL;
+ pServer->pvUser = NULL;
+ *ppServer = pServer;
+ return VINF_SUCCESS;
+ }
+
+ /* bail out */
+ rc = VERR_NO_MEMORY;
+ }
+ }
+ else
+ AssertMsgFailed(("rtSocketSetOpt: %Rrc\n", rc));
+ rtUdpClose(Sock, "RTServerCreateEx");
+ }
+
+ return rc;
+}
+
+
+/**
+ * Listen for incoming datagrams.
+ *
+ * The function will loop waiting for datagrams and call pfnServe for
+ * each of the incoming datagrams in turn. The pfnServe function can
+ * return VERR_UDP_SERVER_STOP too terminate this loop. A stopped server
+ * can only be destroyed.
+ *
+ * @returns IPRT status code.
+ * @retval VERR_UDP_SERVER_STOP if stopped by pfnServe.
+ * @retval VERR_UDP_SERVER_SHUTDOWN if shut down by RTUdpServerShutdown.
+ *
+ * @param pServer The server handle as returned from RTUdpServerCreateEx().
+ * @param pfnServe The function which will handle incoming datagrams.
+ * @param pvUser User argument passed to pfnServe.
+ */
+RTR3DECL(int) RTUdpServerListen(PRTUDPSERVER pServer, PFNRTUDPSERVE pfnServe, void *pvUser)
+{
+ /*
+ * Validate input and retain the instance.
+ */
+ AssertPtrReturn(pfnServe, VERR_INVALID_POINTER);
+ AssertPtrReturn(pServer, VERR_INVALID_HANDLE);
+ AssertReturn(pServer->u32Magic == RTUDPSERVER_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(RTMemPoolRetain(pServer) != UINT32_MAX, VERR_INVALID_HANDLE);
+
+ int rc = VERR_INVALID_STATE;
+ if (rtUdpServerTrySetState(pServer, RTUDPSERVERSTATE_WAITING, RTUDPSERVERSTATE_CREATED))
+ {
+ Assert(!pServer->pfnServe);
+ Assert(!pServer->pvUser);
+ Assert(pServer->Thread == NIL_RTTHREAD);
+
+ pServer->pfnServe = pfnServe;
+ pServer->pvUser = pvUser;
+ pServer->Thread = RTThreadSelf();
+ Assert(pServer->Thread != NIL_RTTHREAD);
+ rc = rtUdpServerListen(pServer);
+ }
+ else
+ {
+ AssertMsgFailed(("enmState=%d\n", pServer->enmState));
+ rc = VERR_INVALID_STATE;
+ }
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+ return rc;
+}
+
+
+/**
+ * Internal worker common for RTUdpServerListen and the thread created by
+ * RTUdpServerCreate().
+ *
+ * The caller makes sure it has its own memory reference and releases it upon
+ * return.
+ */
+static int rtUdpServerListen(PRTUDPSERVER pServer)
+{
+ /*
+ * Wait for incoming datagrams loop.
+ */
+ for (;;)
+ {
+ /*
+ * Change state, getting an extra reference to the socket so we can
+ * allow others to close it while we're stuck in rtSocketAccept.
+ */
+ RTUDPSERVERSTATE enmState = pServer->enmState;
+ RTSOCKET hSocket;
+ ASMAtomicReadHandle(&pServer->hSocket, &hSocket);
+ if (hSocket != NIL_RTSOCKET)
+ RTSocketRetain(hSocket);
+ if ( enmState != RTUDPSERVERSTATE_WAITING
+ && enmState != RTUDPSERVERSTATE_RECEIVING)
+ {
+ RTSocketRelease(hSocket);
+ return rtUdpServerListenCleanup(pServer);
+ }
+ if (!rtUdpServerTrySetState(pServer, RTUDPSERVERSTATE_WAITING, enmState))
+ {
+ RTSocketRelease(hSocket);
+ continue;
+ }
+
+ /*
+ * Wait for incoming datagrams or errors.
+ */
+ uint32_t fEvents;
+ int rc = RTSocketSelectOneEx(hSocket, RTSOCKET_EVT_READ | RTSOCKET_EVT_ERROR, &fEvents, 1000);
+ RTSocketRelease(hSocket);
+ if (rc == VERR_TIMEOUT)
+ continue;
+ if (RT_FAILURE(rc))
+ {
+ /* These are typical for what can happen during destruction. */
+ if ( rc == VERR_INVALID_HANDLE
+ || rc == VERR_INVALID_PARAMETER
+ || rc == VERR_NET_NOT_SOCKET)
+ return rtUdpServerListenCleanup(pServer);
+ continue;
+ }
+ if (fEvents & RTSOCKET_EVT_ERROR)
+ return rtUdpServerListenCleanup(pServer);
+
+ /*
+ * Run a pfnServe callback.
+ */
+ if (!rtUdpServerTrySetState(pServer, RTUDPSERVERSTATE_RECEIVING, RTUDPSERVERSTATE_WAITING))
+ return rtUdpServerListenCleanup(pServer);
+ rc = pServer->pfnServe(hSocket, pServer->pvUser);
+
+ /*
+ * Stop the server?
+ */
+ if (rc == VERR_UDP_SERVER_STOP)
+ {
+ if (rtUdpServerTrySetState(pServer, RTUDPSERVERSTATE_STOPPING, RTUDPSERVERSTATE_RECEIVING))
+ {
+ /*
+ * Reset the server socket and change the state to stopped. After that state change
+ * we cannot safely access the handle so we'll have to return here.
+ */
+ hSocket = rtUdpAtomicXchgSock(&pServer->hSocket, NIL_RTSOCKET);
+ rtUdpServerSetState(pServer, RTUDPSERVERSTATE_STOPPED, RTUDPSERVERSTATE_STOPPING);
+ rtUdpClose(hSocket, "Listener: server stopped");
+ }
+ else
+ rtUdpServerListenCleanup(pServer); /* ignore rc */
+ return rc;
+ }
+ }
+}
+
+
+/**
+ * Clean up after listener.
+ */
+static int rtUdpServerListenCleanup(PRTUDPSERVER pServer)
+{
+ /*
+ * Close the server socket.
+ */
+ rtUdpServerDestroySocket(&pServer->hSocket, "ListenCleanup");
+
+ /*
+ * Figure the return code and make sure the state is OK.
+ */
+ RTUDPSERVERSTATE enmState = pServer->enmState;
+ switch (enmState)
+ {
+ case RTUDPSERVERSTATE_STOPPING:
+ case RTUDPSERVERSTATE_STOPPED:
+ return VERR_UDP_SERVER_SHUTDOWN;
+
+ case RTUDPSERVERSTATE_WAITING:
+ rtUdpServerTrySetState(pServer, RTUDPSERVERSTATE_STOPPED, enmState);
+ return VERR_UDP_SERVER_DESTROYED;
+
+ case RTUDPSERVERSTATE_DESTROYING:
+ return VERR_UDP_SERVER_DESTROYED;
+
+ case RTUDPSERVERSTATE_STARTING:
+ case RTUDPSERVERSTATE_RECEIVING:
+ default:
+ AssertMsgFailedReturn(("pServer=%p enmState=%d\n", pServer, enmState), VERR_INTERNAL_ERROR_4);
+ }
+}
+
+
+/**
+ * Shuts down the server.
+ *
+ * @returns IPRT status code.
+ * @param pServer Handle to the server.
+ */
+RTR3DECL(int) RTUdpServerShutdown(PRTUDPSERVER pServer)
+{
+ /*
+ * Validate input and retain the instance.
+ */
+ AssertPtrReturn(pServer, VERR_INVALID_HANDLE);
+ AssertReturn(pServer->u32Magic == RTUDPSERVER_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(RTMemPoolRetain(pServer) != UINT32_MAX, VERR_INVALID_HANDLE);
+
+ /*
+ * Try change the state to stopping, then replace and destroy the server socket.
+ */
+ for (;;)
+ {
+ RTUDPSERVERSTATE enmState = pServer->enmState;
+ if ( enmState != RTUDPSERVERSTATE_WAITING
+ && enmState != RTUDPSERVERSTATE_RECEIVING)
+ {
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+ switch (enmState)
+ {
+ case RTUDPSERVERSTATE_CREATED:
+ case RTUDPSERVERSTATE_STARTING:
+ default:
+ AssertMsgFailed(("%d\n", enmState));
+ return VERR_INVALID_STATE;
+
+ case RTUDPSERVERSTATE_STOPPING:
+ case RTUDPSERVERSTATE_STOPPED:
+ return VINF_SUCCESS;
+
+ case RTUDPSERVERSTATE_DESTROYING:
+ return VERR_UDP_SERVER_DESTROYED;
+ }
+ }
+ if (rtUdpServerTrySetState(pServer, RTUDPSERVERSTATE_STOPPING, enmState))
+ {
+ rtUdpServerDestroySocket(&pServer->hSocket, "RTUdpServerShutdown");
+ rtUdpServerSetState(pServer, RTUDPSERVERSTATE_STOPPED, RTUDPSERVERSTATE_STOPPING);
+
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+ return VINF_SUCCESS;
+ }
+ }
+}
+
+
+/**
+ * Closes down and frees a UDP Server.
+ *
+ * @returns iprt status code.
+ * @param pServer Handle to the server.
+ */
+RTR3DECL(int) RTUdpServerDestroy(PRTUDPSERVER pServer)
+{
+ /*
+ * Validate input and retain the instance.
+ */
+ AssertPtrReturn(pServer, VERR_INVALID_HANDLE);
+ AssertReturn(pServer->u32Magic == RTUDPSERVER_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(RTMemPoolRetain(pServer) != UINT32_MAX, VERR_INVALID_HANDLE); /* paranoia */
+
+ /*
+ * Move the state along so the listener can figure out what's going on.
+ */
+ for (;;)
+ {
+ bool fDestroyable;
+ RTUDPSERVERSTATE enmState = pServer->enmState;
+ switch (enmState)
+ {
+ case RTUDPSERVERSTATE_STARTING:
+ case RTUDPSERVERSTATE_WAITING:
+ case RTUDPSERVERSTATE_RECEIVING:
+ case RTUDPSERVERSTATE_CREATED:
+ case RTUDPSERVERSTATE_STOPPED:
+ fDestroyable = rtUdpServerTrySetState(pServer, RTUDPSERVERSTATE_DESTROYING, enmState);
+ break;
+
+ /* destroyable states */
+ case RTUDPSERVERSTATE_STOPPING:
+ fDestroyable = true;
+ break;
+
+ /*
+ * Everything else means user or internal misbehavior.
+ */
+ default:
+ AssertMsgFailed(("pServer=%p enmState=%d\n", pServer, enmState));
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+ return VERR_INTERNAL_ERROR;
+ }
+ if (fDestroyable)
+ break;
+ }
+
+ /*
+ * Destroy it.
+ */
+ ASMAtomicWriteU32(&pServer->u32Magic, ~RTUDPSERVER_MAGIC);
+ rtUdpServerDestroySocket(&pServer->hSocket, "Destroyer: server");
+
+ /*
+ * Release it.
+ */
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+ return VINF_SUCCESS;
+}
+
+
+/**
+ * Internal close function which does all the proper bitching.
+ */
+static int rtUdpClose(RTSOCKET Sock, const char *pszMsg)
+{
+ /* ignore nil handles. */
+ if (Sock == NIL_RTSOCKET)
+ return VINF_SUCCESS;
+
+ /*
+ * Close the socket handle (drops our reference to it).
+ */
+ return RTSocketClose(Sock);
+}
+
+
+RTR3DECL(int) RTUdpRead(RTSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead, PRTNETADDR pSrcAddr)
+{
+ if (!RT_VALID_PTR(pcbRead))
+ return VERR_INVALID_POINTER;
+ return RTSocketReadFrom(Sock, pvBuffer, cbBuffer, pcbRead, pSrcAddr);
+}
+
+
+RTR3DECL(int) RTUdpWrite(PRTUDPSERVER pServer, const void *pvBuffer, size_t cbBuffer, PCRTNETADDR pDstAddr)
+{
+ /*
+ * Validate input and retain the instance.
+ */
+ AssertPtrReturn(pServer, VERR_INVALID_HANDLE);
+ AssertReturn(pServer->u32Magic == RTUDPSERVER_MAGIC, VERR_INVALID_HANDLE);
+ AssertReturn(RTMemPoolRetain(pServer) != UINT32_MAX, VERR_INVALID_HANDLE);
+
+ RTSOCKET hSocket;
+ ASMAtomicReadHandle(&pServer->hSocket, &hSocket);
+ if (hSocket == NIL_RTSOCKET)
+ {
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+ return VERR_INVALID_HANDLE;
+ }
+ RTSocketRetain(hSocket);
+
+ int rc = VINF_SUCCESS;
+ RTUDPSERVERSTATE enmState = pServer->enmState;
+ if ( enmState != RTUDPSERVERSTATE_CREATED
+ && enmState != RTUDPSERVERSTATE_STARTING
+ && enmState != RTUDPSERVERSTATE_WAITING
+ && enmState != RTUDPSERVERSTATE_RECEIVING
+ && enmState != RTUDPSERVERSTATE_STOPPING)
+ rc = VERR_INVALID_STATE;
+
+ if (RT_SUCCESS(rc))
+ rc = RTSocketWriteTo(hSocket, pvBuffer, cbBuffer, pDstAddr);
+
+ RTSocketRelease(hSocket);
+ RTMemPoolRelease(RTMEMPOOL_DEFAULT, pServer);
+
+ return rc;
+}
+
diff --git a/src/VBox/Runtime/r3/win/RTHandleGetStandard-win.cpp b/src/VBox/Runtime/r3/win/RTHandleGetStandard-win.cpp
index a0a1e5fa3..42e6953c6 100644
--- a/src/VBox/Runtime/r3/win/RTHandleGetStandard-win.cpp
+++ b/src/VBox/Runtime/r3/win/RTHandleGetStandard-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTHandleGetStandard-win.cpp $ */
+/* $Id: RTHandleGetStandard-win.cpp 36123 2011-03-01 15:38:35Z vboxsync $ */
/** @file
* IPRT - RTHandleGetStandard, Windows.
*/
@@ -63,7 +63,7 @@ RTDECL(int) RTHandleGetStandard(RTHANDLESTD enmStdHandle, PRTHANDLE ph)
* best map on to?
*/
HANDLE hNative = GetStdHandle(dwStdHandle);
- if (hNative)
+ if (hNative == INVALID_HANDLE_VALUE)
return RTErrConvertFromWin32(GetLastError());
DWORD dwInfo;
diff --git a/src/VBox/Runtime/r3/win/RTLogWriteDebugger-win.cpp b/src/VBox/Runtime/r3/win/RTLogWriteDebugger-win.cpp
index 2f3c16c03..faff04b90 100644
--- a/src/VBox/Runtime/r3/win/RTLogWriteDebugger-win.cpp
+++ b/src/VBox/Runtime/r3/win/RTLogWriteDebugger-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLogWriteDebugger-win.cpp $ */
+/* $Id: RTLogWriteDebugger-win.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Log To Debugger, Win32.
*/
diff --git a/src/VBox/Runtime/r3/win/RTSystemQueryDmiString-win.cpp b/src/VBox/Runtime/r3/win/RTSystemQueryDmiString-win.cpp
index 578319106..a37fd76fc 100644
--- a/src/VBox/Runtime/r3/win/RTSystemQueryDmiString-win.cpp
+++ b/src/VBox/Runtime/r3/win/RTSystemQueryDmiString-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSystemQueryDmiString-win.cpp $ */
+/* $Id: RTSystemQueryDmiString-win.cpp 36440 2011-03-25 16:21:57Z vboxsync $ */
/** @file
* IPRT - RTSystemQueryDmiString, windows ring-3.
*/
diff --git a/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp b/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp
index 194e3ee23..a87892ac9 100644
--- a/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp
+++ b/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSystemQueryOSInfo-win.cpp $ */
+/* $Id: RTSystemQueryOSInfo-win.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTSystemQueryOSInfo, generic stub.
*/
diff --git a/src/VBox/Runtime/r3/win/RTSystemQueryTotalRam-win.cpp b/src/VBox/Runtime/r3/win/RTSystemQueryTotalRam-win.cpp
index 5e31869c4..36482d824 100644
--- a/src/VBox/Runtime/r3/win/RTSystemQueryTotalRam-win.cpp
+++ b/src/VBox/Runtime/r3/win/RTSystemQueryTotalRam-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTSystemQueryTotalRam-win.cpp $ */
+/* $Id: RTSystemQueryTotalRam-win.cpp 33503 2010-10-27 13:12:57Z vboxsync $ */
/** @file
* IPRT - RTSystemQueryTotalRam, windows ring-3.
*/
diff --git a/src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp b/src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp
index 8083f98de..e979fa18c 100644
--- a/src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp
+++ b/src/VBox/Runtime/r3/win/RTUuidCreate-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTUuidCreate-win.cpp $ */
+/* $Id: RTUuidCreate-win.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - UUID, Windows RTUuidCreate implementation.
*/
diff --git a/src/VBox/Runtime/r3/win/VBoxRT-openssl-ose.def b/src/VBox/Runtime/r3/win/VBoxRT-openssl-ose.def
index b296ca6a9..8bdd5da8d 100644
--- a/src/VBox/Runtime/r3/win/VBoxRT-openssl-ose.def
+++ b/src/VBox/Runtime/r3/win/VBoxRT-openssl-ose.def
@@ -1,4 +1,4 @@
-; $Id: VBoxRT-openssl-ose.def $
+; $Id: VBoxRT-openssl-ose.def 38036 2011-07-18 16:36:29Z vboxsync $
;; @file
; IPRT - Windows OpenSSL exports.
;
@@ -9,7 +9,7 @@
;
;
-; Copyright (C) 2009 Oracle Corporation
+; Copyright (C) 2009-2011 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
@@ -224,6 +224,7 @@
BIO_dump_indent_cb
BIO_dump_indent_fp
BIO_dup_chain
+ BIO_f_buffer
BIO_find_type
BIO_free
BIO_free_all
@@ -241,6 +242,7 @@
BIO_new
BIO_new_file
BIO_new_fp
+ BIO_new_socket
BIO_next
BIO_number_read
BIO_number_written
@@ -250,6 +252,7 @@
BIO_puts
BIO_read
BIO_s_file
+ BIO_s_socket
BIO_set
BIO_set_callback
BIO_set_callback_arg
@@ -533,6 +536,7 @@
d2i_BASIC_CONSTRAINTS
d2i_CERTIFICATEPOLICIES
d2i_CRL_DIST_POINTS
+ d2i_DHparams
d2i_DIRECTORYSTRING
d2i_DISPLAYTEXT
d2i_DIST_POINT
@@ -759,6 +763,7 @@
ECDSA_sign_ex
ECDSA_sign_setup
ECDSA_size
+ ECDSA_verify
ECParameters_print
ECParameters_print_fp
ECPKParameters_print
@@ -799,6 +804,9 @@
ERR_unload_strings
EVP_add_cipher
EVP_add_digest
+ EVP_aes_128_cbc
+ EVP_aes_192_cbc
+ EVP_aes_256_cbc
EVP_BytesToKey
EVP_Cipher
EVP_CIPHER_asn1_to_param
@@ -851,6 +859,8 @@
EVP_DigestInit
EVP_DigestInit_ex
EVP_DigestUpdate
+ EVP_ecdsa
+ EVP_enc_null
EVP_EncodeBlock
EVP_EncodeFinal
EVP_EncodeInit
@@ -910,6 +920,7 @@
EVP_PKEY_set1_RSA
EVP_PKEY_size
EVP_PKEY_type
+ EVP_rc4
EVP_read_pw_string
EVP_set_pw_prompt
EVP_sha1
@@ -971,6 +982,7 @@
i2d_BASIC_CONSTRAINTS
i2d_CERTIFICATEPOLICIES
i2d_CRL_DIST_POINTS
+ i2d_DHparams
i2d_DIRECTORYSTRING
i2d_DISPLAYTEXT
i2d_DIST_POINT
@@ -1181,7 +1193,9 @@
PEM_proc_type
PEM_read_bio
PEM_read_bio_PrivateKey
+ PEM_read_bio_RSAPrivateKey
PEM_read_bio_X509
+ PEM_read_bio_X509_AUX
PEM_write_bio
PEM_write_bio_X509
PKCS7_DIGEST_free
@@ -1319,6 +1333,22 @@
sk_zero
SSLeay
SSLeay_version
+ SSL_accept
+ SSL_CTX_free
+ SSL_CTX_load_verify_locations
+ SSL_CTX_new
+ SSL_CTX_set_verify
+ SSL_CTX_use_certificate_file
+ SSL_CTX_use_PrivateKey_file
+ SSL_free
+ SSL_get_certificate
+ SSL_library_init
+ SSL_new
+ SSL_pending
+ SSL_read
+ SSL_set_bio
+ SSL_set_read_ahead
+ SSL_write
string_to_hex
SXNET_add_id_asc
SXNET_add_id_INTEGER
@@ -1330,6 +1360,7 @@
SXNET_new
SXNETID_free
SXNETID_new
+ TLSv1_server_method
UI_add_error_string
UI_add_info_string
UI_add_input_boolean
@@ -1416,6 +1447,7 @@
X509_CERT_AUX_print
X509_CERT_PAIR_free
X509_CERT_PAIR_new
+ X509_certificate_type
X509_check_ca
X509_check_issued
X509_check_private_key
@@ -1582,6 +1614,17 @@
X509_SIG_new
X509_sign
X509_signature_print
+ X509_STORE_CTX_cleanup
+ X509_STORE_CTX_get_ex_new_index
+ X509_STORE_CTX_get0_param
+ X509_STORE_CTX_init
+ X509_STORE_CTX_set_default
+ X509_STORE_CTX_set_ex_data
+ X509_STORE_CTX_set_verify_cb
+ X509_STORE_free
+ X509_STORE_load_locations
+ X509_STORE_new
+ X509_STORE_set_default_paths
X509_subject_name_cmp
X509_subject_name_hash
X509_supported_extension
@@ -1590,6 +1633,15 @@
X509_VAL_free
X509_VAL_new
X509_verify
+ X509_verify_cert
+ X509_VERIFY_PARAM_free
+ X509_VERIFY_PARAM_get_depth
+ X509_VERIFY_PARAM_inherit
+ X509_VERIFY_PARAM_new
+ X509_VERIFY_PARAM_set_depth
+ X509_VERIFY_PARAM_set_purpose
+ X509_VERIFY_PARAM_set_trust
+ X509_VERIFY_PARAM_set1
X509at_add1_attr
X509at_add1_attr_by_NID
X509at_add1_attr_by_OBJ
diff --git a/src/VBox/Runtime/r3/win/VBoxRT-openssl.def b/src/VBox/Runtime/r3/win/VBoxRT-openssl.def
index 875c1b481..713a993d0 100644
--- a/src/VBox/Runtime/r3/win/VBoxRT-openssl.def
+++ b/src/VBox/Runtime/r3/win/VBoxRT-openssl.def
@@ -1,4 +1,4 @@
-; $Id: VBoxRT-openssl.def $
+; $Id: VBoxRT-openssl.def 37254 2011-05-30 12:09:59Z vboxsync $
;; @file
; IPRT - Windows OpenSSL exports.
;
@@ -30,7 +30,7 @@
;
;
- ; OpenSSL symbols
+ ; OpenSSL crypto symbols
;
_CONF_add_string
_CONF_free_data
@@ -47,6 +47,20 @@
a2i_IPADDRESS_NC
ACCESS_DESCRIPTION_free
ACCESS_DESCRIPTION_new
+ AES_cbc_encrypt
+ AES_cfb1_encrypt
+ AES_cfb128_encrypt
+ AES_cfb8_encrypt
+ AES_cfbr_encrypt_block
+ AES_ctr128_encrypt
+ AES_decrypt
+ AES_ecb_encrypt
+ AES_encrypt
+ AES_ofb128_encrypt
+ AES_options
+ AES_set_decrypt_key
+ AES_set_encrypt_key
+ asc2uni
asn1_add_error
ASN1_BIT_STRING_free
ASN1_BIT_STRING_get_bit
@@ -162,10 +176,10 @@
ASN1_STRING_print_ex
ASN1_STRING_print_ex_fp
ASN1_STRING_set
- ASN1_STRING_set0
ASN1_STRING_set_by_NID
ASN1_STRING_set_default_mask
ASN1_STRING_set_default_mask_asc
+ ASN1_STRING_set0
ASN1_STRING_TABLE_add
ASN1_STRING_TABLE_cleanup
ASN1_STRING_TABLE_get
@@ -192,9 +206,9 @@
ASN1_TYPE_get_octetstring
ASN1_TYPE_new
ASN1_TYPE_set
- ASN1_TYPE_set1
ASN1_TYPE_set_int_octetstring
ASN1_TYPE_set_octetstring
+ ASN1_TYPE_set1
ASN1_UNIVERSALSTRING_free
ASN1_UNIVERSALSTRING_new
ASN1_UNIVERSALSTRING_to_string
@@ -217,8 +231,11 @@
AUTHORITY_KEYID_new
BASIC_CONSTRAINTS_free
BASIC_CONSTRAINTS_new
+ BIO_accept
BIO_callback_ctrl
BIO_clear_flags
+ BIO_CONNECT_free
+ BIO_CONNECT_new
BIO_copy_next_retry
BIO_ctrl
BIO_ctrl_pending
@@ -230,23 +247,30 @@
BIO_dump_indent_cb
BIO_dump_indent_fp
BIO_dup_chain
+ BIO_f_buffer
BIO_find_type
BIO_free
BIO_free_all
+ BIO_get_accept_socket
BIO_get_callback
BIO_get_callback_arg
BIO_get_ex_data
BIO_get_ex_new_index
+ BIO_get_host_ip
+ BIO_get_port
BIO_get_retry_BIO
BIO_get_retry_reason
+ BIO_gethostbyname
BIO_gets
BIO_indent
BIO_int_ctrl
BIO_method_name
BIO_method_type
BIO_new
+ BIO_new_connect
BIO_new_file
BIO_new_fp
+ BIO_new_socket
BIO_next
BIO_number_read
BIO_number_written
@@ -255,12 +279,22 @@
BIO_push
BIO_puts
BIO_read
+ BIO_s_connect
BIO_s_file
+ BIO_s_socket
BIO_set
BIO_set_callback
BIO_set_callback_arg
BIO_set_ex_data
BIO_set_flags
+ BIO_set_tcp_ndelay
+ BIO_sock_cleanup
+ BIO_sock_error
+ BIO_sock_init
+ BIO_sock_non_fatal_error
+ BIO_sock_should_retry
+ BIO_socket_ioctl
+ BIO_socket_nbio
BIO_test_flags
BIO_vfree
BIO_write
@@ -312,13 +346,13 @@
BN_gcd
BN_GENCB_call
BN_generate_prime_ex
+ BN_get_params
+ BN_get_word
BN_get0_nist_prime_192
BN_get0_nist_prime_224
BN_get0_nist_prime_256
BN_get0_nist_prime_384
BN_get0_nist_prime_521
- BN_get_params
- BN_get_word
BN_GF2m_add
BN_GF2m_arr2poly
BN_GF2m_mod
@@ -357,9 +391,9 @@
BN_mod_exp_simple
BN_mod_inverse
BN_mod_lshift
+ BN_mod_lshift_quick
BN_mod_lshift1
BN_mod_lshift1_quick
- BN_mod_lshift_quick
BN_mod_mul
BN_mod_mul_montgomery
BN_mod_mul_reciprocal
@@ -442,6 +476,11 @@
c2i_ASN1_OBJECT
CERTIFICATEPOLICIES_free
CERTIFICATEPOLICIES_new
+ COMP_compress_block
+ COMP_CTX_free
+ COMP_CTX_new
+ COMP_expand_block
+ COMP_zlib
CONF_dump_bio
CONF_dump_fp
CONF_free
@@ -555,6 +594,7 @@
d2i_BASIC_CONSTRAINTS
d2i_CERTIFICATEPOLICIES
d2i_CRL_DIST_POINTS
+ d2i_DHparams
d2i_DIRECTORYSTRING
d2i_DISPLAYTEXT
d2i_DIST_POINT
@@ -562,16 +602,19 @@
d2i_EC_PRIVATEKEY
d2i_EC_PUBKEY
d2i_EC_PUBKEY_bio
+ d2i_EC_PUBKEY_fp
d2i_ECDSA_SIG
d2i_ECParameters
- d2i_ECPKPARAMETERS
d2i_ECPKParameters
+ d2i_ECPKPARAMETERS
d2i_ECPrivateKey
d2i_ECPrivateKey_bio
+ d2i_ECPrivateKey_fp
d2i_EDIPARTYNAME
d2i_EXTENDED_KEY_USAGE
d2i_GENERAL_NAME
d2i_GENERAL_NAMES
+ d2i_NETSCAPE_CERT_SEQUENCE
d2i_NETSCAPE_SPKAC
d2i_NETSCAPE_SPKI
d2i_NOTICEREF
@@ -591,36 +634,52 @@
d2i_OCSP_SIGNATURE
d2i_OCSP_SINGLERESP
d2i_OTHERNAME
+ d2i_PBE2PARAM
+ d2i_PBEPARAM
+ d2i_PBKDF2PARAM
+ d2i_PKCS12
+ d2i_PKCS12_BAGS
+ d2i_PKCS12_bio
+ d2i_PKCS12_MAC_DATA
+ d2i_PKCS12_SAFEBAG
d2i_PKCS7
d2i_PKCS7_bio
d2i_PKCS7_DIGEST
d2i_PKCS7_ENC_CONTENT
d2i_PKCS7_ENCRYPT
d2i_PKCS7_ENVELOPE
+ d2i_PKCS7_fp
d2i_PKCS7_ISSUER_AND_SERIAL
d2i_PKCS7_RECIP_INFO
d2i_PKCS7_SIGN_ENVELOPE
d2i_PKCS7_SIGNED
d2i_PKCS7_SIGNER_INFO
d2i_PKCS8_bio
+ d2i_PKCS8_fp
d2i_PKCS8_PRIV_KEY_INFO
d2i_PKCS8_PRIV_KEY_INFO_bio
+ d2i_PKCS8_PRIV_KEY_INFO_fp
d2i_PKEY_USAGE_PERIOD
d2i_POLICYINFO
d2i_POLICYQUALINFO
d2i_PrivateKey
d2i_PrivateKey_bio
+ d2i_PrivateKey_fp
d2i_PROXY_CERT_INFO_EXTENSION
d2i_PROXY_POLICY
d2i_PUBKEY
d2i_PUBKEY_bio
+ d2i_PUBKEY_fp
d2i_PublicKey
d2i_RSA_PUBKEY
d2i_RSA_PUBKEY_bio
+ d2i_RSA_PUBKEY_fp
d2i_RSAPrivateKey
d2i_RSAPrivateKey_bio
+ d2i_RSAPrivateKey_fp
d2i_RSAPublicKey
d2i_RSAPublicKey_bio
+ d2i_RSAPublicKey_fp
d2i_SXNET
d2i_SXNETID
d2i_USERNOTICE
@@ -635,14 +694,18 @@
d2i_X509_CINF
d2i_X509_CRL
d2i_X509_CRL_bio
+ d2i_X509_CRL_fp
d2i_X509_CRL_INFO
d2i_X509_EXTENSION
d2i_X509_EXTENSIONS
+ d2i_X509_fp
d2i_X509_NAME
d2i_X509_NAME_ENTRY
+ d2i_X509_PKEY
d2i_X509_PUBKEY
d2i_X509_REQ
d2i_X509_REQ_bio
+ d2i_X509_REQ_fp
d2i_X509_REQ_INFO
d2i_X509_REVOKED
d2i_X509_SIG
@@ -703,7 +766,6 @@
EC_GF2m_simple_method
ec_GF2m_simple_mul
ec_GF2m_simple_oct2point
- ec_GF2m_simple_point2oct
ec_GF2m_simple_point_clear_finish
ec_GF2m_simple_point_copy
ec_GF2m_simple_point_finish
@@ -711,6 +773,7 @@
ec_GF2m_simple_point_init
ec_GF2m_simple_point_set_affine_coordinates
ec_GF2m_simple_point_set_to_infinity
+ ec_GF2m_simple_point2oct
ec_GF2m_simple_points_make_affine
ec_GF2m_simple_set_compressed_coordinates
ec_GFp_mont_field_decode
@@ -749,7 +812,6 @@
ec_GFp_simple_make_affine
EC_GFp_simple_method
ec_GFp_simple_oct2point
- ec_GFp_simple_point2oct
ec_GFp_simple_point_clear_finish
ec_GFp_simple_point_copy
ec_GFp_simple_point_finish
@@ -757,6 +819,7 @@
ec_GFp_simple_point_init
ec_GFp_simple_point_set_affine_coordinates
ec_GFp_simple_point_set_to_infinity
+ ec_GFp_simple_point2oct
ec_GFp_simple_points_make_affine
ec_GFp_simple_set_compressed_coordinates
ec_GFp_simple_set_Jprojective_coordinates_GFp
@@ -766,8 +829,6 @@
EC_GROUP_copy
EC_GROUP_dup
EC_GROUP_free
- EC_GROUP_get0_generator
- EC_GROUP_get0_seed
EC_GROUP_get_asn1_flag
EC_GROUP_get_basis_type
EC_GROUP_get_cofactor
@@ -780,6 +841,8 @@
EC_GROUP_get_point_conversion_form
EC_GROUP_get_seed_len
EC_GROUP_get_trinomial_basis
+ EC_GROUP_get0_generator
+ EC_GROUP_get0_seed
EC_GROUP_have_precompute_mult
EC_GROUP_method_of
EC_GROUP_new
@@ -799,12 +862,12 @@
EC_KEY_dup
EC_KEY_free
EC_KEY_generate_key
- EC_KEY_get0_group
- EC_KEY_get0_private_key
- EC_KEY_get0_public_key
EC_KEY_get_conv_form
EC_KEY_get_enc_flags
EC_KEY_get_key_method_data
+ EC_KEY_get0_group
+ EC_KEY_get0_private_key
+ EC_KEY_get0_public_key
EC_KEY_insert_key_method_data
EC_KEY_new
EC_KEY_new_by_curve_name
@@ -858,6 +921,7 @@
ecdsa_check
ECDSA_do_sign
ECDSA_do_sign_ex
+ ECDSA_do_verify
ECDSA_get_default_method
ECDSA_get_ex_data
ECDSA_get_ex_new_index
@@ -871,6 +935,7 @@
ECDSA_sign_ex
ECDSA_sign_setup
ECDSA_size
+ ECDSA_verify
ECPARAMETERS_free
ECPARAMETERS_new
ECParameters_print
@@ -915,6 +980,24 @@
ERR_unload_strings
EVP_add_cipher
EVP_add_digest
+ EVP_aes_128_cbc
+ EVP_aes_128_cfb1
+ EVP_aes_128_cfb128
+ EVP_aes_128_cfb8
+ EVP_aes_128_ecb
+ EVP_aes_128_ofb
+ EVP_aes_192_cbc
+ EVP_aes_192_cfb1
+ EVP_aes_192_cfb128
+ EVP_aes_192_cfb8
+ EVP_aes_192_ecb
+ EVP_aes_192_ofb
+ EVP_aes_256_cbc
+ EVP_aes_256_cfb1
+ EVP_aes_256_cfb128
+ EVP_aes_256_cfb8
+ EVP_aes_256_ecb
+ EVP_aes_256_ofb
EVP_BytesToKey
EVP_Cipher
EVP_CIPHER_asn1_to_param
@@ -967,6 +1050,8 @@
EVP_DigestInit
EVP_DigestInit_ex
EVP_DigestUpdate
+ EVP_ecdsa
+ EVP_enc_null
EVP_EncodeBlock
EVP_EncodeFinal
EVP_EncodeInit
@@ -979,7 +1064,6 @@
EVP_get_cipherbyname
EVP_get_digestbyname
EVP_get_pw_prompt
- EVP_md5
EVP_MD_block_size
EVP_MD_CTX_cleanup
EVP_MD_CTX_clear_flags
@@ -994,12 +1078,11 @@
EVP_MD_pkey_type
EVP_MD_size
EVP_MD_type
+ EVP_md5
EVP_PBE_alg_add
EVP_PBE_CipherInit
EVP_PBE_cleanup
EVP_PKCS82PKEY
- EVP_PKEY2PKCS8
- EVP_PKEY2PKCS8_broken
EVP_PKEY_add1_attr
EVP_PKEY_add1_attr_by_NID
EVP_PKEY_add1_attr_by_OBJ
@@ -1011,13 +1094,13 @@
EVP_PKEY_copy_parameters
EVP_PKEY_delete_attr
EVP_PKEY_free
- EVP_PKEY_get1_DH
- EVP_PKEY_get1_EC_KEY
- EVP_PKEY_get1_RSA
EVP_PKEY_get_attr
EVP_PKEY_get_attr_by_NID
EVP_PKEY_get_attr_by_OBJ
EVP_PKEY_get_attr_count
+ EVP_PKEY_get1_DH
+ EVP_PKEY_get1_EC_KEY
+ EVP_PKEY_get1_RSA
EVP_PKEY_missing_parameters
EVP_PKEY_new
EVP_PKEY_save_parameters
@@ -1026,6 +1109,10 @@
EVP_PKEY_set1_RSA
EVP_PKEY_size
EVP_PKEY_type
+ EVP_PKEY2PKCS8
+ EVP_PKEY2PKCS8_broken
+ EVP_rc4
+ EVP_rc4_40
EVP_read_pw_string
EVP_set_pw_prompt
EVP_sha1
@@ -1087,6 +1174,7 @@
i2d_BASIC_CONSTRAINTS
i2d_CERTIFICATEPOLICIES
i2d_CRL_DIST_POINTS
+ i2d_DHparams
i2d_DIRECTORYSTRING
i2d_DISPLAYTEXT
i2d_DIST_POINT
@@ -1094,16 +1182,19 @@
i2d_EC_PRIVATEKEY
i2d_EC_PUBKEY
i2d_EC_PUBKEY_bio
+ i2d_EC_PUBKEY_fp
i2d_ECDSA_SIG
i2d_ECParameters
- i2d_ECPKPARAMETERS
i2d_ECPKParameters
+ i2d_ECPKPARAMETERS
i2d_ECPrivateKey
i2d_ECPrivateKey_bio
+ i2d_ECPrivateKey_fp
i2d_EDIPARTYNAME
i2d_EXTENDED_KEY_USAGE
i2d_GENERAL_NAME
i2d_GENERAL_NAMES
+ i2d_NETSCAPE_CERT_SEQUENCE
i2d_NETSCAPE_SPKAC
i2d_NETSCAPE_SPKI
i2d_NOTICEREF
@@ -1123,12 +1214,21 @@
i2d_OCSP_SIGNATURE
i2d_OCSP_SINGLERESP
i2d_OTHERNAME
+ i2d_PBE2PARAM
+ i2d_PBEPARAM
+ i2d_PBKDF2PARAM
+ i2d_PKCS12
+ i2d_PKCS12_BAGS
+ i2d_PKCS12_bio
+ i2d_PKCS12_MAC_DATA
+ i2d_PKCS12_SAFEBAG
i2d_PKCS7
i2d_PKCS7_bio
i2d_PKCS7_DIGEST
i2d_PKCS7_ENC_CONTENT
i2d_PKCS7_ENCRYPT
i2d_PKCS7_ENVELOPE
+ i2d_PKCS7_fp
i2d_PKCS7_ISSUER_AND_SERIAL
i2d_PKCS7_NDEF
i2d_PKCS7_RECIP_INFO
@@ -1136,25 +1236,33 @@
i2d_PKCS7_SIGNED
i2d_PKCS7_SIGNER_INFO
i2d_PKCS8_bio
+ i2d_PKCS8_fp
i2d_PKCS8_PRIV_KEY_INFO
i2d_PKCS8_PRIV_KEY_INFO_bio
+ i2d_PKCS8_PRIV_KEY_INFO_fp
i2d_PKCS8PrivateKeyInfo_bio
+ i2d_PKCS8PrivateKeyInfo_fp
i2d_PKEY_USAGE_PERIOD
i2d_POLICYINFO
i2d_POLICYQUALINFO
i2d_PrivateKey
i2d_PrivateKey_bio
+ i2d_PrivateKey_fp
i2d_PROXY_CERT_INFO_EXTENSION
i2d_PROXY_POLICY
i2d_PUBKEY
i2d_PUBKEY_bio
+ i2d_PUBKEY_fp
i2d_PublicKey
i2d_RSA_PUBKEY
i2d_RSA_PUBKEY_bio
+ i2d_RSA_PUBKEY_fp
i2d_RSAPrivateKey
i2d_RSAPrivateKey_bio
+ i2d_RSAPrivateKey_fp
i2d_RSAPublicKey
i2d_RSAPublicKey_bio
+ i2d_RSAPublicKey_fp
i2d_SXNET
i2d_SXNETID
i2d_USERNOTICE
@@ -1169,14 +1277,18 @@
i2d_X509_CINF
i2d_X509_CRL
i2d_X509_CRL_bio
+ i2d_X509_CRL_fp
i2d_X509_CRL_INFO
i2d_X509_EXTENSION
i2d_X509_EXTENSIONS
+ i2d_X509_fp
i2d_X509_NAME
i2d_X509_NAME_ENTRY
+ i2d_X509_PKEY
i2d_X509_PUBKEY
i2d_X509_REQ
i2d_X509_REQ_bio
+ i2d_X509_REQ_fp
i2d_X509_REQ_INFO
i2d_X509_REVOKED
i2d_X509_SIG
@@ -1190,6 +1302,8 @@
i2v_ASN1_BIT_STRING
i2v_GENERAL_NAME
i2v_GENERAL_NAMES
+ level_add_node
+ level_find_node
lh_delete
lh_doall
lh_doall_arg
@@ -1204,6 +1318,7 @@
MD5_Init
MD5_Transform
MD5_Update
+ MGF1
name_cmp
NAME_CONSTRAINTS_free
NAME_CONSTRAINTS_new
@@ -1220,6 +1335,8 @@
NCONF_load_fp
NCONF_new
NCONF_WIN32
+ NETSCAPE_CERT_SEQUENCE_free
+ NETSCAPE_CERT_SEQUENCE_new
NETSCAPE_SPKAC_free
NETSCAPE_SPKAC_new
NETSCAPE_SPKI_free
@@ -1285,12 +1402,21 @@
OCSP_SIGNATURE_new
OCSP_SINGLERESP_free
OCSP_SINGLERESP_new
+ OpenSSL_add_all_ciphers
OPENSSL_cleanse
+ OPENSSL_DIR_end
+ OPENSSL_DIR_read
OPENSSL_gmtime
OPENSSL_isservice
OpenSSLDie
OTHERNAME_free
OTHERNAME_new
+ PBE2PARAM_free
+ PBE2PARAM_new
+ PBEPARAM_free
+ PBEPARAM_new
+ PBKDF2PARAM_free
+ PBKDF2PARAM_new
PEM_ASN1_read_bio
PEM_ASN1_write_bio
PEM_bytes_read_bio
@@ -1300,10 +1426,89 @@
PEM_get_EVP_CIPHER_INFO
PEM_proc_type
PEM_read_bio
+ PEM_read_bio_DHparams
+ PEM_read_bio_EC_PUBKEY
+ PEM_read_bio_ECPKParameters
+ PEM_read_bio_ECPrivateKey
+ PEM_read_bio_NETSCAPE_CERT_SEQUENCE
+ PEM_read_bio_PKCS7
PEM_read_bio_PrivateKey
+ PEM_read_bio_PUBKEY
+ PEM_read_bio_RSA_PUBKEY
+ PEM_read_bio_RSAPrivateKey
+ PEM_read_bio_RSAPublicKey
PEM_read_bio_X509
+ PEM_read_bio_X509_AUX
+ PEM_read_bio_X509_CERT_PAIR
+ PEM_read_bio_X509_CRL
+ PEM_read_bio_X509_REQ
PEM_write_bio
+ PEM_write_bio_DHparams
+ PEM_write_bio_EC_PUBKEY
+ PEM_write_bio_ECPKParameters
+ PEM_write_bio_ECPrivateKey
+ PEM_write_bio_NETSCAPE_CERT_SEQUENCE
+ PEM_write_bio_PKCS7
+ PEM_write_bio_PrivateKey
+ PEM_write_bio_PUBKEY
+ PEM_write_bio_RSA_PUBKEY
+ PEM_write_bio_RSAPrivateKey
+ PEM_write_bio_RSAPublicKey
PEM_write_bio_X509
+ PEM_write_bio_X509_AUX
+ PEM_write_bio_X509_CERT_PAIR
+ PEM_write_bio_X509_CRL
+ PEM_write_bio_X509_REQ
+ PEM_write_bio_X509_REQ_NEW
+ PEM_X509_INFO_read_bio
+ PEM_X509_INFO_write_bio
+ pitem_free
+ pitem_new
+ PKCS1_MGF1
+ PKCS12_BAGS_free
+ PKCS12_BAGS_new
+ PKCS12_certbag2x509
+ PKCS12_certbag2x509crl
+ PKCS12_decrypt_skey
+ PKCS12_free
+ PKCS12_item_decrypt_d2i
+ PKCS12_item_i2d_encrypt
+ PKCS12_item_pack_safebag
+ PKCS12_key_gen_asc
+ PKCS12_key_gen_uni
+ PKCS12_MAC_DATA_free
+ PKCS12_MAC_DATA_new
+ PKCS12_MAKE_KEYBAG
+ PKCS12_MAKE_SHKEYBAG
+ PKCS12_new
+ PKCS12_pack_authsafes
+ PKCS12_pack_p7data
+ PKCS12_pack_p7encdata
+ PKCS12_PBE_add
+ PKCS12_pbe_crypt
+ PKCS12_PBE_keyivgen
+ PKCS12_SAFEBAG_free
+ PKCS12_SAFEBAG_new
+ PKCS12_unpack_authsafes
+ PKCS12_unpack_p7data
+ PKCS12_unpack_p7encdata
+ PKCS12_x5092certbag
+ PKCS12_x509crl2certbag
+ PKCS5_PBE_add
+ PKCS5_PBE_keyivgen
+ PKCS5_pbe_set
+ PKCS5_pbe2_set
+ PKCS5_PBKDF2_HMAC_SHA1
+ PKCS5_v2_PBE_keyivgen
+ PKCS7_add_certificate
+ PKCS7_add_crl
+ PKCS7_add_recipient
+ PKCS7_add_recipient_info
+ PKCS7_add_signature
+ PKCS7_add_signer
+ PKCS7_cert_from_signer_info
+ PKCS7_content_new
+ PKCS7_ctrl
PKCS7_DIGEST_free
PKCS7_DIGEST_new
PKCS7_dup
@@ -1314,18 +1519,28 @@
PKCS7_ENVELOPE_free
PKCS7_ENVELOPE_new
PKCS7_free
+ PKCS7_get_signer_info
PKCS7_ISSUER_AND_SERIAL_digest
PKCS7_ISSUER_AND_SERIAL_free
PKCS7_ISSUER_AND_SERIAL_new
PKCS7_new
PKCS7_RECIP_INFO_free
PKCS7_RECIP_INFO_new
+ PKCS7_RECIP_INFO_set
+ PKCS7_set_cipher
+ PKCS7_set_content
+ PKCS7_set_digest
+ PKCS7_set_type
+ PKCS7_set0_type_other
PKCS7_SIGN_ENVELOPE_free
PKCS7_SIGN_ENVELOPE_new
PKCS7_SIGNED_free
PKCS7_SIGNED_new
PKCS7_SIGNER_INFO_free
PKCS7_SIGNER_INFO_new
+ PKCS7_SIGNER_INFO_set
+ PKCS8_decrypt
+ PKCS8_encrypt
PKCS8_PRIV_KEY_INFO_free
PKCS8_PRIV_KEY_INFO_new
PKCS8_set_broken
@@ -1341,10 +1556,21 @@
policy_data_new
POLICY_MAPPING_free
POLICY_MAPPING_new
+ policy_node_cmp_new
+ policy_node_free
POLICYINFO_free
POLICYINFO_new
POLICYQUALINFO_free
POLICYQUALINFO_new
+ pqueue_find
+ pqueue_free
+ pqueue_insert
+ pqueue_iterator
+ pqueue_new
+ pqueue_next
+ pqueue_peek
+ pqueue_pop
+ pqueue_size
PROXY_CERT_INFO_EXTENSION_free
PROXY_CERT_INFO_EXTENSION_new
PROXY_POLICY_free
@@ -1381,6 +1607,19 @@
RSA_new
RSA_new_method
RSA_null_method
+ RSA_padding_add_none
+ RSA_padding_add_PKCS1_OAEP
+ RSA_padding_add_PKCS1_type_1
+ RSA_padding_add_PKCS1_type_2
+ RSA_padding_add_SSLv23
+ RSA_padding_add_X931
+ RSA_padding_check_none
+ RSA_padding_check_PKCS1_OAEP
+ RSA_padding_check_PKCS1_type_1
+ RSA_padding_check_PKCS1_type_2
+ RSA_padding_check_SSLv23
+ RSA_padding_check_X931
+ RSA_PKCS1_SSLeay
RSA_print
RSA_print_fp
RSA_private_decrypt
@@ -1395,6 +1634,7 @@
RSA_size
RSA_up_ref
RSA_verify
+ RSA_X931_hash_id
RSAPrivateKey_asn1_meth
RSAPrivateKey_dup
RSAPublicKey_dup
@@ -1457,6 +1697,7 @@
SXNET_new
SXNETID_free
SXNETID_new
+ tree_find_sk
UI_add_error_string
UI_add_info_string
UI_add_input_boolean
@@ -1473,12 +1714,6 @@
UI_dup_input_string
UI_dup_verify_string
UI_free
- UI_get0_action_string
- UI_get0_output_string
- UI_get0_result
- UI_get0_result_string
- UI_get0_test_string
- UI_get0_user_data
UI_get_default_method
UI_get_ex_data
UI_get_ex_new_index
@@ -1487,6 +1722,12 @@
UI_get_result_maxsize
UI_get_result_minsize
UI_get_string_type
+ UI_get0_action_string
+ UI_get0_output_string
+ UI_get0_result
+ UI_get0_result_string
+ UI_get0_test_string
+ UI_get0_user_data
UI_method_get_closer
UI_method_get_flusher
UI_method_get_opener
@@ -1505,6 +1746,7 @@
UI_set_ex_data
UI_set_method
UI_set_result
+ uni2asc
USERNOTICE_free
USERNOTICE_new
UTF8_getc
@@ -1513,10 +1755,10 @@
v2i_GENERAL_NAME
v2i_GENERAL_NAME_ex
v2i_GENERAL_NAMES
+ X509_add_ext
X509_add1_ext_i2d
X509_add1_reject_object
X509_add1_trust_object
- X509_add_ext
X509_ALGOR_dup
X509_ALGOR_free
X509_ALGOR_get0
@@ -1543,16 +1785,20 @@
X509_CERT_AUX_print
X509_CERT_PAIR_free
X509_CERT_PAIR_new
+ X509_certificate_type
X509_check_ca
X509_check_issued
X509_check_private_key
X509_check_purpose
+ X509_check_trust
X509_CINF_free
X509_CINF_new
X509_cmp
+ X509_cmp_current_time
+ X509_cmp_time
+ X509_CRL_add_ext
X509_CRL_add0_revoked
X509_CRL_add1_ext_i2d
- X509_CRL_add_ext
X509_CRL_cmp
X509_CRL_delete_ext
X509_CRL_digest
@@ -1587,9 +1833,12 @@
X509_find_by_issuer_and_serial
X509_find_by_subject
X509_free
- X509_get0_pubkey_bitstr
- X509_get1_email
- X509_get1_ocsp
+ X509_get_default_cert_area
+ X509_get_default_cert_dir
+ X509_get_default_cert_dir_env
+ X509_get_default_cert_file
+ X509_get_default_cert_file_env
+ X509_get_default_private_dir
X509_get_ex_data
X509_get_ex_new_index
X509_get_ext
@@ -1600,14 +1849,35 @@
X509_get_ext_d2i
X509_get_issuer_name
X509_get_pubkey
+ X509_get_pubkey_parameters
X509_get_serialNumber
X509_get_subject_name
+ X509_get0_pubkey_bitstr
+ X509_get1_email
+ X509_get1_ocsp
+ X509_gmtime_adj
+ X509_INFO_free
+ X509_INFO_new
X509_issuer_and_serial_cmp
X509_issuer_and_serial_hash
X509_issuer_name_cmp
X509_issuer_name_hash
X509_keyid_get0
X509_keyid_set1
+ X509_load_cert_crl_file
+ X509_load_cert_file
+ X509_load_crl_file
+ X509_LOOKUP_by_alias
+ X509_LOOKUP_by_fingerprint
+ X509_LOOKUP_by_issuer_serial
+ X509_LOOKUP_by_subject
+ X509_LOOKUP_ctrl
+ X509_LOOKUP_file
+ X509_LOOKUP_free
+ X509_LOOKUP_hash_dir
+ X509_LOOKUP_init
+ X509_LOOKUP_new
+ X509_LOOKUP_shutdown
X509_NAME_add_entry
X509_NAME_add_entry_by_NID
X509_NAME_add_entry_by_OBJ
@@ -1641,8 +1911,26 @@
X509_NAME_print_ex_fp
X509_NAME_set
X509_new
+ X509_OBJECT_free_contents
+ X509_OBJECT_idx_by_subject
+ X509_OBJECT_retrieve_by_subject
+ X509_OBJECT_retrieve_match
+ X509_OBJECT_up_ref_count
X509_ocspid_print
+ X509_PKEY_free
+ X509_PKEY_new
+ X509_policy_check
+ X509_policy_level_get0_node
+ X509_policy_level_node_count
+ X509_policy_node_get0_parent
+ X509_policy_node_get0_policy
+ X509_policy_node_get0_qualifiers
X509_POLICY_NODE_print
+ X509_policy_tree_free
+ X509_policy_tree_get0_level
+ X509_policy_tree_get0_policies
+ X509_policy_tree_get0_user_policies
+ X509_policy_tree_level_count
X509_print
X509_print_ex
X509_print_ex_fp
@@ -1654,29 +1942,28 @@
X509_PUBKEY_set
X509_PURPOSE_add
X509_PURPOSE_cleanup
- X509_PURPOSE_get0
- X509_PURPOSE_get0_name
- X509_PURPOSE_get0_sname
X509_PURPOSE_get_by_id
X509_PURPOSE_get_by_sname
X509_PURPOSE_get_count
X509_PURPOSE_get_id
X509_PURPOSE_get_trust
+ X509_PURPOSE_get0
+ X509_PURPOSE_get0_name
+ X509_PURPOSE_get0_sname
X509_PURPOSE_set
X509_reject_clear
+ X509_REQ_add_extensions
+ X509_REQ_add_extensions_nid
X509_REQ_add1_attr
X509_REQ_add1_attr_by_NID
X509_REQ_add1_attr_by_OBJ
X509_REQ_add1_attr_by_txt
- X509_REQ_add_extensions
- X509_REQ_add_extensions_nid
X509_REQ_check_private_key
X509_REQ_delete_attr
X509_REQ_digest
X509_REQ_dup
X509_REQ_extension_nid
X509_REQ_free
- X509_REQ_get1_email
X509_REQ_get_attr
X509_REQ_get_attr_by_NID
X509_REQ_get_attr_by_OBJ
@@ -1684,6 +1971,7 @@
X509_REQ_get_extension_nids
X509_REQ_get_extensions
X509_REQ_get_pubkey
+ X509_REQ_get1_email
X509_REQ_INFO_free
X509_REQ_INFO_new
X509_REQ_new
@@ -1693,8 +1981,8 @@
X509_REQ_set_version
X509_REQ_sign
X509_REQ_verify
- X509_REVOKED_add1_ext_i2d
X509_REVOKED_add_ext
+ X509_REVOKED_add1_ext_i2d
X509_REVOKED_delete_ext
X509_REVOKED_free
X509_REVOKED_get_ext
@@ -1709,25 +1997,98 @@
X509_SIG_new
X509_sign
X509_signature_print
+ X509_STORE_add_cert
+ X509_STORE_add_crl
+ X509_STORE_add_lookup
+ X509_STORE_CTX_cleanup
+ X509_STORE_CTX_free
+ X509_STORE_CTX_get_chain
+ X509_STORE_CTX_get_current_cert
+ X509_STORE_CTX_get_error
+ X509_STORE_CTX_get_error_depth
+ X509_STORE_CTX_get_ex_data
+ X509_STORE_CTX_get_ex_new_index
+ X509_STORE_CTX_get_explicit_policy
+ X509_STORE_CTX_get0_param
+ X509_STORE_CTX_get0_policy_tree
+ X509_STORE_CTX_get1_chain
+ X509_STORE_CTX_get1_issuer
+ X509_STORE_CTX_init
+ X509_STORE_CTX_new
+ X509_STORE_CTX_purpose_inherit
+ X509_STORE_CTX_set_cert
+ X509_STORE_CTX_set_chain
+ X509_STORE_CTX_set_default
+ X509_STORE_CTX_set_depth
+ X509_STORE_CTX_set_error
+ X509_STORE_CTX_set_ex_data
+ X509_STORE_CTX_set_flags
+ X509_STORE_CTX_set_purpose
+ X509_STORE_CTX_set_time
+ X509_STORE_CTX_set_trust
+ X509_STORE_CTX_set_verify_cb
+ X509_STORE_CTX_set0_crls
+ X509_STORE_CTX_set0_param
+ X509_STORE_CTX_trusted_stack
+ X509_STORE_free
+ X509_STORE_get_by_subject
+ X509_STORE_load_locations
+ X509_STORE_new
+ X509_STORE_set_default_paths
+ X509_STORE_set_depth
+ X509_STORE_set_flags
+ X509_STORE_set_purpose
+ X509_STORE_set_trust
+ X509_STORE_set1_param
X509_subject_name_cmp
X509_subject_name_hash
X509_supported_extension
+ X509_time_adj
X509_to_X509_REQ
+ X509_TRUST_add
+ X509_TRUST_cleanup
X509_trust_clear
+ X509_TRUST_get_by_id
+ X509_TRUST_get_count
+ X509_TRUST_get_flags
+ X509_TRUST_get_trust
+ X509_TRUST_get0
+ X509_TRUST_get0_name
+ X509_TRUST_set
+ X509_TRUST_set_default
X509_VAL_free
X509_VAL_new
X509_verify
+ X509_verify_cert
+ X509_verify_cert_error_string
+ X509_VERIFY_PARAM_add0_policy
+ X509_VERIFY_PARAM_add0_table
+ X509_VERIFY_PARAM_clear_flags
+ X509_VERIFY_PARAM_free
+ X509_VERIFY_PARAM_get_depth
+ X509_VERIFY_PARAM_get_flags
+ X509_VERIFY_PARAM_inherit
+ X509_VERIFY_PARAM_lookup
+ X509_VERIFY_PARAM_new
+ X509_VERIFY_PARAM_set_depth
+ X509_VERIFY_PARAM_set_flags
+ X509_VERIFY_PARAM_set_purpose
+ X509_VERIFY_PARAM_set_time
+ X509_VERIFY_PARAM_set_trust
+ X509_VERIFY_PARAM_set1
+ X509_VERIFY_PARAM_set1_name
+ X509_VERIFY_PARAM_set1_policies
+ X509_VERIFY_PARAM_table_cleanup
X509at_add1_attr
X509at_add1_attr_by_NID
X509at_add1_attr_by_OBJ
X509at_add1_attr_by_txt
X509at_delete_attr
- X509at_get0_data_by_OBJ
X509at_get_attr
X509at_get_attr_by_NID
X509at_get_attr_by_OBJ
X509at_get_attr_count
- X509V3_add1_i2d
+ X509at_get0_data_by_OBJ
X509v3_add_ext
X509V3_add_standard_extensions
X509V3_add_value
@@ -1735,6 +2096,7 @@
X509V3_add_value_bool_nf
X509V3_add_value_int
X509V3_add_value_uchar
+ X509V3_add1_i2d
X509V3_conf_free
X509v3_delete_ext
X509V3_EXT_add
@@ -1781,3 +2143,454 @@
X9_62_CHARACTERISTIC_TWO_new
X9_62_PENTANOMIAL_free
X9_62_PENTANOMIAL_new
+
+ ;
+ ; OpenSSL ssl symbols
+ ;
+ BIO_f_ssl
+ BIO_new_buffer_ssl_connect
+ BIO_new_ssl
+ BIO_new_ssl_connect
+ BIO_ssl_copy_session_id
+ BIO_ssl_shutdown
+ check_srvr_ecc_cert_and_alg
+ d2i_SSL_SESSION
+ do_dtls1_write
+ dtls1_accept
+ dtls1_buffer_message
+ dtls1_clear
+ dtls1_clear_record_buffer
+ dtls1_client_hello
+ dtls1_connect
+ dtls1_ctrl
+ dtls1_default_timeout
+ dtls1_dispatch_alert
+ dtls1_do_write
+ dtls1_double_timeout
+ dtls1_enc
+ dtls1_free
+ dtls1_get_ccs_header
+ dtls1_get_cipher
+ dtls1_get_message
+ dtls1_get_message_header
+ dtls1_get_queue_priority
+ dtls1_get_record
+ dtls1_get_timeout
+ dtls1_handle_timeout
+ dtls1_is_timer_expired
+ dtls1_listen
+ dtls1_new
+ dtls1_output_cert_chain
+ dtls1_read_bytes
+ dtls1_read_failed
+ dtls1_reset_seq_numbers
+ dtls1_retransmit_buffered_messages
+ dtls1_retransmit_message
+ dtls1_send_certificate_request
+ dtls1_send_change_cipher_spec
+ dtls1_send_client_certificate
+ dtls1_send_client_key_exchange
+ dtls1_send_client_verify
+ dtls1_send_finished
+ dtls1_send_hello_request
+ dtls1_send_newsession_ticket
+ dtls1_send_server_certificate
+ dtls1_send_server_done
+ dtls1_send_server_hello
+ dtls1_send_server_key_exchange
+ dtls1_set_message_header
+ dtls1_start_timer
+ dtls1_stop_timer
+ dtls1_write_app_data_bytes
+ dtls1_write_bytes
+ dtlsv1_base_method
+ DTLSv1_client_method
+ DTLSv1_method
+ DTLSv1_server_method
+ ERR_load_SSL_strings
+ i2d_SSL_SESSION
+ SSL_accept
+ SSL_add_client_CA
+ ssl_add_clienthello_renegotiate_ext
+ ssl_add_clienthello_tlsext
+ SSL_add_dir_cert_subjects_to_stack
+ SSL_add_file_cert_subjects_to_stack
+ ssl_add_serverhello_renegotiate_ext
+ ssl_add_serverhello_tlsext
+ SSL_alert_desc_string
+ SSL_alert_desc_string_long
+ SSL_alert_type_string
+ SSL_alert_type_string_long
+ ssl_bad_method
+ ssl_bytes_to_cipher_list
+ SSL_callback_ctrl
+ ssl_cert_dup
+ ssl_cert_free
+ ssl_cert_inst
+ ssl_cert_new
+ ssl_cert_type
+ ssl_check_clienthello_tlsext
+ SSL_check_private_key
+ ssl_check_serverhello_tlsext
+ SSL_CIPHER_description
+ SSL_CIPHER_get_bits
+ ssl_cipher_get_evp
+ SSL_CIPHER_get_name
+ SSL_CIPHER_get_version
+ ssl_cipher_id_cmp
+ ssl_cipher_list_to_bytes
+ ssl_cipher_ptr_id_cmp
+ SSL_clear
+ ssl_clear_bad_session
+ ssl_clear_cipher_ctx
+ SSL_COMP_add_compression_method
+ SSL_COMP_get_compression_methods
+ SSL_COMP_get_name
+ SSL_connect
+ SSL_copy_session_id
+ ssl_create_cipher_list
+ SSL_ctrl
+ SSL_CTX_add_client_CA
+ SSL_CTX_add_session
+ SSL_CTX_callback_ctrl
+ SSL_CTX_check_private_key
+ SSL_CTX_ctrl
+ SSL_CTX_flush_sessions
+ SSL_CTX_free
+ SSL_CTX_get_cert_store
+ SSL_CTX_get_client_CA_list
+ SSL_CTX_get_client_cert_cb
+ SSL_CTX_get_ex_data
+ SSL_CTX_get_ex_new_index
+ SSL_CTX_get_info_callback
+ SSL_CTX_get_quiet_shutdown
+ SSL_CTX_get_timeout
+ SSL_CTX_get_verify_callback
+ SSL_CTX_get_verify_depth
+ SSL_CTX_get_verify_mode
+ SSL_CTX_load_verify_locations
+ SSL_CTX_new
+ SSL_CTX_remove_session
+ SSL_CTX_sess_get_get_cb
+ SSL_CTX_sess_get_new_cb
+ SSL_CTX_sess_get_remove_cb
+ SSL_CTX_sess_set_get_cb
+ SSL_CTX_sess_set_new_cb
+ SSL_CTX_sess_set_remove_cb
+ SSL_CTX_sessions
+ SSL_CTX_set_cert_store
+ SSL_CTX_set_cert_verify_callback
+ SSL_CTX_set_cipher_list
+ SSL_CTX_set_client_CA_list
+ SSL_CTX_set_client_cert_cb
+ SSL_CTX_set_cookie_generate_cb
+ SSL_CTX_set_cookie_verify_cb
+ SSL_CTX_set_default_passwd_cb
+ SSL_CTX_set_default_passwd_cb_userdata
+ SSL_CTX_set_default_verify_paths
+ SSL_CTX_set_ex_data
+ SSL_CTX_set_generate_session_id
+ SSL_CTX_set_info_callback
+ SSL_CTX_set_msg_callback
+ SSL_CTX_set_purpose
+ SSL_CTX_set_quiet_shutdown
+ SSL_CTX_set_session_id_context
+ SSL_CTX_set_ssl_version
+ SSL_CTX_set_timeout
+ SSL_CTX_set_tmp_dh_callback
+ SSL_CTX_set_tmp_rsa_callback
+ SSL_CTX_set_trust
+ SSL_CTX_set_verify
+ SSL_CTX_set_verify_depth
+ SSL_CTX_use_certificate
+ SSL_CTX_use_certificate_ASN1
+ SSL_CTX_use_certificate_chain_file
+ SSL_CTX_use_certificate_file
+ SSL_CTX_use_PrivateKey
+ SSL_CTX_use_PrivateKey_ASN1
+ SSL_CTX_use_PrivateKey_file
+ SSL_CTX_use_RSAPrivateKey
+ SSL_CTX_use_RSAPrivateKey_ASN1
+ SSL_CTX_use_RSAPrivateKey_file
+ ssl_do_client_cert_cb
+ SSL_do_handshake
+ SSL_dup
+ SSL_dup_CA_list
+ SSL_free
+ ssl_free_wbio_buffer
+ SSL_get_certificate
+ SSL_get_cipher_list
+ SSL_get_ciphers
+ ssl_get_ciphers_by_id
+ SSL_get_client_CA_list
+ SSL_get_current_cipher
+ SSL_get_current_compression
+ SSL_get_current_expansion
+ SSL_get_default_timeout
+ SSL_get_error
+ SSL_get_ex_data
+ SSL_get_ex_data_X509_STORE_CTX_idx
+ SSL_get_ex_new_index
+ SSL_get_fd
+ SSL_get_finished
+ SSL_get_info_callback
+ ssl_get_new_session
+ SSL_get_peer_cert_chain
+ SSL_get_peer_certificate
+ SSL_get_peer_finished
+ ssl_get_prev_session
+ SSL_get_privatekey
+ SSL_get_quiet_shutdown
+ SSL_get_rbio
+ SSL_get_read_ahead
+ SSL_get_rfd
+ ssl_get_server_send_cert
+ SSL_get_servername
+ SSL_get_servername_type
+ SSL_get_session
+ SSL_get_shared_ciphers
+ SSL_get_shutdown
+ ssl_get_sign_pkey
+ SSL_get_SSL_CTX
+ SSL_get_ssl_method
+ SSL_get_verify_callback
+ SSL_get_verify_depth
+ SSL_get_verify_mode
+ SSL_get_verify_result
+ SSL_get_version
+ SSL_get_wbio
+ SSL_get_wfd
+ SSL_get1_session
+ SSL_has_matching_session_id
+ ssl_init_wbio_buffer
+ SSL_library_init
+ ssl_load_ciphers
+ SSL_load_client_CA_file
+ SSL_load_error_strings
+ SSL_new
+ ssl_ok
+ ssl_parse_clienthello_renegotiate_ext
+ ssl_parse_clienthello_tlsext
+ ssl_parse_serverhello_renegotiate_ext
+ ssl_parse_serverhello_tlsext
+ SSL_peek
+ SSL_pending
+ SSL_read
+ SSL_renegotiate
+ SSL_renegotiate_pending
+ SSL_rstate_string
+ SSL_rstate_string_long
+ ssl_sess_cert_free
+ ssl_sess_cert_new
+ SSL_SESSION_cmp
+ SSL_SESSION_free
+ SSL_SESSION_get_ex_data
+ SSL_SESSION_get_ex_new_index
+ SSL_SESSION_get_id
+ SSL_SESSION_get_time
+ SSL_SESSION_get_timeout
+ SSL_SESSION_hash
+ SSL_SESSION_new
+ SSL_SESSION_print
+ SSL_SESSION_print_fp
+ SSL_SESSION_set_ex_data
+ SSL_SESSION_set_time
+ SSL_SESSION_set_timeout
+ SSL_set_accept_state
+ SSL_set_bio
+ ssl_set_cert_masks
+ SSL_set_cipher_list
+ SSL_set_client_CA_list
+ SSL_set_connect_state
+ SSL_set_ex_data
+ SSL_set_fd
+ SSL_set_generate_session_id
+ SSL_set_info_callback
+ SSL_set_msg_callback
+ ssl_set_peer_cert_type
+ SSL_set_purpose
+ SSL_set_quiet_shutdown
+ SSL_set_read_ahead
+ SSL_set_rfd
+ SSL_set_session
+ SSL_set_session_id_context
+ SSL_set_shutdown
+ SSL_set_SSL_CTX
+ SSL_set_ssl_method
+ SSL_set_tmp_dh_callback
+ SSL_set_tmp_rsa_callback
+ SSL_set_trust
+ SSL_set_verify
+ SSL_set_verify_depth
+ SSL_set_verify_result
+ SSL_set_wfd
+ SSL_shutdown
+ SSL_state
+ SSL_state_string
+ SSL_state_string_long
+ ssl_undefined_const_function
+ ssl_undefined_function
+ ssl_undefined_void_function
+ ssl_update_cache
+ SSL_use_certificate
+ SSL_use_certificate_ASN1
+ SSL_use_certificate_file
+ SSL_use_PrivateKey
+ SSL_use_PrivateKey_ASN1
+ SSL_use_PrivateKey_file
+ SSL_use_RSAPrivateKey
+ SSL_use_RSAPrivateKey_ASN1
+ SSL_use_RSAPrivateKey_file
+ ssl_verify_alarm_type
+ ssl_verify_cert_chain
+ SSL_version
+ SSL_want
+ SSL_write
+ ssl2_accept
+ ssl2_callback_ctrl
+ ssl2_clear
+ ssl2_connect
+ ssl2_ctrl
+ ssl2_ctx_callback_ctrl
+ ssl2_ctx_ctrl
+ ssl2_default_timeout
+ ssl2_do_write
+ ssl2_enc
+ ssl2_enc_init
+ ssl2_free
+ ssl2_generate_key_material
+ ssl2_get_cipher
+ ssl2_get_cipher_by_char
+ ssl2_mac
+ ssl2_new
+ ssl2_num_ciphers
+ ssl2_part_read
+ ssl2_peek
+ ssl2_pending
+ ssl2_put_cipher_by_char
+ ssl2_read
+ ssl2_return_error
+ ssl2_set_certificate
+ ssl2_shutdown
+ ssl2_write
+ ssl2_write_error
+ ssl23_accept
+ ssl23_connect
+ ssl23_default_timeout
+ ssl23_get_cipher
+ ssl23_get_cipher_by_char
+ ssl23_get_client_hello
+ ssl23_num_ciphers
+ ssl23_peek
+ ssl23_put_cipher_by_char
+ ssl23_read
+ ssl23_read_bytes
+ ssl23_write
+ ssl23_write_bytes
+ ssl3_accept
+ ssl3_alert_code
+ ssl3_callback_ctrl
+ ssl3_cert_verify_mac
+ ssl3_change_cipher_state
+ ssl3_check_cert_and_algorithm
+ ssl3_check_client_hello
+ ssl3_check_finished
+ ssl3_choose_cipher
+ ssl3_cleanup_key_block
+ ssl3_clear
+ ssl3_client_hello
+ ssl3_comp_find
+ ssl3_connect
+ ssl3_ctrl
+ ssl3_ctx_callback_ctrl
+ ssl3_ctx_ctrl
+ ssl3_default_timeout
+ ssl3_dispatch_alert
+ ssl3_do_change_cipher_spec
+ ssl3_do_compress
+ ssl3_do_uncompress
+ ssl3_do_write
+ ssl3_enc
+ ssl3_final_finish_mac
+ ssl3_finish_mac
+ ssl3_free
+ ssl3_generate_master_secret
+ ssl3_get_cert_status
+ ssl3_get_cert_verify
+ ssl3_get_certificate_request
+ ssl3_get_cipher
+ ssl3_get_cipher_by_char
+ ssl3_get_client_certificate
+ ssl3_get_client_hello
+ ssl3_get_client_key_exchange
+ ssl3_get_finished
+ ssl3_get_key_exchange
+ ssl3_get_message
+ ssl3_get_new_session_ticket
+ ssl3_get_req_cert_type
+ ssl3_get_server_certificate
+ ssl3_get_server_done
+ ssl3_get_server_hello
+ ssl3_init_finished_mac
+ ssl3_mac
+ ssl3_new
+ ssl3_num_ciphers
+ ssl3_output_cert_chain
+ ssl3_peek
+ ssl3_pending
+ ssl3_put_cipher_by_char
+ ssl3_read
+ ssl3_read_bytes
+ ssl3_read_n
+ ssl3_record_sequence_update
+ ssl3_renegotiate
+ ssl3_renegotiate_check
+ ssl3_send_alert
+ ssl3_send_cert_status
+ ssl3_send_certificate_request
+ ssl3_send_change_cipher_spec
+ ssl3_send_client_certificate
+ ssl3_send_client_key_exchange
+ ssl3_send_client_verify
+ ssl3_send_finished
+ ssl3_send_hello_request
+ ssl3_send_newsession_ticket
+ ssl3_send_server_certificate
+ ssl3_send_server_done
+ ssl3_send_server_hello
+ ssl3_send_server_key_exchange
+ ssl3_setup_buffers
+ ssl3_setup_key_block
+ ssl3_shutdown
+ ssl3_write
+ ssl3_write_bytes
+ ssl3_write_pending
+ sslv2_base_method
+ SSLv2_client_method
+ SSLv2_method
+ SSLv2_server_method
+ sslv23_base_method
+ SSLv23_client_method
+ SSLv23_method
+ SSLv23_server_method
+ sslv3_base_method
+ SSLv3_client_method
+ SSLv3_method
+ SSLv3_server_method
+ tls1_alert_code
+ tls1_cert_verify_mac
+ tls1_change_cipher_state
+ tls1_clear
+ tls1_default_timeout
+ tls1_enc
+ tls1_final_finish_mac
+ tls1_free
+ tls1_generate_master_secret
+ tls1_mac
+ tls1_new
+ tls1_process_ticket
+ tls1_setup_key_block
+ tlsv1_base_method
+ TLSv1_client_method
+ TLSv1_method
+ TLSv1_server_method
diff --git a/src/VBox/Runtime/r3/win/VBoxRT-win32.def b/src/VBox/Runtime/r3/win/VBoxRT-win32.def
index ae6e5cdcb..1395665f8 100644
--- a/src/VBox/Runtime/r3/win/VBoxRT-win32.def
+++ b/src/VBox/Runtime/r3/win/VBoxRT-win32.def
@@ -1,4 +1,4 @@
-; $Id: VBoxRT-win32.def $
+; $Id: VBoxRT-win32.def 32404 2010-09-10 13:17:42Z vboxsync $
;; @file
; IPRT - Win32 ASM exports.
;
diff --git a/src/VBox/Runtime/r3/win/VBoxRT-win64.def b/src/VBox/Runtime/r3/win/VBoxRT-win64.def
index f0ad7c4e4..fbc41c243 100644
--- a/src/VBox/Runtime/r3/win/VBoxRT-win64.def
+++ b/src/VBox/Runtime/r3/win/VBoxRT-win64.def
@@ -1,4 +1,4 @@
-; $Id: VBoxRT-win64.def $
+; $Id: VBoxRT-win64.def 32404 2010-09-10 13:17:42Z vboxsync $
;; @file
; IPRT - Win64 ASM exports.
;
diff --git a/src/VBox/Runtime/r3/win/alloc-win.cpp b/src/VBox/Runtime/r3/win/alloc-win.cpp
index 01a0a359f..b7b3f75f4 100644
--- a/src/VBox/Runtime/r3/win/alloc-win.cpp
+++ b/src/VBox/Runtime/r3/win/alloc-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: alloc-win.cpp $ */
+/* $Id: alloc-win.cpp 33269 2010-10-20 15:42:28Z vboxsync $ */
/** @file
* IPRT - Memory Allocation, Windows.
*/
diff --git a/src/VBox/Runtime/r3/win/dir-win.cpp b/src/VBox/Runtime/r3/win/dir-win.cpp
index b5640696c..930d16acd 100644
--- a/src/VBox/Runtime/r3/win/dir-win.cpp
+++ b/src/VBox/Runtime/r3/win/dir-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: dir-win.cpp $ */
+/* $Id: dir-win.cpp 34507 2010-11-30 13:14:14Z vboxsync $ */
/** @file
* IPRT - Directory, win32.
*/
diff --git a/src/VBox/Runtime/r3/win/dllmain-win.cpp b/src/VBox/Runtime/r3/win/dllmain-win.cpp
index 9b553f6dc..953a95c80 100644
--- a/src/VBox/Runtime/r3/win/dllmain-win.cpp
+++ b/src/VBox/Runtime/r3/win/dllmain-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: dllmain-win.cpp $ */
+/* $Id: dllmain-win.cpp 37423 2011-06-12 18:37:56Z vboxsync $ */
/** @file
* IPRT - Win32 DllMain (Ring-3).
*/
@@ -30,6 +30,7 @@
*******************************************************************************/
#include <Windows.h>
#include <iprt/thread.h>
+#include <iprt/param.h>
#include "internal/thread.h"
@@ -41,7 +42,24 @@ BOOL __stdcall DllMain(HANDLE hModule, DWORD dwReason, PVOID pvReserved)
{
switch (dwReason)
{
+ /*
+ * When attaching to a process, we'd like to make sure IPRT stays put
+ * and doesn't get unloaded.
+ */
case DLL_PROCESS_ATTACH:
+ {
+ WCHAR wszName[RTPATH_MAX];
+ SetLastError(NO_ERROR);
+ if ( GetModuleFileNameW((HMODULE)hModule, wszName, RT_ELEMENTS(wszName)) > 0
+ && GetLastError() == NO_ERROR)
+ {
+ int cExtraLoads = 32;
+ while (cExtraLoads-- > 0)
+ LoadLibraryW(wszName);
+ }
+ break;
+ }
+
case DLL_PROCESS_DETACH:
case DLL_THREAD_ATTACH:
default:
@@ -54,3 +72,4 @@ BOOL __stdcall DllMain(HANDLE hModule, DWORD dwReason, PVOID pvReserved)
}
return TRUE;
}
+
diff --git a/src/VBox/Runtime/r3/win/errvars-win.cpp b/src/VBox/Runtime/r3/win/errvars-win.cpp
new file mode 100644
index 000000000..ef00e62a6
--- /dev/null
+++ b/src/VBox/Runtime/r3/win/errvars-win.cpp
@@ -0,0 +1,83 @@
+/* $Id: errvars-win.cpp 37233 2011-05-27 13:31:57Z vboxsync $ */
+/** @file
+ * IPRT - Save and Restore Error Variables, Windows Ring-3.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <Winsock2.h>
+#include <errno.h>
+
+#include <iprt/err.h>
+#include "internal/iprt.h"
+
+#include <iprt/assert.h>
+#include "internal/magics.h"
+
+
+
+RTDECL(PRTERRVARS) RTErrVarsSave(PRTERRVARS pVars)
+{
+ pVars->ai32Vars[0] = RTERRVARS_MAGIC;
+ pVars->ai32Vars[1] = GetLastError();
+ pVars->ai32Vars[2] = WSAGetLastError();
+ pVars->ai32Vars[3] = errno;
+ return pVars;
+}
+
+
+RTDECL(void) RTErrVarsRestore(PCRTERRVARS pVars)
+{
+ AssertReturnVoid(pVars->ai32Vars[0] == RTERRVARS_MAGIC);
+ errno = pVars->ai32Vars[3];
+ if (pVars->ai32Vars[2] != WSANOTINITIALISED) /* just an idea... */
+ WSASetLastError(pVars->ai32Vars[2]);
+ SetLastError(pVars->ai32Vars[1]);
+}
+
+
+RTDECL(bool) RTErrVarsAreEqual(PCRTERRVARS pVars1, PCRTERRVARS pVars2)
+{
+ Assert(pVars1->ai32Vars[0] == RTERRVARS_MAGIC);
+ Assert(pVars2->ai32Vars[0] == RTERRVARS_MAGIC);
+
+ return pVars1->ai32Vars[0] == pVars2->ai32Vars[0]
+ && pVars1->ai32Vars[1] == pVars2->ai32Vars[1]
+ && pVars1->ai32Vars[2] == pVars2->ai32Vars[2]
+ && pVars1->ai32Vars[3] == pVars2->ai32Vars[3];
+}
+
+
+RTDECL(bool) RTErrVarsHaveChanged(PCRTERRVARS pVars)
+{
+ Assert(pVars->ai32Vars[0] == RTERRVARS_MAGIC);
+
+ return pVars->ai32Vars[0] != RTERRVARS_MAGIC
+ || pVars->ai32Vars[1] != GetLastError()
+ || pVars->ai32Vars[2] != WSAGetLastError()
+ || pVars->ai32Vars[3] != errno;
+}
+
diff --git a/src/VBox/Runtime/r3/win/fileaio-win.cpp b/src/VBox/Runtime/r3/win/fileaio-win.cpp
index cb32f3c72..6dc7f5fbf 100644
--- a/src/VBox/Runtime/r3/win/fileaio-win.cpp
+++ b/src/VBox/Runtime/r3/win/fileaio-win.cpp
@@ -1,10 +1,10 @@
-/* $Id: fileaio-win.cpp $ */
+/* $Id: fileaio-win.cpp 37607 2011-06-23 10:42:42Z vboxsync $ */
/** @file
* IPRT - File async I/O, native implementation for the Windows host platform.
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -188,7 +188,7 @@ DECLINLINE(int) rtFileAioReqPrepareTransfer(RTFILEAIOREQ hReq, RTFILE hFile,
Assert(cbTransfer > 0);
pReqInt->enmTransferDirection = enmTransferDirection;
- pReqInt->hFile = (HANDLE)hFile;
+ pReqInt->hFile = (HANDLE)RTFileToNative(hFile);
pReqInt->Overlapped.Offset = (DWORD)(off & 0xffffffff);
pReqInt->Overlapped.OffsetHigh = (DWORD)(off >> 32);
pReqInt->cbTransfer = cbTransfer;
@@ -317,7 +317,7 @@ RTDECL(int) RTFileAioCtxAssociateWithFile(RTFILEAIOCTX hAioCtx, RTFILE hFile)
PRTFILEAIOCTXINTERNAL pCtxInt = hAioCtx;
RTFILEAIOCTX_VALID_RETURN(pCtxInt);
- HANDLE hTemp = CreateIoCompletionPort((HANDLE)hFile, pCtxInt->hIoCompletionPort, 0, 1);
+ HANDLE hTemp = CreateIoCompletionPort((HANDLE)RTFileToNative(hFile), pCtxInt->hIoCompletionPort, 0, 1);
if (hTemp != pCtxInt->hIoCompletionPort)
rc = RTErrConvertFromWin32(GetLastError());
diff --git a/src/VBox/Runtime/r3/win/fileio-win.cpp b/src/VBox/Runtime/r3/win/fileio-win.cpp
index de9f2b011..af09fc6b2 100644
--- a/src/VBox/Runtime/r3/win/fileio-win.cpp
+++ b/src/VBox/Runtime/r3/win/fileio-win.cpp
@@ -1,10 +1,10 @@
-/* $Id: fileio-win.cpp $ */
+/* $Id: fileio-win.cpp 37598 2011-06-22 20:58:35Z vboxsync $ */
/** @file
* IPRT - File I/O, native implementation for the Windows host platform.
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -54,12 +54,12 @@
* it not being present in NT4 GA.
*
* @returns Success indicator. Extended error information obtainable using GetLastError().
- * @param File Filehandle.
+ * @param hFile Filehandle.
* @param offSeek Offset to seek.
* @param poffNew Where to store the new file offset. NULL allowed.
* @param uMethod Seek method. (The windows one!)
*/
-DECLINLINE(bool) MySetFilePointer(RTFILE File, uint64_t offSeek, uint64_t *poffNew, unsigned uMethod)
+DECLINLINE(bool) MySetFilePointer(RTFILE hFile, uint64_t offSeek, uint64_t *poffNew, unsigned uMethod)
{
bool fRc;
LARGE_INTEGER off;
@@ -68,17 +68,17 @@ DECLINLINE(bool) MySetFilePointer(RTFILE File, uint64_t offSeek, uint64_t *poffN
#if 1
if (off.LowPart != INVALID_SET_FILE_POINTER)
{
- off.LowPart = SetFilePointer((HANDLE)File, off.LowPart, &off.HighPart, uMethod);
+ off.LowPart = SetFilePointer((HANDLE)RTFileToNative(hFile), off.LowPart, &off.HighPart, uMethod);
fRc = off.LowPart != INVALID_SET_FILE_POINTER;
}
else
{
SetLastError(NO_ERROR);
- off.LowPart = SetFilePointer((HANDLE)File, off.LowPart, &off.HighPart, uMethod);
+ off.LowPart = SetFilePointer((HANDLE)RTFileToNative(hFile), off.LowPart, &off.HighPart, uMethod);
fRc = GetLastError() == NO_ERROR;
}
#else
- fRc = SetFilePointerEx((HANDLE)File, off, &off, uMethod);
+ fRc = SetFilePointerEx((HANDLE)RTFileToNative(hFile), off, &off, uMethod);
#endif
if (fRc && poffNew)
*poffNew = off.QuadPart;
@@ -91,11 +91,11 @@ DECLINLINE(bool) MySetFilePointer(RTFILE File, uint64_t offSeek, uint64_t *poffN
* limit of the filesystem.
*
* @returns true for file size limit exceeded.
- * @param File Filehandle.
+ * @param hFile Filehandle.
* @param offSeek Offset to seek.
* @param uMethod The seek method.
*/
-DECLINLINE(bool) IsBeyondLimit(RTFILE File, uint64_t offSeek, unsigned uMethod)
+DECLINLINE(bool) IsBeyondLimit(RTFILE hFile, uint64_t offSeek, unsigned uMethod)
{
bool fIsBeyondLimit = false;
@@ -107,12 +107,12 @@ DECLINLINE(bool) IsBeyondLimit(RTFILE File, uint64_t offSeek, unsigned uMethod)
* this supposedly works. The fastfat sources in the latest WDK makes no limit checks during
* file seeking, only at the time of writing (and some other odd ones we cannot make use of). */
uint64_t offCurrent;
- if (MySetFilePointer(File, 0, &offCurrent, FILE_CURRENT))
+ if (MySetFilePointer(hFile, 0, &offCurrent, FILE_CURRENT))
{
- if (!MySetFilePointer(File, offSeek, NULL, uMethod))
+ if (!MySetFilePointer(hFile, offSeek, NULL, uMethod))
fIsBeyondLimit = GetLastError() == ERROR_SEEK;
else /* Restore file pointer on success. */
- MySetFilePointer(File, offCurrent, NULL, FILE_BEGIN);
+ MySetFilePointer(hFile, offCurrent, NULL, FILE_BEGIN);
}
return fIsBeyondLimit;
@@ -122,8 +122,8 @@ DECLINLINE(bool) IsBeyondLimit(RTFILE File, uint64_t offSeek, unsigned uMethod)
RTR3DECL(int) RTFileFromNative(PRTFILE pFile, RTHCINTPTR uNative)
{
HANDLE h = (HANDLE)uNative;
- if ( h == INVALID_HANDLE_VALUE
- || (RTFILE)uNative != uNative)
+ AssertCompile(sizeof(h) == sizeof(uNative));
+ if (h == INVALID_HANDLE_VALUE)
{
AssertMsgFailed(("%p\n", uNative));
*pFile = NIL_RTFILE;
@@ -134,14 +134,14 @@ RTR3DECL(int) RTFileFromNative(PRTFILE pFile, RTHCINTPTR uNative)
}
-RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE File)
+RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE hFile)
{
- AssertReturn(File != NIL_RTFILE, (RTHCINTPTR)INVALID_HANDLE_VALUE);
- return (RTHCINTPTR)File;
+ AssertReturn(hFile != NIL_RTFILE, (RTHCINTPTR)INVALID_HANDLE_VALUE);
+ return (RTHCINTPTR)hFile;
}
-RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
+RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint64_t fOpen)
{
/*
* Validate input.
@@ -185,7 +185,7 @@ RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
dwCreationDisposition = CREATE_ALWAYS;
break;
default:
- AssertMsgFailed(("Impossible fOpen=%#x\n", fOpen));
+ AssertMsgFailed(("Impossible fOpen=%#llx\n", fOpen));
return VERR_INVALID_PARAMETER;
}
@@ -206,7 +206,7 @@ RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
: FILE_GENERIC_READ | FILE_GENERIC_WRITE;
break;
default:
- AssertMsgFailed(("Impossible fOpen=%#x\n", fOpen));
+ AssertMsgFailed(("Impossible fOpen=%#llx\n", fOpen));
return VERR_INVALID_PARAMETER;
}
if (dwCreationDisposition == TRUNCATE_EXISTING)
@@ -227,7 +227,7 @@ RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
case RTFILE_O_WRITE: dwDesiredAccess |= FILE_WRITE_ATTRIBUTES | SYNCHRONIZE; break;
case RTFILE_O_READWRITE: dwDesiredAccess |= FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE; break;
default:
- AssertMsgFailed(("Impossible fOpen=%#x\n", fOpen));
+ AssertMsgFailed(("Impossible fOpen=%#llx\n", fOpen));
return VERR_INVALID_PARAMETER;
}
}
@@ -245,7 +245,7 @@ RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
case RTFILE_O_DENY_NOT_DELETE | RTFILE_O_DENY_WRITE: dwShareMode = FILE_SHARE_DELETE | FILE_SHARE_READ; break;
case RTFILE_O_DENY_NOT_DELETE | RTFILE_O_DENY_READWRITE:dwShareMode = FILE_SHARE_DELETE; break;
default:
- AssertMsgFailed(("Impossible fOpen=%#x\n", fOpen));
+ AssertMsgFailed(("Impossible fOpen=%#llx\n", fOpen));
return VERR_INVALID_PARAMETER;
}
@@ -328,7 +328,7 @@ RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
}
-RTR3DECL(int) RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess)
+RTR3DECL(int) RTFileOpenBitBucket(PRTFILE phFile, uint64_t fAccess)
{
AssertReturn( fAccess == RTFILE_O_READ
|| fAccess == RTFILE_O_WRITE
@@ -338,17 +338,40 @@ RTR3DECL(int) RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess)
}
-RTR3DECL(int) RTFileClose(RTFILE File)
+RTR3DECL(int) RTFileClose(RTFILE hFile)
{
- if (File == NIL_RTFILE)
+ if (hFile == NIL_RTFILE)
return VINF_SUCCESS;
- if (CloseHandle((HANDLE)File))
+ if (CloseHandle((HANDLE)RTFileToNative(hFile)))
return VINF_SUCCESS;
return RTErrConvertFromWin32(GetLastError());
}
-RTR3DECL(int) RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64_t *poffActual)
+RTFILE rtFileGetStandard(RTHANDLESTD enmStdHandle)
+{
+ DWORD dwStdHandle;
+ switch (enmStdHandle)
+ {
+ case RTHANDLESTD_INPUT: dwStdHandle = STD_INPUT_HANDLE; break;
+ case RTHANDLESTD_OUTPUT: dwStdHandle = STD_OUTPUT_HANDLE; break;
+ case RTHANDLESTD_ERROR: dwStdHandle = STD_ERROR_HANDLE; break;
+ break;
+ default:
+ AssertFailedReturn(NIL_RTFILE);
+ }
+
+ HANDLE hNative = GetStdHandle(dwStdHandle);
+ if (hNative == INVALID_HANDLE_VALUE)
+ return NIL_RTFILE;
+
+ RTFILE hFile = (RTFILE)(uintptr_t)hNative;
+ AssertReturn((HANDLE)(uintptr_t)hFile == hNative, NIL_RTFILE);
+ return hFile;
+}
+
+
+RTR3DECL(int) RTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod, uint64_t *poffActual)
{
static ULONG aulSeekRecode[] =
{
@@ -369,13 +392,13 @@ RTR3DECL(int) RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64
/*
* Execute the seek.
*/
- if (MySetFilePointer(File, offSeek, poffActual, aulSeekRecode[uMethod]))
+ if (MySetFilePointer(hFile, offSeek, poffActual, aulSeekRecode[uMethod]))
return VINF_SUCCESS;
return RTErrConvertFromWin32(GetLastError());
}
-RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead)
+RTR3DECL(int) RTFileRead(RTFILE hFile, void *pvBuf, size_t cbToRead, size_t *pcbRead)
{
if (cbToRead <= 0)
return VINF_SUCCESS;
@@ -383,7 +406,7 @@ RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcb
AssertReturn(cbToReadAdj == cbToRead, VERR_NUMBER_TOO_BIG);
ULONG cbRead = 0;
- if (ReadFile((HANDLE)File, pvBuf, cbToReadAdj, &cbRead, NULL))
+ if (ReadFile((HANDLE)RTFileToNative(hFile), pvBuf, cbToReadAdj, &cbRead, NULL))
{
if (pcbRead)
/* Caller can handle partial reads. */
@@ -394,7 +417,7 @@ RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcb
while (cbToReadAdj > cbRead)
{
ULONG cbReadPart = 0;
- if (!ReadFile((HANDLE)File, (char*)pvBuf + cbRead, cbToReadAdj - cbRead, &cbReadPart, NULL))
+ if (!ReadFile((HANDLE)RTFileToNative(hFile), (char*)pvBuf + cbRead, cbToReadAdj - cbRead, &cbReadPart, NULL))
return RTErrConvertFromWin32(GetLastError());
if (cbReadPart == 0)
return VERR_EOF;
@@ -404,9 +427,9 @@ RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcb
return VINF_SUCCESS;
}
- /*
- * If it's a console, we might bump into out of memory conditions in the
- * ReadConsole call.
+ /*
+ * If it's a console, we might bump into out of memory conditions in the
+ * ReadConsole call.
*/
DWORD dwErr = GetLastError();
if (dwErr == ERROR_NOT_ENOUGH_MEMORY)
@@ -422,7 +445,7 @@ RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcb
{
ULONG cbToRead = RT_MIN(cbChunk, cbToReadAdj - cbRead);
ULONG cbReadPart = 0;
- if (!ReadFile((HANDLE)File, (char *)pvBuf + cbRead, cbToRead, &cbReadPart, NULL))
+ if (!ReadFile((HANDLE)RTFileToNative(hFile), (char *)pvBuf + cbRead, cbToRead, &cbReadPart, NULL))
{
/* If we failed because the buffer is too big, shrink it and
try again. */
@@ -449,12 +472,12 @@ RTR3DECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcb
}
return VINF_SUCCESS;
}
-
+
return RTErrConvertFromWin32(dwErr);
}
-RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
+RTR3DECL(int) RTFileWrite(RTFILE hFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
{
if (cbToWrite <= 0)
return VINF_SUCCESS;
@@ -462,7 +485,7 @@ RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, siz
AssertReturn(cbToWriteAdj == cbToWrite, VERR_NUMBER_TOO_BIG);
ULONG cbWritten = 0;
- if (WriteFile((HANDLE)File, pvBuf, cbToWriteAdj, &cbWritten, NULL))
+ if (WriteFile((HANDLE)RTFileToNative(hFile), pvBuf, cbToWriteAdj, &cbWritten, NULL))
{
if (pcbWritten)
/* Caller can handle partial writes. */
@@ -473,11 +496,12 @@ RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, siz
while (cbToWriteAdj > cbWritten)
{
ULONG cbWrittenPart = 0;
- if (!WriteFile((HANDLE)File, (char*)pvBuf + cbWritten, cbToWriteAdj - cbWritten, &cbWrittenPart, NULL))
+ if (!WriteFile((HANDLE)RTFileToNative(hFile), (char*)pvBuf + cbWritten,
+ cbToWriteAdj - cbWritten, &cbWrittenPart, NULL))
{
int rc = RTErrConvertFromWin32(GetLastError());
if ( rc == VERR_DISK_FULL
- && IsBeyondLimit(File, cbToWriteAdj - cbWritten, FILE_CURRENT)
+ && IsBeyondLimit(hFile, cbToWriteAdj - cbWritten, FILE_CURRENT)
)
rc = VERR_FILE_TOO_BIG;
return rc;
@@ -490,9 +514,9 @@ RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, siz
return VINF_SUCCESS;
}
- /*
- * If it's a console, we might bump into out of memory conditions in the
- * WriteConsole call.
+ /*
+ * If it's a console, we might bump into out of memory conditions in the
+ * WriteConsole call.
*/
DWORD dwErr = GetLastError();
if (dwErr == ERROR_NOT_ENOUGH_MEMORY)
@@ -508,7 +532,7 @@ RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, siz
{
ULONG cbToWrite = RT_MIN(cbChunk, cbToWriteAdj - cbWritten);
ULONG cbWrittenPart = 0;
- if (!WriteFile((HANDLE)File, (const char *)pvBuf + cbWritten, cbToWrite, &cbWrittenPart, NULL))
+ if (!WriteFile((HANDLE)RTFileToNative(hFile), (const char *)pvBuf + cbWritten, cbToWrite, &cbWrittenPart, NULL))
{
/* If we failed because the buffer is too big, shrink it and
try again. */
@@ -521,7 +545,7 @@ RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, siz
}
int rc = RTErrConvertFromWin32(dwErr);
if ( rc == VERR_DISK_FULL
- && IsBeyondLimit(File, cbToWriteAdj - cbWritten, FILE_CURRENT))
+ && IsBeyondLimit(hFile, cbToWriteAdj - cbWritten, FILE_CURRENT))
rc = VERR_FILE_TOO_BIG;
return rc;
}
@@ -542,15 +566,15 @@ RTR3DECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, siz
int rc = RTErrConvertFromWin32(dwErr);
if ( rc == VERR_DISK_FULL
- && IsBeyondLimit(File, cbToWriteAdj - cbWritten, FILE_CURRENT))
+ && IsBeyondLimit(hFile, cbToWriteAdj - cbWritten, FILE_CURRENT))
rc = VERR_FILE_TOO_BIG;
return rc;
}
-RTR3DECL(int) RTFileFlush(RTFILE File)
+RTR3DECL(int) RTFileFlush(RTFILE hFile)
{
- if (!FlushFileBuffers((HANDLE)File))
+ if (!FlushFileBuffers((HANDLE)RTFileToNative(hFile)))
{
int rc = GetLastError();
Log(("FlushFileBuffers failed with %d\n", rc));
@@ -560,28 +584,28 @@ RTR3DECL(int) RTFileFlush(RTFILE File)
}
-RTR3DECL(int) RTFileSetSize(RTFILE File, uint64_t cbSize)
+RTR3DECL(int) RTFileSetSize(RTFILE hFile, uint64_t cbSize)
{
/*
* Get current file pointer.
*/
int rc;
uint64_t offCurrent;
- if (MySetFilePointer(File, 0, &offCurrent, FILE_CURRENT))
+ if (MySetFilePointer(hFile, 0, &offCurrent, FILE_CURRENT))
{
/*
* Set new file pointer.
*/
- if (MySetFilePointer(File, cbSize, NULL, FILE_BEGIN))
+ if (MySetFilePointer(hFile, cbSize, NULL, FILE_BEGIN))
{
/* set file pointer */
- if (SetEndOfFile((HANDLE)File))
+ if (SetEndOfFile((HANDLE)RTFileToNative(hFile)))
{
/*
* Restore file pointer and return.
* If the old pointer was beyond the new file end, ignore failure.
*/
- if ( MySetFilePointer(File, offCurrent, NULL, FILE_BEGIN)
+ if ( MySetFilePointer(hFile, offCurrent, NULL, FILE_BEGIN)
|| offCurrent > cbSize)
return VINF_SUCCESS;
}
@@ -590,7 +614,7 @@ RTR3DECL(int) RTFileSetSize(RTFILE File, uint64_t cbSize)
* Failed, try restoring the file pointer.
*/
rc = GetLastError();
- MySetFilePointer(File, offCurrent, NULL, FILE_BEGIN);
+ MySetFilePointer(hFile, offCurrent, NULL, FILE_BEGIN);
}
else
rc = GetLastError();
@@ -602,10 +626,10 @@ RTR3DECL(int) RTFileSetSize(RTFILE File, uint64_t cbSize)
}
-RTR3DECL(int) RTFileGetSize(RTFILE File, uint64_t *pcbSize)
+RTR3DECL(int) RTFileGetSize(RTFILE hFile, uint64_t *pcbSize)
{
ULARGE_INTEGER Size;
- Size.LowPart = GetFileSize((HANDLE)File, &Size.HighPart);
+ Size.LowPart = GetFileSize((HANDLE)RTFileToNative(hFile), &Size.HighPart);
if (Size.LowPart != INVALID_FILE_SIZE)
{
*pcbSize = Size.QuadPart;
@@ -617,7 +641,7 @@ RTR3DECL(int) RTFileGetSize(RTFILE File, uint64_t *pcbSize)
}
-RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax)
+RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE hFile, PRTFOFF pcbMax)
{
/** @todo r=bird:
* We might have to make this code OS specific...
@@ -629,11 +653,11 @@ RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax)
}
-RTR3DECL(bool) RTFileIsValid(RTFILE File)
+RTR3DECL(bool) RTFileIsValid(RTFILE hFile)
{
- if (File != NIL_RTFILE)
+ if (hFile != NIL_RTFILE)
{
- DWORD dwType = GetFileType((HANDLE)File);
+ DWORD dwType = GetFileType((HANDLE)RTFileToNative(hFile));
switch (dwType)
{
case FILE_TYPE_CHAR:
@@ -655,7 +679,7 @@ RTR3DECL(bool) RTFileIsValid(RTFILE File)
#define LOW_DWORD(u64) ((DWORD)u64)
#define HIGH_DWORD(u64) (((DWORD *)&u64)[1])
-RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int) RTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
{
Assert(offLock >= 0);
@@ -680,14 +704,14 @@ RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t
Overlapped.OffsetHigh = HIGH_DWORD(offLock);
/* Note: according to Microsoft, LockFileEx API call is available starting from NT 3.5 */
- if (LockFileEx((HANDLE)File, dwFlags, 0, LOW_DWORD(cbLock), HIGH_DWORD(cbLock), &Overlapped))
+ if (LockFileEx((HANDLE)RTFileToNative(hFile), dwFlags, 0, LOW_DWORD(cbLock), HIGH_DWORD(cbLock), &Overlapped))
return VINF_SUCCESS;
return RTErrConvertFromWin32(GetLastError());
}
-RTR3DECL(int) RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int) RTFileChangeLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
{
Assert(offLock >= 0);
@@ -699,18 +723,18 @@ RTR3DECL(int) RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, ui
}
/* Remove old lock. */
- int rc = RTFileUnlock(File, offLock, cbLock);
+ int rc = RTFileUnlock(hFile, offLock, cbLock);
if (RT_FAILURE(rc))
return rc;
/* Set new lock. */
- rc = RTFileLock(File, fLock, offLock, cbLock);
+ rc = RTFileLock(hFile, fLock, offLock, cbLock);
if (RT_SUCCESS(rc))
return rc;
/* Try to restore old lock. */
unsigned fLockOld = (fLock & RTFILE_LOCK_WRITE) ? fLock & ~RTFILE_LOCK_WRITE : fLock | RTFILE_LOCK_WRITE;
- rc = RTFileLock(File, fLockOld, offLock, cbLock);
+ rc = RTFileLock(hFile, fLockOld, offLock, cbLock);
if (RT_SUCCESS(rc))
return VERR_FILE_LOCK_VIOLATION;
else
@@ -718,11 +742,13 @@ RTR3DECL(int) RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, ui
}
-RTR3DECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int) RTFileUnlock(RTFILE hFile, int64_t offLock, uint64_t cbLock)
{
Assert(offLock >= 0);
- if (UnlockFile((HANDLE)File, LOW_DWORD(offLock), HIGH_DWORD(offLock), LOW_DWORD(cbLock), HIGH_DWORD(cbLock)))
+ if (UnlockFile((HANDLE)RTFileToNative(hFile),
+ LOW_DWORD(offLock), HIGH_DWORD(offLock),
+ LOW_DWORD(cbLock), HIGH_DWORD(cbLock)))
return VINF_SUCCESS;
return RTErrConvertFromWin32(GetLastError());
@@ -730,14 +756,14 @@ RTR3DECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
-RTR3DECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
+RTR3DECL(int) RTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
{
/*
* Validate input.
*/
- if (File == NIL_RTFILE)
+ if (hFile == NIL_RTFILE)
{
- AssertMsgFailed(("Invalid File=%RTfile\n", File));
+ AssertMsgFailed(("Invalid hFile=%RTfile\n", hFile));
return VERR_INVALID_PARAMETER;
}
if (!pObjInfo)
@@ -756,8 +782,14 @@ RTR3DECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD
* Query file info.
*/
BY_HANDLE_FILE_INFORMATION Data;
- if (!GetFileInformationByHandle((HANDLE)File, &Data))
- return RTErrConvertFromWin32(GetLastError());
+ if (!GetFileInformationByHandle((HANDLE)RTFileToNative(hFile), &Data))
+ {
+ DWORD dwErr = GetLastError();
+ /* Only return if we *really* don't have a valid handle value,
+ * everything else is fine here ... */
+ if (dwErr != ERROR_INVALID_HANDLE)
+ return RTErrConvertFromWin32(dwErr);
+ }
/*
* Setup the returned data.
@@ -821,7 +853,7 @@ RTR3DECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD
}
-RTR3DECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
+RTR3DECL(int) RTFileSetTimes(RTFILE hFile, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime)
{
if (!pAccessTime && !pModificationTime && !pBirthTime)
@@ -843,12 +875,12 @@ RTR3DECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC
pLastWriteTimeFT = RTTimeSpecGetNtFileTime(pModificationTime, &LastWriteTimeFT);
int rc = VINF_SUCCESS;
- if (!SetFileTime((HANDLE)File, pCreationTimeFT, pLastAccessTimeFT, pLastWriteTimeFT))
+ if (!SetFileTime((HANDLE)RTFileToNative(hFile), pCreationTimeFT, pLastAccessTimeFT, pLastWriteTimeFT))
{
DWORD Err = GetLastError();
rc = RTErrConvertFromWin32(Err);
Log(("RTFileSetTimes(%RTfile, %p, %p, %p, %p): SetFileTime failed with lasterr %d (%Rrc)\n",
- File, pAccessTime, pModificationTime, pChangeTime, pBirthTime, Err, rc));
+ hFile, pAccessTime, pModificationTime, pChangeTime, pBirthTime, Err, rc));
}
return rc;
}
@@ -860,7 +892,7 @@ RTR3DECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC
extern int rtFileNativeSetAttributes(HANDLE FileHandle, ULONG FileAttributes);
-RTR3DECL(int) RTFileSetMode(RTFILE File, RTFMODE fMode)
+RTR3DECL(int) RTFileSetMode(RTFILE hFile, RTFMODE fMode)
{
/*
* Normalize the mode and call the API.
@@ -870,12 +902,12 @@ RTR3DECL(int) RTFileSetMode(RTFILE File, RTFMODE fMode)
return VERR_INVALID_PARAMETER;
ULONG FileAttributes = (fMode & RTFS_DOS_MASK) >> RTFS_DOS_SHIFT;
- int Err = rtFileNativeSetAttributes((HANDLE)File, FileAttributes);
+ int Err = rtFileNativeSetAttributes((HANDLE)hFile, FileAttributes);
if (Err != ERROR_SUCCESS)
{
int rc = RTErrConvertFromWin32(Err);
Log(("RTFileSetMode(%RTfile, %RTfmode): rtFileNativeSetAttributes (0x%08X) failed with err %d (%Rrc)\n",
- File, fMode, FileAttributes, Err, rc));
+ hFile, fMode, FileAttributes, Err, rc));
return rc;
}
return VINF_SUCCESS;
diff --git a/src/VBox/Runtime/r3/win/fs-win.cpp b/src/VBox/Runtime/r3/win/fs-win.cpp
index c0fa65c32..14e2fea69 100644
--- a/src/VBox/Runtime/r3/win/fs-win.cpp
+++ b/src/VBox/Runtime/r3/win/fs-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: fs-win.cpp $ */
+/* $Id: fs-win.cpp 32431 2010-09-11 18:02:17Z vboxsync $ */
/** @file
* IPRT - File System, Win32.
*/
diff --git a/src/VBox/Runtime/r3/win/ldrNative-win.cpp b/src/VBox/Runtime/r3/win/ldrNative-win.cpp
index 540169588..058bde3a4 100644
--- a/src/VBox/Runtime/r3/win/ldrNative-win.cpp
+++ b/src/VBox/Runtime/r3/win/ldrNative-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: ldrNative-win.cpp $ */
+/* $Id: ldrNative-win.cpp 35183 2010-12-16 13:59:44Z vboxsync $ */
/** @file
* IPRT - Binary Image Loader, Win32 native.
*/
diff --git a/src/VBox/Runtime/r3/win/localipc-win.cpp b/src/VBox/Runtime/r3/win/localipc-win.cpp
index 15ff6f8bb..13d17076c 100644
--- a/src/VBox/Runtime/r3/win/localipc-win.cpp
+++ b/src/VBox/Runtime/r3/win/localipc-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: localipc-win.cpp $ */
+/* $Id: localipc-win.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Local IPC, Windows Implementation Using Named Pipes.
*/
diff --git a/src/VBox/Runtime/r3/win/mp-win.cpp b/src/VBox/Runtime/r3/win/mp-win.cpp
index fed1152ba..970900de8 100644
--- a/src/VBox/Runtime/r3/win/mp-win.cpp
+++ b/src/VBox/Runtime/r3/win/mp-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: mp-win.cpp $ */
+/* $Id: mp-win.cpp 36262 2011-03-11 14:50:45Z vboxsync $ */
/** @file
* IPRT - Multiprocessor, Windows.
*/
diff --git a/src/VBox/Runtime/r3/win/ntdll-mini-implib.c b/src/VBox/Runtime/r3/win/ntdll-mini-implib.c
index 74094221d..b6c683932 100644
--- a/src/VBox/Runtime/r3/win/ntdll-mini-implib.c
+++ b/src/VBox/Runtime/r3/win/ntdll-mini-implib.c
@@ -1,4 +1,4 @@
-/* $Id: ntdll-mini-implib.c $ */
+/* $Id: ntdll-mini-implib.c 35018 2010-12-13 14:46:17Z vboxsync $ */
/** @file
* IPRT - Minimal NTDLL import library defintion file.
*/
diff --git a/src/VBox/Runtime/r3/win/ntdll-mini-implib.def b/src/VBox/Runtime/r3/win/ntdll-mini-implib.def
index a0d39ee48..8793f742f 100644
--- a/src/VBox/Runtime/r3/win/ntdll-mini-implib.def
+++ b/src/VBox/Runtime/r3/win/ntdll-mini-implib.def
@@ -1,4 +1,4 @@
-; $Id: ntdll-mini-implib.def $
+; $Id: ntdll-mini-implib.def 35020 2010-12-13 14:53:16Z vboxsync $
;; @file
; IPRT - Minimal NTDLL import library defintion file.
;
diff --git a/src/VBox/Runtime/r3/win/path-win.cpp b/src/VBox/Runtime/r3/win/path-win.cpp
index df85a2121..9f24ad5f4 100644
--- a/src/VBox/Runtime/r3/win/path-win.cpp
+++ b/src/VBox/Runtime/r3/win/path-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: path-win.cpp $ */
+/* $Id: path-win.cpp 36879 2011-04-29 09:15:52Z vboxsync $ */
/** @file
* IPRT - Path manipulation.
*/
@@ -30,11 +30,13 @@
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_PATH
#include <Windows.h>
+#include <Shlobj.h>
#include <iprt/path.h>
#include <iprt/assert.h>
#include <iprt/string.h>
#include <iprt/time.h>
+#include <iprt/ldr.h>
#include <iprt/mem.h>
#include <iprt/param.h>
#include <iprt/log.h>
@@ -42,6 +44,9 @@
#include "internal/path.h"
#include "internal/fs.h"
+/* Needed for lazy loading SHGetFolderPathW in RTPathUserDocuments(). */
+typedef HRESULT FNSHGETFOLDERPATHW(HWND, int, HANDLE, DWORD, LPWSTR);
+typedef FNSHGETFOLDERPATHW *PFNSHGETFOLDERPATHW;
/**
* Get the real (no symlinks, no . or .. components) path, must exist.
@@ -181,6 +186,40 @@ RTDECL(int) RTPathUserHome(char *pszPath, size_t cchPath)
}
+RTDECL(int) RTPathUserDocuments(char *pszPath, size_t cchPath)
+{
+ /*
+ * Validate input
+ */
+ AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
+ AssertReturn(cchPath, VERR_INVALID_PARAMETER);
+
+ RTLDRMOD hShell32;
+ int rc = RTLdrLoad("Shell32.dll", &hShell32);
+ if (RT_SUCCESS(rc))
+ {
+ PFNSHGETFOLDERPATHW pfnSHGetFolderPathW;
+ rc = RTLdrGetSymbol(hShell32, "SHGetFolderPathW", (void**)&pfnSHGetFolderPathW);
+ if (RT_SUCCESS(rc))
+ {
+ RTUTF16 wszPath[RTPATH_MAX];
+ HRESULT hrc = pfnSHGetFolderPathW(0, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, wszPath);
+ if ( hrc == S_OK /* Found */
+ || hrc == S_FALSE) /* Found, but doesn't exist */
+ {
+ /*
+ * Convert and return.
+ */
+ RTLdrClose(hShell32);
+ return RTUtf16ToUtf8Ex(&wszPath[0], RTSTR_MAX, &pszPath, cchPath, NULL);
+ }
+ }
+ RTLdrClose(hShell32);
+ }
+ return VERR_PATH_NOT_FOUND;
+}
+
+
RTR3DECL(int) RTPathQueryInfo(const char *pszPath, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
{
return RTPathQueryInfoEx(pszPath, pObjInfo, enmAdditionalAttribs, RTPATH_F_ON_LINK);
diff --git a/src/VBox/Runtime/r3/win/pipe-win.cpp b/src/VBox/Runtime/r3/win/pipe-win.cpp
index 6c12768e2..4e4193322 100644
--- a/src/VBox/Runtime/r3/win/pipe-win.cpp
+++ b/src/VBox/Runtime/r3/win/pipe-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: pipe-win.cpp $ */
+/* $Id: pipe-win.cpp 34119 2010-11-16 15:33:25Z vboxsync $ */
/** @file
* IPRT - Anonymous Pipes, Windows Implementation.
*/
diff --git a/src/VBox/Runtime/r3/win/poll-win.cpp b/src/VBox/Runtime/r3/win/poll-win.cpp
index 0f3b187ff..54641a99d 100644
--- a/src/VBox/Runtime/r3/win/poll-win.cpp
+++ b/src/VBox/Runtime/r3/win/poll-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: poll-win.cpp $ */
+/* $Id: poll-win.cpp 32431 2010-09-11 18:02:17Z vboxsync $ */
/** @file
* IPRT - Polling I/O Handles, Windows Implementation.
*
diff --git a/src/VBox/Runtime/r3/win/process-win.cpp b/src/VBox/Runtime/r3/win/process-win.cpp
index f616baf9f..567b3f196 100644
--- a/src/VBox/Runtime/r3/win/process-win.cpp
+++ b/src/VBox/Runtime/r3/win/process-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: process-win.cpp $ */
+/* $Id: process-win.cpp 37448 2011-06-14 16:06:06Z vboxsync $ */
/** @file
* IPRT - Process, Windows.
*/
@@ -29,6 +29,7 @@
* Header Files *
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_PROCESS
+#include <iprt/asm.h> /* hack */
#include <Userenv.h>
#include <Windows.h>
diff --git a/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp b/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp
index 5c8a1b71f..7965eb31f 100644
--- a/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp
+++ b/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp
@@ -1,10 +1,10 @@
-/* $Id: rtFileNativeSetAttributes-win.cpp $ */
+/* $Id: rtFileNativeSetAttributes-win.cpp 37600 2011-06-22 22:05:01Z vboxsync $ */
/** @file
* IPRT - NtSetInformationFile wrapper.
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Runtime/r3/win/rtProcInitExePath-win.cpp b/src/VBox/Runtime/r3/win/rtProcInitExePath-win.cpp
index 3b056cde1..d285a8052 100644
--- a/src/VBox/Runtime/r3/win/rtProcInitExePath-win.cpp
+++ b/src/VBox/Runtime/r3/win/rtProcInitExePath-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: rtProcInitExePath-win.cpp $ */
+/* $Id: rtProcInitExePath-win.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - rtProcInitName, Windows.
*/
diff --git a/src/VBox/Runtime/r3/win/sched-win.cpp b/src/VBox/Runtime/r3/win/sched-win.cpp
index 1f4a985c9..53dacd577 100644
--- a/src/VBox/Runtime/r3/win/sched-win.cpp
+++ b/src/VBox/Runtime/r3/win/sched-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: sched-win.cpp $ */
+/* $Id: sched-win.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */
/** @file
* IPRT - Scheduling, Win32.
*/
@@ -256,7 +256,7 @@ static const PROCPRIORITY *g_pProcessPriority = &g_aDefaultPriority;
* @returns iprt status code.
* @param enmType The thread type to be assumed for the current thread.
*/
-int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
{
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
return VINF_SUCCESS;
@@ -272,7 +272,7 @@ int rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
* @param enmPriority The priority to validate and set.
* @remark Located in sched.
*/
-int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
+DECLHIDDEN(int) rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
{
Assert(enmPriority > RTPROCPRIORITY_INVALID && enmPriority < RTPROCPRIORITY_LAST);
return VINF_SUCCESS;
@@ -285,7 +285,7 @@ int rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
* @returns Valid win32 handle for the specified thread.
* @param pThread The thread.
*/
-inline HANDLE rtThreadNativeGetHandle(PRTTHREADINT pThread)
+DECLINLINE(HANDLE) rtThreadNativeGetHandle(PRTTHREADINT pThread)
{
if ((uintptr_t)pThread->Core.Key == GetCurrentThreadId())
return GetCurrentThread();
@@ -305,7 +305,7 @@ inline HANDLE rtThreadNativeGetHandle(PRTTHREADINT pThread)
* @param enmType The thread type.
* @remark Located in sched.
*/
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
{
Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
AssertMsg(g_pProcessPriority && g_pProcessPriority->aTypes[enmType].enmType == enmType,
diff --git a/src/VBox/Runtime/r3/win/semevent-win.cpp b/src/VBox/Runtime/r3/win/semevent-win.cpp
index 13d715bfc..59558abfb 100644
--- a/src/VBox/Runtime/r3/win/semevent-win.cpp
+++ b/src/VBox/Runtime/r3/win/semevent-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: semevent-win.cpp $ */
+/* $Id: semevent-win.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Event Semaphore, Windows.
*/
diff --git a/src/VBox/Runtime/r3/win/semeventmulti-win.cpp b/src/VBox/Runtime/r3/win/semeventmulti-win.cpp
index b7f9febbe..5fa6d648c 100644
--- a/src/VBox/Runtime/r3/win/semeventmulti-win.cpp
+++ b/src/VBox/Runtime/r3/win/semeventmulti-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: semeventmulti-win.cpp $ */
+/* $Id: semeventmulti-win.cpp 32970 2010-10-07 10:08:00Z vboxsync $ */
/** @file
* IPRT - Multiple Release Event Semaphore, Windows.
*
diff --git a/src/VBox/Runtime/r3/win/semmutex-win.cpp b/src/VBox/Runtime/r3/win/semmutex-win.cpp
index 7cdab20b8..b86ec5fc5 100644
--- a/src/VBox/Runtime/r3/win/semmutex-win.cpp
+++ b/src/VBox/Runtime/r3/win/semmutex-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: semmutex-win.cpp $ */
+/* $Id: semmutex-win.cpp 30111 2010-06-09 12:14:59Z vboxsync $ */
/** @file
* IPRT - Mutex Semaphores, Windows.
*/
diff --git a/src/VBox/Runtime/r3/win/symlink-win.cpp b/src/VBox/Runtime/r3/win/symlink-win.cpp
index c30245e45..5a02d9ea3 100644
--- a/src/VBox/Runtime/r3/win/symlink-win.cpp
+++ b/src/VBox/Runtime/r3/win/symlink-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: symlink-win.cpp $ */
+/* $Id: symlink-win.cpp 33437 2010-10-25 16:28:14Z vboxsync $ */
/** @file
* IPRT - Symbolic Links, Windows.
*/
diff --git a/src/VBox/Runtime/r3/win/thread-win.cpp b/src/VBox/Runtime/r3/win/thread-win.cpp
index 1d9c00163..9280729b0 100644
--- a/src/VBox/Runtime/r3/win/thread-win.cpp
+++ b/src/VBox/Runtime/r3/win/thread-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: thread-win.cpp $ */
+/* $Id: thread-win.cpp 37733 2011-07-01 15:41:37Z vboxsync $ */
/** @file
* IPRT - Threads, Windows.
*/
@@ -35,11 +35,14 @@
#include <process.h>
#include <iprt/thread.h>
-#include <iprt/log.h>
-#include <iprt/assert.h>
-#include <iprt/alloc.h>
+#include "internal/iprt.h"
+
#include <iprt/asm-amd64-x86.h>
+#include <iprt/assert.h>
+#include <iprt/cpuset.h>
#include <iprt/err.h>
+#include <iprt/log.h>
+#include <iprt/mem.h>
#include "internal/thread.h"
@@ -56,7 +59,7 @@ static DWORD g_dwSelfTLS = TLS_OUT_OF_INDEXES;
static unsigned __stdcall rtThreadNativeMain(void *pvArgs);
-int rtThreadNativeInit(void)
+DECLHIDDEN(int) rtThreadNativeInit(void)
{
g_dwSelfTLS = TlsAlloc();
if (g_dwSelfTLS == TLS_OUT_OF_INDEXES)
@@ -65,7 +68,7 @@ int rtThreadNativeInit(void)
}
-void rtThreadNativeDetach(void)
+DECLHIDDEN(void) rtThreadNativeDetach(void)
{
/*
* Deal with alien threads.
@@ -80,7 +83,7 @@ void rtThreadNativeDetach(void)
}
-void rtThreadNativeDestroy(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
{
if (pThread == (PRTTHREADINT)TlsGetValue(g_dwSelfTLS))
TlsSetValue(g_dwSelfTLS, NULL);
@@ -93,7 +96,7 @@ void rtThreadNativeDestroy(PRTTHREADINT pThread)
}
-int rtThreadNativeAdopt(PRTTHREADINT pThread)
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
{
if (!TlsSetValue(g_dwSelfTLS, pThread))
return VERR_FAILED_TO_SET_SELF_TLS;
@@ -102,9 +105,9 @@ int rtThreadNativeAdopt(PRTTHREADINT pThread)
/**
- * Bitch about dangling COM and OLE references, dispose of them
- * afterwards so we don't end up deadlocked somewhere below
- * OLE32!DllMain.
+ * Bitch about dangling COM and OLE references, dispose of them
+ * afterwards so we don't end up deadlocked somewhere below
+ * OLE32!DllMain.
*/
static void rtThreadNativeUninitComAndOle(void)
{
@@ -142,14 +145,14 @@ static void rtThreadNativeUninitComAndOle(void)
cComInits = pOleTlsData->cComInits;
cOleInits = pOleTlsData->cOleInits;
}
- }
+ }
__except(EXCEPTION_EXECUTE_HANDLER)
{
AssertFailedReturnVoid();
}
-
+
/*
- * Assert sanity. If any of these breaks, the structure layout above is
+ * Assert sanity. If any of these breaks, the structure layout above is
* probably not correct any longer.
*/
AssertMsgReturnVoid(cComInits < 1000, ("%u (%#x)\n", cComInits, cComInits));
@@ -161,7 +164,7 @@ static void rtThreadNativeUninitComAndOle(void)
*/
if (cComInits)
{
- AssertMsgFailed(("cComInits=%u (%#x) cOleInits=%u (%#x) - dangling COM/OLE inits!\n",
+ AssertMsgFailed(("cComInits=%u (%#x) cOleInits=%u (%#x) - dangling COM/OLE inits!\n",
cComInits, cComInits, cOleInits, cOleInits));
HMODULE hOle32 = GetModuleHandle("OLE32");
@@ -208,7 +211,7 @@ static unsigned __stdcall rtThreadNativeMain(void *pvArgs)
}
-int rtThreadNativeCreate(PRTTHREADINT pThread, PRTNATIVETHREAD pNativeThread)
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThread, PRTNATIVETHREAD pNativeThread)
{
AssertReturn(pThread->cbStack < ~(unsigned)0, VERR_INVALID_PARAMETER);
@@ -236,32 +239,6 @@ RTDECL(RTTHREAD) RTThreadSelf(void)
}
-RTDECL(RTNATIVETHREAD) RTThreadNativeSelf(void)
-{
- return (RTNATIVETHREAD)GetCurrentThreadId();
-}
-
-
-RTR3DECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
-{
- LogFlow(("RTThreadSleep: cMillies=%d\n", cMillies));
- Sleep(cMillies);
- LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", VINF_SUCCESS, cMillies));
- return VINF_SUCCESS;
-}
-
-
-RTR3DECL(bool) RTThreadYield(void)
-{
- uint64_t u64TS = ASMReadTSC();
- Sleep(0);
- u64TS = ASMReadTSC() - u64TS;
- bool fRc = u64TS > 1500;
- LogFlow(("RTThreadYield: returning %d (%llu ticks)\n", fRc, u64TS));
- return fRc;
-}
-
-
#if 0 /* noone is using this ... */
/**
* Returns the processor number the current thread was running on during this call
@@ -286,10 +263,10 @@ static int rtThreadGetCurrentProcessorNumber(void)
#endif
-RTR3DECL(int) RTThreadSetAffinity(uint64_t u64Mask)
+RTR3DECL(int) RTThreadSetAffinity(PCRTCPUSET pCpuSet)
{
- Assert((DWORD_PTR)u64Mask == u64Mask || u64Mask == ~(uint64_t)0);
- DWORD_PTR dwRet = SetThreadAffinityMask(GetCurrentThread(), (DWORD_PTR)u64Mask);
+ DWORD_PTR fNewMask = pCpuSet ? RTCpuSetToU64(pCpuSet) : ~(DWORD_PTR)0;
+ DWORD_PTR dwRet = SetThreadAffinityMask(GetCurrentThread(), fNewMask);
if (dwRet)
return VINF_SUCCESS;
@@ -299,7 +276,7 @@ RTR3DECL(int) RTThreadSetAffinity(uint64_t u64Mask)
}
-RTR3DECL(uint64_t) RTThreadGetAffinity(void)
+RTR3DECL(int) RTThreadGetAffinity(PRTCPUSET pCpuSet)
{
/*
* Haven't found no query api, but the set api returns the old mask, so let's use that.
@@ -314,7 +291,9 @@ RTR3DECL(uint64_t) RTThreadGetAffinity(void)
{
DWORD_PTR dwSet = SetThreadAffinityMask(hThread, dwRet);
Assert(dwSet == dwProcAff); NOREF(dwRet);
- return dwRet;
+
+ RTCpuSetFromU64(pCpuSet, (uint64_t)dwSet);
+ return VINF_SUCCESS;
}
}
diff --git a/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c b/src/VBox/Runtime/r3/win/thread2-win.cpp
index 1b5c736cf..3970c0b4d 100644
--- a/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c
+++ b/src/VBox/Runtime/r3/win/thread2-win.cpp
@@ -1,10 +1,10 @@
-/* $Id: mpnotification-r0drv-solaris.c $ */
+/* $Id: thread2-win.cpp 37733 2011-07-01 15:41:37Z vboxsync $ */
/** @file
- * IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Solaris.
+ * IPRT - Threads part 2, Windows.
*/
/*
- * Copyright (C) 2008 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -28,56 +28,41 @@
/*******************************************************************************
* Header Files *
*******************************************************************************/
-#include "the-solaris-kernel.h"
+#define LOG_GROUP RTLOGGROUP_THREAD
+#include <Windows.h>
+
+#include <iprt/thread.h>
#include "internal/iprt.h"
-#include <iprt/mp.h>
+#include <iprt/asm-amd64-x86.h>
#include <iprt/err.h>
-#include "r0drv/mp-r0drv.h"
+#include <iprt/log.h>
+#include "internal/thread.h"
-static int rtMpNotificationSolarisCallback(cpu_setup_t enmSolarisEvent, int iCpu, void *pvUser)
+RTDECL(RTNATIVETHREAD) RTThreadNativeSelf(void)
{
- NOREF(pvUser);
-
- /* ASSUMES iCpu == RTCPUID */
- switch (enmSolarisEvent)
- {
- case CPU_INIT:
- case CPU_CONFIG:
- case CPU_UNCONFIG:
- break;
-
- case CPU_ON:
- rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, iCpu);
- break;
-
- case CPU_OFF:
- rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, iCpu);
- break;
-
- case CPU_CPUPART_IN:
- case CPU_CPUPART_OUT:
- /** @todo are these relevant? */
- break;
- }
- return 0;
+ return (RTNATIVETHREAD)GetCurrentThreadId();
}
-int rtR0MpNotificationNativeInit(void)
+RTR3DECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
{
- mutex_enter(&cpu_lock);
- register_cpu_setup_func(rtMpNotificationSolarisCallback, NULL);
- mutex_exit(&cpu_lock);
+ LogFlow(("RTThreadSleep: cMillies=%d\n", cMillies));
+ Sleep(cMillies);
+ LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", VINF_SUCCESS, cMillies));
return VINF_SUCCESS;
}
-void rtR0MpNotificationNativeTerm(void)
+RTR3DECL(bool) RTThreadYield(void)
{
- mutex_enter(&cpu_lock);
- unregister_cpu_setup_func(rtMpNotificationSolarisCallback, NULL);
- mutex_exit(&cpu_lock);
+ uint64_t u64TS = ASMReadTSC();
+ Sleep(0);
+ u64TS = ASMReadTSC() - u64TS;
+ bool fRc = u64TS > 1500;
+ LogFlow(("RTThreadYield: returning %d (%llu ticks)\n", fRc, u64TS));
+ return fRc;
}
+
diff --git a/src/VBox/Runtime/r3/win/time-win.cpp b/src/VBox/Runtime/r3/win/time-win.cpp
index bd4e768a7..517589c09 100644
--- a/src/VBox/Runtime/r3/win/time-win.cpp
+++ b/src/VBox/Runtime/r3/win/time-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: time-win.cpp $ */
+/* $Id: time-win.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Time, Windows.
*/
diff --git a/src/VBox/Runtime/r3/win/timer-win.cpp b/src/VBox/Runtime/r3/win/timer-win.cpp
index 08ed4ec1f..868d1d371 100644
--- a/src/VBox/Runtime/r3/win/timer-win.cpp
+++ b/src/VBox/Runtime/r3/win/timer-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: timer-win.cpp $ */
+/* $Id: timer-win.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Timer.
*/
diff --git a/src/VBox/Runtime/r3/win/tls-win.cpp b/src/VBox/Runtime/r3/win/tls-win.cpp
index 2bc332b76..01a5e581f 100644
--- a/src/VBox/Runtime/r3/win/tls-win.cpp
+++ b/src/VBox/Runtime/r3/win/tls-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: tls-win.cpp $ */
+/* $Id: tls-win.cpp 34507 2010-11-30 13:14:14Z vboxsync $ */
/** @file
* IPRT - Thread Local Storage (TLS), Win32.
*/
diff --git a/src/VBox/Runtime/r3/win/utf16locale-win.cpp b/src/VBox/Runtime/r3/win/utf16locale-win.cpp
index 40d99bb2b..1831a5088 100644
--- a/src/VBox/Runtime/r3/win/utf16locale-win.cpp
+++ b/src/VBox/Runtime/r3/win/utf16locale-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: utf16locale-win.cpp $ */
+/* $Id: utf16locale-win.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - UTF-16 Locale Specific Manipulation, Win32.
*/
diff --git a/src/VBox/Runtime/r3/win/utf8-win.cpp b/src/VBox/Runtime/r3/win/utf8-win.cpp
index 58a6e3957..bef381b85 100644
--- a/src/VBox/Runtime/r3/win/utf8-win.cpp
+++ b/src/VBox/Runtime/r3/win/utf8-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: utf8-win.cpp $ */
+/* $Id: utf8-win.cpp 31157 2010-07-28 03:15:35Z vboxsync $ */
/** @file
* IPRT - UTF8 helpers.
*/
diff --git a/src/VBox/Runtime/r3/win/uuid-win.cpp b/src/VBox/Runtime/r3/win/uuid-win.cpp
index 0d91df790..203b81594 100644
--- a/src/VBox/Runtime/r3/win/uuid-win.cpp
+++ b/src/VBox/Runtime/r3/win/uuid-win.cpp
@@ -1,4 +1,4 @@
-/* $Id: uuid-win.cpp $ */
+/* $Id: uuid-win.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - UUID, Windows implementation.
*/
diff --git a/src/VBox/Runtime/r3/xml.cpp b/src/VBox/Runtime/r3/xml.cpp
index c1007a4da..ecf63bc70 100644
--- a/src/VBox/Runtime/r3/xml.cpp
+++ b/src/VBox/Runtime/r3/xml.cpp
@@ -1,4 +1,4 @@
-/* $Id: xml.cpp $ */
+/* $Id: xml.cpp 37493 2011-06-16 13:18:11Z vboxsync $ */
/** @file
* IPRT - XML Manipulation API.
*/
@@ -90,7 +90,7 @@ public:
/** Used to provide some thread safety missing in libxml2 (see e.g.
* XmlTreeBackend::read()) */
- RTLockMtx lock;
+ RTCLockMtx lock;
}
sxml; /* XXX naming this xml will break with gcc-3.3 */
}
@@ -108,7 +108,7 @@ namespace xml
////////////////////////////////////////////////////////////////////////////////
LogicError::LogicError(RT_SRC_POS_DECL)
- : Error(NULL)
+ : RTCError(NULL)
{
char *msg = NULL;
RTStrAPrintf(&msg, "In '%s', '%s' at #%d",
@@ -174,7 +174,7 @@ struct File::Data
: handle(NIL_RTFILE), opened(false)
{ }
- iprt::MiniString strFileName;
+ RTCString strFileName;
RTFILE handle;
bool opened : 1;
bool flushOnClose : 1;
@@ -386,7 +386,7 @@ int MemoryBuf::read (char *aBuf, int aLen)
struct GlobalLock::Data
{
PFNEXTERNALENTITYLOADER pOldLoader;
- RTLock lock;
+ RTCLock lock;
Data()
: pOldLoader(NULL),
@@ -824,7 +824,7 @@ bool ElementNode::getAttributeValue(const char *pcszMatch, const char *&ppcsz) c
* @param str out: attribute value; overwritten only if attribute was found
* @return TRUE if attribute was found and str was thus updated.
*/
-bool ElementNode::getAttributeValue(const char *pcszMatch, iprt::MiniString &str) const
+bool ElementNode::getAttributeValue(const char *pcszMatch, RTCString &str) const
{
const Node* pAttr;
if ((pAttr = findAttribute(pcszMatch)))
@@ -843,7 +843,7 @@ bool ElementNode::getAttributeValue(const char *pcszMatch, iprt::MiniString &str
* @param str
* @return
*/
-bool ElementNode::getAttributeValuePath(const char *pcszMatch, iprt::MiniString &str) const
+bool ElementNode::getAttributeValuePath(const char *pcszMatch, RTCString &str) const
{
if (getAttributeValue(pcszMatch, str))
{
@@ -1077,9 +1077,9 @@ AttributeNode* ElementNode::setAttribute(const char *pcszName, const char *pcszV
* @param strValue
* @return
*/
-AttributeNode* ElementNode::setAttributePath(const char *pcszName, const iprt::MiniString &strValue)
+AttributeNode* ElementNode::setAttributePath(const char *pcszName, const RTCString &strValue)
{
- iprt::MiniString strTemp(strValue);
+ RTCString strTemp(strValue);
strTemp.findReplace('\\', '/');
return setAttribute(pcszName, strTemp.c_str());
}
@@ -1333,6 +1333,11 @@ struct Document::Data
delete pRootElement;
pRootElement = NULL;
}
+ if (pComment)
+ {
+ delete pComment;
+ pComment = NULL;
+ }
}
void copyFrom(const Document::Data *p)
@@ -1481,7 +1486,7 @@ XmlMemParser::~XmlMemParser()
* @param doc out: document to be reset and filled with data according to file contents.
*/
void XmlMemParser::read(const void* pvBuf, size_t cbSize,
- const iprt::MiniString &strFilename,
+ const RTCString &strFilename,
Document &doc)
{
GlobalLock lock;
@@ -1539,7 +1544,7 @@ void XmlMemWriter::write(const Document &doc, void **ppvBuf, size_t *pcbSize)
struct XmlFileParser::Data
{
- iprt::MiniString strXmlFilename;
+ RTCString strXmlFilename;
Data()
{
@@ -1565,14 +1570,14 @@ XmlFileParser::~XmlFileParser()
struct IOContext
{
File file;
- iprt::MiniString error;
+ RTCString error;
IOContext(const char *pcszFilename, File::Mode mode, bool fFlush = false)
: file(mode, pcszFilename, fFlush)
{
}
- void setError(const iprt::Error &x)
+ void setError(const RTCError &x)
{
error = x.what();
}
@@ -1608,7 +1613,7 @@ struct WriteContext : IOContext
* @param strFilename in: name fo file to parse.
* @param doc out: document to be reset and filled with data according to file contents.
*/
-void XmlFileParser::read(const iprt::MiniString &strFilename,
+void XmlFileParser::read(const RTCString &strFilename,
Document &doc)
{
GlobalLock lock;
@@ -1644,7 +1649,7 @@ int XmlFileParser::ReadCallback(void *aCtxt, char *aBuf, int aLen)
return pContext->file.read(aBuf, aLen);
}
catch (const xml::EIPRTFailure &err) { pContext->setError(err); }
- catch (const iprt::Error &err) { pContext->setError(err); }
+ catch (const RTCError &err) { pContext->setError(err); }
catch (const std::exception &err) { pContext->setError(err); }
catch (...) { pContext->setError(xml::LogicError(RT_SRC_POS)); }
@@ -1769,7 +1774,7 @@ int XmlFileWriter::WriteCallback(void *aCtxt, const char *aBuf, int aLen)
return pContext->file.write(aBuf, aLen);
}
catch (const xml::EIPRTFailure &err) { pContext->setError(err); }
- catch (const iprt::Error &err) { pContext->setError(err); }
+ catch (const RTCError &err) { pContext->setError(err); }
catch (const std::exception &err) { pContext->setError(err); }
catch (...) { pContext->setError(xml::LogicError(RT_SRC_POS)); }
diff --git a/src/VBox/Runtime/testcase/Makefile.kmk b/src/VBox/Runtime/testcase/Makefile.kmk
index 1aabc736f..7b48c2f70 100644
--- a/src/VBox/Runtime/testcase/Makefile.kmk
+++ b/src/VBox/Runtime/testcase/Makefile.kmk
@@ -1,4 +1,4 @@
-# $Id: Makefile.kmk $
+# $Id: Makefile.kmk 37720 2011-06-30 20:27:48Z vboxsync $
## @file
# Sub-Makefile for the IPRT testcases.
#
@@ -54,6 +54,7 @@ PROGRAMS += \
tstDir \
tstDir-2 \
tstDir-3 \
+ tstRTDvm \
tstEnv \
tstErrUnique \
tstFile \
@@ -67,6 +68,7 @@ PROGRAMS += \
tstRTHeapOffset \
tstRTHeapSimple \
tstRTInlineAsm \
+ tstIprtList \
tstIprtMiniString \
tstLdr \
tstLdrLoad \
@@ -106,6 +108,7 @@ PROGRAMS += \
tstRTSystemQueryOsInfo \
tstRTTcp-1 \
tstRTTemp \
+ tstRTDirCreateUniqueNumbered \
tstTermCallbacks \
tstThread-1 \
tstRTThreadPoke \
@@ -120,7 +123,8 @@ PROGRAMS += \
tstUtf8 \
tstRTUuid \
tstRTCircBuf \
- tstRTManifest
+ tstRTManifest \
+ tstVector
PROGRAMS.win += \
tstRTProcWait \
@@ -211,6 +215,8 @@ tstDir-2_SOURCES = tstDir-2.cpp
tstDir-3_SOURCES = tstDir-3.cpp
+tstRTDvm_SOURCES = tstRTDvm.cpp
+
tstEnv_SOURCES = tstEnv.cpp
# Note: tstErrUnique.cpp depends on a header generated by the makefile above us.
@@ -261,6 +267,9 @@ tstRTInlineAsmPIC3_SOURCES = tstRTInlineAsm.cpp
tstRTInlineAsmPIC3_CXXFLAGS = -fPIC -fomit-frame-pointer -O3
tstRTInlineAsmPIC3_DEFS = PIC
+tstIprtList_TEMPLATE = VBOXR3TSTEXE
+tstIprtList_SOURCES = tstIprtList.cpp
+
tstIprtMiniString_TEMPLATE = VBOXR3TSTEXE
tstIprtMiniString_SOURCES = tstIprtMiniString.cpp
@@ -459,6 +468,9 @@ tstRTTcp-1_SOURCES = tstRTTcp-1.cpp
tstRTTemp_TEMPLATE = VBOXR3TSTEXE
tstRTTemp_SOURCES = tstRTTemp.cpp
+tstRTDirCreateUniqueNumbered_TEMPLATE = VBOXR3TSTEXE
+tstRTDirCreateUniqueNumbered_SOURCES = tstRTDirCreateUniqueNumbered.cpp
+
tstTermCallbacks_SOURCES = tstTermCallbacks.cpp
tstThread-1_SOURCES = tstThread-1.cpp
@@ -501,6 +513,9 @@ tstRTManifest_SOURCES = tstRTManifest.cpp
tstRTCoreDump_TEMPLACE = VBOXR3TSTEXE
tstRTCoreDump_SOURCES = tstRTCoreDump.cpp
+tstVector_TEMPLATE = VBOXR3TSTEXE
+tstVector_SOURCES = tstVector.cpp
+
#
# Ring-0 testcases.
diff --git a/src/VBox/Runtime/testcase/ioctl.h b/src/VBox/Runtime/testcase/ioctl.h
index f9a5273ec..57732e44b 100644
--- a/src/VBox/Runtime/testcase/ioctl.h
+++ b/src/VBox/Runtime/testcase/ioctl.h
@@ -1,4 +1,4 @@
-/* $Id: ioctl.h $ */
+/* $Id: ioctl.h 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* VBox L4/OSS audio - header for Linux IoCtls.
*/
diff --git a/src/VBox/Runtime/testcase/ntGetTimerResolution.cpp b/src/VBox/Runtime/testcase/ntGetTimerResolution.cpp
index 7e12327c6..c25551be1 100644
--- a/src/VBox/Runtime/testcase/ntGetTimerResolution.cpp
+++ b/src/VBox/Runtime/testcase/ntGetTimerResolution.cpp
@@ -1,4 +1,4 @@
-/* $Id: ntGetTimerResolution.cpp $ */
+/* $Id: ntGetTimerResolution.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Win32 (NT) testcase for getting the timer resolution.
*/
diff --git a/src/VBox/Runtime/testcase/tstDir-2.cpp b/src/VBox/Runtime/testcase/tstDir-2.cpp
index 27c4edc5e..39e8e76b2 100644
--- a/src/VBox/Runtime/testcase/tstDir-2.cpp
+++ b/src/VBox/Runtime/testcase/tstDir-2.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstDir-2.cpp $ */
+/* $Id: tstDir-2.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Directory listing & filtering .
*/
diff --git a/src/VBox/Runtime/testcase/tstDir-3.cpp b/src/VBox/Runtime/testcase/tstDir-3.cpp
index 9f3623833..c9b6cf167 100644
--- a/src/VBox/Runtime/testcase/tstDir-3.cpp
+++ b/src/VBox/Runtime/testcase/tstDir-3.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstDir-3.cpp $ */
+/* $Id: tstDir-3.cpp 33464 2010-10-26 12:27:50Z vboxsync $ */
/** @file
* IPRT Testcase - Directory listing & filtering (no parameters needed).
*/
diff --git a/src/VBox/Runtime/testcase/tstDir.cpp b/src/VBox/Runtime/testcase/tstDir.cpp
index 154231068..225258add 100644
--- a/src/VBox/Runtime/testcase/tstDir.cpp
+++ b/src/VBox/Runtime/testcase/tstDir.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstDir.cpp $ */
+/* $Id: tstDir.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Directory listing.
*/
diff --git a/src/VBox/Runtime/testcase/tstEnv.cpp b/src/VBox/Runtime/testcase/tstEnv.cpp
index b21bdc77f..3fe9e37de 100644
--- a/src/VBox/Runtime/testcase/tstEnv.cpp
+++ b/src/VBox/Runtime/testcase/tstEnv.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstEnv.cpp $ */
+/* $Id: tstEnv.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Environment.
*/
diff --git a/src/VBox/Runtime/testcase/tstErrUnique.cpp b/src/VBox/Runtime/testcase/tstErrUnique.cpp
index 41386e6f2..d3f802482 100644
--- a/src/VBox/Runtime/testcase/tstErrUnique.cpp
+++ b/src/VBox/Runtime/testcase/tstErrUnique.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstErrUnique.cpp $ */
+/* $Id: tstErrUnique.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Error Messages.
*/
diff --git a/src/VBox/Runtime/testcase/tstFile.cpp b/src/VBox/Runtime/testcase/tstFile.cpp
index 8da4c1693..1a38ddec6 100644
--- a/src/VBox/Runtime/testcase/tstFile.cpp
+++ b/src/VBox/Runtime/testcase/tstFile.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstFile.cpp $ */
+/* $Id: tstFile.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - File I/O.
*/
diff --git a/src/VBox/Runtime/testcase/tstFileAppendWin-1.cpp b/src/VBox/Runtime/testcase/tstFileAppendWin-1.cpp
index 7ffd7fe1a..6714aec30 100644
--- a/src/VBox/Runtime/testcase/tstFileAppendWin-1.cpp
+++ b/src/VBox/Runtime/testcase/tstFileAppendWin-1.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstFileAppendWin-1.cpp $ */
+/* $Id: tstFileAppendWin-1.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Exploration of File Appending on Windows.
*/
diff --git a/src/VBox/Runtime/testcase/tstFileLock.cpp b/src/VBox/Runtime/testcase/tstFileLock.cpp
index 950ce1268..6b577fc8d 100644
--- a/src/VBox/Runtime/testcase/tstFileLock.cpp
+++ b/src/VBox/Runtime/testcase/tstFileLock.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstFileLock.cpp $ */
+/* $Id: tstFileLock.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - File Locks.
*/
diff --git a/src/VBox/Runtime/testcase/tstFork.cpp b/src/VBox/Runtime/testcase/tstFork.cpp
index 8d511f7c2..7cc4d63c1 100644
--- a/src/VBox/Runtime/testcase/tstFork.cpp
+++ b/src/VBox/Runtime/testcase/tstFork.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstFork.cpp $ */
+/* $Id: tstFork.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT Testcase - fork() issues.
*/
diff --git a/src/VBox/Runtime/testcase/tstHandleTable.cpp b/src/VBox/Runtime/testcase/tstHandleTable.cpp
index 6dfec0828..b5791f7ba 100644
--- a/src/VBox/Runtime/testcase/tstHandleTable.cpp
+++ b/src/VBox/Runtime/testcase/tstHandleTable.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstHandleTable.cpp $ */
+/* $Id: tstHandleTable.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Handle Tables.
*/
diff --git a/src/VBox/Runtime/testcase/tstIoCtl.cpp b/src/VBox/Runtime/testcase/tstIoCtl.cpp
index 31e901ef8..0f592b90b 100644
--- a/src/VBox/Runtime/testcase/tstIoCtl.cpp
+++ b/src/VBox/Runtime/testcase/tstIoCtl.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstIoCtl.cpp $ */
+/* $Id: tstIoCtl.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - file IoCtl.
*/
diff --git a/src/VBox/Runtime/testcase/tstIprtList.cpp b/src/VBox/Runtime/testcase/tstIprtList.cpp
new file mode 100644
index 000000000..31acd089e
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstIprtList.cpp
@@ -0,0 +1,612 @@
+/* $Id: tstIprtList.cpp 37861 2011-07-11 10:03:22Z vboxsync $ */
+/** @file
+ * IPRT Testcase - RTCList/RTCMTList.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/cpp/mtlist.h>
+
+#include <iprt/cpp/ministring.h>
+#include <iprt/test.h>
+#include <iprt/rand.h>
+#include <iprt/thread.h>
+
+
+/*******************************************************************************
+* Global Variables *
+*******************************************************************************/
+/** Used for the string test. */
+static const char *g_apszTestStrings[] =
+{
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
+ "Vestibulum non turpis vel metus pellentesque tincidunt at id massa.",
+ "Cras quis erat sed nulla ullamcorper molestie.",
+ "Mauris ac elit turpis, id pulvinar diam.",
+ "Nulla quis dolor dolor, in ultrices diam.",
+ "Vivamus ac quam non ipsum vehicula tempor ac ac arcu.",
+ "Aenean posuere lacus blandit erat semper eu iaculis ante eleifend.",
+ "Donec quis quam a lacus interdum sollicitudin quis eu est.",
+ "Morbi sed nisi a arcu commodo convallis.",
+ "Aenean molestie condimentum velit, non mattis magna ultricies quis.",
+ "Nulla id velit at mauris gravida mattis.",
+ "Phasellus viverra velit eu urna semper in porta arcu sollicitudin.",
+ "Pellentesque consequat turpis et tortor hendrerit id tempor ipsum lacinia.",
+ "Cras iaculis nulla quis risus pulvinar eget tempor lectus placerat.",
+ "Nullam in nulla sed sapien euismod euismod.",
+ "Morbi in tortor at magna sagittis fermentum ut eu nunc.",
+ "Nulla vitae ante sit amet dui molestie sagittis lacinia quis tellus.",
+ "Proin iaculis lorem ultricies metus bibendum tincidunt.",
+ "Sed gravida purus id risus sollicitudin ac porta orci vestibulum.",
+ "Duis quis purus non ligula consectetur cursus eu interdum erat.",
+ "Nullam non nunc in elit volutpat tempor in nec metus.",
+ "Aliquam id purus eget enim luctus molestie.",
+ "Sed id elit nec elit luctus scelerisque.",
+ "Suspendisse viverra leo non ligula congue ac luctus nisl vulputate.",
+ "Nulla dignissim lobortis nunc, eu tempus ipsum luctus sed.",
+ "Integer vel lacus lacus, quis condimentum felis.",
+ "Nulla ut lacus ac lacus gravida ultrices id sed ipsum.",
+ "Etiam non purus ut augue fermentum consequat.",
+ "Nam sit amet eros quis nibh blandit lacinia non posuere lectus.",
+ "Sed sit amet ipsum et dolor sagittis facilisis.",
+ "Ut congue nisi lacus, vel ultrices est.",
+ "Donec vel erat ut justo hendrerit sodales eu eget libero.",
+ "Integer a ipsum ac nunc eleifend congue convallis a urna.",
+ "Sed vel eros eu lectus imperdiet vehicula.",
+ "Vivamus eget turpis sed erat dapibus varius eget eu nulla.",
+ "Nam id nulla non elit eleifend commodo sed ac est.",
+ "Integer pulvinar dolor sodales velit pulvinar et facilisis eros scelerisque.",
+ "Ut mattis arcu ut libero imperdiet in rhoncus augue sodales.",
+ "Ut luctus turpis ligula, id dapibus felis.",
+ "Nullam sit amet sapien eget tellus hendrerit vestibulum eget in odio.",
+ "Phasellus non orci vitae mi placerat semper.",
+ "Quisque pharetra aliquet velit, quis tempor magna porttitor nec.",
+ "Praesent porta neque felis, vehicula facilisis odio.",
+ "Maecenas ultricies ipsum eu velit laoreet faucibus.",
+ "Mauris et nunc leo, et euismod quam.",
+ "Phasellus a felis et justo fringilla lacinia.",
+ "Vestibulum eget augue ante, ac viverra neque.",
+ "Mauris pellentesque ligula quis metus elementum venenatis.",
+ "Curabitur eu neque tellus, non porta sapien.",
+ "Ut mattis metus id enim aliquam laoreet et sed tortor.",
+ "Aenean quis nulla vitae nulla auctor lobortis a egestas turpis.",
+ "Praesent vitae ante a urna porta placerat non nec eros.",
+ "Donec quis neque eros, placerat adipiscing turpis.",
+ "Cras sit amet sapien risus, quis euismod arcu.",
+ "Integer volutpat massa eros, ac gravida mi.",
+ "Nunc vitae nunc sagittis diam vulputate suscipit.",
+ "Suspendisse quis mauris bibendum mauris aliquet pulvinar.",
+ "Donec volutpat vestibulum ligula, eget interdum tortor malesuada sit amet.",
+ "Mauris hendrerit dui non nibh varius sit amet fringilla orci pretium.",
+ "Phasellus a quam tellus, auctor lacinia sapien.",
+ "Sed dapibus leo vitae neque faucibus id porttitor sapien ultricies.",
+ "Maecenas euismod elit nec tortor sagittis pretium.",
+ "Ut tincidunt risus at erat fermentum sit amet molestie ante lacinia.",
+ "Nulla non leo nec lacus sollicitudin lobortis a a nisl.",
+ "Nunc vulputate erat vel libero elementum a interdum turpis malesuada.",
+ "Morbi id libero turpis, a lobortis dolor.",
+ "Donec vehicula imperdiet lorem, non pretium nulla tempus ut.",
+ "Morbi lacinia massa id nunc tempus in blandit risus blandit.",
+ "Sed feugiat orci id ipsum suscipit quis fringilla enim rutrum.",
+ "Mauris suscipit lobortis urna, vel dictum justo iaculis ac.",
+ "In rhoncus lectus tristique nunc blandit gravida placerat turpis rutrum.",
+ "Aliquam pellentesque ornare justo, sed hendrerit metus mattis a.",
+ "Nam aliquet lorem congue nisl blandit posuere.",
+ "Sed lobortis interdum ipsum, ac cursus erat lacinia in.",
+ "Maecenas vel tortor vel lorem facilisis interdum.",
+ "Aenean porttitor massa enim, eget dignissim est.",
+ "Nullam id libero lacus, mattis feugiat risus.",
+ "Fusce et dolor at eros ornare auctor malesuada vel ipsum.",
+ "Donec at massa sit amet lorem pellentesque interdum at ac lacus.",
+ "Praesent suscipit velit at justo suscipit eu vestibulum ligula interdum.",
+ "Aenean id justo nulla, vitae vulputate diam.",
+ "Fusce pellentesque leo quis orci pulvinar at pellentesque tellus dictum.",
+ "Ut facilisis purus at enim varius vulputate.",
+ "Donec malesuada bibendum sapien, sed pretium nisi cursus quis.",
+ "Mauris porttitor diam ut sapien pretium egestas.",
+ "Vestibulum ut justo eu libero semper convallis vitae et velit.",
+ "Quisque eleifend dapibus ligula, eu tincidunt massa rutrum at.",
+ "Sed euismod diam eget enim suscipit dictum.",
+ "Mauris fermentum orci eu nunc venenatis in sollicitudin tellus vestibulum.",
+ "Vivamus faucibus consequat turpis, lobortis vehicula lectus gravida eget.",
+ "Curabitur eu erat eu mi interdum scelerisque.",
+ "Morbi consequat molestie nulla, imperdiet elementum augue sagittis vel.",
+ "Sed ullamcorper velit suscipit arcu egestas quis commodo est hendrerit.",
+ "Proin vitae velit ut enim sollicitudin ultrices.",
+ "Curabitur posuere euismod lacus, sed volutpat erat adipiscing sit amet.",
+ "Cras sit amet sem lorem, in cursus augue.",
+ "Sed fermentum ultricies orci, quis hendrerit risus imperdiet et.",
+ "Proin nec arcu interdum ipsum molestie vestibulum.",
+ "Nulla quis quam non sem pretium scelerisque et eu velit.",
+ "Donec eu tellus nisl, ac vehicula tortor."
+};
+
+
+/**
+ * Does a list test.
+ *
+ * @param T1 The list type.
+ * @param T2 The input type
+ * @param pcszDesc The test description.
+ * @param paTestData Pointer to the array with the test input data.
+ * @param cTestItems The size of the input data.
+ */
+template<template <class, typename> class L, typename T1, typename T2, typename T3>
+static void test1(const char *pcszDesc, T3 paTestData[], size_t cTestItems)
+{
+ RTTestISubF("%s with size of %u (items=%u)", pcszDesc, sizeof(T1), cTestItems);
+
+ /*
+ * Construction
+ */
+
+ /* Create a test list */
+ L<T1, T2> testList;
+
+ const size_t defCap = L<T1, T2>::DefaultCapacity;
+ RTTESTI_CHECK(testList.isEmpty());
+ RTTESTI_CHECK(testList.size() == 0);
+ RTTESTI_CHECK(testList.capacity() == defCap);
+
+ /*
+ * Adding
+ */
+
+ /* Add the second half of the test data */
+ size_t cAdded = 1;
+
+ /* Start adding the second half of our test list */
+ for (size_t i = cTestItems / 2; i < cTestItems; ++i, ++cAdded)
+ {
+ testList.append(paTestData[i]);
+ RTTESTI_CHECK_RETV(testList.size() == cAdded);
+ RTTESTI_CHECK(testList.at(0) == paTestData[cTestItems / 2]);
+ RTTESTI_CHECK(testList[0] == paTestData[cTestItems / 2]);
+ RTTESTI_CHECK(testList.first() == paTestData[cTestItems / 2]);
+ RTTESTI_CHECK(testList.at(cAdded - 1) == paTestData[i]);
+ RTTESTI_CHECK(testList[cAdded - 1] == paTestData[i]);
+ RTTESTI_CHECK(testList.last() == paTestData[i]);
+ }
+
+ /* Check that all is correctly appended. */
+ RTTESTI_CHECK_RETV(testList.size() == cTestItems / 2);
+ RTTESTI_CHECK_RETV(testList.isEmpty() == false);
+ for (size_t i = 0; i < testList.size(); ++i)
+ RTTESTI_CHECK(testList.at(i) == paTestData[cTestItems / 2 + i]);
+
+ /* Start prepending the first half of our test list. Iterate reverse to get
+ * the correct sorting back. */
+ for (size_t i = cTestItems / 2; i > 0; --i, ++cAdded)
+ {
+ testList.prepend(paTestData[i - 1]);
+ RTTESTI_CHECK_RETV(testList.size() == cAdded);
+ RTTESTI_CHECK(testList.at(0) == paTestData[i - 1]);
+ RTTESTI_CHECK(testList[0] == paTestData[i - 1]);
+ RTTESTI_CHECK(testList.first() == paTestData[i - 1]);
+ RTTESTI_CHECK(testList.at(cAdded - 1) == paTestData[cTestItems - 1]);
+ RTTESTI_CHECK(testList[cAdded - 1] == paTestData[cTestItems - 1]);
+ RTTESTI_CHECK(testList.last() == paTestData[cTestItems - 1]);
+ }
+
+ /* Check that all is correctly prepended. */
+ RTTESTI_CHECK_RETV(testList.size() == cTestItems);
+ RTTESTI_CHECK_RETV(testList.isEmpty() == false);
+ for (size_t i = 0; i < testList.size(); ++i)
+ RTTESTI_CHECK(testList.at(i) == paTestData[i]);
+
+ /*
+ * Contains
+ */
+ L<T1, T2> testList2;
+
+ /* Check full list. */
+ RTTESTI_CHECK( testList.contains(paTestData[0]));
+ RTTESTI_CHECK( testList.contains(paTestData[cTestItems / 2]));
+ RTTESTI_CHECK( testList.contains(paTestData[cTestItems - 1]));
+ RTTESTI_CHECK(!testList.contains(T1()));
+ /* Check empty list. */
+ RTTESTI_CHECK(!testList2.contains(paTestData[0]));
+ RTTESTI_CHECK(!testList2.contains(paTestData[cTestItems / 2]));
+ RTTESTI_CHECK(!testList2.contains(paTestData[cTestItems - 1]));
+ RTTESTI_CHECK(!testList2.contains(T1()));
+
+ /*
+ * Copy operator
+ */
+ L<T1, T2> testList3(testList);
+
+ /* Check that all is correctly appended. */
+ RTTESTI_CHECK_RETV(testList3.size() == cTestItems);
+ for (size_t i = 0; i < testList3.size(); ++i)
+ RTTESTI_CHECK(testList3.at(i) == paTestData[i]);
+
+ /*
+ * "=" operator
+ */
+ L<T1, T2> testList4;
+ testList4 = testList;
+
+ /* Check that all is correctly appended. */
+ RTTESTI_CHECK_RETV(testList4.size() == cTestItems);
+ for (size_t i = 0; i < testList4.size(); ++i)
+ RTTESTI_CHECK(testList4.at(i) == paTestData[i]);
+
+ /*
+ * Append list
+ */
+ testList3.append(testList4);
+
+ /* Check that all is correctly appended. */
+ RTTESTI_CHECK_RETV(testList3.size() == cTestItems * 2);
+ for (size_t i = 0; i < testList3.size(); ++i)
+ RTTESTI_CHECK(testList3.at(i) == paTestData[i % cTestItems]);
+
+ /*
+ * Prepend list
+ */
+ testList3.prepend(testList4);
+
+ /* Check that all is correctly appended. */
+ RTTESTI_CHECK_RETV(testList3.size() == cTestItems * 3);
+ for (size_t i = 0; i < testList3.size(); ++i)
+ RTTESTI_CHECK(testList3.at(i) == paTestData[i % cTestItems]);
+
+ /*
+ * "value" method
+ */
+ for (size_t i = 0; i < testList3.size(); ++i)
+ RTTESTI_CHECK(testList3.value(i) == paTestData[i % cTestItems]);
+ for (size_t i = 0; i < testList3.size(); ++i)
+ RTTESTI_CHECK(testList3.value(i, T1()) == paTestData[i % cTestItems]);
+ RTTESTI_CHECK(testList3.value(testList3.size() + 1) == T1()); /* Invalid index */
+ RTTESTI_CHECK(testList3.value(testList3.size() + 1, T1()) == T1()); /* Invalid index */
+
+ /*
+ * operator[] (reading)
+ */
+ for (size_t i = 0; i < testList.size(); ++i)
+ RTTESTI_CHECK(testList[i] == paTestData[i]);
+
+ /*
+ * operator[] (writing)
+ *
+ * Replace with inverted array.
+ */
+ for (size_t i = 0; i < cTestItems; ++i)
+ testList[i] = paTestData[cTestItems - i - 1];
+ RTTESTI_CHECK_RETV(testList.size() == cTestItems);
+ for (size_t i = 0; i < testList.size(); ++i)
+ RTTESTI_CHECK(testList[i] == paTestData[cTestItems - i - 1]);
+
+ /*
+ * Replace
+ *
+ * Replace with inverted array (Must be original array when finished).
+ */
+ for (size_t i = 0; i < cTestItems; ++i)
+ testList.replace(i, paTestData[i]);
+ RTTESTI_CHECK_RETV(testList.size() == cTestItems);
+ for (size_t i = 0; i < testList.size(); ++i)
+ RTTESTI_CHECK(testList[i] == paTestData[i]);
+
+ /*
+ * Removing
+ */
+
+ /* Remove Range */
+ testList3.removeRange(cTestItems, cTestItems * 2);
+ RTTESTI_CHECK_RETV(testList3.size() == cTestItems * 2);
+ for (size_t i = 0; i < testList3.size(); ++i)
+ RTTESTI_CHECK(testList3.at(i) == paTestData[i % cTestItems]);
+
+ /* Remove the first half (reverse) */
+ size_t cRemoved = 1;
+ for (size_t i = cTestItems / 2; i > 0; --i, ++cRemoved)
+ {
+ testList.removeAt(i - 1);
+ RTTESTI_CHECK_RETV(testList.size() == cTestItems - cRemoved);
+ }
+ RTTESTI_CHECK_RETV(testList.size() == cTestItems / 2);
+
+ /* Check that all is correctly removed and only the second part of the list
+ * is still there. */
+ for (size_t i = 0; i < testList.size(); ++i)
+ RTTESTI_CHECK(testList.at(i) == paTestData[cTestItems / 2 + i]);
+
+ /*
+ * setCapacitiy
+ */
+ testList.setCapacity(cTestItems * 5);
+ RTTESTI_CHECK(testList.capacity() == cTestItems * 5);
+ RTTESTI_CHECK_RETV(testList.size() == cTestItems / 2);
+
+ /* As the capacity just increased, we should still have all entries from
+ * the previous list. */
+ for (size_t i = 0; i < testList.size(); ++i)
+ RTTESTI_CHECK(testList.at(i) == paTestData[cTestItems / 2 + i]);
+
+ /* Decrease the capacity so it will be smaller than the count of items in
+ * the list. The list should be shrink automatically, but the remaining
+ * items should be still valid. */
+ testList.setCapacity(cTestItems / 4);
+ RTTESTI_CHECK_RETV(testList.size() == cTestItems / 4);
+ RTTESTI_CHECK(testList.capacity() == cTestItems / 4);
+ for (size_t i = 0; i < testList.size(); ++i)
+ RTTESTI_CHECK(testList.at(i) == paTestData[cTestItems / 2 + i]);
+
+ /* Clear all */
+ testList.clear();
+ RTTESTI_CHECK_RETV(testList.isEmpty());
+ RTTESTI_CHECK_RETV(testList.size() == 0);
+ RTTESTI_CHECK(testList.capacity() == defCap);
+
+
+ /* Copy empty lists. */
+ L<T1, T2> testList5(testList);
+ RTTESTI_CHECK_RETV(testList5.isEmpty());
+ RTTESTI_CHECK_RETV(testList5.size() == 0);
+ RTTESTI_CHECK(testList5.capacity() == 0);
+
+ testList5.append(paTestData[0]);
+ testList5 = testList;
+ RTTESTI_CHECK_RETV(testList5.isEmpty());
+ RTTESTI_CHECK_RETV(testList5.size() == 0);
+ RTTESTI_CHECK(testList5.capacity() == 0);
+
+}
+
+/* define RTCList here to see what happens without MT support ;)
+ * (valgrind is the preferred tool to check). */
+#define MTTESTLISTTYPE RTCMTList
+#define MTTESTTYPE uint32_t
+#define MTTESTITEMS 1000
+
+/**
+ * Thread for prepending items to a shared list.
+ *
+ * @param hSelf The thread handle.
+ * @param pvUser The provided user data.
+ */
+DECLCALLBACK(int) mttest1(RTTHREAD hSelf, void *pvUser)
+{
+ MTTESTLISTTYPE<MTTESTTYPE> *pTestList = (MTTESTLISTTYPE<MTTESTTYPE> *)pvUser;
+
+ /* Prepend new items at the start of the list. */
+ for (size_t i = 0; i < MTTESTITEMS; ++i)
+ pTestList->prepend(0x0);
+
+ return VINF_SUCCESS;
+}
+
+/**
+ * Thread for appending items to a shared list.
+ *
+ * @param hSelf The thread handle.
+ * @param pvUser The provided user data.
+ */
+DECLCALLBACK(int) mttest2(RTTHREAD hSelf, void *pvUser)
+{
+ MTTESTLISTTYPE<MTTESTTYPE> *pTestList = (MTTESTLISTTYPE<MTTESTTYPE> *)pvUser;
+
+ /* Append new items at the end of the list. */
+ for (size_t i = 0; i < MTTESTITEMS; ++i)
+ pTestList->append(0xFFFFFFFF);
+
+ return VINF_SUCCESS;
+}
+
+/**
+ * Thread for inserting items to a shared list.
+ *
+ * @param hSelf The thread handle.
+ * @param pvUser The provided user data.
+ */
+DECLCALLBACK(int) mttest3(RTTHREAD hSelf, void *pvUser)
+{
+ MTTESTLISTTYPE<MTTESTTYPE> *pTestList = (MTTESTLISTTYPE<MTTESTTYPE> *)pvUser;
+
+ /* Insert new items in the middle of the list. */
+ for (size_t i = 0; i < MTTESTITEMS; ++i)
+ pTestList->insert(pTestList->size() / 2, 0xF0F0F0F0);
+
+ return VINF_SUCCESS;
+}
+
+/**
+ * Thread for reading items from a shared list.
+ *
+ * @param hSelf The thread handle.
+ * @param pvUser The provided user data.
+ */
+DECLCALLBACK(int) mttest4(RTTHREAD hSelf, void *pvUser)
+{
+ MTTESTLISTTYPE<MTTESTTYPE> *pTestList = (MTTESTLISTTYPE<MTTESTTYPE> *)pvUser;
+
+ MTTESTTYPE a;
+ /* Try to read C items from random places. */
+ for (size_t i = 0; i < MTTESTITEMS; ++i)
+ {
+ /* Make sure there is at least one item in the list. */
+ while (pTestList->isEmpty()) {};
+ a = pTestList->at(RTRandU32Ex(0, (uint32_t)pTestList->size() - 1));
+ }
+
+ return VINF_SUCCESS;
+}
+
+/**
+ * Thread for replacing items in a shared list.
+ *
+ * @param hSelf The thread handle.
+ * @param pvUser The provided user data.
+ */
+DECLCALLBACK(int) mttest5(RTTHREAD hSelf, void *pvUser)
+{
+ MTTESTLISTTYPE<MTTESTTYPE> *pTestList = (MTTESTLISTTYPE<MTTESTTYPE> *)pvUser;
+
+ /* Try to replace C items from random places. */
+ for (size_t i = 0; i < MTTESTITEMS; ++i)
+ {
+ /* Make sure there is at least one item in the list. */
+ while (pTestList->isEmpty()) {};
+ pTestList->replace(RTRandU32Ex(0, (uint32_t)pTestList->size() - 1), 0xFF00FF00);
+ }
+
+ return VINF_SUCCESS;
+}
+
+/**
+ * Thread for erasing items from a shared list.
+ *
+ * @param hSelf The thread handle.
+ * @param pvUser The provided user data.
+ */
+DECLCALLBACK(int) mttest6(RTTHREAD hSelf, void *pvUser)
+{
+ MTTESTLISTTYPE<MTTESTTYPE> *pTestList = (MTTESTLISTTYPE<MTTESTTYPE> *)pvUser;
+
+ /* Try to delete items from random places. */
+ for (size_t i = 0; i < MTTESTITEMS; ++i)
+ {
+ /* Make sure there is at least one item in the list. */
+ while (pTestList->isEmpty()) {};
+ pTestList->removeAt(RTRandU32Ex(0, (uint32_t)pTestList->size() - 1));
+ }
+
+ return VINF_SUCCESS;
+}
+
+/**
+ * Does a multi-threading list test. Several list additions, reading, replacing
+ * and erasing are done simultaneous.
+ *
+ */
+static void test2()
+{
+ RTTestISubF("MT test with 6 threads (%u tests per thread).", MTTESTITEMS);
+
+ RTTHREAD hThread1, hThread2, hThread3, hThread4, hThread5, hThread6;
+ int rc = VINF_SUCCESS;
+
+ MTTESTLISTTYPE<MTTESTTYPE> testList;
+ rc = RTThreadCreate(&hThread1, &mttest1, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest1");
+ AssertRC(rc);
+ rc = RTThreadCreate(&hThread2, &mttest2, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest2");
+ AssertRC(rc);
+ rc = RTThreadCreate(&hThread3, &mttest3, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest3");
+ AssertRC(rc);
+ rc = RTThreadCreate(&hThread4, &mttest4, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest4");
+ AssertRC(rc);
+ rc = RTThreadCreate(&hThread5, &mttest5, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest5");
+ AssertRC(rc);
+ rc = RTThreadCreate(&hThread6, &mttest6, &testList, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "mttest6");
+ AssertRC(rc);
+
+ rc = RTThreadWait(hThread1, RT_INDEFINITE_WAIT, 0);
+ AssertRC(rc);
+ rc = RTThreadWait(hThread2, RT_INDEFINITE_WAIT, 0);
+ AssertRC(rc);
+ rc = RTThreadWait(hThread3, RT_INDEFINITE_WAIT, 0);
+ AssertRC(rc);
+ rc = RTThreadWait(hThread4, RT_INDEFINITE_WAIT, 0);
+ AssertRC(rc);
+ rc = RTThreadWait(hThread5, RT_INDEFINITE_WAIT, 0);
+ AssertRC(rc);
+ rc = RTThreadWait(hThread6, RT_INDEFINITE_WAIT, 0);
+ AssertRC(rc);
+
+ RTTESTI_CHECK_RETV(testList.size() == MTTESTITEMS * 2);
+ for (size_t i = 0; i < testList.size(); ++i)
+ {
+ uint32_t a = testList.at(i);
+ RTTESTI_CHECK(a == 0x0 || a == 0xFFFFFFFF || a == 0xF0F0F0F0 || a == 0xFF00FF00);
+ }
+}
+
+int main()
+{
+ /* How many integer test items should be created. */
+ static const size_t s_cTestCount = 1000;
+
+ RTTEST hTest;
+ RTEXITCODE rcExit = RTTestInitAndCreate("tstIprtList", &hTest);
+ if (rcExit)
+ return rcExit;
+ RTTestBanner(hTest);
+
+ /* Some host info. */
+ RTTestIPrintf(RTTESTLVL_ALWAYS, "sizeof(void*)=%d", sizeof(void*));
+
+ /*
+ * The tests.
+ */
+
+ /*
+ * Native types.
+ */
+ uint8_t au8TestInts[s_cTestCount];
+ for (size_t i = 0; i < RT_ELEMENTS(au8TestInts); ++i)
+ au8TestInts[i] = (uint8_t)RTRandU32Ex(1, UINT8_MAX);
+ test1<RTCList, uint8_t, uint8_t, uint8_t>("ST: Native type", au8TestInts, RT_ELEMENTS(au8TestInts));
+ test1<RTCMTList, uint8_t, uint8_t, uint8_t>("MT: Native type", au8TestInts, RT_ELEMENTS(au8TestInts));
+
+ uint16_t au16TestInts[s_cTestCount];
+ for (size_t i = 0; i < RT_ELEMENTS(au16TestInts); ++i)
+ au16TestInts[i] = (uint16_t)RTRandU32Ex(1, UINT16_MAX);
+ test1<RTCList, uint16_t, uint16_t, uint16_t>("ST: Native type", au16TestInts, RT_ELEMENTS(au16TestInts));
+ test1<RTCMTList, uint16_t, uint16_t, uint16_t>("MT: Native type", au16TestInts, RT_ELEMENTS(au16TestInts));
+
+ uint32_t au32TestInts[s_cTestCount];
+ for (size_t i = 0; i < RT_ELEMENTS(au32TestInts); ++i)
+ au32TestInts[i] = RTRandU32Ex(1, UINT32_MAX);
+ test1<RTCList, uint32_t, uint32_t, uint32_t>("ST: Native type", au32TestInts, RT_ELEMENTS(au32TestInts));
+ test1<RTCMTList, uint32_t, uint32_t, uint32_t>("MT: Native type", au32TestInts, RT_ELEMENTS(au32TestInts));
+
+ /*
+ * Specialized type.
+ */
+ uint64_t au64TestInts[s_cTestCount];
+ for (size_t i = 0; i < RT_ELEMENTS(au64TestInts); ++i)
+ au64TestInts[i] = RTRandU64Ex(1, UINT64_MAX);
+ test1<RTCList, uint64_t, uint64_t, uint64_t>("ST: Specialized type", au64TestInts, RT_ELEMENTS(au64TestInts));
+ test1<RTCMTList, uint64_t, uint64_t, uint64_t>("MT: Specialized type", au64TestInts, RT_ELEMENTS(au64TestInts));
+
+ /*
+ * Big size type (translate to internal pointer list).
+ */
+ test1<RTCList, RTCString, RTCString *, const char *>("ST: Class type", g_apszTestStrings, RT_ELEMENTS(g_apszTestStrings));
+ test1<RTCMTList, RTCString, RTCString *, const char *>("MT: Class type", g_apszTestStrings, RT_ELEMENTS(g_apszTestStrings));
+
+ /*
+ * Multi-threading test.
+ */
+ test2();
+
+ /*
+ * Summary.
+ */
+ return RTTestSummaryAndDestroy(hTest);
+}
+
diff --git a/src/VBox/Runtime/testcase/tstIprtMiniString.cpp b/src/VBox/Runtime/testcase/tstIprtMiniString.cpp
index c945d5dbf..b4d58e8ab 100644
--- a/src/VBox/Runtime/testcase/tstIprtMiniString.cpp
+++ b/src/VBox/Runtime/testcase/tstIprtMiniString.cpp
@@ -1,6 +1,6 @@
-/* $Id: tstIprtMiniString.cpp $ */
+/* $Id: tstIprtMiniString.cpp 36561 2011-04-05 13:42:59Z vboxsync $ */
/** @file
- * IPRT Testcase - iprt::MiniString.
+ * IPRT Testcase - RTCString.
*/
/*
@@ -41,7 +41,7 @@ static void test1Hlp1(const char *pszExpect, const char *pszFormat, ...)
#if 0
va_list va;
va_start(va, pszFormat);
- iprt::MiniString strTst(pszFormat, va);
+ RTCString strTst(pszFormat, va);
va_end(va);
RTTESTI_CHECK_MSG(strTst.equals(pszExpect), ("strTst='%s' expected='%s'\n", strTst.c_str(), pszExpect));
#endif
@@ -69,15 +69,15 @@ static void test1(RTTEST hTest)
RTTestIFailed("line %u: expected \"%s\" got \"%s\"", __LINE__, szExpect, (Str).c_str()); \
} while (0)
- iprt::MiniString empty;
+ RTCString empty;
CHECK(empty.length() == 0);
CHECK(empty.capacity() == 0);
- iprt::MiniString sixbytes("12345");
+ RTCString sixbytes("12345");
CHECK(sixbytes.length() == 5);
CHECK(sixbytes.capacity() == 6);
- sixbytes.append(iprt::MiniString("678"));
+ sixbytes.append(RTCString("678"));
CHECK(sixbytes.length() == 8);
CHECK(sixbytes.capacity() >= 9);
@@ -94,20 +94,20 @@ static void test1(RTTEST hTest)
CHECK(sixbytes.length() == 6);
CHECK(sixbytes.capacity() == 7);
- iprt::MiniString morebytes("tobereplaced");
+ RTCString morebytes("tobereplaced");
morebytes = "newstring ";
morebytes.append(sixbytes);
CHECK_DUMP(morebytes == "newstring 123456", morebytes.c_str());
- iprt::MiniString third(morebytes);
+ RTCString third(morebytes);
third.reserve(100 * 1024); // 100 KB
CHECK_DUMP(third == "newstring 123456", morebytes.c_str() );
CHECK(third.capacity() == 100 * 1024);
CHECK(third.length() == morebytes.length()); // must not have changed
- iprt::MiniString copy1(morebytes);
- iprt::MiniString copy2 = morebytes;
+ RTCString copy1(morebytes);
+ RTCString copy2 = morebytes;
CHECK(copy1 == copy2);
copy1 = NULL;
@@ -116,38 +116,38 @@ static void test1(RTTEST hTest)
copy1 = "";
CHECK(copy1.length() == 0);
- CHECK(iprt::MiniString("abc") < iprt::MiniString("def"));
- CHECK(iprt::MiniString("") < iprt::MiniString("def"));
- CHECK(iprt::MiniString("abc") > iprt::MiniString(""));
- CHECK(iprt::MiniString("abc") != iprt::MiniString("def"));
- CHECK_DUMP_I(iprt::MiniString("def") > iprt::MiniString("abc"));
- CHECK(iprt::MiniString("abc") == iprt::MiniString("abc"));
- CHECK(iprt::MiniString("").compare("") == 0);
- CHECK(iprt::MiniString("").compare(NULL) == 0);
- CHECK(iprt::MiniString("").compare("a") < 0);
- CHECK(iprt::MiniString("a").compare("") > 0);
- CHECK(iprt::MiniString("a").compare(NULL) > 0);
-
- CHECK(iprt::MiniString("abc") < "def");
- CHECK(iprt::MiniString("abc") != "def");
- CHECK_DUMP_I(iprt::MiniString("def") > "abc");
- CHECK(iprt::MiniString("abc") == "abc");
-
- CHECK(iprt::MiniString("abc").equals("abc"));
- CHECK(!iprt::MiniString("abc").equals("def"));
- CHECK(iprt::MiniString("abc").equalsIgnoreCase("Abc"));
- CHECK(iprt::MiniString("abc").equalsIgnoreCase("ABc"));
- CHECK(iprt::MiniString("abc").equalsIgnoreCase("ABC"));
- CHECK(!iprt::MiniString("abc").equalsIgnoreCase("dBC"));
- CHECK(iprt::MiniString("").equals(""));
- CHECK(iprt::MiniString("").equals(NULL));
- CHECK(!iprt::MiniString("").equals("a"));
- CHECK(!iprt::MiniString("a").equals(""));
- CHECK(!iprt::MiniString("a").equals(NULL));
- CHECK(iprt::MiniString("").equalsIgnoreCase(""));
- CHECK(iprt::MiniString("").equalsIgnoreCase(NULL));
- CHECK(!iprt::MiniString("").equalsIgnoreCase("a"));
- CHECK(!iprt::MiniString("a").equalsIgnoreCase(""));
+ CHECK(RTCString("abc") < RTCString("def"));
+ CHECK(RTCString("") < RTCString("def"));
+ CHECK(RTCString("abc") > RTCString(""));
+ CHECK(RTCString("abc") != RTCString("def"));
+ CHECK_DUMP_I(RTCString("def") > RTCString("abc"));
+ CHECK(RTCString("abc") == RTCString("abc"));
+ CHECK(RTCString("").compare("") == 0);
+ CHECK(RTCString("").compare(NULL) == 0);
+ CHECK(RTCString("").compare("a") < 0);
+ CHECK(RTCString("a").compare("") > 0);
+ CHECK(RTCString("a").compare(NULL) > 0);
+
+ CHECK(RTCString("abc") < "def");
+ CHECK(RTCString("abc") != "def");
+ CHECK_DUMP_I(RTCString("def") > "abc");
+ CHECK(RTCString("abc") == "abc");
+
+ CHECK(RTCString("abc").equals("abc"));
+ CHECK(!RTCString("abc").equals("def"));
+ CHECK(RTCString("abc").equalsIgnoreCase("Abc"));
+ CHECK(RTCString("abc").equalsIgnoreCase("ABc"));
+ CHECK(RTCString("abc").equalsIgnoreCase("ABC"));
+ CHECK(!RTCString("abc").equalsIgnoreCase("dBC"));
+ CHECK(RTCString("").equals(""));
+ CHECK(RTCString("").equals(NULL));
+ CHECK(!RTCString("").equals("a"));
+ CHECK(!RTCString("a").equals(""));
+ CHECK(!RTCString("a").equals(NULL));
+ CHECK(RTCString("").equalsIgnoreCase(""));
+ CHECK(RTCString("").equalsIgnoreCase(NULL));
+ CHECK(!RTCString("").equalsIgnoreCase("a"));
+ CHECK(!RTCString("a").equalsIgnoreCase(""));
copy2.setNull();
for (int i = 0; i < 100; ++i)
@@ -166,7 +166,7 @@ static void test1(RTTEST hTest)
CHECK(copy2.length() == 100);
/* printf */
- iprt::MiniString StrFmt;
+ RTCString StrFmt;
CHECK(StrFmt.printf("%s-%s-%d", "abc", "def", 42).equals("abc-def-42"));
test1Hlp1("abc-42-def", "%s-%d-%s", "abc", 42, "def");
test1Hlp1("", "");
@@ -174,44 +174,44 @@ static void test1(RTTEST hTest)
test1Hlp1("foobar", "%s", "foobar");
/* substring constructors */
- iprt::MiniString SubStr1("", (size_t)0);
+ RTCString SubStr1("", (size_t)0);
CHECK_EQUAL(SubStr1, "");
- iprt::MiniString SubStr2("abcdef", 2);
+ RTCString SubStr2("abcdef", 2);
CHECK_EQUAL(SubStr2, "ab");
- iprt::MiniString SubStr3("abcdef", 1);
+ RTCString SubStr3("abcdef", 1);
CHECK_EQUAL(SubStr3, "a");
- iprt::MiniString SubStr4("abcdef", 6);
+ RTCString SubStr4("abcdef", 6);
CHECK_EQUAL(SubStr4, "abcdef");
- iprt::MiniString SubStr5("abcdef", 7);
+ RTCString SubStr5("abcdef", 7);
CHECK_EQUAL(SubStr5, "abcdef");
- iprt::MiniString SubStrBase("abcdef");
+ RTCString SubStrBase("abcdef");
- iprt::MiniString SubStr10(SubStrBase, 0);
+ RTCString SubStr10(SubStrBase, 0);
CHECK_EQUAL(SubStr10, "abcdef");
- iprt::MiniString SubStr11(SubStrBase, 1);
+ RTCString SubStr11(SubStrBase, 1);
CHECK_EQUAL(SubStr11, "bcdef");
- iprt::MiniString SubStr12(SubStrBase, 1, 1);
+ RTCString SubStr12(SubStrBase, 1, 1);
CHECK_EQUAL(SubStr12, "b");
- iprt::MiniString SubStr13(SubStrBase, 2, 3);
+ RTCString SubStr13(SubStrBase, 2, 3);
CHECK_EQUAL(SubStr13, "cde");
- iprt::MiniString SubStr14(SubStrBase, 2, 4);
+ RTCString SubStr14(SubStrBase, 2, 4);
CHECK_EQUAL(SubStr14, "cdef");
- iprt::MiniString SubStr15(SubStrBase, 2, 5);
+ RTCString SubStr15(SubStrBase, 2, 5);
CHECK_EQUAL(SubStr15, "cdef");
/* substr() and substrCP() functions */
- iprt::MiniString strTest("");
+ RTCString strTest("");
CHECK_EQUAL(strTest.substr(0), "");
CHECK_EQUAL(strTest.substrCP(0), "");
CHECK_EQUAL(strTest.substr(1), "");
@@ -255,26 +255,68 @@ static void test1(RTTEST hTest)
size_t pos = strTest.find("ß");
CHECK_EQUAL(strTest.substr(pos), "ßäbcdef");
+ /* split */
+ RTCList<RTCString> spList1 = RTCString("##abcdef##abcdef####abcdef##").split("##", RTCString::RemoveEmptyParts);
+ RTTESTI_CHECK(spList1.size() == 3);
+ for (size_t i = 0; i < spList1.size(); ++i)
+ RTTESTI_CHECK(spList1.at(i) == "abcdef");
+ RTCList<RTCString> spList2 = RTCString("##abcdef##abcdef####abcdef##").split("##", RTCString::KeepEmptyParts);
+ RTTESTI_CHECK_RETV(spList2.size() == 5);
+ RTTESTI_CHECK(spList2.at(0) == "");
+ RTTESTI_CHECK(spList2.at(1) == "abcdef");
+ RTTESTI_CHECK(spList2.at(2) == "abcdef");
+ RTTESTI_CHECK(spList2.at(3) == "");
+ RTTESTI_CHECK(spList2.at(4) == "abcdef");
+ RTCList<RTCString> spList3 = RTCString().split("##", RTCString::KeepEmptyParts);
+ RTTESTI_CHECK(spList3.size() == 0);
+ RTCList<RTCString> spList4 = RTCString().split("");
+ RTTESTI_CHECK(spList4.size() == 0);
+ RTCList<RTCString> spList5 = RTCString("abcdef").split("");
+ RTTESTI_CHECK_RETV(spList5.size() == 1);
+ RTTESTI_CHECK(spList5.at(0) == "abcdef");
+
+ /* join */
+ RTCList<RTCString> jnList;
+ strTest = RTCString::join(jnList);
+ RTTESTI_CHECK(strTest == "");
+ strTest = RTCString::join(jnList, "##");
+ RTTESTI_CHECK(strTest == "");
+
+ jnList.append("abcdef");
+ strTest = RTCString::join(jnList, "##");
+ RTTESTI_CHECK(strTest == "abcdef");
+
+ jnList.append("abcdef");
+ strTest = RTCString::join(jnList, ";");
+ RTTESTI_CHECK(strTest == "abcdef;abcdef");
+
+ for (size_t i = 0; i < 3; ++i)
+ jnList.append("abcdef");
+ strTest = RTCString::join(jnList);
+ RTTESTI_CHECK(strTest == "abcdefabcdefabcdefabcdefabcdef");
+ strTest = RTCString::join(jnList, "##");
+ RTTESTI_CHECK(strTest == "abcdef##abcdef##abcdef##abcdef##abcdef");
+
/* special constructor and assignment arguments */
- iprt::MiniString StrCtor1("");
+ RTCString StrCtor1("");
RTTESTI_CHECK(StrCtor1.isEmpty());
RTTESTI_CHECK(StrCtor1.length() == 0);
- iprt::MiniString StrCtor2(NULL);
+ RTCString StrCtor2(NULL);
RTTESTI_CHECK(StrCtor2.isEmpty());
RTTESTI_CHECK(StrCtor2.length() == 0);
- iprt::MiniString StrCtor1d(StrCtor1);
+ RTCString StrCtor1d(StrCtor1);
RTTESTI_CHECK(StrCtor1d.isEmpty());
RTTESTI_CHECK(StrCtor1d.length() == 0);
- iprt::MiniString StrCtor2d(StrCtor2);
+ RTCString StrCtor2d(StrCtor2);
RTTESTI_CHECK(StrCtor2d.isEmpty());
RTTESTI_CHECK(StrCtor2d.length() == 0);
for (unsigned i = 0; i < 2; i++)
{
- iprt::MiniString StrAssign;
+ RTCString StrAssign;
if (i) StrAssign = "abcdef";
StrAssign = (char *)NULL;
RTTESTI_CHECK(StrAssign.isEmpty());
@@ -328,14 +370,14 @@ static void test2(RTTEST hTest)
RTTESTI_CHECK(mymemcmp((str1).c_str(), (str2).c_str(), (str2).length() + 1) == 0); \
} while (0)
- iprt::MiniString strTmp;
+ RTCString strTmp;
char szDst[16];
/* Collect all upper and lower case code points. */
- iprt::MiniString strLower("");
+ RTCString strLower("");
strLower.reserve(_4M);
- iprt::MiniString strUpper("");
+ RTCString strUpper("");
strUpper.reserve(_4M);
for (RTUNICP uc = 1; uc <= 0x10fffd; uc++)
@@ -358,7 +400,7 @@ static void test2(RTTEST hTest)
into the same or less number of bytes. */
size_t cch = 0;
const char *pszCur = strLower.c_str();
- iprt::MiniString strUpper2("");
+ RTCString strUpper2("");
strUpper2.reserve(strLower.length() + 64);
for (;;)
{
@@ -402,7 +444,7 @@ static void test2(RTTEST hTest)
/* Ditto for the upper case string. */
cch = 0;
pszCur = strUpper.c_str();
- iprt::MiniString strLower2("");
+ RTCString strLower2("");
strLower2.reserve(strUpper.length() + 64);
for (;;)
{
diff --git a/src/VBox/Runtime/testcase/tstLdr-2.cpp b/src/VBox/Runtime/testcase/tstLdr-2.cpp
index 9dcb2ca7e..dbeb310e6 100644
--- a/src/VBox/Runtime/testcase/tstLdr-2.cpp
+++ b/src/VBox/Runtime/testcase/tstLdr-2.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstLdr-2.cpp $ */
+/* $Id: tstLdr-2.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Testcase for parts of RTLdr*, manual inspection.
*/
diff --git a/src/VBox/Runtime/testcase/tstLdr-3.cpp b/src/VBox/Runtime/testcase/tstLdr-3.cpp
index cfda66ac9..f8fb66880 100644
--- a/src/VBox/Runtime/testcase/tstLdr-3.cpp
+++ b/src/VBox/Runtime/testcase/tstLdr-3.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstLdr-3.cpp $ */
+/* $Id: tstLdr-3.cpp 32878 2010-10-03 20:30:49Z vboxsync $ */
/** @file
* IPRT - Testcase for parts of RTLdr*, manual inspection.
*/
diff --git a/src/VBox/Runtime/testcase/tstLdr-4.cpp b/src/VBox/Runtime/testcase/tstLdr-4.cpp
index bfe1959f8..c385f3ca9 100644
--- a/src/VBox/Runtime/testcase/tstLdr-4.cpp
+++ b/src/VBox/Runtime/testcase/tstLdr-4.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstLdr-4.cpp $ */
+/* $Id: tstLdr-4.cpp 33269 2010-10-20 15:42:28Z vboxsync $ */
/** @file
* IPRT - Testcase for RTLdrOpen using ldrLdrObjR0.r0.
*/
diff --git a/src/VBox/Runtime/testcase/tstLdr.cpp b/src/VBox/Runtime/testcase/tstLdr.cpp
index 8003bdc2f..9b2a0ae4c 100644
--- a/src/VBox/Runtime/testcase/tstLdr.cpp
+++ b/src/VBox/Runtime/testcase/tstLdr.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstLdr.cpp $ */
+/* $Id: tstLdr.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - Testcase for parts of RTLdr*.
*/
diff --git a/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp b/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp
index ad50e9ad2..aaa75b836 100644
--- a/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp
+++ b/src/VBox/Runtime/testcase/tstLdrDisasmTest.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstLdrDisasmTest.cpp $ */
+/* $Id: tstLdrDisasmTest.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTLdr test object.
*
diff --git a/src/VBox/Runtime/testcase/tstLdrLoad.cpp b/src/VBox/Runtime/testcase/tstLdrLoad.cpp
index ce9b283f4..7d794e222 100644
--- a/src/VBox/Runtime/testcase/tstLdrLoad.cpp
+++ b/src/VBox/Runtime/testcase/tstLdrLoad.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstLdrLoad.cpp $ */
+/* $Id: tstLdrLoad.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Native Loader.
*/
diff --git a/src/VBox/Runtime/testcase/tstLdrObj.cpp b/src/VBox/Runtime/testcase/tstLdrObj.cpp
index 6d7783d00..747c3ee57 100644
--- a/src/VBox/Runtime/testcase/tstLdrObj.cpp
+++ b/src/VBox/Runtime/testcase/tstLdrObj.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstLdrObj.cpp $ */
+/* $Id: tstLdrObj.cpp 35346 2010-12-27 16:13:13Z vboxsync $ */
/** @file
* IPRT - RTLdr test object.
*
diff --git a/src/VBox/Runtime/testcase/tstLdrObjR0.cpp b/src/VBox/Runtime/testcase/tstLdrObjR0.cpp
index 23c220d4e..93e96389b 100644
--- a/src/VBox/Runtime/testcase/tstLdrObjR0.cpp
+++ b/src/VBox/Runtime/testcase/tstLdrObjR0.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstLdrObjR0.cpp $ */
+/* $Id: tstLdrObjR0.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTLdr test object.
*
diff --git a/src/VBox/Runtime/testcase/tstLog.cpp b/src/VBox/Runtime/testcase/tstLog.cpp
index 1e1366c7b..d1a31f810 100644
--- a/src/VBox/Runtime/testcase/tstLog.cpp
+++ b/src/VBox/Runtime/testcase/tstLog.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstLog.cpp $ */
+/* $Id: tstLog.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Log Formatting.
*/
diff --git a/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp b/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp
index 9a4474c8a..946194944 100644
--- a/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp
+++ b/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp
@@ -1,6 +1,6 @@
-/* $Id: tstMemAutoPtr.cpp $ */
+/* $Id: tstMemAutoPtr.cpp 36529 2011-04-04 13:54:13Z vboxsync $ */
/** @file
- * IPRT - Testcase the RTMemAutoPtr template.
+ * IPRT - Testcase the RTCMemAutoPtr template.
*/
/*
@@ -27,7 +27,7 @@
/*******************************************************************************
* Header Files *
*******************************************************************************/
-#include <iprt/mem.h>
+#include <iprt/cpp/mem.h>
#include <iprt/stream.h>
#include <iprt/initterm.h>
#include <iprt/string.h>
@@ -60,7 +60,7 @@ static unsigned g_cFrees;
*/
extern "C" int tstMemAutoPtrDisas1(void **ppv)
{
- RTMemAutoPtr<TSTMEMAUTOPTRSTRUCT> Handle(1);
+ RTCMemAutoPtr<TSTMEMAUTOPTRSTRUCT> Handle(1);
if (!Handle)
{
Handle->a = RTRandU32();
@@ -134,7 +134,7 @@ int main()
* Some simple stuff.
*/
{
- RTMemAutoPtr<char> NilObj;
+ RTCMemAutoPtr<char> NilObj;
CHECK_EXPR(!NilObj);
CHECK_EXPR(NilObj.get() == NULL);
CHECK_EXPR(NilObj.release() == NULL);
@@ -142,13 +142,13 @@ int main()
}
{
- RTMemAutoPtr<char> Alloc(10);
+ RTCMemAutoPtr<char> Alloc(10);
CHECK_EXPR(Alloc.get() != NULL);
char *pch = Alloc.release();
CHECK_EXPR(pch != NULL);
CHECK_EXPR(Alloc.get() == NULL);
- RTMemAutoPtr<char> Manage(pch);
+ RTCMemAutoPtr<char> Manage(pch);
CHECK_EXPR(Manage.get() == pch);
CHECK_EXPR(&Manage[0] == pch);
CHECK_EXPR(&Manage[1] == &pch[1]);
@@ -160,7 +160,7 @@ int main()
* arguments and also check some subscript / reference limit thing.
*/
{
- RTMemAutoPtr<char, RTMemEfAutoFree<char>, RTMemEfReallocNP> Electric(10);
+ RTCMemAutoPtr<char, RTCMemEfAutoFree<char>, RTMemEfReallocNP> Electric(10);
CHECK_EXPR(Electric.get() != NULL);
Electric[0] = '0';
CHECK_EXPR(Electric[0] == '0');
@@ -177,14 +177,14 @@ int main()
*/
g_cFrees = 0;
{
- RTMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt(128);
+ RTCMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt(128);
FreeIt[127] = '0';
}
CHECK_EXPR(g_cFrees == 1);
g_cFrees = 0;
{
- RTMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt2(128);
+ RTCMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt2(128);
FreeIt2[127] = '1';
FreeIt2.reset();
FreeIt2.alloc(128);
@@ -195,7 +195,7 @@ int main()
g_cFrees = 0;
{
- RTMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> DontFreeIt(256);
+ RTCMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> DontFreeIt(256);
DontFreeIt[255] = '0';
RTMemEfFreeNP(DontFreeIt.release());
}
@@ -203,7 +203,7 @@ int main()
g_cFrees = 0;
{
- RTMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt3(128);
+ RTCMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt3(128);
FreeIt3[127] = '0';
CHECK_EXPR(FreeIt3.realloc(128));
FreeIt3[127] = '0';
@@ -218,7 +218,7 @@ int main()
g_cFrees = 0;
{
- RTMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt4;
+ RTCMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt4;
CHECK_EXPR(FreeIt4.alloc(123));
CHECK_EXPR(FreeIt4.realloc(543));
FreeIt4 = (char *)NULL;
@@ -230,7 +230,7 @@ int main()
* Check the ->, [] and * (unary) operators with some useful struct.
*/
{
- RTMemAutoPtr<TSTMEMAUTOPTRSTRUCT> Struct1(1);
+ RTCMemAutoPtr<TSTMEMAUTOPTRSTRUCT> Struct1(1);
Struct1->a = 0x11223344;
Struct1->b = 0x55667788;
Struct1->c = 0x99aabbcc;
@@ -265,12 +265,12 @@ int main()
* Check the zeroing of memory.
*/
{
- RTMemAutoPtr<uint64_t, RTMemAutoDestructor<uint64_t>, tstMemAutoPtrAllocatorNoZero> Zeroed1(1, true);
+ RTCMemAutoPtr<uint64_t, RTCMemAutoDestructor<uint64_t>, tstMemAutoPtrAllocatorNoZero> Zeroed1(1, true);
CHECK_EXPR(*Zeroed1 == 0);
}
{
- RTMemAutoPtr<uint64_t, RTMemAutoDestructor<uint64_t>, tstMemAutoPtrAllocatorNoZero> Zeroed2;
+ RTCMemAutoPtr<uint64_t, RTCMemAutoDestructor<uint64_t>, tstMemAutoPtrAllocatorNoZero> Zeroed2;
Zeroed2.alloc(5, true);
CHECK_EXPR(Zeroed2[0] == 0);
CHECK_EXPR(Zeroed2[1] == 0);
diff --git a/src/VBox/Runtime/testcase/tstMove.cpp b/src/VBox/Runtime/testcase/tstMove.cpp
index ad8d9870c..a2589795e 100644
--- a/src/VBox/Runtime/testcase/tstMove.cpp
+++ b/src/VBox/Runtime/testcase/tstMove.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstMove.cpp $ */
+/* $Id: tstMove.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - RTFileMove & RTDirMove test program.
*/
diff --git a/src/VBox/Runtime/testcase/tstMp-1.cpp b/src/VBox/Runtime/testcase/tstMp-1.cpp
index 736f5181d..1de62c71b 100644
--- a/src/VBox/Runtime/testcase/tstMp-1.cpp
+++ b/src/VBox/Runtime/testcase/tstMp-1.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstMp-1.cpp $ */
+/* $Id: tstMp-1.cpp 33814 2010-11-05 21:28:14Z vboxsync $ */
/** @file
* IPRT Testcase - RTMp.
*/
diff --git a/src/VBox/Runtime/testcase/tstNoCrt-1.cpp b/src/VBox/Runtime/testcase/tstNoCrt-1.cpp
index 84afa1c53..fc8db47c7 100644
--- a/src/VBox/Runtime/testcase/tstNoCrt-1.cpp
+++ b/src/VBox/Runtime/testcase/tstNoCrt-1.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstNoCrt-1.cpp $ */
+/* $Id: tstNoCrt-1.cpp 30320 2010-06-21 08:35:09Z vboxsync $ */
/** @file
* IPRT Testcase - Testcase for the No-CRT assembly bits.
*/
diff --git a/src/VBox/Runtime/testcase/tstOnce.cpp b/src/VBox/Runtime/testcase/tstOnce.cpp
index bd48bcf96..15c717e73 100644
--- a/src/VBox/Runtime/testcase/tstOnce.cpp
+++ b/src/VBox/Runtime/testcase/tstOnce.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstOnce.cpp $ */
+/* $Id: tstOnce.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - RTOnce.
*/
diff --git a/src/VBox/Runtime/testcase/tstPrfRT.cpp b/src/VBox/Runtime/testcase/tstPrfRT.cpp
index 68be5fe59..0a8c1003b 100644
--- a/src/VBox/Runtime/testcase/tstPrfRT.cpp
+++ b/src/VBox/Runtime/testcase/tstPrfRT.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstPrfRT.cpp $ */
+/* $Id: tstPrfRT.cpp 29250 2010-05-09 17:53:58Z vboxsync $ */
/** @file
* IPRT testcase - profile some of the important functions.
*/
diff --git a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp b/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp
index 0c0cfd8d6..ca91925c9 100644
--- a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp
+++ b/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstR0ThreadPreemption.cpp $ */
+/* $Id: tstR0ThreadPreemption.cpp 29250 2010-05-09 17:53:58Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Thread Preemption.
*/
diff --git a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h b/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h
index f37376428..a5b993662 100644
--- a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h
+++ b/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h
@@ -1,4 +1,4 @@
-/* $Id: tstR0ThreadPreemption.h $ */
+/* $Id: tstR0ThreadPreemption.h 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Thread Preemption, common header.
*/
diff --git a/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp b/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp
index 921269391..b09a08dc3 100644
--- a/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp
+++ b/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstR0ThreadPreemptionDriver.cpp $ */
+/* $Id: tstR0ThreadPreemptionDriver.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Thread Preemption, driver program.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTAssertCompile.cpp b/src/VBox/Runtime/testcase/tstRTAssertCompile.cpp
index 7c8e7bd96..dd3e5538d 100644
--- a/src/VBox/Runtime/testcase/tstRTAssertCompile.cpp
+++ b/src/VBox/Runtime/testcase/tstRTAssertCompile.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTAssertCompile.cpp $ */
+/* $Id: tstRTAssertCompile.cpp 37809 2011-07-07 08:15:02Z vboxsync $ */
/** @file
* IPRT Testcase - AssertCompile* - A Compile Time Testcase.
*/
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
AssertCompileSizeAlignment(u64, 4);
AssertCompileSizeAlignment(u64, 8);
- typedef struct STRUCT1
+ typedef struct STRUCT12S
{
uint8_t u8;
uint8_t au8[8];
@@ -112,7 +112,7 @@ int main(int argc, char **argv)
AssertCompileMemberOffset(STRUCT1, au8[8], 9);
#endif
- typedef union UNION1
+ typedef union UNION1U
{
STRUCT1 s1;
STRUCT2 s2;
diff --git a/src/VBox/Runtime/testcase/tstRTAvl.cpp b/src/VBox/Runtime/testcase/tstRTAvl.cpp
index e77f68113..067ef9816 100644
--- a/src/VBox/Runtime/testcase/tstRTAvl.cpp
+++ b/src/VBox/Runtime/testcase/tstRTAvl.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTAvl.cpp $ */
+/* $Id: tstRTAvl.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT Testcase - AVL trees.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTBase64.cpp b/src/VBox/Runtime/testcase/tstRTBase64.cpp
index bbb2c38d9..41f905c5e 100644
--- a/src/VBox/Runtime/testcase/tstRTBase64.cpp
+++ b/src/VBox/Runtime/testcase/tstRTBase64.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTBase64.cpp $ */
+/* $Id: tstRTBase64.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Base64.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTBitOperations.cpp b/src/VBox/Runtime/testcase/tstRTBitOperations.cpp
index f7a0c5a10..a962ec69e 100644
--- a/src/VBox/Runtime/testcase/tstRTBitOperations.cpp
+++ b/src/VBox/Runtime/testcase/tstRTBitOperations.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTBitOperations.cpp $ */
+/* $Id: tstRTBitOperations.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Inlined Bit Operations.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTCidr.cpp b/src/VBox/Runtime/testcase/tstRTCidr.cpp
index 48c5ed375..270ac2549 100644
--- a/src/VBox/Runtime/testcase/tstRTCidr.cpp
+++ b/src/VBox/Runtime/testcase/tstRTCidr.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTCidr.cpp $ */
+/* $Id: tstRTCidr.cpp 29845 2010-05-27 11:29:36Z vboxsync $ */
/** @file
* IPRT Testcase - IPv4.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTCircBuf.cpp b/src/VBox/Runtime/testcase/tstRTCircBuf.cpp
index 0a6971228..7cb8ef81e 100644
--- a/src/VBox/Runtime/testcase/tstRTCircBuf.cpp
+++ b/src/VBox/Runtime/testcase/tstRTCircBuf.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTCircBuf.cpp $ */
+/* $Id: tstRTCircBuf.cpp 37210 2011-05-25 09:55:16Z vboxsync $ */
/** @file
* IPRT Testcase - Lock free circular buffers.
*/
@@ -29,8 +29,8 @@
*******************************************************************************/
#include <iprt/circbuf.h>
-#include <iprt/string.h>
#include <iprt/err.h>
+#include <iprt/string.h>
#include <iprt/test.h>
@@ -39,8 +39,8 @@
*/
static void tst1(void)
{
- void *pvBuf = NULL;
- size_t cbSize = 0;
+ void *pvBuf;
+ size_t cbSize;
char pcTestPattern1[] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9 };
char pcTestPattern2[] = { 0x8, 0x9, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9 };
@@ -61,7 +61,7 @@ static void tst1(void)
RTCircBufReleaseWriteBlock(pBuf, 10);
RTTESTI_CHECK(RTCircBufFree(pBuf) == 0);
RTTESTI_CHECK(RTCircBufUsed(pBuf) == 10);
- RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern1, 10) == 0); /* Check the internal state */
+// RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern1, 10) == 0); /* Check the internal state */
/* Half read */
RTTestISub("Half read");
@@ -80,7 +80,7 @@ static void tst1(void)
RTCircBufReleaseWriteBlock(pBuf, 2);
RTTESTI_CHECK(RTCircBufFree(pBuf) == 3);
RTTESTI_CHECK(RTCircBufUsed(pBuf) == 7);
- RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern2, 10) == 0); /* Check the internal state */
+// RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern2, 10) == 0); /* Check the internal state */
/* Split tests */
/* Split read */
@@ -112,7 +112,7 @@ static void tst1(void)
RTCircBufReleaseWriteBlock(pBuf, 2);
RTTESTI_CHECK(RTCircBufFree(pBuf) == 0);
RTTESTI_CHECK(RTCircBufUsed(pBuf) == 10);
- RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern3, 10) == 0); /* Check the internal state */
+// RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern3, 10) == 0); /* Check the internal state */
/* Destroy */
RTCircBufDestroy(pBuf);
diff --git a/src/VBox/Runtime/testcase/tstRTCoreDump.cpp b/src/VBox/Runtime/testcase/tstRTCoreDump.cpp
index d4942358b..dd5b2ddf9 100644
--- a/src/VBox/Runtime/testcase/tstRTCoreDump.cpp
+++ b/src/VBox/Runtime/testcase/tstRTCoreDump.cpp
@@ -1,10 +1,10 @@
-/* $Id: tstRTCoreDump.cpp $ */
+/* $Id: tstRTCoreDump.cpp 37631 2011-06-24 13:25:07Z vboxsync $ */
/** @file
* IPRT Testcase - Core Dumper.
*/
/*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -27,80 +27,72 @@
/*******************************************************************************
* Header Files *
*******************************************************************************/
-#include <iprt/types.h>
+#include <iprt/coredumper.h>
+
+#include <iprt/test.h>
#include <iprt/err.h>
#include <iprt/initterm.h>
#include <iprt/thread.h>
-#include <iprt/stream.h>
-#include <iprt/coredumper.h>
/*******************************************************************************
* Globals *
*******************************************************************************/
-static unsigned volatile g_cErrors = 0;
-
-static DECLCALLBACK(int) SleepyThread(RTTHREAD Thread, void *pvUser)
+static DECLCALLBACK(int) SleepyThread(RTTHREAD hThread, void *pvUser)
{
NOREF(pvUser);
- RTThreadSleep(90000000);
+ RTThreadUserWait(hThread, 90000000);
return VINF_SUCCESS;
}
int main()
{
- RTR3Init();
- RTPrintf("tstRTCoreDump: TESTING...\n");
+ RTTEST hTest;
+ RTEXITCODE rcExit = RTTestInitAndCreate("tstRTCoreDump", &hTest);
+ if (rcExit != RTEXITCODE_SUCCESS)
+ return rcExit;
+ RTTestBanner(hTest);
/*
* Setup core dumping.
*/
- int rc = RTCoreDumperSetup(NULL, RTCOREDUMPER_FLAGS_REPLACE_SYSTEM_DUMP | RTCOREDUMPER_FLAGS_LIVE_CORE);
+ int rc;
+ RTTESTI_CHECK_RC(rc = RTCoreDumperSetup(NULL, RTCOREDUMPER_FLAGS_REPLACE_SYSTEM_DUMP | RTCOREDUMPER_FLAGS_LIVE_CORE),
+ VINF_SUCCESS);
if (RT_SUCCESS(rc))
{
/*
* Spawn a few threads.
*/
RTTHREAD ahThreads[5];
- unsigned i = 0;
- for (; i < RT_ELEMENTS(ahThreads); i++)
+ unsigned i;
+ for (i = 0; i < RT_ELEMENTS(ahThreads); i++)
{
- rc = RTThreadCreate(&ahThreads[i], SleepyThread, &ahThreads[i], 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "TEST1");
- if (RT_FAILURE(rc))
- {
- RTPrintf("tstRTCoreDump: FAILURE(%d) - %d RTThreadCreate failed, rc=%Rrc\n", __LINE__, i, rc);
- g_cErrors++;
- ahThreads[i] = NIL_RTTHREAD;
- break;
- }
+ RTTESTI_CHECK_RC_BREAK(RTThreadCreate(&ahThreads[i], SleepyThread, &ahThreads[i], 0, RTTHREADTYPE_DEFAULT,
+ RTTHREADFLAGS_WAITABLE, "TEST1"),
+ VINF_SUCCESS);
}
- RTPrintf("Spawned %d threads.\n", i);
+ RTTestIPrintf(RTTESTLVL_ALWAYS, "Spawned %d threads.\n", i);
/*
* Write the core to disk.
*/
- rc = RTCoreDumperTakeDump(NULL, false /* fLiveCore*/);
- if (RT_FAILURE(rc))
+ RTTESTI_CHECK_RC(RTCoreDumperTakeDump(NULL, true /* fLiveCore*/), VINF_SUCCESS);
+
+ /*
+ * Clean up.
+ */
+ RTTESTI_CHECK_RC(RTCoreDumperDisable(), VINF_SUCCESS);
+ while (i-- > 0)
{
- g_cErrors++;
- RTPrintf("RTCoreDumperTakeDump failed. rc=%Rrc\n", rc);
+ RTTESTI_CHECK_RC(RTThreadUserSignal(ahThreads[i]), VINF_SUCCESS);
+ RTTESTI_CHECK_RC(RTThreadWait(ahThreads[i], 60*1000, NULL), VINF_SUCCESS);
}
- RTCoreDumperDisable();
- }
- else
- {
- g_cErrors++;
- RTPrintf("RTCoreDumperSetup failed. rc=%Rrc\n", rc);
}
/*
* Summary.
*/
- if (!g_cErrors)
- RTPrintf("tstRTCoreDump: SUCCESS\n");
- else
- RTPrintf("tstRTCoreDump: FAILURE - %d errors\n", g_cErrors);
-
- return !!g_cErrors;
+ return RTTestSummaryAndDestroy(hTest);
}
diff --git a/src/VBox/Runtime/testcase/tstRTCoreDump.h b/src/VBox/Runtime/testcase/tstRTCoreDump.h
index 524db6628..9220a0873 100644
--- a/src/VBox/Runtime/testcase/tstRTCoreDump.h
+++ b/src/VBox/Runtime/testcase/tstRTCoreDump.h
@@ -1,4 +1,4 @@
-/* $Id: tstRTCoreDump.h $ */
+/* $Id: tstRTCoreDump.h 31796 2010-08-19 16:18:42Z vboxsync $ */
/** @file
* IPRT Testcase - Core dump, header.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTCritSect.cpp b/src/VBox/Runtime/testcase/tstRTCritSect.cpp
index b6ae874a0..697fa8f81 100644
--- a/src/VBox/Runtime/testcase/tstRTCritSect.cpp
+++ b/src/VBox/Runtime/testcase/tstRTCritSect.cpp
@@ -1,10 +1,10 @@
-/* $Id: tstRTCritSect.cpp $ */
+/* $Id: tstRTCritSect.cpp 36492 2011-04-01 12:53:59Z vboxsync $ */
/** @file
* IPRT Testcase - Critical Sections.
*/
/*
- * Copyright (C) 2006-2009 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -30,6 +30,7 @@
#ifdef TRY_WIN32_CRIT
# include <Windows.h>
#endif
+#define RTCRITSECT_WITHOUT_REMAPPING
#include <iprt/critsect.h>
#include <iprt/asm.h>
@@ -58,14 +59,12 @@
#define PRTCRITSECT LPCRITICAL_SECTION
#define LOCKERS(sect) (*(LONG volatile *)&(sect).LockCount)
-#undef RTCritSectInit
DECLINLINE(int) RTCritSectInit(PCRITICAL_SECTION pCritSect)
{
InitializeCriticalSection(pCritSect);
return VINF_SUCCESS;
}
-#undef RTCritSectEnter
DECLINLINE(int) RTCritSectEnter(PCRITICAL_SECTION pCritSect)
{
EnterCriticalSection(pCritSect);
diff --git a/src/VBox/Runtime/testcase/tstRTDarwinMachKernel.cpp b/src/VBox/Runtime/testcase/tstRTDarwinMachKernel.cpp
index 789578023..aee8ee7d0 100644
--- a/src/VBox/Runtime/testcase/tstRTDarwinMachKernel.cpp
+++ b/src/VBox/Runtime/testcase/tstRTDarwinMachKernel.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTDarwinMachKernel.cpp $ */
+/* $Id: tstRTDarwinMachKernel.cpp 37573 2011-06-21 11:40:11Z vboxsync $ */
/** @file
* IPRT Testcase - mach_kernel symbol resolving hack.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTDigest.cpp b/src/VBox/Runtime/testcase/tstRTDigest.cpp
index 4be63c1ea..ecad8301d 100644
--- a/src/VBox/Runtime/testcase/tstRTDigest.cpp
+++ b/src/VBox/Runtime/testcase/tstRTDigest.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTDigest.cpp $ */
+/* $Id: tstRTDigest.cpp 33806 2010-11-05 17:20:15Z vboxsync $ */
/** @file
* IPRT Testcase - RTSha*, RTMd5, RTCrc*.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTDirCreateUniqueNumbered.cpp b/src/VBox/Runtime/testcase/tstRTDirCreateUniqueNumbered.cpp
new file mode 100644
index 000000000..0b723d6eb
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTDirCreateUniqueNumbered.cpp
@@ -0,0 +1,129 @@
+/* $Id: tstRTDirCreateUniqueNumbered.cpp 36577 2011-04-06 13:35:17Z vboxsync $ */
+/** @file
+ * IPRT Testcase - Unique directory creation.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/dir.h>
+
+#include <iprt/path.h>
+#include <iprt/mem.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+
+
+/*******************************************************************************
+* Global Variables *
+*******************************************************************************/
+static char g_szTempPath[RTPATH_MAX - 50];
+
+
+static void tst1(size_t cTest, size_t cchDigits, char chSep)
+{
+ RTTestISubF("tst #%u (digits: %u; sep: %c)", cTest, cchDigits, chSep ? chSep : ' ');
+
+ /* We try to create max possible + one. */
+ size_t cTimes = 1;
+ for (size_t i = 0; i < cchDigits; ++i)
+ cTimes *= 10;
+
+ /* Allocate the result array. */
+ char **papszNames = (char **)RTMemTmpAllocZ(cTimes * sizeof(char *));
+ RTTESTI_CHECK_RETV(papszNames != NULL);
+
+ int rc;
+ /* The test loop. */
+ size_t i;
+ for (i = 0; i < cTimes; i++)
+ {
+ char szName[RTPATH_MAX];
+ RTTESTI_CHECK_RC(rc = RTPathAppend(strcpy(szName, g_szTempPath), sizeof(szName), "RTDirCreateUniqueNumbered"), VINF_SUCCESS);
+ if (RT_FAILURE(rc))
+ break;
+
+ RTTESTI_CHECK_RC(rc = RTDirCreateUniqueNumbered(szName, sizeof(szName), 0700, cchDigits, chSep), VINF_SUCCESS);
+ if (RT_FAILURE(rc))
+ {
+ RTTestIFailed("RTDirCreateUniqueNumbered(%s) call #%u -> %Rrc\n", szName, i, rc);
+ break;
+ }
+
+ RTTESTI_CHECK(papszNames[i] = RTStrDup(szName));
+ if (!papszNames[i])
+ break;
+
+ RTTestIPrintf(RTTESTLVL_DEBUG, "%s\n", papszNames[i]);
+ }
+
+ /* Try to create one more, which shouldn't be possible. */
+ if (RT_SUCCESS(rc))
+ {
+ char szName[RTPATH_MAX];
+ RTTESTI_CHECK_RC(rc = RTPathAppend(strcpy(szName, g_szTempPath), sizeof(szName), "RTDirCreateUniqueNumbered"), VINF_SUCCESS);
+ if (RT_SUCCESS(rc))
+ RTTESTI_CHECK_RC(rc = RTDirCreateUniqueNumbered(szName, sizeof(szName), 0700, cchDigits, chSep), VERR_ALREADY_EXISTS);
+ }
+
+ /* cleanup */
+ while (i-- > 0)
+ {
+ RTTESTI_CHECK_RC(RTDirRemove(papszNames[i]), VINF_SUCCESS);
+ RTStrFree(papszNames[i]);
+ }
+ RTMemTmpFree(papszNames);
+}
+
+
+int main()
+{
+ RTTEST hTest;
+ RTEXITCODE rcExit = RTTestInitAndCreate("tstRTDirCreateUniqueNumbered", &hTest);
+ if (rcExit)
+ return rcExit;
+ RTTestBanner(hTest);
+
+ /*
+ * Get the temp directory (this is essential to the testcase).
+ */
+ int rc;
+ RTTESTI_CHECK_RC(rc = RTPathTemp(g_szTempPath, sizeof(g_szTempPath)), VINF_SUCCESS);
+ if (RT_FAILURE(rc))
+ return RTTestSummaryAndDestroy(hTest);
+
+ /*
+ * Create some test directories.
+ */
+ tst1(1, 1, 0 );
+ tst1(2, 1, '-');
+ tst1(3, 2, 0 );
+ tst1(4, 2, '-');
+
+ /*
+ * Summary.
+ */
+ return RTTestSummaryAndDestroy(hTest);
+}
+
diff --git a/src/VBox/Runtime/testcase/tstRTDvm.cpp b/src/VBox/Runtime/testcase/tstRTDvm.cpp
new file mode 100644
index 000000000..ecfa2fa71
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTDvm.cpp
@@ -0,0 +1,221 @@
+/* $Id: tstRTDvm.cpp 37270 2011-05-30 21:25:42Z vboxsync $ */
+/** @file
+ * IPRT Testcase - IPRT Disk Volume Management (DVM)
+ */
+
+/*
+ * Copyright (C) 2009 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/initterm.h>
+#include <iprt/err.h>
+#include <iprt/test.h>
+#include <iprt/dvm.h>
+#include <iprt/file.h>
+#include <iprt/string.h>
+
+/**
+ * Disk structure.
+ */
+typedef struct TSTRTDVMDISK
+{
+ /** Flag whether this disk uses the image file or a volume. */
+ bool fUseImage;
+ /** Data dependent on the flag. */
+ union
+ {
+ /** File handle of the image. */
+ RTFILE hImage;
+ /** Handle of the volume. */
+ RTDVMVOLUME hVol;
+ };
+} TSTRTDVMDISK, *PTSTRTDVMDISK;
+
+static int dvmDiskRead(void *pvUser, uint64_t off, void *pvBuf, size_t cbRead)
+{
+ PTSTRTDVMDISK pDisk = (PTSTRTDVMDISK)pvUser;
+
+ if (pDisk->fUseImage)
+ return RTFileReadAt(pDisk->hImage, off, pvBuf, cbRead, NULL);
+ else
+ return RTDvmVolumeRead(pDisk->hVol, off, pvBuf, cbRead);
+}
+
+static int dvmDiskWrite(void *pvUser, uint64_t off, const void *pvBuf, size_t cbWrite)
+{
+ PTSTRTDVMDISK pDisk = (PTSTRTDVMDISK)pvUser;
+
+ if (pDisk->fUseImage)
+ return RTFileWriteAt(pDisk->hImage, off, pvBuf, cbWrite, NULL);
+ else
+ return RTDvmVolumeWrite(pDisk->hVol, off, pvBuf, cbWrite);
+}
+
+static int tstRTDvmVolume(RTTEST hTest, PTSTRTDVMDISK pDisk, uint64_t cb, unsigned cNesting)
+{
+ char szPrefix[100];
+ int rc = VINF_SUCCESS;
+
+ memset(szPrefix, 0, sizeof(szPrefix));
+
+ if (cNesting < sizeof(szPrefix) - 1)
+ {
+ for (unsigned i = 0; i < cNesting; i++)
+ szPrefix[i] = '\t';
+ }
+
+ RTTestSubF(hTest, "Create DVM");
+ RTDVM hVolMgr;
+ rc = RTDvmCreate(&hVolMgr, dvmDiskRead, dvmDiskWrite, cb, 512, pDisk);
+ if (RT_FAILURE(rc))
+ {
+ RTTestIFailed("RTDvmCreate -> %Rrc", rc);
+ return RTTestSummaryAndDestroy(hTest);
+ }
+
+ RTTestSubF(hTest, "Open volume map");
+ rc = RTDvmMapOpen(hVolMgr);
+ if ( RT_FAILURE(rc)
+ && rc != VERR_NOT_SUPPORTED)
+ {
+ RTTestIFailed("RTDvmOpen -> %Rrc", rc);
+ return RTTestSummaryAndDestroy(hTest);
+ }
+ else if (rc == VERR_NOT_SUPPORTED)
+ return VINF_SUCCESS;
+
+ RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Successfully opened map with format: %s.\n", szPrefix, RTDvmMapGetFormat(hVolMgr));
+
+ /* Dump all volumes. */
+ RTTestSubF(hTest, "Dump volumes");
+ uint32_t cVolume = 0;
+ RTDVMVOLUME hVol;
+
+ rc = RTDvmMapQueryFirstVolume(hVolMgr, &hVol);
+
+ while (RT_SUCCESS(rc))
+ {
+ char *pszVolName = NULL;
+ RTDVMVOLTYPE enmVolType = RTDvmVolumeGetType(hVol);
+ uint64_t fVolFlags = RTDvmVolumeGetFlags(hVol);
+
+ RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume %u:\n", szPrefix, cVolume);
+ RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume type %s\n", szPrefix, RTDvmVolumeTypeGetDescr(enmVolType));
+ RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume size %llu\n", szPrefix, RTDvmVolumeGetSize(hVol));
+ RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume flags %s %s\n\n", szPrefix,
+ fVolFlags & DVMVOLUME_FLAGS_BOOTABLE ? "Bootable" : "",
+ fVolFlags & DVMVOLUME_FLAGS_ACTIVE ? "Active" : "");
+
+ rc = RTDvmVolumeQueryName(hVol, &pszVolName);
+ if (RT_SUCCESS(rc))
+ {
+ RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume name %s.\n", szPrefix, pszVolName);
+ RTStrFree(pszVolName);
+ }
+ else if (rc != VERR_NOT_SUPPORTED)
+ RTTestIFailed("RTDvmVolumeQueryName -> %Rrc", rc);
+ else
+ rc = VINF_SUCCESS;
+
+ /*
+ * Query all volumes which might be inside this.
+ * (think of MBR partitions with a bsdlabel inside)
+ */
+ TSTRTDVMDISK Disk;
+ Disk.fUseImage = false;
+ Disk.hVol = hVol;
+ rc = tstRTDvmVolume(hTest, &Disk, RTDvmVolumeGetSize(hVol), cNesting + 1);
+
+ RTDVMVOLUME hVolNext;
+ rc = RTDvmMapQueryNextVolume(hVolMgr, hVol, &hVolNext);
+ RTDvmVolumeRelease(hVol);
+ hVol = hVolNext;
+ cVolume++;
+ }
+
+ RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Dumped %u volumes\n", szPrefix, cVolume);
+
+ if ( rc == VERR_DVM_MAP_EMPTY
+ || rc == VERR_DVM_MAP_NO_VOLUME)
+ rc = VINF_SUCCESS;
+
+ RTTESTI_CHECK(rc == VINF_SUCCESS);
+
+ RTDvmRelease(hVolMgr);
+
+ return rc;
+}
+
+int main(int argc, char **argv)
+{
+ /*
+ * Initialize IPRT and create the test.
+ */
+ RTTEST hTest;
+ int rc = RTTestInitAndCreate("tstRTDvm", &hTest);
+ if (rc)
+ return rc;
+ RTTestBanner(hTest);
+
+ /*
+ * If no args, display usage.
+ */
+ if (argc < 2)
+ {
+ RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Syntax: %s <image>\n", argv[0]);
+ return RTTestSkipAndDestroy(hTest, "Missing required arguments\n");
+ }
+
+ /* Open image. */
+ RTFILE hFile;
+ uint64_t cb = 0;
+ rc = RTFileOpen(&hFile, argv[1], RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_READWRITE);
+ if (RT_FAILURE(rc))
+ {
+ RTTestIFailed("RTFileOpen -> %Rrc", rc);
+ return RTTestSummaryAndDestroy(hTest);
+ }
+
+ rc = RTFileGetSize(hFile, &cb);
+ if ( RT_FAILURE(rc)
+ || cb % 512 != 0) /* Assume 512 byte sector size. */
+ {
+ RTTestIFailed("RTFileGetSize -> %Rrc", rc);
+ return RTTestSummaryAndDestroy(hTest);
+ }
+
+ TSTRTDVMDISK Disk;
+
+ Disk.fUseImage = true;
+ Disk.hImage = hFile;
+ rc = tstRTDvmVolume(hTest, &Disk, cb, 0);
+
+ RTTESTI_CHECK(rc == VINF_SUCCESS);
+
+ /*
+ * Summary
+ */
+ return RTTestSummaryAndDestroy(hTest);
+}
+
diff --git a/src/VBox/Runtime/testcase/tstRTFileAio.cpp b/src/VBox/Runtime/testcase/tstRTFileAio.cpp
index b164083f2..9e3da3d83 100644
--- a/src/VBox/Runtime/testcase/tstRTFileAio.cpp
+++ b/src/VBox/Runtime/testcase/tstRTFileAio.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTFileAio.cpp $ */
+/* $Id: tstRTFileAio.cpp 29393 2010-05-12 00:20:38Z vboxsync $ */
/** @file
* IPRT Testcase - File Async I/O.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTFileAppend-1.cpp b/src/VBox/Runtime/testcase/tstRTFileAppend-1.cpp
index c18940b3a..d9a977eb4 100644
--- a/src/VBox/Runtime/testcase/tstRTFileAppend-1.cpp
+++ b/src/VBox/Runtime/testcase/tstRTFileAppend-1.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTFileAppend-1.cpp $ */
+/* $Id: tstRTFileAppend-1.cpp 29393 2010-05-12 00:20:38Z vboxsync $ */
/** @file
* IPRT Testcase - File Appending.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTFsQueries.cpp b/src/VBox/Runtime/testcase/tstRTFsQueries.cpp
index 42320d797..276a5464d 100644
--- a/src/VBox/Runtime/testcase/tstRTFsQueries.cpp
+++ b/src/VBox/Runtime/testcase/tstRTFsQueries.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTFsQueries.cpp $ */
+/* $Id: tstRTFsQueries.cpp 30365 2010-06-22 12:08:20Z vboxsync $ */
/** @file
* IPRT Testcase - RTFs Queries..
*/
diff --git a/src/VBox/Runtime/testcase/tstRTGetOpt.cpp b/src/VBox/Runtime/testcase/tstRTGetOpt.cpp
index 9505f80e3..07a249027 100644
--- a/src/VBox/Runtime/testcase/tstRTGetOpt.cpp
+++ b/src/VBox/Runtime/testcase/tstRTGetOpt.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTGetOpt.cpp $ */
+/* $Id: tstRTGetOpt.cpp 34542 2010-11-30 22:57:21Z vboxsync $ */
/** @file
* IPRT Testcase - RTGetOpt
*/
diff --git a/src/VBox/Runtime/testcase/tstRTGetOptArgv.cpp b/src/VBox/Runtime/testcase/tstRTGetOptArgv.cpp
index 27c067683..baaab0318 100644
--- a/src/VBox/Runtime/testcase/tstRTGetOptArgv.cpp
+++ b/src/VBox/Runtime/testcase/tstRTGetOptArgv.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTGetOptArgv.cpp $ */
+/* $Id: tstRTGetOptArgv.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - RTGetOptArgv*.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTHeapOffset.cpp b/src/VBox/Runtime/testcase/tstRTHeapOffset.cpp
index 467619a2a..d017f5c27 100644
--- a/src/VBox/Runtime/testcase/tstRTHeapOffset.cpp
+++ b/src/VBox/Runtime/testcase/tstRTHeapOffset.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTHeapOffset.cpp $ */
+/* $Id: tstRTHeapOffset.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Offset Based Heap.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTHeapSimple.cpp b/src/VBox/Runtime/testcase/tstRTHeapSimple.cpp
index ef763466f..7921a1482 100644
--- a/src/VBox/Runtime/testcase/tstRTHeapSimple.cpp
+++ b/src/VBox/Runtime/testcase/tstRTHeapSimple.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTHeapSimple.cpp $ */
+/* $Id: tstRTHeapSimple.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Simple Heap.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp b/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp
index 925b23b51..87287ec6d 100644
--- a/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp
+++ b/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTInlineAsm.cpp $ */
+/* $Id: tstRTInlineAsm.cpp 33207 2010-10-18 15:02:47Z vboxsync $ */
/** @file
* IPRT Testcase - inline assembly.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTList.cpp b/src/VBox/Runtime/testcase/tstRTList.cpp
index fdbba25da..4306f3018 100644
--- a/src/VBox/Runtime/testcase/tstRTList.cpp
+++ b/src/VBox/Runtime/testcase/tstRTList.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTList.cpp $ */
+/* $Id: tstRTList.cpp 34406 2010-11-26 16:45:34Z vboxsync $ */
/** @file
* IPRT Testcase - List interface.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTLockValidator.cpp b/src/VBox/Runtime/testcase/tstRTLockValidator.cpp
index 575a97fa6..b295d7922 100644
--- a/src/VBox/Runtime/testcase/tstRTLockValidator.cpp
+++ b/src/VBox/Runtime/testcase/tstRTLockValidator.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTLockValidator.cpp $ */
+/* $Id: tstRTLockValidator.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT Testcase - RTLockValidator.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTManifest.cpp b/src/VBox/Runtime/testcase/tstRTManifest.cpp
index 629815d8d..61d3cf143 100644
--- a/src/VBox/Runtime/testcase/tstRTManifest.cpp
+++ b/src/VBox/Runtime/testcase/tstRTManifest.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTManifest.cpp $ */
+/* $Id: tstRTManifest.cpp 34464 2010-11-29 13:45:37Z vboxsync $ */
/** @file
* IPRT Testcase - Manifest files.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTMemCache.cpp b/src/VBox/Runtime/testcase/tstRTMemCache.cpp
index 73c481460..2b4499788 100644
--- a/src/VBox/Runtime/testcase/tstRTMemCache.cpp
+++ b/src/VBox/Runtime/testcase/tstRTMemCache.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTMemCache.cpp $ */
+/* $Id: tstRTMemCache.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - RTMemCache.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTMemEf.cpp b/src/VBox/Runtime/testcase/tstRTMemEf.cpp
index e4761dd0c..ca73b1f9f 100644
--- a/src/VBox/Runtime/testcase/tstRTMemEf.cpp
+++ b/src/VBox/Runtime/testcase/tstRTMemEf.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTMemEf.cpp $ */
+/* $Id: tstRTMemEf.cpp 36580 2011-04-06 13:52:10Z vboxsync $ */
/** @file
* IPRT - Testcase for the RTMemEf* functions.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTMemPool.cpp b/src/VBox/Runtime/testcase/tstRTMemPool.cpp
index 2956eb0f4..c04f734c5 100644
--- a/src/VBox/Runtime/testcase/tstRTMemPool.cpp
+++ b/src/VBox/Runtime/testcase/tstRTMemPool.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTMemPool.cpp $ */
+/* $Id: tstRTMemPool.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT Testcase - MemPool.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTPath.cpp b/src/VBox/Runtime/testcase/tstRTPath.cpp
index 06009aa75..b91555bbd 100644
--- a/src/VBox/Runtime/testcase/tstRTPath.cpp
+++ b/src/VBox/Runtime/testcase/tstRTPath.cpp
@@ -1,10 +1,10 @@
-/* $Id: tstRTPath.cpp $ */
+/* $Id: tstRTPath.cpp 36881 2011-04-29 09:17:05Z vboxsync $ */
/** @file
* IPRT Testcase - Test various path functions.
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -55,7 +55,7 @@ int main()
* RTPathExecDir, RTPathUserHome and RTProcGetExecutablePath.
*/
RTTestSub(hTest, "RTPathExecDir");
- RTTESTI_CHECK_RC(RTPathExecDir(szPath, sizeof(szPath)), VINF_SUCCESS);
+ RTTESTI_CHECK_RC(rc = RTPathExecDir(szPath, sizeof(szPath)), VINF_SUCCESS);
if (RT_SUCCESS(rc))
RTTestIPrintf(RTTESTLVL_INFO, "ExecDir={%s}\n", szPath);
@@ -66,12 +66,17 @@ int main()
RTTestIFailed("RTProcGetExecutablePath -> NULL");
RTTestSub(hTest, "RTPathUserHome");
- RTTESTI_CHECK_RC(RTPathUserHome(szPath, sizeof(szPath)), VINF_SUCCESS);
+ RTTESTI_CHECK_RC(rc = RTPathUserHome(szPath, sizeof(szPath)), VINF_SUCCESS);
if (RT_SUCCESS(rc))
RTTestIPrintf(RTTESTLVL_INFO, "UserHome={%s}\n", szPath);
+ RTTestSub(hTest, "RTPathUserDocuments");
+ RTTESTI_CHECK_RC(rc = RTPathUserDocuments(szPath, sizeof(szPath)), VINF_SUCCESS);
+ if (RT_SUCCESS(rc))
+ RTTestIPrintf(RTTESTLVL_INFO, "UserDocuments={%s}\n", szPath);
+
RTTestSub(hTest, "RTPathTemp");
- RTTESTI_CHECK_RC(RTPathTemp(szPath, sizeof(szPath)), VINF_SUCCESS);
+ RTTESTI_CHECK_RC(rc = RTPathTemp(szPath, sizeof(szPath)), VINF_SUCCESS);
if (RT_SUCCESS(rc))
RTTestIPrintf(RTTESTLVL_INFO, "PathTemp={%s}\n", szPath);
size_t cch = strlen(szPath);
diff --git a/src/VBox/Runtime/testcase/tstRTPipe.cpp b/src/VBox/Runtime/testcase/tstRTPipe.cpp
index dfb73685d..74862c227 100644
--- a/src/VBox/Runtime/testcase/tstRTPipe.cpp
+++ b/src/VBox/Runtime/testcase/tstRTPipe.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTPipe.cpp $ */
+/* $Id: tstRTPipe.cpp 33806 2010-11-05 17:20:15Z vboxsync $ */
/** @file
* IPRT Testcase - RTPipe.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTPoll.cpp b/src/VBox/Runtime/testcase/tstRTPoll.cpp
index 8e14c23d7..9b9e09d93 100644
--- a/src/VBox/Runtime/testcase/tstRTPoll.cpp
+++ b/src/VBox/Runtime/testcase/tstRTPoll.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTPoll.cpp $ */
+/* $Id: tstRTPoll.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - RTPoll.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTPrfIO.cpp b/src/VBox/Runtime/testcase/tstRTPrfIO.cpp
index 7b2bfe11d..9c3a516d8 100644
--- a/src/VBox/Runtime/testcase/tstRTPrfIO.cpp
+++ b/src/VBox/Runtime/testcase/tstRTPrfIO.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTPrfIO.cpp $ */
+/* $Id: tstRTPrfIO.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT Testcase - Profile IPRT I/O APIs.
*/
@@ -210,7 +210,7 @@ int main(int argc, char **argv)
break;
case 'V':
- RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "$Revision: 67140 $\n");
+ RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "$Revision: 33540 $\n");
return RTTestSummaryAndDestroy(g_hTest);
case 'h':
diff --git a/src/VBox/Runtime/testcase/tstRTProcCreateEx.cpp b/src/VBox/Runtime/testcase/tstRTProcCreateEx.cpp
index 0e3019ac4..ef0a8c008 100644
--- a/src/VBox/Runtime/testcase/tstRTProcCreateEx.cpp
+++ b/src/VBox/Runtime/testcase/tstRTProcCreateEx.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTProcCreateEx.cpp $ */
+/* $Id: tstRTProcCreateEx.cpp 33806 2010-11-05 17:20:15Z vboxsync $ */
/** @file
* IPRT Testcase - RTProcCreateEx.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTProcIsRunningByName.cpp b/src/VBox/Runtime/testcase/tstRTProcIsRunningByName.cpp
index 578985eae..a872808ce 100644
--- a/src/VBox/Runtime/testcase/tstRTProcIsRunningByName.cpp
+++ b/src/VBox/Runtime/testcase/tstRTProcIsRunningByName.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTProcIsRunningByName.cpp $ */
+/* $Id: tstRTProcIsRunningByName.cpp 33806 2010-11-05 17:20:15Z vboxsync $ */
/** @file
* IPRT Testcase - RTProcIsRunningByName
*/
diff --git a/src/VBox/Runtime/testcase/tstRTProcWait.cpp b/src/VBox/Runtime/testcase/tstRTProcWait.cpp
index 210988a8d..6217521e9 100644
--- a/src/VBox/Runtime/testcase/tstRTProcWait.cpp
+++ b/src/VBox/Runtime/testcase/tstRTProcWait.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTProcWait.cpp $ */
+/* $Id: tstRTProcWait.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - RTProcWait.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0Common.h b/src/VBox/Runtime/testcase/tstRTR0Common.h
index 196e5f9de..2b246e466 100644
--- a/src/VBox/Runtime/testcase/tstRTR0Common.h
+++ b/src/VBox/Runtime/testcase/tstRTR0Common.h
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0Common.h $ */
+/* $Id: tstRTR0Common.h 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Common header.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0CommonDriver.h b/src/VBox/Runtime/testcase/tstRTR0CommonDriver.h
index b381383c6..1bacfba26 100644
--- a/src/VBox/Runtime/testcase/tstRTR0CommonDriver.h
+++ b/src/VBox/Runtime/testcase/tstRTR0CommonDriver.h
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0CommonDriver.h $ */
+/* $Id: tstRTR0CommonDriver.h 32736 2010-09-23 16:19:46Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Common header for the testcase drivers.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0CommonReq.h b/src/VBox/Runtime/testcase/tstRTR0CommonReq.h
index b32e174d2..54924d79b 100644
--- a/src/VBox/Runtime/testcase/tstRTR0CommonReq.h
+++ b/src/VBox/Runtime/testcase/tstRTR0CommonReq.h
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0CommonReq.h $ */
+/* $Id: tstRTR0CommonReq.h 32648 2010-09-20 16:17:03Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Common header defining the request packet.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0MemUserKernel.cpp b/src/VBox/Runtime/testcase/tstRTR0MemUserKernel.cpp
index 4fc007651..4f504b6b3 100644
--- a/src/VBox/Runtime/testcase/tstRTR0MemUserKernel.cpp
+++ b/src/VBox/Runtime/testcase/tstRTR0MemUserKernel.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0MemUserKernel.cpp $ */
+/* $Id: tstRTR0MemUserKernel.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Thread Preemption.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0MemUserKernel.h b/src/VBox/Runtime/testcase/tstRTR0MemUserKernel.h
index 7efbeed55..f1d09aba0 100644
--- a/src/VBox/Runtime/testcase/tstRTR0MemUserKernel.h
+++ b/src/VBox/Runtime/testcase/tstRTR0MemUserKernel.h
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0MemUserKernel.h $ */
+/* $Id: tstRTR0MemUserKernel.h 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT R0 Testcase - User & Kernel Memory, common header.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0MemUserKernelDriver.cpp b/src/VBox/Runtime/testcase/tstRTR0MemUserKernelDriver.cpp
index dddcb775c..3f5e9de6d 100644
--- a/src/VBox/Runtime/testcase/tstRTR0MemUserKernelDriver.cpp
+++ b/src/VBox/Runtime/testcase/tstRTR0MemUserKernelDriver.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0MemUserKernelDriver.cpp $ */
+/* $Id: tstRTR0MemUserKernelDriver.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Thread Preemption, driver program.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0SemMutex.cpp b/src/VBox/Runtime/testcase/tstRTR0SemMutex.cpp
index 944180755..26368f9eb 100644
--- a/src/VBox/Runtime/testcase/tstRTR0SemMutex.cpp
+++ b/src/VBox/Runtime/testcase/tstRTR0SemMutex.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0SemMutex.cpp $ */
+/* $Id: tstRTR0SemMutex.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Mutex Semaphores.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0SemMutex.h b/src/VBox/Runtime/testcase/tstRTR0SemMutex.h
index ee5cf4d5e..020383c60 100644
--- a/src/VBox/Runtime/testcase/tstRTR0SemMutex.h
+++ b/src/VBox/Runtime/testcase/tstRTR0SemMutex.h
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0SemMutex.h $ */
+/* $Id: tstRTR0SemMutex.h 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Mutex Semaphores, common header.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0SemMutexDriver.cpp b/src/VBox/Runtime/testcase/tstRTR0SemMutexDriver.cpp
index 6ac25ff1f..10c5054d3 100644
--- a/src/VBox/Runtime/testcase/tstRTR0SemMutexDriver.cpp
+++ b/src/VBox/Runtime/testcase/tstRTR0SemMutexDriver.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0SemMutexDriver.cpp $ */
+/* $Id: tstRTR0SemMutexDriver.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Thread Preemption, driver program.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0Timer.cpp b/src/VBox/Runtime/testcase/tstRTR0Timer.cpp
index 4700ad5a7..21992a5ea 100644
--- a/src/VBox/Runtime/testcase/tstRTR0Timer.cpp
+++ b/src/VBox/Runtime/testcase/tstRTR0Timer.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0Timer.cpp $ */
+/* $Id: tstRTR0Timer.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Timers.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0Timer.h b/src/VBox/Runtime/testcase/tstRTR0Timer.h
index 8699490f0..5ecddd4cf 100644
--- a/src/VBox/Runtime/testcase/tstRTR0Timer.h
+++ b/src/VBox/Runtime/testcase/tstRTR0Timer.h
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0Timer.h $ */
+/* $Id: tstRTR0Timer.h 32736 2010-09-23 16:19:46Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Timers, common header.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp b/src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp
index 8b34cbd1a..f0d190f8c 100644
--- a/src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp
+++ b/src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTR0TimerDriver.cpp $ */
+/* $Id: tstRTR0TimerDriver.cpp 32753 2010-09-24 09:57:49Z vboxsync $ */
/** @file
* IPRT R0 Testcase - Timers, driver program.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTS3.cpp b/src/VBox/Runtime/testcase/tstRTS3.cpp
index 6dda00540..a5456df1b 100644
--- a/src/VBox/Runtime/testcase/tstRTS3.cpp
+++ b/src/VBox/Runtime/testcase/tstRTS3.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTS3.cpp $ */
+/* $Id: tstRTS3.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Simple Storage Service (S3) Communication API
*/
diff --git a/src/VBox/Runtime/testcase/tstRTSemEventMulti.cpp b/src/VBox/Runtime/testcase/tstRTSemEventMulti.cpp
index 3857a4c3e..598ae803b 100644
--- a/src/VBox/Runtime/testcase/tstRTSemEventMulti.cpp
+++ b/src/VBox/Runtime/testcase/tstRTSemEventMulti.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTSemEventMulti.cpp $ */
+/* $Id: tstRTSemEventMulti.cpp 32970 2010-10-07 10:08:00Z vboxsync $ */
/** @file
* IPRT Testcase - Multiple Release Event Semaphores.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTSemRW.cpp b/src/VBox/Runtime/testcase/tstRTSemRW.cpp
index 06575bce2..7032f240b 100644
--- a/src/VBox/Runtime/testcase/tstRTSemRW.cpp
+++ b/src/VBox/Runtime/testcase/tstRTSemRW.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTSemRW.cpp $ */
+/* $Id: tstRTSemRW.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Reader/Writer Semaphore.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTSemXRoads.cpp b/src/VBox/Runtime/testcase/tstRTSemXRoads.cpp
index 86169536c..30aea892f 100644
--- a/src/VBox/Runtime/testcase/tstRTSemXRoads.cpp
+++ b/src/VBox/Runtime/testcase/tstRTSemXRoads.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTSemXRoads.cpp $ */
+/* $Id: tstRTSemXRoads.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - RTSemXRoads.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTSort.cpp b/src/VBox/Runtime/testcase/tstRTSort.cpp
index 0bc0e8371..dff8aec79 100644
--- a/src/VBox/Runtime/testcase/tstRTSort.cpp
+++ b/src/VBox/Runtime/testcase/tstRTSort.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTSort.cpp $ */
+/* $Id: tstRTSort.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Sorting.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTStrAlloc.cpp b/src/VBox/Runtime/testcase/tstRTStrAlloc.cpp
index 6f49cb0eb..2ebcef989 100644
--- a/src/VBox/Runtime/testcase/tstRTStrAlloc.cpp
+++ b/src/VBox/Runtime/testcase/tstRTStrAlloc.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTStrAlloc.cpp $ */
+/* $Id: tstRTStrAlloc.cpp 33285 2010-10-21 09:41:51Z vboxsync $ */
/** @file
* IPRT Testcase - String allocation APIs and related manipulators.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTStrCache.cpp b/src/VBox/Runtime/testcase/tstRTStrCache.cpp
index ef466554b..6078eb90b 100644
--- a/src/VBox/Runtime/testcase/tstRTStrCache.cpp
+++ b/src/VBox/Runtime/testcase/tstRTStrCache.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTStrCache.cpp $ */
+/* $Id: tstRTStrCache.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - StrCache.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTStrCatCopy.cpp b/src/VBox/Runtime/testcase/tstRTStrCatCopy.cpp
index 36ab67683..3b1f09e8d 100644
--- a/src/VBox/Runtime/testcase/tstRTStrCatCopy.cpp
+++ b/src/VBox/Runtime/testcase/tstRTStrCatCopy.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTStrCatCopy.cpp $ */
+/* $Id: tstRTStrCatCopy.cpp 33678 2010-11-02 10:30:46Z vboxsync $ */
/** @file
* IPRT Testcase - String Concatenation and Copy.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTStrFormat.cpp b/src/VBox/Runtime/testcase/tstRTStrFormat.cpp
index ae67d8c06..37bb36976 100644
--- a/src/VBox/Runtime/testcase/tstRTStrFormat.cpp
+++ b/src/VBox/Runtime/testcase/tstRTStrFormat.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTStrFormat.cpp $ */
+/* $Id: tstRTStrFormat.cpp 37966 2011-07-14 13:39:15Z vboxsync $ */
/** @file
* IPRT Testcase - String formatting.
*/
@@ -589,6 +589,17 @@ int main()
CHECKSTR(pszBuf2);
/*
+ * x86 register formatting.
+ */
+ RTTestSub(hTest, "x86 register format types (%RAx86[*])");
+ CHECK42("%RAx86[cr0]", UINT64_C(0x80000011), "80000011{PE,ET,PG}");
+ CHECK42("%RAx86[cr0]", UINT64_C(0x80000001), "80000001{PE,PG}");
+ CHECK42("%RAx86[cr0]", UINT64_C(0x00000001), "00000001{PE}");
+ CHECK42("%RAx86[cr0]", UINT64_C(0x80000000), "80000000{PG}");
+ CHECK42("%RAx86[cr4]", UINT64_C(0x80000001), "80000001{VME,unkn=80000000}");
+ CHECK42("%#RAx86[cr4]", UINT64_C(0x80000001), "0x80000001{VME,unkn=0x80000000}");
+
+ /*
* Custom types.
*/
RTTestSub(hTest, "Custom format types (%R[*])");
diff --git a/src/VBox/Runtime/testcase/tstRTStrVersion.cpp b/src/VBox/Runtime/testcase/tstRTStrVersion.cpp
index 6f7ee8209..fe85f0c5f 100644
--- a/src/VBox/Runtime/testcase/tstRTStrVersion.cpp
+++ b/src/VBox/Runtime/testcase/tstRTStrVersion.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTStrVersion.cpp $ */
+/* $Id: tstRTStrVersion.cpp 37016 2011-05-09 17:48:43Z vboxsync $ */
/** @file
* IPRT Testcase - Version String Comparison.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTSymlink.cpp b/src/VBox/Runtime/testcase/tstRTSymlink.cpp
index 007db683a..c284f368e 100644
--- a/src/VBox/Runtime/testcase/tstRTSymlink.cpp
+++ b/src/VBox/Runtime/testcase/tstRTSymlink.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTSymlink.cpp $ */
+/* $Id: tstRTSymlink.cpp 33806 2010-11-05 17:20:15Z vboxsync $ */
/** @file
* IPRT Testcase - Symbolic Links.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTSystemQueryDmi.cpp b/src/VBox/Runtime/testcase/tstRTSystemQueryDmi.cpp
index a92b22ba1..7e23ec58a 100644
--- a/src/VBox/Runtime/testcase/tstRTSystemQueryDmi.cpp
+++ b/src/VBox/Runtime/testcase/tstRTSystemQueryDmi.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTSystemQueryDmi.cpp $ */
+/* $Id: tstRTSystemQueryDmi.cpp 30320 2010-06-21 08:35:09Z vboxsync $ */
/** @file
* IPRT Testcase - RTSystemQueryDmi*.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTSystemQueryOsInfo.cpp b/src/VBox/Runtime/testcase/tstRTSystemQueryOsInfo.cpp
index d2febda33..ec22f4095 100644
--- a/src/VBox/Runtime/testcase/tstRTSystemQueryOsInfo.cpp
+++ b/src/VBox/Runtime/testcase/tstRTSystemQueryOsInfo.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTSystemQueryOsInfo.cpp $ */
+/* $Id: tstRTSystemQueryOsInfo.cpp 30320 2010-06-21 08:35:09Z vboxsync $ */
/** @file
* IPRT Testcase - RTSystemQueryOSInfo.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTTemp.cpp b/src/VBox/Runtime/testcase/tstRTTemp.cpp
index 1b3b31a1d..c3d107296 100644
--- a/src/VBox/Runtime/testcase/tstRTTemp.cpp
+++ b/src/VBox/Runtime/testcase/tstRTTemp.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTTemp.cpp $ */
+/* $Id: tstRTTemp.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Temporary files and directories.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTThreadExecutionTime.cpp b/src/VBox/Runtime/testcase/tstRTThreadExecutionTime.cpp
index 4050791c9..b5a814c53 100644
--- a/src/VBox/Runtime/testcase/tstRTThreadExecutionTime.cpp
+++ b/src/VBox/Runtime/testcase/tstRTThreadExecutionTime.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTThreadExecutionTime.cpp $ */
+/* $Id: tstRTThreadExecutionTime.cpp 34629 2010-12-02 17:09:09Z vboxsync $ */
/** @file
* IPRT Testcase - RTThreadGetExecution.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTThreadPoke.cpp b/src/VBox/Runtime/testcase/tstRTThreadPoke.cpp
index 47588db89..2e2938e4d 100644
--- a/src/VBox/Runtime/testcase/tstRTThreadPoke.cpp
+++ b/src/VBox/Runtime/testcase/tstRTThreadPoke.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTThreadPoke.cpp $ */
+/* $Id: tstRTThreadPoke.cpp 35351 2010-12-27 17:04:17Z vboxsync $ */
/** @file
* IPRT Testcase - RTThreadPoke.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTTimeSpec.cpp b/src/VBox/Runtime/testcase/tstRTTimeSpec.cpp
index 08f5cc90b..27ce88943 100644
--- a/src/VBox/Runtime/testcase/tstRTTimeSpec.cpp
+++ b/src/VBox/Runtime/testcase/tstRTTimeSpec.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTTimeSpec.cpp $ */
+/* $Id: tstRTTimeSpec.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT - RTTimeSpec and PRTTIME tests.
*/
diff --git a/src/VBox/Runtime/testcase/tstRTUuid.cpp b/src/VBox/Runtime/testcase/tstRTUuid.cpp
index 692bcb941..10bd5ecaf 100644
--- a/src/VBox/Runtime/testcase/tstRTUuid.cpp
+++ b/src/VBox/Runtime/testcase/tstRTUuid.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRTUuid.cpp $ */
+/* $Id: tstRTUuid.cpp 32996 2010-10-08 08:12:41Z vboxsync $ */
/** @file
* IPRT Testcase - UUID.
*/
diff --git a/src/VBox/Runtime/testcase/tstRand.cpp b/src/VBox/Runtime/testcase/tstRand.cpp
index cf82e6e74..5f9277045 100644
--- a/src/VBox/Runtime/testcase/tstRand.cpp
+++ b/src/VBox/Runtime/testcase/tstRand.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstRand.cpp $ */
+/* $Id: tstRand.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT - Testcase for the RTRand API.
*/
diff --git a/src/VBox/Runtime/testcase/tstSemMutex.cpp b/src/VBox/Runtime/testcase/tstSemMutex.cpp
index d3b6722c7..d99c75829 100644
--- a/src/VBox/Runtime/testcase/tstSemMutex.cpp
+++ b/src/VBox/Runtime/testcase/tstSemMutex.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstSemMutex.cpp $ */
+/* $Id: tstSemMutex.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Simple Mutex Semaphore Smoke Test.
*/
diff --git a/src/VBox/Runtime/testcase/tstSemPingPong.cpp b/src/VBox/Runtime/testcase/tstSemPingPong.cpp
index c35564731..3a6032e81 100644
--- a/src/VBox/Runtime/testcase/tstSemPingPong.cpp
+++ b/src/VBox/Runtime/testcase/tstSemPingPong.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstSemPingPong.cpp $ */
+/* $Id: tstSemPingPong.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - RTSemPing/RTSemPong.
*/
diff --git a/src/VBox/Runtime/testcase/tstStrSimplePattern.cpp b/src/VBox/Runtime/testcase/tstStrSimplePattern.cpp
index f9f11cc64..8525cd9cb 100644
--- a/src/VBox/Runtime/testcase/tstStrSimplePattern.cpp
+++ b/src/VBox/Runtime/testcase/tstStrSimplePattern.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstStrSimplePattern.cpp $ */
+/* $Id: tstStrSimplePattern.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - RTStrSimplePattern.
*/
diff --git a/src/VBox/Runtime/testcase/tstStrToNum.cpp b/src/VBox/Runtime/testcase/tstStrToNum.cpp
index 4f73c7aad..4cb516a04 100644
--- a/src/VBox/Runtime/testcase/tstStrToNum.cpp
+++ b/src/VBox/Runtime/testcase/tstStrToNum.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstStrToNum.cpp $ */
+/* $Id: tstStrToNum.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - String To Number Conversion.
*/
diff --git a/src/VBox/Runtime/testcase/tstTSC.cpp b/src/VBox/Runtime/testcase/tstTSC.cpp
index eeee218a7..b9d21f04d 100644
--- a/src/VBox/Runtime/testcase/tstTSC.cpp
+++ b/src/VBox/Runtime/testcase/tstTSC.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstTSC.cpp $ */
+/* $Id: tstTSC.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */
/** @file
* IPRT Testcase - SMP TSC testcase.
*/
diff --git a/src/VBox/Runtime/testcase/tstTermCallbacks.cpp b/src/VBox/Runtime/testcase/tstTermCallbacks.cpp
index e72e16b55..7405145a3 100644
--- a/src/VBox/Runtime/testcase/tstTermCallbacks.cpp
+++ b/src/VBox/Runtime/testcase/tstTermCallbacks.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstTermCallbacks.cpp $ */
+/* $Id: tstTermCallbacks.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Termination Callbacks.
*/
diff --git a/src/VBox/Runtime/testcase/tstThread-1.cpp b/src/VBox/Runtime/testcase/tstThread-1.cpp
index b83d2fa83..3fa81fafc 100644
--- a/src/VBox/Runtime/testcase/tstThread-1.cpp
+++ b/src/VBox/Runtime/testcase/tstThread-1.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstThread-1.cpp $ */
+/* $Id: tstThread-1.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Thread Testcase no.1.
*/
diff --git a/src/VBox/Runtime/testcase/tstTime-2.cpp b/src/VBox/Runtime/testcase/tstTime-2.cpp
index 52277e253..db46c5268 100644
--- a/src/VBox/Runtime/testcase/tstTime-2.cpp
+++ b/src/VBox/Runtime/testcase/tstTime-2.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstTime-2.cpp $ */
+/* $Id: tstTime-2.cpp 29279 2010-05-09 23:29:11Z vboxsync $ */
/** @file
* IPRT Testcase - Simple RTTime test.
*/
diff --git a/src/VBox/Runtime/testcase/tstTime-3.cpp b/src/VBox/Runtime/testcase/tstTime-3.cpp
index e5ba1e803..36936f30c 100644
--- a/src/VBox/Runtime/testcase/tstTime-3.cpp
+++ b/src/VBox/Runtime/testcase/tstTime-3.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstTime-3.cpp $ */
+/* $Id: tstTime-3.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Simple RTTime test.
*/
diff --git a/src/VBox/Runtime/testcase/tstTime-4.cpp b/src/VBox/Runtime/testcase/tstTime-4.cpp
index 06895b858..41b2857c9 100644
--- a/src/VBox/Runtime/testcase/tstTime-4.cpp
+++ b/src/VBox/Runtime/testcase/tstTime-4.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstTime-4.cpp $ */
+/* $Id: tstTime-4.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Simple RTTime vs. RTTimeSystem test.
*/
diff --git a/src/VBox/Runtime/testcase/tstTime.cpp b/src/VBox/Runtime/testcase/tstTime.cpp
index 6396e4d04..8ff537a50 100644
--- a/src/VBox/Runtime/testcase/tstTime.cpp
+++ b/src/VBox/Runtime/testcase/tstTime.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstTime.cpp $ */
+/* $Id: tstTime.cpp 29279 2010-05-09 23:29:11Z vboxsync $ */
/** @file
* IPRT Testcase - Simple RTTime tests.
*/
diff --git a/src/VBox/Runtime/testcase/tstTimer.cpp b/src/VBox/Runtime/testcase/tstTimer.cpp
index 81175de86..c2295987c 100644
--- a/src/VBox/Runtime/testcase/tstTimer.cpp
+++ b/src/VBox/Runtime/testcase/tstTimer.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstTimer.cpp $ */
+/* $Id: tstTimer.cpp 32431 2010-09-11 18:02:17Z vboxsync $ */
/** @file
* IPRT Testcase - Timers.
*/
diff --git a/src/VBox/Runtime/testcase/tstTimerLR.cpp b/src/VBox/Runtime/testcase/tstTimerLR.cpp
index e8584fb25..5afca3c54 100644
--- a/src/VBox/Runtime/testcase/tstTimerLR.cpp
+++ b/src/VBox/Runtime/testcase/tstTimerLR.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstTimerLR.cpp $ */
+/* $Id: tstTimerLR.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
/** @file
* IPRT Testcase - Low Resolution Timers.
*/
diff --git a/src/VBox/Runtime/testcase/tstUtf8.cpp b/src/VBox/Runtime/testcase/tstUtf8.cpp
index 453115dc1..f68586002 100644
--- a/src/VBox/Runtime/testcase/tstUtf8.cpp
+++ b/src/VBox/Runtime/testcase/tstUtf8.cpp
@@ -1,4 +1,4 @@
-/* $Id: tstUtf8.cpp $ */
+/* $Id: tstUtf8.cpp 33595 2010-10-29 10:35:00Z vboxsync $ */
/** @file
* IPRT Testcase - UTF-8 and UTF-16 string conversions.
*/
diff --git a/src/VBox/Runtime/testcase/tstVector.cpp b/src/VBox/Runtime/testcase/tstVector.cpp
new file mode 100644
index 000000000..ecc07e6ab
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstVector.cpp
@@ -0,0 +1,234 @@
+/* $Id: tstVector.cpp 37829 2011-07-08 08:35:47Z vboxsync $ */
+/** @file
+ * IPRT Testcase - Vector container structure.
+ */
+
+/*
+ * Copyright (C) 2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+* Header Files *
+*******************************************************************************/
+#include <iprt/test.h>
+#include <iprt/vector.h>
+
+#include <stdlib.h> /* For realloc */
+
+/** Counter of the number of delete calls made so far */
+static unsigned s_cDeleteCalls = 0;
+
+/** Record the argument of the delete function here. */
+static void *s_apvDeleteArg[10];
+
+/** Dummy delete function for vector-of-void pointer elements */
+static void deletePVoid(void **ppv)
+{
+ if (s_cDeleteCalls < RT_ELEMENTS(s_apvDeleteArg))
+ s_apvDeleteArg[s_cDeleteCalls] = *ppv;
+ ++s_cDeleteCalls;
+}
+
+/** Dummy delete by value function for vector-of-void pointer elements */
+static void deletePVoidValue(void *pv)
+{
+ if (s_cDeleteCalls < RT_ELEMENTS(s_apvDeleteArg))
+ s_apvDeleteArg[s_cDeleteCalls] = pv;
+ ++s_cDeleteCalls;
+}
+
+/* Start by instantiating each function once for syntax checking */
+RTVEC_DECL_STRUCT(tstInstance, void *)
+RTVEC_DECL_STRUCT(tstInstance2, void *)
+
+RTVEC_DECLFN_DELETE_ADAPTER_ID(tstInstance, void *)
+RTVEC_DECLFN_DELETE_ADAPTER_TO_VALUE(tstInstance, void *)
+
+RTVEC_DECLFN_SIZE(tstInstance, void *)
+RTVEC_DECLFN_RESERVE(tstInstance, void *, rtvecReallocDefTag)
+RTVEC_DECLFN_BEGIN(tstInstance, void *)
+RTVEC_DECLFN_END(tstInstance, void *)
+RTVEC_DECLFN_PUSHBACK(tstInstance, void *)
+RTVEC_DECLFN_POPBACK(tstInstance)
+RTVEC_DECLFN_POPBACK_DELETE(tstInstance2, void *, deletePVoid,
+ tstInstanceDeleteAdapterId)
+RTVEC_DECLFN_CLEAR(tstInstance)
+RTVEC_DECLFN_CLEAR_DELETE(tstInstance2, deletePVoid,
+ tstInstanceDeleteAdapterId)
+RTVEC_DECLFN_DETACH(tstInstance, void *)
+
+RTVEC_DECL(tstSimple, void *)
+
+static void testVectorSimple(RTTEST hTest)
+{
+ RTTestISub("Vector structure, no cleanup callback");
+
+ struct tstSimple myVec = RTVEC_INITIALIZER;
+ void **ppvVal;
+
+ RTTESTI_CHECK(tstSimpleSize(&myVec) == 0);
+
+ ppvVal = tstSimplePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ RTTESTI_CHECK(ppvVal == tstSimpleBegin(&myVec));
+ RTTESTI_CHECK(ppvVal + 1 == tstSimpleEnd(&myVec));
+ RTTESTI_CHECK(tstSimpleSize(&myVec) == 1);
+ *ppvVal = (void *)1;
+
+ ppvVal = tstSimplePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ RTTESTI_CHECK(ppvVal - 1 == tstSimpleBegin(&myVec));
+ RTTESTI_CHECK(ppvVal + 1 == tstSimpleEnd(&myVec));
+ RTTESTI_CHECK(tstSimpleSize(&myVec) == 2);
+ RTTESTI_CHECK(ppvVal[-1] == (void *)1);
+
+ *ppvVal = (void *)3;
+ ppvVal = tstSimplePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ RTTESTI_CHECK(ppvVal - 2 == tstSimpleBegin(&myVec));
+ RTTESTI_CHECK(ppvVal + 1 == tstSimpleEnd(&myVec));
+ RTTESTI_CHECK(tstSimpleSize(&myVec) == 3);
+ RTTESTI_CHECK(ppvVal[-2] == (void *)1);
+ RTTESTI_CHECK(ppvVal[-1] == (void *)3);
+
+ tstSimplePopBack(&myVec);
+ RTTESTI_CHECK(tstSimpleBegin(&myVec) + 2 == tstSimpleEnd(&myVec));
+ RTTESTI_CHECK(*tstSimpleBegin(&myVec) == (void *)1);
+ RTTESTI_CHECK(*(tstSimpleEnd(&myVec) - 1) == (void *)3);
+
+ tstSimpleClear(&myVec);
+ RTTESTI_CHECK(tstSimpleBegin(&myVec) == tstSimpleEnd(&myVec));
+ ppvVal = tstSimplePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ RTTESTI_CHECK(ppvVal == tstSimpleBegin(&myVec));
+ RTTESTI_CHECK(ppvVal + 1 == tstSimpleEnd(&myVec));
+
+ tstSimpleClear(&myVec);
+ ppvVal = tstSimplePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ *ppvVal = (void *)1;
+ ppvVal = tstSimplePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ *ppvVal = (void *)3;
+ ppvVal = tstSimplePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ *ppvVal = (void *)2;
+ ppvVal = tstSimpleDetach(&myVec);
+ RTTESTI_CHECK(tstSimpleBegin(&myVec) == NULL);
+ RTTESTI_CHECK(tstSimpleSize(&myVec) == 0);
+ RTTESTI_CHECK(ppvVal[0] == (void *)1);
+ RTTESTI_CHECK(ppvVal[1] == (void *)3);
+ RTTESTI_CHECK(ppvVal[2] == (void *)2);
+}
+
+RTVEC_DECL_DELETE(tstDelete, void *, deletePVoid)
+
+static void testVectorDelete(RTTEST hTest)
+{
+ RTTestISub("Vector structure with cleanup by pointer callback");
+
+ struct tstDelete myVec = RTVEC_INITIALIZER;
+ void **ppvVal;
+
+ ppvVal = tstDeletePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ *ppvVal = (void *)1;
+ ppvVal = tstDeletePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ *ppvVal = (void *)3;
+ ppvVal = tstDeletePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ *ppvVal = (void *)2;
+
+ s_cDeleteCalls = 0;
+ tstDeletePopBack(&myVec);
+ RTTESTI_CHECK(s_cDeleteCalls == 1);
+ RTTESTI_CHECK(s_apvDeleteArg[0] == (void *)2);
+ RTTESTI_CHECK(tstDeleteBegin(&myVec) + 2 == tstDeleteEnd(&myVec));
+ RTTESTI_CHECK(*tstDeleteBegin(&myVec) == (void *)1);
+ RTTESTI_CHECK(*(tstDeleteEnd(&myVec) - 1) == (void *)3);
+
+ s_cDeleteCalls = 0;
+ tstDeleteClear(&myVec);
+ RTTESTI_CHECK(s_cDeleteCalls == 2);
+ RTTESTI_CHECK(s_apvDeleteArg[0] == (void *)1);
+ RTTESTI_CHECK(s_apvDeleteArg[1] == (void *)3);
+ RTTESTI_CHECK(tstDeleteBegin(&myVec) == tstDeleteEnd(&myVec));
+ ppvVal = tstDeletePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ RTTESTI_CHECK(ppvVal == tstDeleteBegin(&myVec));
+ RTTESTI_CHECK(ppvVal + 1 == tstDeleteEnd(&myVec));
+}
+
+RTVEC_DECL_DELETE_BY_VALUE(tstDeleteValue, void *, deletePVoidValue)
+
+static void testVectorDeleteValue(RTTEST hTest)
+{
+ RTTestISub("Vector structure with cleanup by value callback");
+
+ struct tstDeleteValue myVec = RTVEC_INITIALIZER;
+ void **ppvVal;
+
+ ppvVal = tstDeleteValuePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ *ppvVal = (void *)1;
+ ppvVal = tstDeleteValuePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ *ppvVal = (void *)3;
+ ppvVal = tstDeleteValuePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ *ppvVal = (void *)2;
+
+ s_cDeleteCalls = 0;
+ tstDeleteValuePopBack(&myVec);
+ RTTESTI_CHECK(s_cDeleteCalls == 1);
+ RTTESTI_CHECK(s_apvDeleteArg[0] == (void *)2);
+ RTTESTI_CHECK( tstDeleteValueBegin(&myVec) + 2
+ == tstDeleteValueEnd(&myVec));
+ RTTESTI_CHECK(*tstDeleteValueBegin(&myVec) == (void *)1);
+ RTTESTI_CHECK(*(tstDeleteValueEnd(&myVec) - 1) == (void *)3);
+
+ s_cDeleteCalls = 0;
+ tstDeleteValueClear(&myVec);
+ RTTESTI_CHECK(s_cDeleteCalls == 2);
+ RTTESTI_CHECK(s_apvDeleteArg[0] == (void *)1);
+ RTTESTI_CHECK(s_apvDeleteArg[1] == (void *)3);
+ RTTESTI_CHECK(tstDeleteValueBegin(&myVec) == tstDeleteValueEnd(&myVec));
+ ppvVal = tstDeleteValuePushBack(&myVec);
+ /* AssertPtrReturnVoid(ppvVal); */
+ RTTESTI_CHECK(ppvVal == tstDeleteValueBegin(&myVec));
+ RTTESTI_CHECK(ppvVal + 1 == tstDeleteValueEnd(&myVec));
+}
+
+
+
+int main()
+{
+ RTTEST hTest;
+ RTEXITCODE rcExit = RTTestInitAndCreate("tstVector", &hTest);
+ if (rcExit != RTEXITCODE_SUCCESS)
+ return rcExit;
+
+ testVectorSimple(hTest);
+ testVectorDelete(hTest);
+ testVectorDeleteValue(hTest);
+
+ return RTTestSummaryAndDestroy(hTest);
+}
diff --git a/src/VBox/Runtime/tools/Makefile.kmk b/src/VBox/Runtime/tools/Makefile.kmk
index 684ecc244..51b953cac 100644
--- a/src/VBox/Runtime/tools/Makefile.kmk
+++ b/src/VBox/Runtime/tools/Makefile.kmk
@@ -1,4 +1,4 @@
-# $Id: Makefile.kmk $
+# $Id: Makefile.kmk 34673 2010-12-03 00:51:42Z vboxsync $
## @file
# Sub-Makefile for the IPRT tools.
#
diff --git a/src/VBox/Runtime/tools/RTGzip.cpp b/src/VBox/Runtime/tools/RTGzip.cpp
index 197a74f63..0f771229c 100644
--- a/src/VBox/Runtime/tools/RTGzip.cpp
+++ b/src/VBox/Runtime/tools/RTGzip.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTGzip.cpp $ */
+/* $Id: RTGzip.cpp 34464 2010-11-29 13:45:37Z vboxsync $ */
/** @file
* IPRT - GZIP Utility.
*/
diff --git a/src/VBox/Runtime/tools/RTLdrFlt.cpp b/src/VBox/Runtime/tools/RTLdrFlt.cpp
index 9e3876da5..993475cef 100644
--- a/src/VBox/Runtime/tools/RTLdrFlt.cpp
+++ b/src/VBox/Runtime/tools/RTLdrFlt.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTLdrFlt.cpp $ */
+/* $Id: RTLdrFlt.cpp 34464 2010-11-29 13:45:37Z vboxsync $ */
/** @file
* IPRT - Utility for translating addresses into symbols+offset.
*/
@@ -149,7 +149,7 @@ int main(int argc, char **argv)
break;
case 'V':
- RTPrintf("$Revision: 68240 $");
+ RTPrintf("$Revision: 34464 $");
return RTEXITCODE_SUCCESS;
case VINF_GETOPT_NOT_OPTION:
diff --git a/src/VBox/Runtime/tools/RTManifest.cpp b/src/VBox/Runtime/tools/RTManifest.cpp
index 385d271b9..e31133f49 100644
--- a/src/VBox/Runtime/tools/RTManifest.cpp
+++ b/src/VBox/Runtime/tools/RTManifest.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTManifest.cpp $ */
+/* $Id: RTManifest.cpp 34466 2010-11-29 15:00:56Z vboxsync $ */
/** @file
* IPRT - Manifest Utility.
*/
diff --git a/src/VBox/Runtime/tools/RTTar.cpp b/src/VBox/Runtime/tools/RTTar.cpp
index 34e53ca9d..a44d4f5b9 100644
--- a/src/VBox/Runtime/tools/RTTar.cpp
+++ b/src/VBox/Runtime/tools/RTTar.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTTar.cpp $ */
+/* $Id: RTTar.cpp 34464 2010-11-29 13:45:37Z vboxsync $ */
/** @file
* IPRT - TAR Utility.
*/
diff --git a/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp b/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp
index 0da4c41a0..c4cbd2356 100644
--- a/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp
+++ b/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp
@@ -1,4 +1,4 @@
-/* $Id: RTErrConvertFromWin32.cpp $ */
+/* $Id: RTErrConvertFromWin32.cpp 33437 2010-10-25 16:28:14Z vboxsync $ */
/** @file
* IPRT - Convert win32 error codes to iprt status codes.
*/
diff --git a/src/VBox/Runtime/win/errmsgwin.cpp b/src/VBox/Runtime/win/errmsgwin.cpp
index 0f5c54466..fed8a0a82 100644
--- a/src/VBox/Runtime/win/errmsgwin.cpp
+++ b/src/VBox/Runtime/win/errmsgwin.cpp
@@ -1,4 +1,4 @@
-/* $Id: errmsgwin.cpp $ */
+/* $Id: errmsgwin.cpp 35445 2011-01-10 11:05:23Z vboxsync $ */
/** @file
* IPRT - Status code messages.
*/