110#define _XOPEN_SOURCE 600
119#include <sys/xattr.h>
124# include <sys/types.h>
129#include "RConfigure.h"
163#define ROOT_compiledata_cxx
164#include "compiledata.h"
170#include "ROOT/InternalIOUtils.hxx"
181#include <sys/extattr.h>
202#define getxattr(path, name, value, size) getxattr(path, name, value, size, 0u, 0)
205#define getxattr(path, name, value, size) extattr_get_file(path, EXTATTR_NAMESPACE_USER, name, value, size)
214static struct AddPseudoGlobals {
231 Info(
"TFile",
"default ctor");
381 ::Fatal(
"TFile::TFile",
"ROOT system not initialized");
383 auto zombify = [
this] {
387 gROOT->GetListOfClosedObjects()->Add(
this);
399 "please use TFile::Open to access remote files:\n\tauto f = std::unique_ptr<TFile>{TFile::Open(\"%s\")};",
478 if (!create && !recreate && !
update && !read) {
485 if (!fname1 || !fname1[0]) {
486 Error(
"TFile",
"file name is not specified");
492 if (!strcmp(fname1,
"/dev/null") &&
512 Error(
"TFile",
"error expanding path %s", fname1);
528 SysError(
"TFile",
"could not delete %s (errno: %d)",
539 Error(
"TFile",
"file %s already exists", fname.
Data());
549 Error(
"TFile",
"no write permission, could not open file %s", fname.
Data());
556 Error(
"TFile",
"file %s does not exist", fname.
Data());
561 Error(
"TFile",
"no read permission, could not open file %s", fname.
Data());
575 SysError(
"TFile",
"file %s can not be opened", fname.
Data());
587 SysError(
"TFile",
"file %s can not be opened for reading", fname.
Data());
628 gROOT->GetListOfClosedObjects()->Remove(
this);
639 Info(
"~TFile",
"dtor called for %s [%zx]",
GetName(),(
size_t)
this);
665 Error(
"Init",
"archive %s can only be opened in read mode",
GetName());
684 Error(
"Init",
"member %s not found in archive %s",
707 if (
gEnv->
GetValue(
"TFile.v630forwardCompatibility", 0) == 1)
727 char *header =
new char[
kBEGIN+200];
732 Error(
"Init",
"%s failed to read the file type data.",
739 if (strncmp(header,
"root", 4)) {
745 char *buffer = header + 4;
748 frombuf(buffer, &headerLength);
751 Int_t send,sfree,sinfo;
772 if (fBEGIN < 0 || fBEGIN >
fEND) {
774 Error(
"Init",
"file %s has an incorrect header length (%lld) or incorrect end of file length (%lld)",
786 Warning(
"Init",
"file %s probably not closed, cannot read free segments",
GetName());
791 char *buffer_keyloc =
nullptr;
796 Error(
"Init",
"file %s has an incorrect header length (%lld) or incorrect end of file length (%lld)",
803 header =
new char[nbytes];
808 Error(
"Init",
"%s failed to read the file header information at %lld (size=%d)",
814 buffer_keyloc = header;
817 buffer_keyloc = header+
fBEGIN;
820 frombuf(buffer,&version); versiondir = version%1000;
825 if (version > 1000) {
830 Int_t sdir,sparent,skeys;
838 buffer_keyloc +=
sizeof(
Int_t);
840 frombuf(buffer_keyloc, &keyversion);
842 if (keyversion > 1000) {
849 cname.ReadBuffer(buffer_keyloc);
850 cname.ReadBuffer(buffer_keyloc);
853 if (fNbytesName < 10 || fNbytesName > 10000) {
854 Error(
"Init",
"cannot read directory info of file %s",
GetName());
871 if (
gEnv->
GetValue(
"TFile.v630forwardCompatibility", 0) == 1)
895 Error(
"Init",
"file %s is truncated at %lld bytes: should be %lld, "
898 Error(
"Init",
"file %s is truncated at %lld bytes: should be %lld",
904 Warning(
"Init",
"file %s probably not closed, "
905 "trying to recover",
GetName());
913 Warning(
"Init",
"successfully recovered %d keys", nrecov);
915 Warning(
"Init",
"no keys recovered, file has been made a Zombie");
923 gROOT->GetListOfFiles()->Add(
this);
929 Int_t lenIndex =
gROOT->GetListOfStreamerInfo()->GetSize()+1;
930 if (lenIndex < 5000) lenIndex = 5000;
937 gROOT->GetListOfFiles()->Remove(
this);
944 const auto separator =
fVersion < 63200 ?
"/" :
".";
945 const auto thisVersion =
gROOT->GetVersionInt();
946 const auto msg =
"no StreamerInfo found in %s therefore preventing schema evolution when reading this file. "
947 "The file was produced with ROOT version %d.%02d%s%02d, "
948 "while the current version is %d.%02d.%02d";
952 thisVersion / 10000, (thisVersion / 100) % (100), thisVersion % 100);
962 while ((key = (
TKey*)next())) {
973 gROOT->GetListOfClosedObjects()->Add(
this);
1021 while ((key = iter()) !=
nullptr) {
1079 gROOT->GetListOfFiles()->Remove(
this);
1080 gROOT->GetListOfBrowsers()->RecursiveRemove(
this);
1081 gROOT->GetListOfClosedObjects()->Add(
this);
1092 return new TKey(obj,
name, bufsize, mother);
1100 return new TKey(obj, cl,
name, bufsize, mother);
1112 static TFile *currentFile =
nullptr;
1125 Info(
"Delete",
"deleting name = %s", namecycle);
1155 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFileDrawMap"))) {
1156 if (
h->LoadPlugin() == -1) {
1157 ::Error(
"TFile::Open",
"Failed to load plugin TFileDrawMap");
1160 h->ExecPlugin(3,
this, keys,
option);
1199 tobuf(buffer, version);
1215 if (
result >= (
double)std::numeric_limits<Int_t>::max()) {
1216 return std::numeric_limits<Int_t>::max() -1;
1232 Int_t nbytes, objlen, nwh = 64;
1233 char *header =
new char[
fBEGIN];
1239 while (idcur <
fEND-100) {
1254 if (nbytes == 0)
break;
1260 if (!objlen) objlen = nbytes-keylen;
1262 uncomp += keylen + objlen;
1332 if (first <
fBEGIN)
return 0;
1333 if (first >
fEND)
return 0;
1335 Int_t nread = maxbytes;
1336 if (first+maxbytes >
fEND) nread =
fEND-maxbytes;
1338 Warning(
"GetRecordHeader",
"%s: parameter maxbytes = %d must be >= 4",
1344 Warning(
"GetRecordHeader",
"%s: failed to read header data (maxbytes = %d)",
1355 if (nb < 0)
return nread;
1357 const Int_t headerSize = 16;
1358 if (nread < headerSize)
return nread;
1363 if (!olen) olen = nbytes-klen;
1382 Error(
"GetSize",
"cannot stat the file %s",
GetName());
1408 TList *list =
nullptr;
1411 auto key = std::make_unique<TKey>(
this);
1412 auto buffer = std::make_unique<char[]>(
fNbytesInfo+1);
1413 auto buf = buffer.get();
1417 Warning(
"GetRecordHeader",
"%s: failed to read the StreamerInfo data from disk.",
1419 return {
nullptr, 1, hash};
1422 if (lookupSICache) {
1429 Info(
"GetStreamerInfo",
"The streamer info record for file %s has already been treated, skipping it.",
GetName());
1430 for(
auto uid : *si_uids)
1432 return {
nullptr, 0, hash};
1436 return {
nullptr, 1, hash};
1437 list =
dynamic_cast<TList*
>(key->ReadObjWithBuffer(buffer.get()));
1440 list = (
TList*)
Get(
"StreamerInfo");
1444 Info(
"GetStreamerInfoList",
"cannot find the StreamerInfo record in file %s",
1446 return {
nullptr, 1, hash};
1449 return {list, 0, hash};
1516 if(!newfree)
return;
1520 if (nbytesl > 2000000000) nbytesl = 2000000000;
1522 char buffer[
sizeof(
Int_t)];
1523 char *pbuffer = buffer;
1524 tobuf(pbuffer, nbytes);
1596 const bool forComp = options.
Contains(
"forcomp");
1597 const bool extended = options.
Contains(
"extended");
1599 const unsigned char nDigits = std::log10(
fEND) + 1;
1601 std::optional<ROOT::Detail::TKeyMapNode> lastNode;
1603 for (
const auto &key : tkeyInfos) {
1605 switch (key.fType) {
1607 Printf(
"Address = %" PRIu64
"\tNbytes = %u\t=====E R R O R=======", key.fAddr, key.fLen);
1611 Printf(
"Address = %" PRIu64
"\tNbytes = %d\t=====G A P===========", key.fAddr, -key.fLen);
1617 extrainfo.
Form(
" name: %-16s title: %s", key.fKeyName.c_str(), key.fKeyTitle.c_str());
1621 if (key.fObjLen !=
static_cast<Int_t>(key.fLen) - key.fKeyLen) {
1622 Float_t cx =
static_cast<float>(key.fObjLen + key.fKeyLen) / key.fLen;
1623 Printf(
"At:%-*" PRIu64
" N=%-8u K=%-3d O=%-8d %-14s CX = %5.2f %s", nDigits + 1, key.fAddr, key.fLen,
1624 key.fKeyLen, key.fObjLen, key.fClassName.c_str(), cx, extrainfo.
Data());
1626 Printf(
"At:%-*" PRIu64
" N=%-8u K=%-3d O=%-8d %-14s CX = 1 %s", nDigits + 1, key.fAddr, key.fLen,
1627 key.fKeyLen, key.fObjLen, key.fClassName.c_str(), extrainfo.
Data());
1632 if (key.fObjLen !=
static_cast<Int_t>(key.fLen) - key.fKeyLen) {
1633 Float_t cx =
static_cast<float>(key.fObjLen + key.fKeyLen) / key.fLen;
1634 Printf(
"%d/%06d At:%-*" PRIu64
" N=%-8u %-14s CX = %5.2f %s", date, time, nDigits + 1, key.fAddr,
1635 key.fLen, key.fClassName.c_str(), cx, extrainfo.
Data());
1637 Printf(
"%d/%06d At:%-*" PRIu64
" N=%-8u %-14s %s", date, time, nDigits + 1, key.fAddr,
1638 key.fLen, key.fClassName.c_str(), extrainfo.
Data());
1645 Int_t datime = lastNode ? lastNode->fDatime : 0;
1648 Printf(
"%d/%06d At:%-*lld N=%-8d %-14s", date, time, nDigits + 1,
fEND, 1,
"END");
1650 Printf(
"At:%-*lld N=%-8d K= O= %-14s", nDigits + 1,
fEND, 1,
"END");
1668 static constexpr int headerSize = 512;
1670 const std::uint64_t idcur = fCurAddr;
1673 return std::nullopt;
1676 auto nread = headerSize;
1677 if (idcur + nread >=
end)
1678 nread =
end - idcur - 1;
1680 char header[headerSize];
1688 char *buffer = header;
1706 frombuf(buffer, &node.fKeyVersion);
1707 frombuf(buffer, &node.fObjLen);
1708 frombuf(buffer, &node.fDatime);
1709 frombuf(buffer, &node.fKeyLen);
1710 frombuf(buffer, &node.fCycle);
1711 if (node.fKeyVersion > 1000) {
1712 frombuf(buffer, &node.fSeekKey);
1713 frombuf(buffer, &node.fSeekPdir);
1718 node.fSeekKey =
static_cast<Long64_t>(skey);
1719 node.fSeekPdir =
static_cast<Long64_t>(sdir);
1722 const auto readString = [&buffer, &header](
bool skipCheck =
false) {
1723 std::uint8_t stringLenShort;
1724 std::uint32_t stringLen;
1725 if (!skipCheck && ((buffer - header) >= headerSize)) {
1728 frombuf(buffer, &stringLenShort);
1729 if (stringLenShort == 0xFF)
1732 stringLen = stringLenShort;
1734 if ((buffer - header) + stringLen > headerSize)
1735 stringLen = headerSize - (buffer - header);
1740 str = std::string(buffer, stringLen);
1741 buffer += stringLen;
1746 node.fClassName = readString(
true);
1749 node.fClassName =
"FreeSegments";
1751 node.fClassName =
"StreamerInfo";
1753 node.fClassName =
"KeysList";
1755 node.fKeyName = readString();
1756 node.fKeyTitle = readString();
1776 Printf(
"TFile: name=%s, title=%s, option=%s", GetName(), GetTitle(), GetOption());
1798 if ((st = ReadBufferViaCache(buf,
len))) {
1807 while ((siz = SysRead(fD, buf,
len)) < 0 && GetErrno() == EINTR)
1811 SysError(
"ReadBuffer",
"error reading from file %s", GetName());
1815 Error(
"ReadBuffer",
"error reading all requested bytes from file %s, got %ld of %d",
1843 if ((st = ReadBufferViaCache(buf,
len))) {
1854 while ((siz = SysRead(fD, buf,
len)) < 0 && GetErrno() == EINTR)
1858 SysError(
"ReadBuffer",
"error reading from file %s", GetName());
1862 Error(
"ReadBuffer",
"error reading all requested bytes from file %s, got %ld of %d",
1892 for (
Int_t j = 0; j < nbuf; j++) {
1893 if (ReadBufferAsync(pos[j],
len[j])) {
1903 fCacheRead =
nullptr;
1906 char *buf2 =
nullptr;
1909 cur = pos[i]+
len[i];
1911 if (cur -curbegin < fgReadaheadSize) {
n++; i++; bigRead =
kFALSE;}
1912 if (bigRead || (i>=nbuf)) {
1924 if (!buf2) buf2 =
new char[fgReadaheadSize];
1931 for (
Int_t j=0;j<
n;j++) {
1932 memcpy(&buf[k],&buf2[pos[i-
n+j]-curbegin],
len[i-
n+j]);
1937 fBytesReadExtra += extra;
1938 fBytesRead -= extra;
1939 fgBytesRead -= extra;
1942 curbegin = i < nbuf ? pos[i] : 0;
1945 if (buf2)
delete [] buf2;
1960 Int_t st = fCacheRead->ReadBuffer(buf, off,
len);
1965 SetOffset(off +
len);
1972 if (fWritable && fCacheWrite) {
1973 if (fCacheWrite->ReadBuffer(buf, off,
len) == 0) {
1974 SetOffset(off +
len);
1995 if (fNbytesFree < 0 || fNbytesFree > fEND) {
1999 TKey *headerfree =
new TKey(fSeekFree, fNbytesFree,
this);
2008 if (afree->
GetLast() > fEND)
break;
2021 TObjArray *pids = GetListOfProcessIDs();
2031 snprintf(pidname,32,
"ProcessID%d",pidf);
2034 printf(
"ReadProcessID, name=%s, file=%s, pid=%zx\n",pidname,GetName(),(
size_t)pid);
2043 TIter next(pidslist);
2060 p->IncrementCount();
2120 if ((
size = GetSize()) == -1) {
2121 Error(
"Recover",
"cannot stat the file %s", GetName());
2127 if (fWritable && !fFree) fFree =
new TList;
2131 while (idcur < fEND) {
2133 int nread =
sizeof(header);
2136 if (idcur+nread >= fEND) nread = fEND-idcur-1;
2139 Error(
"Recover",
"%s: failed to read the key data from disk at %lld.",
2143 char *buffer = header;
2147 Error(
"Recover",
"Address = %lld\tNbytes = %d\t=====E R R O R=======", idcur, nbytes);
2152 if (fWritable)
new TFree(fFree,idcur,idcur-nbytes-1);
2167 if (versionkey > 1000) {
2176 frombuf(buffer, &classnameLen);
2177 char classname[101];
2178 if (classnameLen <= 0 || classnameLen > (
Int_t)
sizeof(classname))
2180 memcpy(classname, buffer, classnameLen);
2181 buffer += classnameLen;
2182 classname[
static_cast<std::size_t
>(classnameLen)] =
'\0';
2187 && strcmp(classname,
"TBasket")) {
2189 char *bufread = header;
2191 if (!keyRead || !strcmp(key->
GetName(),
"StreamerInfo")) {
2192 fSeekInfo = seekkey;
2194 fNbytesInfo = nbytes;
2200 Info(
"Recover",
"%s, recovered key %s:%s at address %lld",GetName(),key->
GetClassName(),key->
GetName(),idcur);
2207 if (max_file_size < fEND) max_file_size = fEND+1000000000;
2210 last->
AddFree(fFree,fEND,max_file_size);
2212 new TFree(fFree,fEND,max_file_size);
2214 if (nrecov) Write();
2237 if (opt !=
"READ" && opt !=
"UPDATE") {
2238 Error(
"ReOpen",
"mode must be either READ or UPDATE, not %s", opt.
Data());
2242 if (opt == fOption || (opt ==
"UPDATE" && fOption ==
"CREATE"))
2245 if (opt ==
"READ") {
2249 if (IsOpen() && IsWritable()) {
2250 WriteStreamerInfo();
2276 fD = SysOpen(fRealName, O_RDONLY, 0666);
2278 fD = SysOpen(fRealName, O_RDONLY | O_BINARY, S_IREAD | S_IWRITE);
2281 SysError(
"ReOpen",
"file %s can not be opened in read mode", GetName());
2298 fD = SysOpen(fRealName, O_RDWR | O_CREAT, 0666);
2300 fD = SysOpen(fRealName, O_RDWR | O_CREAT | O_BINARY, S_IREAD | S_IWRITE);
2303 SysError(
"ReOpen",
"file %s can not be opened in update mode", GetName());
2309 if (fSeekFree > fBEGIN)
2312 Warning(
"ReOpen",
"file %s probably not closed, cannot read free segments", GetName());
2325 fOffset =
offset + fArchiveOffset;
2333 Error(
"SetOffset",
"seeking from end in archive is not (yet) supported");
2348 offset += fArchiveOffset;
2357 Error(
"Seek",
"seeking from end in archive is not (yet) supported");
2361 if ((retpos = SysSeek(fD,
offset, whence)) < 0)
2362 SysError(
"Seek",
"cannot seek to position %lld in file %s, retpos=%lld",
2363 offset, GetName(), retpos);
2376 if (fCompress < 0) {
2379 int level = fCompress % 100;
2380 fCompress = 100 * algorithm + level;
2389 if (level < 0) level = 0;
2390 if (level > 99) level = 99;
2391 if (fCompress < 0) {
2395 int algorithm = fCompress / 100;
2397 fCompress = 100 * algorithm + level;
2408 fCompress = settings;
2436 if (cache) fCacheReadMap->Add(tree, cache);
2441 fCacheReadMap->Remove(tree);
2442 if (tpf && (tpf->
GetFile() ==
this) && (action != kDoNotDisconnect)) tpf->
SetFile(0, action);
2445 if (cache) cache->
SetFile(
this, action);
2446 else if (!tree && fCacheRead && (action != kDoNotDisconnect)) fCacheRead->SetFile(0, action);
2458 if (!cache && fCacheWrite)
delete fCacheWrite;
2459 fCacheWrite = cache;
2475 if (
b.IsReading()) {
2488 fSumBuffer +=
double(bufsize);
2506 if (!IsWritable()) {
2507 if (!TestBit(kWriteError)) {
2509 Warning(
"Write",
"file %s not opened in write mode", GetName());
2515 if (!GetTitle() || strlen(GetTitle()) == 0)
2516 Info(
"Write",
"writing name = %s", GetName());
2518 Info(
"Write",
"writing name = %s title = %s", GetName(), GetTitle());
2523 WriteStreamerInfo();
2536 Error(
"Write const",
"A const TFile object should not be saved. We try to proceed anyway.");
2537 return const_cast<TFile*
>(
this)->Write(
n, opt, bufsize);
2546 if (IsOpen() && fWritable) {
2549 if ((st = WriteBufferViaCache(buf,
len))) {
2557 while ((siz = SysWrite(fD, buf,
len)) < 0 && GetErrno() == EINTR)
2562 SetBit(kWriteError); SetWritable(
kFALSE);
2563 SysError(
"WriteBuffer",
"error writing to file %s (%ld)", GetName(), (
Long_t)siz);
2567 SetBit(kWriteError);
2568 Error(
"WriteBuffer",
"error writing all requested bytes to file %s, wrote %ld of %d",
2573 fgBytesWrite += siz;
2589 if (!fCacheWrite)
return 0;
2593 if ((st = fCacheWrite->WriteBuffer(buf, off,
len)) < 0) {
2594 SetBit(kWriteError);
2595 Error(
"WriteBuffer",
"error writing to cache");
2614 if (fSeekFree != 0) {
2615 MakeFree(fSeekFree, fSeekFree + fNbytesFree -1);
2620 auto createKey = [
this]() {
2624 while ((afree = (
TFree*) next())) {
2625 nbytes += afree->
Sizeof();
2627 if (!nbytes)
return (
TKey*)
nullptr;
2629 TKey *key =
new TKey(fName,fTitle,IsA(),nbytes,
this);
2633 return (
TKey*)
nullptr;
2638 TKey *key = createKey();
2655 char *start = buffer;
2659 while ((afree = (
TFree*) next())) {
2664 auto actualBytes = buffer-start;
2665 if ( actualBytes != nbytes ) {
2666 if (actualBytes < nbytes) {
2669 memset(buffer,0,nbytes-actualBytes);
2671 Error(
"WriteFree",
"The free block list TKey wrote more data than expected (%d vs %ld). Most likely there has been an out-of-bound write.",nbytes,(
long int)actualBytes);
2687 if (lastfree) fEND = lastfree->
GetFirst();
2688 const char *root =
"root";
2689 char *psave =
new char[fBEGIN];
2690 char *buffer = psave;
2691 Int_t nfree = fFree->GetSize();
2692 memcpy(buffer, root, 4); buffer += 4;
2693 Int_t version = fVersion;
2694 if (version <1000000 && fEND > kStartBigFile) {version += 1000000; fUnits = 8;}
2695 tobuf(buffer, version);
2697 if (version < 1000000) {
2700 tobuf(buffer, fNbytesFree);
2701 tobuf(buffer, nfree);
2702 tobuf(buffer, fNbytesName);
2703 tobuf(buffer, fUnits);
2704 tobuf(buffer, fCompress);
2706 tobuf(buffer, fNbytesInfo);
2708 tobuf(buffer, fEND);
2709 tobuf(buffer, fSeekFree);
2710 tobuf(buffer, fNbytesFree);
2711 tobuf(buffer, nfree);
2712 tobuf(buffer, fNbytesName);
2713 tobuf(buffer, fUnits);
2714 tobuf(buffer, fCompress);
2715 tobuf(buffer, fSeekInfo);
2716 tobuf(buffer, fNbytesInfo);
2718 if (TestBit(kReproducible))
2721 fUUID.FillBuffer(buffer);
2722 Int_t nbytes = buffer - psave;
2724 WriteBuffer(psave, nbytes);
2809 }
else if (opt.
Contains(
"recreate")) {
2813 Error(
"MakeProject",
"cannot create directory '%s'",dirname);
2821 if (strcmp(afile,
".") == 0)
continue;
2822 if (strcmp(afile,
"..") == 0)
continue;
2823 dirpath.
Form(
"%s/%s",dirname,afile);
2831 Error(
"MakeProject",
"cannot create directory %s, already existing",dirname);
2836 Error(
"MakeProject",
"cannot create directory '%s'",dirname);
2848 TList *filelist = (
TList*)GetStreamerInfoCache();
2849 if (filelist) filelist = (
TList*)filelist->
Clone();
2851 Error(
"MakeProject",
"file %s has no StreamerInfo", GetName());
2855 TString clean_dirname(dirname);
2856 if (clean_dirname[clean_dirname.
Length()-1]==
'/') {
2858 }
else if (clean_dirname[clean_dirname.
Length()-1]==
'\\') {
2860 if (clean_dirname[clean_dirname.
Length()-1]==
'\\') {
2865 if (subdirname ==
"") {
2866 Error(
"MakeProject",
"Directory name must not be empty.");
2871 TString spath; spath.
Form(
"%s/%sProjectSource.cxx",clean_dirname.
Data(),subdirname.
Data());
2872 FILE *sfp = fopen(spath.
Data(),
"w");
2874 Error(
"MakeProject",
"Unable to create the source file %s.",spath.
Data());
2877 fprintf(sfp,
"namespace std {}\nusing namespace std;\n");
2878 fprintf(sfp,
"#include \"%sProjectHeaders.h\"\n\n",subdirname.
Data() );
2879 if (!
genreflex) fprintf(sfp,
"#include \"%sLinkDef.h\"\n\n",subdirname.
Data() );
2880 fprintf(sfp,
"#include \"%sProjectDict.cxx\"\n\n",subdirname.
Data() );
2881 fprintf(sfp,
"struct DeleteObjectFunctor {\n");
2882 fprintf(sfp,
" template <typename T>\n");
2883 fprintf(sfp,
" void operator()(const T *ptr) const {\n");
2884 fprintf(sfp,
" delete ptr;\n");
2885 fprintf(sfp,
" }\n");
2886 fprintf(sfp,
" template <typename T, typename Q>\n");
2887 fprintf(sfp,
" void operator()(const std::pair<T,Q> &) const {\n");
2888 fprintf(sfp,
" // Do nothing\n");
2889 fprintf(sfp,
" }\n");
2890 fprintf(sfp,
" template <typename T, typename Q>\n");
2891 fprintf(sfp,
" void operator()(const std::pair<T,Q*> &ptr) const {\n");
2892 fprintf(sfp,
" delete ptr.second;\n");
2893 fprintf(sfp,
" }\n");
2894 fprintf(sfp,
" template <typename T, typename Q>\n");
2895 fprintf(sfp,
" void operator()(const std::pair<T*,Q> &ptr) const {\n");
2896 fprintf(sfp,
" delete ptr.first;\n");
2897 fprintf(sfp,
" }\n");
2898 fprintf(sfp,
" template <typename T, typename Q>\n");
2899 fprintf(sfp,
" void operator()(const std::pair<T*,Q*> &ptr) const {\n");
2900 fprintf(sfp,
" delete ptr.first;\n");
2901 fprintf(sfp,
" delete ptr.second;\n");
2902 fprintf(sfp,
" }\n");
2903 fprintf(sfp,
"};\n\n");
2910 TIter flnext(filelist);
2917 if (strstr(info->
GetName(),
"@@")) {
2934 for(
auto rule : rules) {
2935 if( rule->IsRenameRule() || rule->IsAliasRule() )
2938 if ( rule->HasTarget( el->
GetName()) && rule->GetAttributes()[0] != 0 ) {
2941 if (
attr.Contains(
"owner")) {
2942 if (
attr.Contains(
"notowner")) {
2956 list->AddAfter(alternate, info);
2957 list->Remove(alternate);
2965 TIter nextextra(&extrainfos);
2968 filelist->
Add(info);
2979 TIter subnext(list);
2994 subClasses.
Add(subinfo);
2999 subClasses.
Clear(
"nodelete");
3001 extrainfos.
Clear(
"nodelete");
3004 path.
Form(
"%s/%sProjectHeaders.h",clean_dirname.
Data(),subdirname.
Data());
3005 FILE *allfp = fopen(path,
"a");
3007 Error(
"MakeProject",
"Cannot open output file:%s\n",path.
Data());
3009 fprintf(allfp,
"#include \"%sProjectInstances.h\"\n", subdirname.
Data());
3013 printf(
"MakeProject has generated %d classes in %s\n",ngener,clean_dirname.
Data());
3024 FILE *fpMAKE =
nullptr;
3028 path.
Form(
"%s/makep.cmd",clean_dirname.
Data());
3030 path.
Form(
"%s/MAKEP",clean_dirname.
Data());
3033 fpMAKE = fopen(path,
"wb");
3035 fpMAKE = fopen(path,
"w");
3038 Error(
"MakeProject",
"cannot open file %s", path.
Data());
3046 FILE *ifp =
nullptr;
3047 path.
Form(
"%s/%sProjectInstances.h",clean_dirname.
Data(),subdirname.
Data());
3049 ifp = fopen(path,
"wb");
3051 ifp = fopen(path,
"w");
3054 Error(
"MakeProject",
"cannot open path file %s", path.
Data());
3063 fprintf(fpMAKE,
"genreflex %sProjectHeaders.h -o %sProjectDict.cxx --comments --iocomments %s ",subdirname.
Data(),subdirname.
Data(),
gSystem->
GetIncludePath());
3064 path.
Form(
"%s/%sSelection.xml",clean_dirname.
Data(),subdirname.
Data());
3067 path.
Form(
"%s/%sLinkDef.h",clean_dirname.
Data(),subdirname.
Data());
3073 FILE *fp = fopen(path,
"wb");
3075 FILE *fp = fopen(path,
"w");
3078 Error(
"MakeProject",
"cannot open path file %s", path.
Data());
3087 fprintf(fp,
"<lcgdict>\n");
3090 fprintf(fp,
"#ifdef __CLING__\n");
3102 if (strncmp(info->
GetName(),
"auto_ptr<", std::char_traits<char>::length(
"auto_ptr<")) == 0) {
3111 for(
auto rule : rules) {
3114 rule->AsString(strrule,
"x");
3117 selections.
Append(strrule);
3120 rule->AsString(strrule);
3121 if (strncmp(strrule.
Data(),
"type=",5)==0) {
3124 fprintf(fp,
"#pragma %s;\n",strrule.
Data());
3131 std::vector<std::string> inside;
3138 switch ( stlkind ) {
3142 what =
"std::pair<";
3152 tmp.
Form(
"<class name=\"%s\" />\n",
what.Data());
3156 tmp.
Form(
"template class %s;\n",
what.Data());
3161 what.ReplaceAll(
"std::",
"");
3164 fprintf(fp,
"#pragma link C++ class %s+;\n",
what.Data());
3172 tmp.
Form(
"<class name=\"%s\" />\n",key->
GetName());
3181 what.ReplaceAll(
"std::",
"");
3182 fprintf(fp,
"#pragma link C++ class %s+;\n",key->
GetName());
3193 tmp.
Form(
"<class name=\"%s\" />\n",
what.Data());
3197 if (
what[
what.Length()-1] ==
'>') {
3198 tmp.
Form(
"template class %s;\n",
what.Data());
3204 what.ReplaceAll(
"std::",
"");
3205 fprintf(fp,
"#pragma link C++ class %s+;\n",
what.Data());
3215 tmp.
Form(
"<class name=\"%s\" />\n",
what.Data());
3219 tmp.
Form(
"template class %s;\n",
what.Data());
3228 fprintf(ifp,
"#ifndef PROJECT_INSTANCES_H\n");
3229 fprintf(ifp,
"#define PROJECT_INSTANCES_H\n");
3230 fprintf(ifp,
"%s",instances.
Data());
3231 fprintf(ifp,
"#endif\n");
3232 fprintf(fp,
"%s",selections.
Data());
3233 fprintf(fp,
"</lcgdict>\n");
3235 fprintf(fp,
"#endif\n");
3248 cmd.
ReplaceAll(
"$ObjectFiles",
object.Data());
3256 TString rootbuild = ROOTBUILD;
3262#if defined(_MSC_VER) && defined(_DEBUG)
3270 fprintf(fpMAKE,
"-s %sSelection.xml \n",subdirname.
Data());
3272 fprintf(fpMAKE,
"%sProjectHeaders.h ",subdirname.
Data());
3273 fprintf(fpMAKE,
"%sLinkDef.h \n",subdirname.
Data());
3276 fprintf(fpMAKE,
"%s\n",cmd.
Data());
3278 printf(
"%s/MAKEP file has been generated\n", clean_dirname.
Data());
3283 if (!opt.
Contains(
"nocompilation")) {
3292 chmod(
"makep.cmd",00700);
3297 if (res) printf(
"Shared lib %s has been generated\n",path.
Data());
3302 if (res) printf(
"Shared lib %s has been dynamically linked\n",path.
Data());
3321 auto listRetcode = GetStreamerInfoListImpl(
true);
3322 TList *list = listRetcode.fList;
3323 auto retcode = listRetcode.fReturnCode;
3325 if (retcode) MakeZombie();
3331 if (
gDebug > 0)
Info(
"ReadStreamerInfo",
"called for file %s",GetName());
3335 Int_t version = fVersion;
3336 if (version > 1000000) version -= 1000000;
3337 if (version < 53419 || (59900 < version && version < 59907)) {
3352 if (!base)
continue;
3363 std::vector<Int_t> si_uids;
3378 if (strcmp(obj->
GetName(),
"listOfRules")==0) {
3386 rulelnk = rulelnk->
Next();
3390 Warning(
"ReadStreamerInfo",
"%s has a %s in the list of TStreamerInfo.", GetName(), info->
IsA()->
GetName());
3400 Warning(
"ReadStreamerInfo",
"The StreamerInfo for %s does not have a list of elements.",info->
GetName());
3405 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
3407 if ( (!isstl &&
mode ==0) || (isstl &&
mode ==1) ) {
3412 Int_t asize = fClassIndex->GetSize();
3413 if (uid >= asize && uid <100000) fClassIndex->Set(2*asize);
3414 if (uid >= 0 && uid < fClassIndex->GetSize()) {
3415 si_uids.push_back(uid);
3416 fClassIndex->fArray[uid] = 1;
3419 printf(
"ReadStreamerInfo, class:%s, illegal uid=%d\n",info->
GetName(),uid);
3426 fClassIndex->fArray[0] = 0;
3432 fgTsSIHashes.Insert(listRetcode.fHash, std::move(si_uids));
3448 fgReadInfo = readinfo;
3466 TList *list = GetStreamerInfoList();
3481 TObjArray *pids = GetListOfProcessIDs();
3482 Int_t npids = GetNProcessIDs();
3483 for (
Int_t i=0;i<npids;i++) {
3491 snprintf(
name,32,
"ProcessID%d",npids);
3492 this->WriteTObject(pid,
name);
3493 this->IncrementProcessIDs();
3495 Info(
"WriteProcessID",
"name=%s, file=%s",
name, GetName());
3509 if (!fWritable)
return;
3510 if (!fClassIndex)
return;
3511 if (fIsPcmFile)
return;
3512 if (fClassIndex->fArray[0] == 0
3513 && fSeekInfo != 0) {
3519 if (
gDebug > 0)
Info(
"WriteStreamerInfo",
"called for file %s",GetName());
3529 listOfRules.
SetName(
"listOfRules");
3530 std::set<TClass*> classSet;
3534 if (fClassIndex->fArray[uid]) {
3536 if (
gDebug > 0) printf(
" -class: %s info number %d saved\n",info->
GetName(),uid);
3542 if ( classSet.find( clinfo ) == classSet.end() ) {
3543 if (
gDebug > 0) printf(
" -class: %s stored the I/O customization rules\n",info->
GetName());
3550 listOfRules.
Add(obj);
3552 classSet.insert(clinfo);
3559 fClassIndex->fArray[0] = 2;
3563 list.Add(&listOfRules);
3567 if (fSeekInfo) MakeFree(fSeekInfo,fSeekInfo+fNbytesInfo-1);
3569 TKey key(&list,
"StreamerInfo",GetBestBuffer(),
this);
3570 fKeys->Remove(&key);
3576 fClassIndex->fArray[0] = 0;
3593 if (fgCacheFileDir ==
"") {
3595 "you want to read through a cache, but you have no valid cache "
3596 "directory set - reading remotely");
3597 ::Info(
"TFile::OpenFromCache",
"set cache directory using TFile::SetCacheFileDir()");
3603 if (!fgCacheFileForce)
3605 "you want to read through a cache, but you are reading "
3606 "local files - CACHEREAD disabled");
3612 cachefilepath = fgCacheFileDir;
3613 cachefilepath += fileurl.
GetFile();
3617 ::Warning(
"TFile::OpenFromCache",
"you want to read through a cache, but I "
3618 "cannot create the directory %s - CACHEREAD disabled",
3619 cachefilepathbasedir.
Data());
3624 cachefilepath +=
"__";
3628 if (strstr(
name,
"zip=")) {
3633 Int_t optioncount = 0;
3642 if (optioncount!=0) {
3647 newoptions +=
value;
3657 cachefilepath +=
"__";
3658 cachefilepath += zipname;
3671 if (!fgCacheFileDisconnected) {
3672 char cacheblock[256];
3673 char remotblock[256];
3676 cfurl = cachefilepath;
3677 cfurl +=
"?filetype=raw";
3680 ropt +=
"&filetype=raw";
3683 Bool_t forcedcache = fgCacheFileForce;
3684 fgCacheFileForce =
kFALSE;
3689 fgCacheFileForce = forcedcache;
3693 ::Error(
"TFile::OpenFromCache",
3694 "cannot open the cache file to check cache consistency");
3699 ::Error(
"TFile::OpenFromCache",
3700 "cannot open the remote file to check cache consistency");
3707 if ((!cachefile->
ReadBuffer(cacheblock,256)) &&
3709 if (memcmp(cacheblock, remotblock, 256)) {
3710 ::Warning(
"TFile::OpenFromCache",
"the header of the cache file "
3711 "differs from the remote file - forcing an update");
3715 ::Warning(
"TFile::OpenFromCache",
"the header of the cache and/or "
3716 "remote file are not readable - forcing an update");
3728 Bool_t forcedcache = fgCacheFileForce;
3729 fgCacheFileForce =
kFALSE;
3731 const auto cachefilepathtmp = cachefilepath + std::to_string(
gSystem->
GetPid()) +
".tmp";
3734 "you want to read through a cache, but I "
3735 "cannot make a cache copy of %s - CACHEREAD disabled",
3736 cachefilepathbasedir.
Data());
3737 fgCacheFileForce = forcedcache;
3745 fgCacheFileForce = forcedcache;
3746 ::Info(
"TFile::OpenFromCache",
"using local cache copy of %s [%s]",
name, cachefilepath.
Data());
3749 fileurl.
SetFile(cachefilepath);
3752 tagfile = cachefilepath;
3753 tagfile +=
".ROOT.cachefile";
3811 if (!url || strlen(url) <= 0) {
3812 ::Error(
"TFile::Open",
"no url specified");
3819 if (
auto xurl = ROOT::Internal::GetEOSRedirectedXRootURL(expandedUrl)) {
3820 if ((
f =
TFile::Open(xurl->c_str(), options, ftitle, compress, netopt))) {
3821 if (!
f->IsZombie()) {
3837 TString sto = opts(ito + std::char_traits<char>::length(
"TIMEOUT="), opts.
Length());
3842 if (
gDebug > 0)
::Info(
"TFile::Open",
"timeout of %d millisec requested", toms);
3844 sto.
Insert(0,
"TIMEOUT=");
3862 ::Info(
"TFile::Open",
"waited %d millisec for asynchronous open", toms - xtms);
3864 ::Info(
"TFile::Open",
"timeout option not supported (requires asynchronous"
3869 ::Error(
"TFile::Open",
"timeout expired while opening '%s'", expandedUrl.
Data());
3876 ::Warning(
"TFile::Open",
"incomplete 'TIMEOUT=' option specification - ignored");
3882 const char *
option = opts;
3885 TString namelist(expandedUrl);
3902 while (namelist.
Tokenize(
n, from,
"|") && !
f) {
3905 if (!strcasecmp(
option,
"CACHEREAD") ||
3906 ((!strcasecmp(
option,
"READ") || !strcasecmp(
option,
"READ_WITHOUT_GLOBALREGISTRATION") || !
option[0]) &&
3907 fgCacheFileForce)) {
3913 IncrementFileCounter();
3920 if (fgAsyncOpenRequests && (fgAsyncOpenRequests->GetSize() > 0)) {
3921 TIter nxr(fgAsyncOpenRequests);
3940 if (
type == kLocal) {
3946 lfname = urlname.
GetUrl();
3950 }
else if (
type == kNet) {
3953 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name))) {
3954 if (
h->LoadPlugin() == -1) {
3955 ::Error(
"TFile::Open",
"Failed to load plugin %s",
name.Data());
3961 }
else if (
type == kWeb) {
3964 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name))) {
3965 if (
h->LoadPlugin() == -1) {
3966 ::Error(
"TFile::Open",
"Failed to load plugin %s",
name.Data());
3972 }
else if (
type == kFile) {
3975 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name)) &&
3976 h->LoadPlugin() == 0) {
3977 name.ReplaceAll(
"file:",
"");
3985 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name.Data()))) {
3986 if (
h->LoadPlugin() == -1) {
3987 ::Error(
"TFile::Open",
"Failed to load plugin %s",
name.Data());
4000 if (
f &&
f->IsZombie()) {
4022 if (
type != kLocal &&
type != kFile &&
4023 f &&
f->IsWritable() && !
f->IsRaw()) {
4058 const char *ftitle,
Int_t compress,
4066 if (!url || strlen(url) <= 0) {
4067 ::Error(
"TFile::AsyncOpen",
"no url specified");
4079 TString outf =
".TFileAsyncOpen_";
4090 while (namelist.
Tokenize(
n, from,
"|") && !
f) {
4105 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name)) &&
4106 !strcmp(
h->GetClass(),
"TNetXNGFile")
4107 &&
h->LoadPlugin() == 0) {
4118 if (!notfound && !
f)
4138 if (!fgAsyncOpenRequests)
4139 fgAsyncOpenRequests =
new TList;
4140 fgAsyncOpenRequests->
Add(fh);
4158 if (fh && fgAsyncOpenRequests) {
4161 fgAsyncOpenRequests->
Remove(fh);
4163 if ((
f = fh->
GetFile()) && !(
f->IsZombie())) {
4165 Bool_t cr = (!strcmp(
f->GetOption(),
"CREATE") ||
4166 !strcmp(
f->GetOption(),
"RECREATE") ||
4177 if (
f)
f->fAsyncHandle = fh;
4189#if defined(R__WINGCC)
4192 return ::open(pathname, flags | O_BINARY,
mode);
4193#elif defined(R__SEEK64)
4194 return ::open64(pathname, flags,
mode);
4196 return ::open(pathname, flags,
mode);
4205 if (fd < 0)
return 0;
4214 return ::read(fd, buf,
len);
4222 return ::write(fd, buf,
len);
4233#if defined (R__SEEK64)
4234 return ::lseek64(fd,
offset, whence);
4236 return ::_lseeki64(fd,
offset, whence);
4238 return ::lseek(fd,
offset, whence);
4260 if (TestBit(kDevNull))
return 0;
4265 return ::_commit(fd);
4274 return fCacheWrite ? fCacheWrite->GetBytesInCache() + fBytesWrite : fBytesWrite;
4291 return fgBytesWrite;
4307 return fgReadaheadSize;
4336 if (!cached.EndsWith(
"/"))
4343 ::Error(
"TFile::SetCacheFileDir",
"no sufficient permissions on cache directory %s or cannot create it",
TString(cachedir).Data());
4344 fgCacheFileDir =
"";
4351 fgCacheFileDir = cached;
4352 fgCacheFileDisconnected = operatedisconnected;
4353 fgCacheFileForce = forcecacheread;
4362 return fgCacheFileDir;
4374 if (fgCacheFileDir ==
"") {
4384 TString cachetagfile = fgCacheFileDir;
4385 cachetagfile +=
".tag.ROOT.cache";
4389 if (lastcleanuptime < cleanupinterval) {
4390 ::Info(
"TFile::ShrinkCacheFileDir",
"clean-up is skipped - last cleanup %lu seconds ago - you requested %lu", lastcleanuptime, cleanupinterval);
4396 cachetagfile +=
"?filetype=raw";
4397 TFile *tagfile =
nullptr;
4399 if (!(tagfile =
TFile::Open(cachetagfile,
"RECREATE"))) {
4400 ::Error(
"TFile::ShrinkCacheFileDir",
"cannot create the cache tag file %s", cachetagfile.
Data());
4408#if defined(R__WIN32)
4409 cmd =
"echo <TFile::ShrinkCacheFileDir>: cleanup to be implemented";
4410#elif defined(R__MACOSX)
4411 cmd.
Form(
"perl -e 'my $cachepath = \"%s\"; my $cachesize = %lld;my $findcommand=\"find $cachepath -type f -exec stat -f \\\"\\%%a::\\%%N::\\%%z\\\" \\{\\} \\\\\\;\";my $totalsize=0;open FIND, \"$findcommand | sort -k 1 |\";while (<FIND>) { my ($accesstime, $filename, $filesize) = split \"::\",$_; $totalsize += $filesize;if ($totalsize > $cachesize) {if ( ( -e \"${filename}.ROOT.cachefile\" ) || ( -e \"${filename}\" ) ) {unlink \"$filename.ROOT.cachefile\";unlink \"$filename\";}}}close FIND;' ", fgCacheFileDir.Data(),shrinksize);
4413 cmd.
Form(
"perl -e 'my $cachepath = \"%s\"; my $cachesize = %lld;my $findcommand=\"find $cachepath -type f -exec stat -c \\\"\\%%x::\\%%n::\\%%s\\\" \\{\\} \\\\\\;\";my $totalsize=0;open FIND, \"$findcommand | sort -k 1 |\";while (<FIND>) { my ($accesstime, $filename, $filesize) = split \"::\",$_; $totalsize += $filesize;if ($totalsize > $cachesize) {if ( ( -e \"${filename}.ROOT.cachefile\" ) || ( -e \"${filename}\" ) ) {unlink \"$filename.ROOT.cachefile\";unlink \"$filename\";}}}close FIND;' ", fgCacheFileDir.Data(),shrinksize);
4420 ::Error(
"TFile::ShrinkCacheFileDir",
"error executing clean-up script");
4432 UInt_t to = fgOpenTimeout;
4433 fgOpenTimeout = timeout;
4442 return fgOpenTimeout;
4453 fgOnlyStaged = onlystaged;
4462 return fgOnlyStaged;
4478 if (!strcmp(u.
GetFile(), fUrl.GetFile())) {
4480 if (u.
GetPort() == fUrl.GetPort()) {
4481 if (!strcmp(u.
GetHostFQDN(), fUrl.GetHostFQDN())) {
4500 }
else if (fName.Length() > 0){
4532 if (re.Match(
name)) {
4550 forceRemote =
kTRUE;
4551 else if (opts.
Contains(
"remote=0"))
4560 if (fname[0] ==
'/') {
4562 lfname.
Form(
"%s%s", prefix->
Data(), fname);
4565 }
else if (fname[0] ==
'~' || fname[0] ==
'$') {
4583 if (localFile && prefix)
4589 type = (localFile) ? kLocal :
type;
4590 }
else if (
TPMERegexp(
"^(http[s]?|s3http[s]?|[a]?s3|gs|gshttp[s]?){1}:",
"i").Match(
name)) {
4594 }
else if (!strncmp(
name,
"file:", 5)) {
4609 if (fgAsyncOpenRequests && (fgAsyncOpenRequests->GetSize() > 0)) {
4610 TIter nxr(fgAsyncOpenRequests);
4620 if (of && (of->
GetSize() > 0)) {
4623 while ((
f = (
TFile *)nxf()))
4624 if (
f->Matches(
name))
4629 return kAOSNotAsync;
4637 if (handle && handle->
fFile) {
4655 if (fgAsyncOpenRequests && (fgAsyncOpenRequests->GetSize() > 0)) {
4656 TIter nxr(fgAsyncOpenRequests);
4667 if (of && (of->
GetSize() > 0)) {
4670 while ((
f = (
TFile *)nxf()))
4671 if (
f->Matches(
name))
4676 return (
const TUrl *)
nullptr;
4684 fprintf(stderr,
"[TFile::Cp] Total %.02f MB\t|", (
Double_t)
size/1048576);
4686 for (
int l = 0;
l < 20;
l++) {
4688 if (
l < 20*bytesread/
size)
4689 fprintf(stderr,
"=");
4690 else if (
l == 20*bytesread/
size)
4691 fprintf(stderr,
">");
4692 else if (
l > 20*bytesread/
size)
4693 fprintf(stderr,
".");
4695 fprintf(stderr,
"=");
4701 fprintf(stderr,
"| %.02f %% [%.01f MB/s]\r",
4702 100.0*(
size?(bytesread/((
float)
size)):1), (lCopy_time>0.)?bytesread/lCopy_time/1048576.:0.);
4726 opt +=
"filetype=raw";
4730 char *copybuffer =
nullptr;
4732 TFile *sfile =
this;
4733 TFile *dfile =
nullptr;
4749 ::Error(
"TFile::Cp",
"cannot open destination file %s",
dst);
4755 rmdestiferror =
kTRUE;
4760 copybuffer =
new char[bufsize];
4762 ::Error(
"TFile::Cp",
"cannot allocate the copy buffer");
4767 Long64_t read, written, totalread, filesize, b00;
4777 if (progressbar) CpProgress(totalread, filesize,watch);
4782 if (filesize - b1 > (
Long64_t)bufsize) {
4785 readsize = filesize - b1;
4788 if (readsize == 0)
break;
4794 if ((read <= 0) || readop) {
4795 ::Error(
"TFile::Cp",
"cannot read from source file %s. readsize=%lld read=%lld readop=%d",
4796 sfile->
GetName(), readsize, read, readop);
4803 if ((written != read) || writeop) {
4804 ::Error(
"TFile::Cp",
"cannot write %lld bytes to destination file %s", read,
dst);
4808 }
while (read == (
Long64_t)bufsize);
4811 CpProgress(totalread, filesize,watch);
4812 fprintf(stderr,
"\n");
4818 if (dfile) dfile->
Close();
4820 if (dfile)
delete dfile;
4821 if (copybuffer)
delete[] copybuffer;
4823 if (rmdestiferror && (success !=
kTRUE))
4841 TFile *sfile =
nullptr;
4847 ::Error(
"TFile::Cp",
"cannot open source file %s",
src);
4849 success = sfile->
Cp(
dst, progressbar, bufsize);
4864#if defined(R__neverLINUX) && !defined(R__WINGCC)
4876 int advice = POSIX_FADV_WILLNEED;
4881 advice = POSIX_FADV_NORMAL;
4885#if defined(R__SEEK64)
4913 if ((cr = GetCacheRead())) {
void frombuf(char *&buf, Bool_t *x)
void tobuf(char *&buf, Bool_t x)
T ReadBuffer(TBufferFile *buf)
One of the template functions used to read objects from messages.
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
bool Bool_t
Boolean (0=false, 1=true) (bool)
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
int Int_t
Signed integer 4 bytes (int)
short Version_t
Class version identifier (short)
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
float Float_t
Float 4 bytes (float)
short Short_t
Signed Short integer 2 bytes (short)
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void SysError(const char *location, const char *msgfmt,...)
Use this function in case a system (OS or GUI) related error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
winID h TVirtualViewer3D TVirtualGLPainter p
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 result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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 Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t TPoint TPoint const char mode
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 Atom_t Int_t ULong_t ULong_t bytes
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
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 Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
R__EXTERN TPluginManager * gPluginMgr
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
R__EXTERN TVirtualMutex * gROOTMutex
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
R__EXTERN TSystem * gSystem
R__EXTERN void **(* gThreadTsd)(void *, Int_t)
R__EXTERN TVirtualMonitoringWriter * gMonitoringWriter
#define R__LOCKGUARD(mutex)
#define R__WRITE_LOCKGUARD(mutex)
#define R__READ_LOCKGUARD(mutex)
std::optional< TKeyMapNode > Next()
TIterator(TFile *file, std::uint64_t addr)
const TMatches FindRules(const TString &source) const
Return all the rules that are about the given 'source' class.
const TObjArray * GetRules() const
This class is a thread-safe associative collection connecting a 256 bits digest/hash to a collection ...
static HashValue Hash(char *buf, int len)
Return the hash object corresponding to the buffer.
const RUidColl * Find(const HashValue &hash) const
Return the collection of UID corresponding to the hash if the hash has already been seen or nullptr o...
void AsString(TString &out, const char *options="") const
Add to the string 'out' the string representation of the rule.
const char * GetMemberName() const
virtual Int_t SetCurrentMember()=0
const char * GetArchiveName() const
TArchiveMember * GetMember() const
static TArchiveFile * Open(const char *url, TFile *file)
Return proper archive file handler depending on passed url.
Long64_t GetMemberFilePosition() const
Return position in archive of current member.
virtual Int_t OpenArchive()=0
Long64_t GetDecompressedSize() const
Array of chars or bytes (8 bits per element).
Buffer base class used for serializing objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t IsSyntheticPair() const
ROOT::ESTLType GetCollectionType() const
Return the 'type' of the STL the TClass is representing.
Bool_t HasInterpreterInfo() const
const ROOT::Detail::TSchemaRuleSet * GetSchemaRules() const
Return the set of the schema rules if any.
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
static Bool_t AddRule(const char *rule)
Add a schema evolution customization rule.
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Version_t GetClassVersion() const
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.
virtual bool UseRWLock(Bool_t enable=true)
Set this collection to use a RW lock upon access, making it thread safe.
void SetName(const char *name)
virtual Int_t GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
TObject * Clone(const char *newname="") const override
Make a clone of an collection using the Streamer facility.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
static void GetDateTime(UInt_t datetime, Int_t &date, Int_t &time)
Static function that returns the date and time.
void ReadBuffer(char *&buffer)
Decode Date/Time from output buffer, used by I/O system.
A ROOT file is structured in Directories (like a file system).
void Close(Option_t *option="") override
Delete all objects from memory and directory structure itself.
Bool_t cd() override
Change current directory to "this" directory.
Bool_t IsWritable() const override
void Delete(const char *namecycle="") override
Delete Objects or/and keys in the current directory.
Int_t ReadKeys(Bool_t forceRead=kTRUE) override
Read the linked list of keys.
TDatime fDatimeM
Date and time of last modification.
Int_t fNbytesKeys
Number of bytes for the keys.
Int_t GetNkeys() const override
Long64_t fSeekKeys
Location of Keys record on file.
Int_t Sizeof() const override
Return the size in bytes of the directory header.
Long64_t fSeekParent
Location of parent directory on file.
void BuildDirectoryFile(TFile *motherFile, TDirectory *motherDir)
Initialise directory to defaults.
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override
Write all objects in memory to disk.
Long64_t fSeekDir
Location of directory on file.
Int_t fNbytesName
Number of bytes in TNamed at creation time.
TDatime fDatimeC
Date and time when directory is created.
Bool_t fWritable
True if directory is writable.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
void FillBuffer(char *&buffer) override
Encode directory header into output buffer.
void SetWritable(Bool_t writable=kTRUE) override
Set the new value of fWritable recursively.
TList * fKeys
Pointer to keys list in memory.
void ls(Option_t *option="") const override
List Directory contents.
TDirectory::TContext keeps track and restore the current directory.
Describe directory structure in memory.
virtual TList * GetList() const
void SetName(const char *newname) override
Set the name for directory If the directory name is changed after the directory was written once,...
TUUID fUUID
Unique identifier.
virtual TObject * Remove(TObject *)
Remove an object from the in-memory list.
TList * fList
List of objects in memory.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
A cache when reading files over the network.
virtual void Close(Option_t *option="")
Close out any threads or asynchronous fetches used by the underlying implementation.
virtual Int_t GetBufferSize() const
virtual void SetFile(TFile *file, TFile::ECacheAction action=TFile::kDisconnect)
Set the file using this cache and reset the current blocks (if any).
A cache when writing files over the network.
virtual Bool_t Flush()
Flush the current write buffer to the file.
Class holding info about the file being opened.
TFile * fFile
TFile instance of the file being opened.
const char * GetOpt() const
Bool_t Matches(const char *name)
Return kTRUE if this async request matches the open request specified by 'url'.
Int_t GetCompress() const
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
static std::atomic< Long64_t > fgBytesRead
Number of bytes read by all TFile objects.
static void SetFileBytesWritten(Long64_t bytes=0)
static Bool_t fgCacheFileForce
Indicates, to force all READ to CACHEREAD.
virtual TProcessID * ReadProcessID(UShort_t pidf)
The TProcessID with number pidf is read from this file.
void ls(Option_t *option="") const override
List file contents.
ROOT::Detail::TKeyMapIterable WalkTKeys()
Traverses all TKeys in the TFile and returns information about them.
virtual void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Seek to a specific position in the file. Pos it either kBeg, kCur or kEnd.
static Bool_t GetOnlyStaged()
Returns staged only flag.
static void IncrementFileCounter()
static Bool_t ShrinkCacheFileDir(Long64_t shrinkSize, Long_t cleanupInteval=0)
Try to shrink the cache to the desired size.
Long64_t fSeekFree
Location on disk of free segments structure.
static Int_t fgReadaheadSize
Readahead buffer size.
void FillBuffer(char *&buffer) override
Encode file output buffer.
Double_t fSum2Buffer
Sum of squares of buffer sizes of objects written so far.
static void SetReadaheadSize(Int_t bufsize=256000)
static Bool_t fgCacheFileDisconnected
Indicates, we trust in the files in the cache dir without stat on the cached file.
const TList * GetStreamerInfoCache()
Returns the cached list of StreamerInfos used in this file.
static Bool_t GetReadStreamerInfo()
If the streamerinfos are to be read at file opening.
TArchiveFile * fArchive
!Archive file from which we read this file
virtual Int_t SysSync(Int_t fd)
Interface to system fsync. All arguments like in POSIX fsync().
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode.
virtual void ReadStreamerInfo()
Read the list of StreamerInfo from this file.
virtual Bool_t Matches(const char *name)
Return kTRUE if 'url' matches the coordinates of this file.
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=nullptr, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
TArrayC * fClassIndex
!Index of TStreamerInfo classes written to this file
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
virtual InfoListRet GetStreamerInfoListImpl(bool lookupSICache)
See documentation of GetStreamerInfoList for more details.
static void SetReadStreamerInfo(Bool_t readinfo=kTRUE)
Specify if the streamerinfos must be read at file opening.
Bool_t fNoAnchorInName
!True if we don't want to force the anchor to be appended to the file name
static void SetFileBytesRead(Long64_t bytes=0)
Long64_t fSeekInfo
Location on disk of StreamerInfo record.
void Paint(Option_t *option="") override
Paint all objects in the file.
Int_t GetBestBuffer() const
Return the best buffer size of objects on this file.
TList * fOpenPhases
!Time info about open phases
virtual void SetCompressionLevel(Int_t level=ROOT::RCompressionSetting::ELevel::kUseMin)
See comments for function SetCompressionSettings.
TFileCacheWrite * GetCacheWrite() const
Return a pointer to the current write cache.
static void SetFileReadCalls(Int_t readcalls=0)
static TString fgCacheFileDir
Directory where to locally stage files.
virtual Int_t SysRead(Int_t fd, void *buf, Int_t len)
Interface to system read. All arguments like in POSIX read().
Int_t fVersion
File format version.
void Print(Option_t *option="") const override
Print all objects in the file.
static std::atomic< Long64_t > fgFileCounter
Counter for all opened files.
virtual EAsyncOpenStatus GetAsyncOpenStatus()
void Streamer(TBuffer &) override
Stream a TFile object.
static UInt_t GetOpenTimeout()
Returns open timeout (in ms).
static void CpProgress(Long64_t bytesread, Long64_t size, TStopwatch &watch)
Print file copy progress.
static Bool_t fgOnlyStaged
Before the file is opened, it is checked, that the file is staged, if not, the open fails.
Bool_t fMustFlush
!True if the file buffers must be flushed
Int_t WriteBufferViaCache(const char *buf, Int_t len)
Write buffer via cache.
static Long64_t GetFileBytesRead()
Static function returning the total number of bytes read from all files.
Int_t ReadBufferViaCache(char *buf, Int_t len)
Read buffer via cache.
virtual TKey * CreateKey(TDirectory *mother, const TObject *obj, const char *name, Int_t bufsize)
Creates key for object and converts data to buffer.
virtual void WriteFree()
Write FREE linked list on the file.
static Int_t GetReadaheadSize()
Static function returning the readahead buffer size.
~TFile() override
File destructor.
virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Read the nbuf blocks described in arrays pos and len.
static Long64_t GetFileCounter()
TMap * fCacheReadMap
!Pointer to the read cache (if any)
Long64_t fBEGIN
First used byte in file.
virtual UShort_t WriteProcessID(TProcessID *pid)
Check if the ProcessID pidd is already in the file, if not, add it and return the index number in the...
virtual void MakeProject(const char *dirname, const char *classes="*", Option_t *option="new")
Generate source code necessary to access the objects stored in the file.
Long64_t fArchiveOffset
!Offset at which file starts in archive
Int_t fNbytesInfo
Number of bytes for StreamerInfo record.
virtual Long64_t GetSize() const
Returns the current file size.
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
TFileOpenHandle * fAsyncHandle
!For proper automatic cleanup
static Bool_t SetOnlyStaged(Bool_t onlystaged)
Sets only staged flag.
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t bufsize=1000000)
Allows to copy this file to the dst URL.
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override
Write memory objects to this file.
virtual Long64_t GetBytesRead() const
virtual Int_t GetErrno() const
Method returning errno.
virtual void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
Used to specify the compression level and algorithm.
static Bool_t fgReadInfo
if true (default) ReadStreamerInfo is called when opening a file
virtual void Init(Bool_t create)
Initialize a TFile object.
static TFileOpenHandle * AsyncOpen(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Submit an asynchronous open request.
virtual void SetCacheWrite(TFileCacheWrite *cache)
Set a pointer to the write cache.
TString fOption
File options.
virtual Bool_t WriteBuffer(const char *buf, Int_t len)
Write a buffer to the file.
void SumBuffer(Int_t bufsize)
Increment statistics for buffer sizes of objects in this file.
static const char * GetCacheFileDir()
Get the directory where to locally stage/cache remote files.
EAsyncOpenStatus
Asynchronous open request status.
virtual void WriteStreamerInfo()
Write the list of TStreamerInfo as a single object in this file The class Streamer description for al...
virtual Long64_t GetBytesWritten() const
Return the total number of bytes written so far to the file.
Int_t fCompress
Compression level and algorithm.
static TFile *& CurrentFile()
Return the current ROOT file if any.
virtual void SetCompressionAlgorithm(Int_t algorithm=ROOT::RCompressionSetting::EAlgorithm::kUseGlobal)
See comments for function SetCompressionSettings.
virtual const TUrl * GetEndpointUrl() const
Int_t fNbytesFree
Number of bytes for free segments structure.
static constexpr Version_t Class_Version()
virtual void ResetErrno() const
Method resetting the errno.
Int_t Sizeof() const override
Return the size in bytes of the file header.
Bool_t FlushWriteCache()
Flush the write cache if active.
Bool_t fIsPcmFile
!True if the file is a ROOT pcm file.
TFileCacheRead * fCacheRead
!Pointer to the read cache (if any)
virtual Int_t SysClose(Int_t fd)
Interface to system close. All arguments like in POSIX close().
TFile()
File default Constructor.
Char_t fUnits
Number of bytes for file pointers.
TObjArray * fProcessIDs
!Array of pointers to TProcessIDs
static EFileType GetType(const char *name, Option_t *option="", TString *prefix=nullptr)
Resolve the file type as a function of the protocol field in 'name'.
virtual void ShowStreamerInfo()
Show the StreamerInfo of all classes written to this file.
virtual Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence)
Interface to system lseek.
virtual Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
Return file stat information.
virtual Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
Interface to system open. All arguments like in POSIX open().
ECacheAction
TTreeCache flushing semantics.
static UInt_t SetOpenTimeout(UInt_t timeout)
Sets open timeout time (in ms). Returns previous timeout value.
virtual void ReadFree()
Read the FREE linked list.
static ROOT::Internal::RConcurrentHashColl fgTsSIHashes
!TS Set of hashes built from read streamer infos
Bool_t fIsRootFile
!True is this is a ROOT file, raw file otherwise
virtual void Flush()
Synchronize a file's in-memory and on-disk states.
TList * fFree
Free segments linked list table.
virtual Bool_t ReadBufferAsync(Long64_t offs, Int_t len)
void Delete(const char *namecycle="") override
Delete Objects or/and keys in the current directory.
Bool_t fInitDone
!True if the file has been initialized
virtual void DrawMap(const char *keys="*", Option_t *option="")
Draw map of objects in this file.
virtual void MakeFree(Long64_t first, Long64_t last)
Mark unused bytes on the file.
TFileCacheWrite * fCacheWrite
!Pointer to the write cache (if any)
TString fRealName
Effective real file name (not original url)
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
static std::atomic< Long64_t > fgBytesWrite
Number of bytes written by all TFile objects.
TList * fInfoCache
!Cached list of the streamer infos in this file
virtual Int_t GetBytesToPrefetch() const
Max number of bytes to prefetch.
static UInt_t fgOpenTimeout
Timeout for open operations in ms - 0 corresponds to blocking i/o.
Long64_t fEND
Last used byte in file.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
static Bool_t SetCacheFileDir(std::string_view cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Sets the directory where to locally stage/cache remote files.
EAsyncOpenStatus fAsyncOpenStatus
!Status of an asynchronous open request
bool fGlobalRegistration
! if true, bypass use of global lists
Double_t fSumBuffer
Sum of buffer sizes of objects written so far.
Bool_t fIsArchive
!True if this is a pure archive file
void Draw(Option_t *option="") override
Fill Graphics Structure and Paint.
void Close(Option_t *option="") override
Close a file.
TClass * IsA() const override
static std::atomic< Int_t > fgReadCalls
Number of bytes read from all TFile objects.
virtual Int_t Recover()
Attempt to recover file if not correctly closed.
virtual TList * GetStreamerInfoList() final
Read the list of TStreamerInfo objects written to this file.
virtual void WriteHeader()
Write File Header.
@ k630forwardCompatibility
static TFile * OpenFromCache(const char *name, Option_t *="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Open a file for reading through the file cache.
Int_t fNProcessIDs
Number of TProcessID written to this file.
Int_t fWritten
Number of objects written so far.
Int_t GetRecordHeader(char *buf, Long64_t first, Int_t maxbytes, Int_t &nbytes, Int_t &objlen, Int_t &keylen)
Read the logical record header starting at a certain postion.
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
Float_t GetCompressionFactor()
Return the file compression factor.
virtual Int_t SysWrite(Int_t fd, const void *buf, Int_t len)
Interface to system write. All arguments like in POSIX write().
static Int_t GetFileReadCalls()
Static function returning the total number of read calls from all files.
TFileCacheRead * GetCacheRead(const TObject *tree=nullptr) const
Return a pointer to the current read cache.
static TList * fgAsyncOpenRequests
Int_t Sizeof() const
return number of bytes occupied by this TFree on permanent storage
virtual void ReadBuffer(char *&buffer)
Decode one free structure from input buffer.
Long64_t GetFirst() const
virtual void FillBuffer(char *&buffer)
Encode fre structure into output buffer.
TFree * AddFree(TList *lfree, Long64_t first, Long64_t last)
Add a new free segment to the list of free segments.
static void MakeFunctor(const char *name, const char *type, GlobFunc &func)
Book space in a file, create I/O buffers, to fill them, (un)compress them.
void Delete(Option_t *option="") override
Delete an object from the file.
virtual Long64_t GetSeekKey() const
virtual const char * GetClassName() const
virtual Bool_t ReadFile()
Read the key structure from the file.
void ReadKeyBuffer(char *&buffer)
Decode input buffer.
virtual Int_t WriteFile(Int_t cycle=1, TFile *f=nullptr)
Write the encoded object supported by this key.
virtual char * GetBuffer() const
void Clear(Option_t *option="") override
Remove all objects from the list.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void Add(TObject *obj) override
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
virtual TObjLink * FirstLink() const
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
static void GenerateMissingStreamerInfos(TList *extrainfos, TStreamerElement *element)
Generate an empty StreamerInfo for types that are used in templates parameters but are not known in t...
static TString UpdateAssociativeToVector(const char *name)
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
virtual void FillBuffer(char *&buffer)
Encode TNamed into output buffer.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual Int_t Sizeof() const
Return size of the TNamed part of the TObject.
Iterator of object array.
TObject * Next() override
Return next object in array. Returns 0 when no more objects in array.
Int_t IndexOf(const TObject *obj) const override
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
Int_t GetEntries() const override
Return the number of objects in array (i.e.
TObject * At(Int_t idx) const override
TObject * UncheckedAt(Int_t i) const
void Add(TObject *obj) override
Wrapper around a TObject so it can be stored in a TList.
TObject * GetObject() const
Collectable string class.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual UInt_t GetUniqueID() const
Return the unique object id.
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
R__ALWAYS_INLINE Bool_t IsOnHeap() const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
R__ALWAYS_INLINE Bool_t IsZombie() const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
virtual const char * GetTitle() const
Returns title of object.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Longptr_t ExecPlugin(int nargs)
A TProcessID identifies a ROOT job in a unique way in time and space.
Int_t IncrementCount()
Increase the reference count to this object.
void Clear(Option_t *option="") override
delete the TObjArray pointing to referenced objects this function is called by TFile::Close("R")
void CheckInit()
Initialize fObjects.
static TObjArray * GetPIDs()
static: returns array of TProcessIDs
static TProcessID * GetSessionProcessID()
static function returning the pointer to the session TProcessID
Int_t DecrementCount()
The reference fCount is used to delete the TProcessID in the TFile destructor when fCount = 0.
static TProcessID * GetPID()
static: returns pointer to current TProcessID
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
Sequenceable collection abstract base class.
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Continue()
Resume a stopped stopwatch.
void Stop()
Stop the stopwatch.
void SetBaseCheckSum(UInt_t cs)
Describe one element (data member) to be Streamed.
TClass * GetClass() const
Describes a persistent version of a class.
Int_t GetClassVersion() const override
Int_t GenerateHeaderFile(const char *dirname, const TList *subClasses=nullptr, const TList *extrainfos=nullptr) override
Generate header file for the class described by this TStreamerInfo the function is called by TFile::M...
Int_t GetNumber() const override
TClass * IsA() const override
TClass * GetClass() const override
TObjArray * GetElements() const override
UInt_t GetCheckSum() const override
void BuildCheck(TFile *file=nullptr, Bool_t load=kTRUE) override
Check if built and consistent with the class dictionary.
void ToLower()
Change string to lower-case.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
TString & Insert(Ssiz_t pos, const char *s)
Int_t Atoi() const
Return integer value of string.
void Clear()
Clear string without changing its capacity.
const char * Data() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
TString & ReplaceAll(const TString &s1, const TString &s2)
void ToUpper()
Change string to upper case.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void ReadBuffer(char *&buffer)
Read string from I/O buffer.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual FILE * TempFileName(TString &base, const char *dir=nullptr, const char *suffix=nullptr)
Create a secure temporary file by appending a unique 6 letter string to base.
virtual const char * GetMakeSharedLib() const
Return the command line use to make a shared library.
virtual Int_t RedirectOutput(const char *name, const char *mode="a", RedirectHandle_t *h=nullptr)
Redirect standard output (stdout, stderr) to the specified file.
virtual void IgnoreInterrupt(Bool_t ignore=kTRUE)
If ignore is true ignore the interrupt signal, else restore previous behaviour.
virtual int Symlink(const char *from, const char *to)
Create a symbolic link from file1 to file2.
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 int Chmod(const char *file, UInt_t mode)
Set the file permission bits. Returns -1 in case or error, 0 otherwise.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory.
virtual int GetPid()
Get process id.
virtual const char * GetIncludePath()
Get the list of include path.
virtual void ShowOutput(RedirectHandle_t *h)
Display the content associated with the redirection described by the opaque handle 'h'.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual int Rename(const char *from, const char *to)
Rename a file.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual const char * GetFlagsDebug() const
Return the debug flags.
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
virtual const char * GetObjExt() const
Get the object file extension.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual const char * WorkingDirectory()
Return working directory.
virtual const char * GetLibraries(const char *regexp="", const char *option="", Bool_t isRegexp=kTRUE)
Return a space separated list of loaded shared libraries.
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
virtual const char * GetSoExt() const
Get the shared library extension.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
virtual int Unlink(const char *name)
Unlink, i.e.
virtual const char * GetFlagsOpt() const
Return the optimization flags.
The TTimeStamp encapsulates seconds and ns since EPOCH.
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
void ReadBuffer(char *&buffer)
Stream UUID from input buffer.
void FillBuffer(char *&buffer)
Stream UUID into output buffer.
This class represents a WWW compatible URL.
const char * GetAnchor() const
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
void SetAnchor(const char *anchor)
const char * GetFileAndOptions() const
Return the file and its options (the string specified behind the ?).
const char * GetFile() const
const char * GetValueFromOptions(const char *key) const
Return a value for a given key from the URL options.
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
void SetOptions(const char *opt)
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
const char * GetOptions() const
void SetHost(const char *host)
const char * GetProtocol() const
void SetFile(const char *file)
Bool_t HasOption(const char *key) const
Returns true if the given key appears in the URL options list.
virtual Bool_t SendFileReadProgress(TFile *)
virtual Bool_t SendFileCloseEvent(TFile *)
virtual Bool_t SendFileWriteProgress(TFile *)
Abstract Interface class describing Streamer information for one class.
virtual Int_t GetClassVersion() const =0
R__EXTERN TVirtualRWMutex * gCoreMutex
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
bool IsStdPair(std::string_view name)
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
int GetSplit(const char *type, std::vector< std::string > &output, int &nestedLoc, EModType mode=TClassEdit::kNone)
Stores in output (after emptying it) the split type.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
@ kUndefined
Undefined compression algorithm (must be kept the last of the list in case a new algorithm is added).
@ kUseMin
Compression level reserved when we are not sure what to use (1 is for the fastest compression)
Simple struct of the return value of GetStreamerInfoListImpl.