12#pragma optimize("",off) 
   67# ifdef CreateSemaphore 
   68#   undef CreateSemaphore 
   71# ifdef AcquireSemaphore 
   72#   undef AcquireSemaphore; 
   75# ifdef ReleaseSemaphore 
   76#   undef ReleaseSemaphore 
   79# ifdef DeleteSemaphore 
   80#   undef DeleteSemaphore 
   84#  define INVALID_HANDLE_VALUE -1 
  101#include "mmprivate.h" 
  105#if defined(R__UNIX) && !defined(R__WINGCC) 
  107#include <sys/types.h> 
  110#if !defined(WIN32) && !defined(R__MACOSX) 
  117#if defined(R__LINUX) || defined(R__LYNXOS) || defined(R__HURD) 
  135         if (
mf->IsWritable())
 
  148         return mf->GetMmallocDesc();
 
  269   char  *cleanup = 
nullptr;
 
  296      Error(
"TMapFile", 
"error expanding path %s", 
name);
 
  309      Error(
"TMapFile", 
"file %s already exists", 
fname);
 
  318         Error(
"TMapFile", 
"no write permission, could not open file %s", 
fname);
 
  324         Error(
"TMapFile", 
"file %s does not exist", 
fname);
 
  328         Error(
"TMapFile", 
"no read permission, could not open file %s", 
fname);
 
  364         SysError(
"TMapFile", 
"file %s can not be opened for reading", 
fname);
 
  381      if (
mapto == (
void *)-1) {
 
  382         Error(
"TMapFile", 
"no memory mapped file capability available\n" 
  383                           "Use rootn.exe or link application against \"-lNew\"");
 
  386            Error(
"TMapFile", 
"mapped file not in mmalloc format or\n" 
  387                              "already open in RW mode by another process");
 
  389            Error(
"TMapFile", 
"mapped file not in mmalloc format");
 
  409         Error(
"TMapFile", 
"map file %s (%d) incompatible with current ROOT version (%d)",
 
  423         Warning(
"TMapFile", 
"map file already open in write mode, opening in read-only mode");
 
  437         cleanup        = 
mf->fOption;
 
  450         delete [] 
mf->fOption;
 
  462      gROOT->GetListOfMappedFiles()->AddLast(
this);
 
  469         Error(
"TMapFile", 
"map file is not writable");
 
  495      gROOT->GetListOfMappedFiles()->AddLast(
this);
 
  505   if (cleanup) 
delete [] cleanup;
 
 
  667      if (
all || 
mr->fObject == obj) {
 
  670            const char *
cname = 
mr->fObject->ClassName();
 
  674            mr->fBuffer = 
new char[
mr->fBufSize];
 
  679         b->MapObject(
mr->fObject);  
 
  680         mr->fObject->Streamer(*
b);
 
  681         mr->fBufSize = 
b->BufferSize() + 8; 
 
  682         mr->fBuffer  = 
b->Buffer();
 
 
  708      if (
mr->fObject == obj) {
 
 
  811         if (!
mr->fBufSize) 
goto release;
 
  820            Error(
"Get", 
"cannot create new object of class %s", 
mr->GetClassName(
fOffset));
 
 
  858   if (fSemaphore != -1) {
 
  864   char buffer[] =
"ROOT_Semaphore_xxxxxxxx";
 
  866   if (!pid) fSemaphore = 
getpid();
 
 
  910#if defined(R__FBSD) || defined(R__OBSD) 
  937         Error(
"AcquireSemaphore", 
"cannot update mapping");
 
 
  953#if defined(R__FBSD) || defined(R__OBSD) 
 
  984      Error(
"Close", 
"shadow map == 0, should never happen!");
 
  991      gROOT->GetListOfMappedFiles()->Remove(
this);
 
 
 1047             (
float)
size/1048576);
 
 1050      Printf(
"Option:               file closed");
 
 
 1106      ((
TMapFile*)
this)->AcquireSemaphore();
 
 1108      Printf(
"%-20s %-20s %-10s", 
"Object", 
"Class", 
"Size");
 
 1110         Printf(
"*** no objects stored in memory mapped file ***");
 
 1119      ((
TMapFile*)
this)->ReleaseSemaphore();
 
 
 1246void TMapFile::operator 
delete(
void *ptr)
 
 1251   TObject::operator 
delete(ptr);
 
 
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
 
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
 
unsigned long ULongptr_t
Unsigned integer large enough to hold a pointer (platform-dependent)
 
const char Option_t
Option string (const char)
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
 
struct SetFreeIfTMapFile_t gSetFreeIfTMapFile
 
#define INVALID_HANDLE_VALUE
 
R__EXTERN TVirtualMutex * gROOTMutex
 
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
 
char * StrDup(const char *str)
Duplicate the string str.
 
R__EXTERN TSystem * gSystem
 
#define R__LOCKGUARD(mutex)
 
Using a TBrowser one can browse all ROOT objects.
 
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
 
TClass instances represent classes, structs and namespaces in the ROOT type system.
 
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
 
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
 
A ROOT file is structured in Directories (like a file system).
 
virtual void Build(TFile *motherFile=nullptr, TDirectory *motherDir=nullptr)
 
virtual Bool_t cd()
Change current directory to "this" directory.
 
void SetName(const char *newname) override
Set the name for directory If the directory name is changed after the directory was written once,...
 
virtual void SetMother(TObject *mother)
 
Utility class for browsing TMapFile objects.
 
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
 
void Add(TObject *obj) override
 
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
 
This class implements a shared memory region mapped to a file.
 
static TMapFile * WhichMapFile(void *addr)
 
void * GetBreakval() const
Return the current location in the memory region for this malloc heap which represents the end of mem...
 
Int_t fWritten
Number of objects written so far.
 
static TMapFile * Create(const char *name, Option_t *option="READ", Int_t size=kDefaultMapSize, const char *title="")
Create a memory mapped file.
 
TMapRec * fLast
Last object in list of shared objects.
 
Int_t fVersion
ROOT version (or -1 for shadow map file)
 
Bool_t IsFolder() const override
Returns kTRUE in case object is a folder (i.e. contains browsable lists).
 
ULongptr_t fBaseAddr
Base address of mapped memory region.
 
const char * GetName() const override
Returns name of object.
 
void ls(Option_t *option="") const override
List contents of TMapFile.
 
TDirectory * fDirectory
Pointer to directory associated to this mapfile.
 
void SumBuffer(Int_t bufsize)
Increment statistics for buffer sizes of objects in this file.
 
const char * GetTitle() const override
Returns title of object.
 
TObject * Get(const char *name, TObject *retObj=nullptr)
Return pointer to object retrieved from shared memory.
 
void Print(Option_t *option="") const override
Print some info about the mapped file.
 
char * fTitle
Title of mapped file.
 
void InitDirectory()
Create the directory associated to this mapfile.
 
void RemoveAll()
Remove all objects from shared memory.
 
Double_t fSum2Buffer
Sum of squares of buffer sizes of objects written so far.
 
Bool_t fWritable
TRUE if mapped file opened in RDWR mode.
 
Longptr_t fOffset
Offset in bytes for region mapped by reader.
 
void Close(Option_t *option="") override
Close a mapped file.
 
void * OrgAddress(void *addr) const
 
Bool_t cd(const char *path=nullptr)
Cd to associated directory.
 
void DeleteSemaphore()
Delete the semaphore.
 
Longptr_t fSemaphore
Modification semaphore (or getpid() for WIN32)
 
TList * fBrowseList
List of KeyMapFile objects.
 
TMapRec * fFirst
List of streamed objects is shared memory.
 
~TMapFile() override
TMapFiles may not be deleted, since we want to keep the complete TMapFile object in the mapped file f...
 
ULongptr_t fhSemaphore
HANDLE of WIN32 Mutex object to implement semaphore.
 
static void * MapToAddress()
Return the base address at which we would like the next TMapFile's mapped data to start.
 
void Update(TObject *obj=nullptr)
Update an object (or all objects, if obj == 0) in shared memory.
 
TObject * fGetting
Don't deadlock in update mode, when from Get() Add() is called.
 
TMapFile * FindShadowMapFile()
Returns shadow map file.
 
void * fMmallocDesc
Pointer to mmalloc descriptor.
 
Double_t fSumBuffer
Sum of buffer sizes of objects written so far.
 
static void * fgMmallocDesc
Used in Close() and operator delete()
 
void CreateSemaphore(Int_t pid=0)
Create semaphore used for synchronizing access to shared memory.
 
Longptr_t fFd
Descriptor of mapped file.
 
Int_t fSize
Original start size of memory mapped region.
 
TObject * Remove(TObject *obj, Bool_t lock)
Remove object from shared memory.
 
Int_t ReleaseSemaphore()
Release semaphore. Returns 0 if OK, -1 on error.
 
static void SetMapAddress(Longptr_t addr)
Set preferred map address.
 
char * fName
Name of mapped file.
 
TMapFile()
Default ctor. Does not much except setting some basic values.
 
char * fOption
Directory creation options.
 
Int_t AcquireSemaphore()
Acquire semaphore. Returns 0 if OK, -1 on error.
 
void Browse(TBrowser *b) override
Browse contents of TMapFile.
 
void Add(const TObject *obj, const char *name="")
Add an object to the list of objects to be stored in shared memory.
 
static Longptr_t fgMapAddress
Map to this address, set address via SetMapAddress()
 
Int_t GetBestBuffer()
Return the best buffer size for objects in this file.
 
TMapRec * GetFirst() const
 
Keep track of an object in the mapped file.
 
TObject * fObject
Pointer to original object.
 
Int_t fBufSize
Buffer size.
 
TMapRec(const TMapRec &)=delete
 
TMapRec * fNext
Next MapRec in list.
 
TObject * GetObject() const
This method returns a pointer to the original object.
 
char * fClassName
Class name.
 
void * fBuffer
Buffer containing object of class name.
 
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
 
Wrapper around a TObject so it can be stored in a TList.
 
Mother of all ROOT objects.
 
virtual const char * GetName() const
Returns name of object.
 
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
 
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
 
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
 
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
 
static void SetDtorOnly(void *obj)
Set destructor only flag.
 
static Bool_t HasCustomNewDelete()
return the has custom delete flag
 
static void * ReAlloc(void *vp, size_t size, size_t oldsize)
Reallocate (i.e.
 
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
 
static void ResetErrno()
Static function resetting system error number.
 
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
 
static Int_t GetErrno()
Static function returning system error number.
 
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
 
virtual int Unlink(const char *name)
Unlink, i.e.
 
Abstract base class for TMapFile.
 
R__EXTERN TROOT * gROOTLocal
 
R__EXTERN GetMapFileMapllocDesc_t * gGetMapFileMallocDesc
 
R__EXTERN FreeIfTMapFile_t * gFreeIfTMapFile
 
R__EXTERN void * gMmallocDesc
 
Set ROOT::Internal::gFreeIfTMapFile on library load.