Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TMemFile.cxx
Go to the documentation of this file.
1 // @(#)root/io:$Id$
2 // Author: Philippe Canal, May 2011
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /**
13 \class TMemFile TMemFile.cxx
14 \ingroup IO
15 
16 A TMemFile is like a normal TFile except that it reads and writes
17 only from memory.
18 */
19 
20 #include "TBufferFile.h"
21 #include "TMemFile.h"
22 #include "TError.h"
23 #include "TSystem.h"
24 #include "TROOT.h"
25 #include "TArrayC.h"
26 #include "TKey.h"
27 #include "TClass.h"
28 #include "TVirtualMutex.h"
29 #include <errno.h>
30 #include <stdio.h>
31 #include <sys/stat.h>
32 
33 // The following snippet is used for developer-level debugging
34 #define TMemFile_TRACE
35 #ifndef TMemFile_TRACE
36 #define TRACE(x) \
37  Debug("TMemFile", "%s", x);
38 #else
39 #define TRACE(x);
40 #endif
41 
42 ClassImp(TMemFile);
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// Constructor allocating the memory buffer.
46 ///
47 /// \param size: size of the buffer to be allocated. A value of -1 means that
48 /// no allocation should happen, leaving fBuffer and fSize at 0.
49 ///
50 /// \param previous: previous TMemBlock, used to set up the linked list.
51 
52 TMemFile::TMemBlock::TMemBlock(Long64_t size, TMemBlock *previous) : fPrevious(previous)
53 {
54  // size will be -1 when copying an existing buffer into fBuffer.
55  if (size != -1) {
56  fBuffer = new UChar_t[size];
57  fSize = size;
58  }
59 }
60 
61 ////////////////////////////////////////////////////////////////////////////////
62 /// Constructor not allocating the memory buffer, for external ownership.
63 
64 TMemFile::TMemBlock::TMemBlock(UChar_t *data, Long64_t size) : fBuffer(data), fSize(size)
65 {
66 }
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 /// Usual destructors. Delete the block memory.
70 
71 TMemFile::TMemBlock::~TMemBlock()
72 {
73  delete fNext;
74  delete [] fBuffer;
75 }
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 
79 void TMemFile::TMemBlock::CreateNext(Long64_t size)
80 {
81  R__ASSERT(fNext == nullptr);
82  fNext = new TMemBlock(size,this);
83 }
84 
85 ////////////////////////////////////////////////////////////////////////////////
86 /// Parse option strings and set fOption.
87 TMemFile::EMode TMemFile::ParseOption(Option_t *option)
88 {
89  fOption = option;
90  fOption.ToUpper();
91  if (fOption == "NEW") fOption = "CREATE";
92 
93  EMode mode = EMode::kRead;
94  if (fOption == "CREATE")
95  mode = EMode::kCreate;
96  else if (fOption == "RECREATE")
97  mode = EMode::kRecreate;
98  else if (fOption == "UPDATE")
99  mode = EMode::kUpdate;
100  else {
101  fOption = "READ";
102  }
103 
104  return mode;
105 }
106 
107 ////////////////////////////////////////////////////////////////////////////////
108 /// Constructor to create a TMemFile re-using external C-Style storage.
109 
110 TMemFile::TMemFile(const char *path, const ZeroCopyView_t &datarange)
111  : TFile(path, "WEB", "read-only TMemFile", 0 /*compress*/),
112  fBlockList(reinterpret_cast<UChar_t *>(const_cast<char *>(datarange.fStart)), datarange.fSize),
113  fSize(datarange.fSize), fBlockSeek(&(fBlockList))
114 {
115  fD = 0;
116  fOption = "READ";
117  fWritable = kFALSE;
118 
119  // This is read-only, so become a zombie if created with an empty buffer
120  if (!fBlockList.fBuffer) {
121  MakeZombie();
122  gDirectory = gROOT;
123  return;
124  }
125 
126  Init(/* create */ false);
127 }
128 
129 ////////////////////////////////////////////////////////////////////////////////
130 /// Constructor to create a TMemFile re-using external storage.
131 
132 TMemFile::TMemFile(const char *path, ExternalDataPtr_t data)
133  : TMemFile(path, ZeroCopyView_t(data->data(), data->size()))
134 {
135  fExternalData = data;
136 }
137 
138 ////////////////////////////////////////////////////////////////////////////////////
139 /// Constructor to create a read-only TMemFile using an std::unique_ptr<TBufferFile>
140 
141 TMemFile::TMemFile(const char *name, std::unique_ptr<TBufferFile> buffer)
142  : TMemFile(name, ZeroCopyView_t(buffer->Buffer(), (size_t)buffer->BufferSize()))
143 {
144  assert(!fD && !fWritable);
145 
146  fIsOwnedByROOT = true;
147 
148  // Note: We need to release the buffer here to avoid double delete.
149  // The memory of a TBufferFile is allocated with new[], so we can let
150  // TMemBlock delete it, as its destructor calls "delete [] fBuffer;"
151  buffer.release();
152 }
153 
154 ////////////////////////////////////////////////////////////////////////////////
155 /// \brief Usual Constructor.
156 /// The defBlockSize parameter defines the size of the blocks of memory allocated
157 /// when expanding the underlying TMemFileBuffer. If the value 0 is passed, the
158 /// default block size, fgDefaultBlockSize, is adopted.
159 /// See the TFile constructor for details.
160 
161 TMemFile::TMemFile(const char *path, Option_t *option, const char *ftitle, Int_t compress, Long64_t defBlockSize)
162  : TMemFile(path, nullptr, -1, option, ftitle, compress, defBlockSize)
163 {
164 }
165 
166 ////////////////////////////////////////////////////////////////////////////////
167 /// Usual Constructor. See the TFile constructor for details. Copy data from buffer.
168 
169 TMemFile::TMemFile(const char *path, char *buffer, Long64_t size, Option_t *option, const char *ftitle, Int_t compress,
170  Long64_t defBlockSize)
171  : TFile(path, "WEB", ftitle, compress), fBlockList(size), fIsOwnedByROOT(kTRUE), fSize(size),
172  fBlockSeek(&(fBlockList))
173 {
174  fDefaultBlockSize = defBlockSize == 0LL ? fgDefaultBlockSize : defBlockSize;
175 
176  EMode optmode = ParseOption(option);
177 
178  if (NeedsToWrite(optmode)) {
179  Int_t mode = O_RDWR | O_CREAT;
180  if (optmode == EMode::kRecreate) mode |= O_TRUNC;
181 
182  fD = TMemFile::SysOpen(path, O_RDWR | O_CREAT, 0644);
183  if (fD == -1) {
184  SysError("TMemFile", "file %s can not be opened", path);
185  goto zombie;
186  }
187  fWritable = kTRUE;
188 
189  } else {
190  fD = TMemFile::SysOpen(path, O_RDONLY, 0644);
191  if (fD == -1) {
192  SysError("TMemFile", "file %s can not be opened for reading", path);
193  goto zombie;
194  }
195  fWritable = kFALSE;
196  }
197 
198  if (buffer)
199  SysWriteImpl(fD,buffer,size);
200 
201  Init(!NeedsExistingFile(optmode));
202  return;
203 
204 zombie:
205  // Error in opening file; make this a zombie
206  MakeZombie();
207  gDirectory = gROOT;
208 }
209 
210 ////////////////////////////////////////////////////////////////////////////////
211 /// Copying the content of the TMemFile into another TMemFile.
212 
213 TMemFile::TMemFile(const TMemFile &orig)
214  : TFile(orig.GetEndpointUrl()->GetUrl(), "WEB", orig.GetTitle(), orig.GetCompressionSettings()),
215  fBlockList(orig.GetEND()), fExternalData(orig.fExternalData), fIsOwnedByROOT(orig.fIsOwnedByROOT),
216  fSize(orig.GetEND()), fBlockSeek(&(fBlockList))
217 {
218  EMode optmode = ParseOption(orig.fOption);
219 
220  fD = orig.fD; // not really used, so it is okay to have the same value.
221  fWritable = orig.fWritable;
222 
223  if (!IsExternalData()) {
224  // We intentionally allocated just one big buffer for this object.
225  orig.CopyTo(fBlockList.fBuffer,fSize);
226  }
227 
228  Init(!NeedsExistingFile(optmode)); // A copy is
229 }
230 
231 
232 ////////////////////////////////////////////////////////////////////////////////
233 /// Close and clean-up file.
234 
235 TMemFile::~TMemFile()
236 {
237  // Need to call close, now as it will need both our virtual table
238  // and the content of the list of blocks
239  Close();
240  if (IsExternalData()) {
241  // Do not delete external buffer, we don't own it.
242  fBlockList.fBuffer = nullptr;
243  // We must not get extra blocks, as writing is disabled for external data!
244  R__ASSERT(!fBlockList.fNext && "External block is not the only one!");
245  }
246  TRACE("destroy")
247 }
248 
249 ////////////////////////////////////////////////////////////////////////////////
250 /// Copy the binary representation of the TMemFile into
251 /// the memory area starting at 'to' and of length at most 'maxsize'
252 /// returns the number of bytes actually copied.
253 
254 Long64_t TMemFile::CopyTo(void *to, Long64_t maxsize) const
255 {
256  Long64_t len = GetSize();
257  if (len > maxsize) {
258  len = maxsize;
259  }
260  Long64_t storedSysOffset = fSysOffset;
261  Long64_t storedBlockOffset = fBlockOffset;
262  TMemBlock *storedBlockSeek = fBlockSeek;
263 
264  const_cast<TMemFile*>(this)->SysSeek(fD, 0, SEEK_SET);
265  len = const_cast<TMemFile*>(this)->SysReadImpl(fD, to, len);
266 
267  const_cast<TMemFile*>(this)->fBlockSeek = storedBlockSeek;
268  const_cast<TMemFile*>(this)->fBlockOffset = storedBlockOffset;
269  const_cast<TMemFile*>(this)->fSysOffset = storedSysOffset;
270  return len;
271 }
272 
273 ////////////////////////////////////////////////////////////////////////////////
274 /// Copy the binary representation of the TMemFile into
275 /// the TBuffer tobuf
276 
277 void TMemFile::CopyTo(TBuffer &tobuf) const
278 {
279  const TMemBlock *current = &fBlockList;
280  while(current) {
281  tobuf.WriteFastArray(current->fBuffer,current->fSize);
282  current = current->fNext;
283  }
284 }
285 
286 ////////////////////////////////////////////////////////////////////////////////
287 /// Return the current size of the memory file
288 
289 Long64_t TMemFile::GetSize() const
290 {
291  // We could also attempt to read it from the beginning of the buffer
292  return fSize;
293 }
294 
295 ////////////////////////////////////////////////////////////////////////////////
296 
297 void TMemFile::Print(Option_t *option /* = "" */) const
298 {
299  Printf("TMemFile: name=%s, title=%s, option=%s", GetName(), GetTitle(), GetOption());
300  if (strcmp(option,"blocks")==0) {
301  const TMemBlock *current = &fBlockList;
302  Int_t counter = 0;
303  while(current) {
304  Printf("TMemBlock: %d size=%lld addr=%p curr=%p prev=%p next=%p",
305  counter,current->fSize,current->fBuffer,
306  current,current->fPrevious,current->fNext);
307  current = current->fNext;
308  ++counter;
309  }
310  } else {
311  GetList()->R__FOR_EACH(TObject,Print)(option);
312  }
313 }
314 
315 ////////////////////////////////////////////////////////////////////////////////
316 /// Wipe all the data from the permanent buffer but keep, the in-memory object
317 /// alive.
318 
319 void TMemFile::ResetAfterMerge(TFileMergeInfo *info)
320 {
321  ResetObjects(this,info);
322 
323  fNbytesKeys = 0;
324  fSeekKeys = 0;
325 
326  fMustFlush = kTRUE;
327  fInitDone = kFALSE;
328 
329  if (fFree) {
330  fFree->Delete();
331  delete fFree;
332  fFree = nullptr;
333  }
334  fWritten = 0;
335  fSumBuffer = 0;
336  fSum2Buffer = 0;
337  fBytesRead = 0;
338  fBytesReadExtra = 0;
339  fBytesWrite = 0;
340  delete fClassIndex;
341  fClassIndex = nullptr;
342  fSeekInfo = 0;
343  fNbytesInfo = 0;
344  delete fProcessIDs;
345  fProcessIDs = nullptr;
346  fNProcessIDs = 0;
347  fOffset = 0;
348  fCacheRead = 0;
349  fCacheWrite = 0;
350  fReadCalls = 0;
351  if (fFree) {
352  fFree->Delete();
353  delete fFree;
354  fFree = nullptr;
355  }
356 
357  fSysOffset = 0;
358  fBlockSeek = &fBlockList;
359  fBlockOffset = 0;
360  {
361  R__LOCKGUARD(gROOTMutex);
362  gROOT->GetListOfFiles()->Remove(this);
363  }
364 
365  {
366  TDirectory::TContext ctxt(this);
367  Init(kTRUE);
368 
369  // And now we need re-initilize the directories ...
370 
371  TIter next(this->GetList());
372  TObject *idcur;
373  while ((idcur = next())) {
374  if (idcur->IsA() == TDirectoryFile::Class()) {
375  ((TDirectoryFile*)idcur)->ResetAfterMerge(info);
376  }
377  }
378 
379  }
380 }
381 
382 ////////////////////////////////////////////////////////////////////////////////
383 /// Wipe all the data from the permanent buffer but keep, the in-memory object
384 /// alive.
385 
386 void TMemFile::ResetObjects(TDirectoryFile *directory, TFileMergeInfo *info) const
387 {
388  if (directory->GetListOfKeys()) {
389  TIter next(directory->GetListOfKeys());
390  TKey *key;
391  while( (key = (TKey*)next()) ) {
392  if (nullptr == directory->GetList()->FindObject(key->GetName())) {
393  Warning("ResetObjects","Key/Object %s is not attached to the directory %s and can not be ResetAfterMerge correctly",
394  key->GetName(),directory->GetName());
395  }
396  }
397  directory->GetListOfKeys()->Delete("slow");
398  }
399 
400  TString listHargs;
401  listHargs.Form("(TFileMergeInfo*)0x%lx",(ULong_t)info);
402 
403  TIter next(directory->GetList());
404  TObject *idcur;
405  while ((idcur = next())) {
406  TClass *objcl = idcur->IsA();
407  if (objcl == TDirectoryFile::Class()) {
408  ResetObjects((TDirectoryFile*)idcur,info);
409  } else if (objcl->GetResetAfterMerge()) {
410  (objcl->GetResetAfterMerge())(idcur,info);
411  } else if (idcur->IsA()->GetMethodWithPrototype("ResetAfterMerge", "TFileMergeInfo*") ) {
412  Int_t error = 0;
413  idcur->Execute("ResetAfterMerge", listHargs.Data(), &error);
414  if (error) {
415  Error("ResetObjects", "calling ResetAfterMerge() on '%s' failed.",
416  idcur->GetName());
417  }
418  } else {
419 // Error("ResetObjects","In %s, we can not reset %s (not ResetAfterMerge function)",
420 // directory->GetName(),idcur->GetName());
421  }
422  }
423 }
424 
425 ////////////////////////////////////////////////////////////////////////////////
426 /// Read specified number of bytes from current offset into the buffer.
427 /// See documentation for TFile::SysRead().
428 
429 Int_t TMemFile::SysReadImpl(Int_t, void *buf, Long64_t len)
430 {
431  TRACE("READ")
432 
433  if (fBlockSeek == nullptr || fBlockSeek->fBuffer == nullptr) {
434  errno = EBADF;
435  gSystem->SetErrorStr("The memory file is not open.");
436  return 0;
437  } else {
438  // Don't read past the end.
439  if (fSysOffset + len > fSize) {
440  len = fSize - fSysOffset;
441  }
442 
443  if (fBlockOffset+len <= fBlockSeek->fSize) {
444  // 'len' does not go past the end of the current block,
445  // so let's make a simple copy.
446  memcpy(buf,fBlockSeek->fBuffer+fBlockOffset,len);
447  fBlockOffset += len;
448  } else {
449  // We are going to have to copy data from more than one
450  // block.
451 
452  // First copy the end of the first block.
453  Int_t sublen = fBlockSeek->fSize - fBlockOffset;
454  memcpy(buf,fBlockSeek->fBuffer+fBlockOffset,sublen);
455 
456  // Move to the next.
457  buf = (char*)buf + sublen;
458  Int_t len_left = len - sublen;
459  fBlockSeek = fBlockSeek->fNext;
460 
461  // Copy all the full blocks that are covered by the request.
462  while (len_left > fBlockSeek->fSize) {
463  R__ASSERT(fBlockSeek);
464 
465  memcpy(buf, fBlockSeek->fBuffer, fBlockSeek->fSize);
466  buf = (char*)buf + fBlockSeek->fSize;
467  len_left -= fBlockSeek->fSize;
468  fBlockSeek = fBlockSeek->fNext;
469  }
470 
471  // Copy the data from the last block.
472  R__ASSERT(fBlockSeek);
473  memcpy(buf,fBlockSeek->fBuffer, len_left);
474  fBlockOffset = len_left;
475 
476  }
477  fSysOffset += len;
478  return len;
479  }
480 }
481 
482 
483 ////////////////////////////////////////////////////////////////////////////////
484 /// Read specified number of bytes from current offset into the buffer.
485 /// See documentation for TFile::SysRead().
486 
487 Int_t TMemFile::SysRead(Int_t fd, void *buf, Int_t len)
488 {
489  return SysReadImpl(fd, buf, len);
490 }
491 
492 ////////////////////////////////////////////////////////////////////////////////
493 /// Seek to a specified position in the file. See TFile::SysSeek().
494 /// Note that TMemFile does not support seeks when the file is open for write.
495 
496 Long64_t TMemFile::SysSeek(Int_t, Long64_t offset, Int_t whence)
497 {
498  TRACE("SEEK")
499  if (whence == SEEK_SET) {
500  fSysOffset = offset;
501  fBlockSeek = &fBlockList;
502  Long64_t counter = 0;
503  while(fBlockSeek->fNext && (counter+fBlockSeek->fSize) < fSysOffset)
504  {
505  counter += fBlockSeek->fSize;
506  fBlockSeek = fBlockSeek->fNext;
507  }
508  fBlockOffset = fSysOffset - counter; // If we seek past the 'end' of the file, we now have fBlockOffset > fBlockSeek->fSize
509  } else if (whence == SEEK_CUR) {
510 
511  if (offset == 0) {
512  // nothing to do, really
513  } else if (offset > 0) {
514  // Move forward.
515  if ( (fBlockOffset+offset) < fBlockSeek->fSize) {
516  fSysOffset += offset;
517  fBlockOffset += offset;
518  } else {
519  Long64_t counter = fSysOffset;
520  fSysOffset += offset;
521  while(fBlockSeek->fNext && counter < fSysOffset)
522  {
523  counter += fBlockSeek->fSize;
524  fBlockSeek = fBlockSeek->fNext;
525  }
526  fBlockOffset = fSysOffset - counter; // If we seek past the 'end' of the file, we now have fBlockOffset > fBlockSeek->fSize
527  }
528  } else {
529  // Move backward in the file (offset < 0).
530  Long64_t counter = fSysOffset;
531  fSysOffset += offset;
532  if (fSysOffset < 0) {
533  SysError("TMemFile", "Unable to seek past the beginning of file");
534  fSysOffset = 0;
535  fBlockSeek = &fBlockList;
536  fBlockOffset = 0;
537  return -1;
538  } else {
539  if (offset+fBlockOffset >= 0) {
540  // We are just moving in the current block.
541  fBlockOffset += offset;
542  } else {
543  while(fBlockSeek->fPrevious && counter > fSysOffset)
544  {
545  counter -= fBlockSeek->fSize;
546  fBlockSeek = fBlockSeek->fPrevious;
547  }
548  fBlockOffset = fSysOffset - counter;
549  }
550  }
551  }
552  } else if (whence == SEEK_END) {
553  if (offset > 0) {
554  SysError("TMemFile", "Unable to seek past end of file");
555  return -1;
556  }
557  if (fSize == -1) {
558  SysError("TMemFile", "Unable to seek to end of file");
559  return -1;
560  }
561  fSysOffset = fSize;
562  } else {
563  SysError("TMemFile", "Unknown whence!");
564  return -1;
565  }
566  return fSysOffset;
567 }
568 
569 ////////////////////////////////////////////////////////////////////////////////
570 /// Open a file in 'MemFile'.
571 
572 Int_t TMemFile::SysOpen(const char * /* pathname */, Int_t /* flags */, UInt_t /* mode */)
573 {
574  if (!fBlockList.fBuffer) {
575  fBlockList.fBuffer = new UChar_t[fDefaultBlockSize];
576  fBlockList.fSize = fDefaultBlockSize;
577  fSize = fDefaultBlockSize;
578  }
579  if (fBlockList.fBuffer) {
580  return 0;
581  } else {
582  return -1;
583  }
584 }
585 
586 ////////////////////////////////////////////////////////////////////////////////
587 /// Close the mem file.
588 
589 Int_t TMemFile::SysClose(Int_t /* fd */)
590 {
591  return 0;
592 }
593 
594 ////////////////////////////////////////////////////////////////////////////////
595 /// Write a buffer into the file.
596 
597 Int_t TMemFile::SysWriteImpl(Int_t /* fd */, const void *buf, Long64_t len)
598 {
599  TRACE("WRITE")
600 
601  if (IsExternalData()) {
602  gSystem->SetErrorStr("A memory file with shared data is read-only.");
603  return 0;
604  }
605 
606  if (fBlockList.fBuffer == 0) {
607  errno = EBADF;
608  gSystem->SetErrorStr("The memory file is not open.");
609  return 0;
610  } else {
611  if (fBlockOffset+len <= fBlockSeek->fSize) {
612  // 'len' does not go past the end of the current block,
613  // so let's make a simple copy.
614  memcpy(fBlockSeek->fBuffer+fBlockOffset,buf,len);
615  fBlockOffset += len;
616  } else {
617  // We are going to have to copy data into more than one
618  // block.
619 
620  // First copy to the end of the first block.
621  Int_t sublen = fBlockSeek->fSize - fBlockOffset;
622  memcpy(fBlockSeek->fBuffer+fBlockOffset,buf,sublen);
623 
624  // Move to the next.
625  buf = (char*)buf + sublen;
626  Int_t len_left = len - sublen;
627  if (!fBlockSeek->fNext) {
628  fBlockSeek->CreateNext(fDefaultBlockSize);
629  fSize += fDefaultBlockSize;
630  }
631  fBlockSeek = fBlockSeek->fNext;
632 
633  // Copy all the full blocks that are covered by the request.
634  while (len_left > fBlockSeek->fSize) {
635  R__ASSERT(fBlockSeek);
636 
637  memcpy(fBlockSeek->fBuffer, buf, fBlockSeek->fSize);
638  buf = (char*)buf + fBlockSeek->fSize;
639  len_left -= fBlockSeek->fSize;
640  if (!fBlockSeek->fNext) {
641  fBlockSeek->CreateNext(fDefaultBlockSize);
642  fSize += fDefaultBlockSize;
643  }
644  fBlockSeek = fBlockSeek->fNext;
645  }
646 
647  // Copy the data from the last block.
648  R__ASSERT(fBlockSeek);
649  memcpy(fBlockSeek->fBuffer, buf, len_left);
650  fBlockOffset = len_left;
651 
652  }
653  fSysOffset += len;
654  return len;
655  }
656 }
657 
658 ////////////////////////////////////////////////////////////////////////////////
659 /// Write a buffer into the file.
660 
661 Int_t TMemFile::SysWrite(Int_t fd, const void *buf, Int_t len)
662 {
663  return SysWriteImpl(fd,buf,len);
664 }
665 
666 ////////////////////////////////////////////////////////////////////////////////
667 /// Perform a stat on the file; see TFile::SysStat().
668 
669 Int_t TMemFile::SysStat(Int_t, Long_t* /* id */, Long64_t* /* size */, Long_t* /* flags */, Long_t* /* modtime */)
670 {
671  MayNotUse("SysStat");
672  return 0;
673 }
674 
675 ////////////////////////////////////////////////////////////////////////////////
676 /// Sync remaining data to disk.
677 /// Nothing to do here.
678 
679 Int_t TMemFile::SysSync(Int_t)
680 {
681  return 0;
682 }
683 
684 ////////////////////////////////////////////////////////////////////////////////
685 /// Simply calls TSystem::ResetErrno().
686 
687 void TMemFile::ResetErrno() const
688 {
689  TSystem::ResetErrno();
690 }