106#define _XOPEN_SOURCE 600
115#include <sys/xattr.h>
120# include <sys/types.h>
125#include "RConfigure.h"
161#include "compiledata.h"
173#include <sys/extattr.h>
194#define getxattr(path, name, value, size) getxattr(path, name, value, size, 0u, 0)
197#define getxattr(path, name, value, size) extattr_get_file(path, EXTATTR_NAMESPACE_USER, name, value, size)
207static struct AddPseudoGlobals {
224 Info(
"TFile",
"default ctor");
360 ::Fatal(
"TFile::TFile",
"ROOT system not initialized");
362 auto zombify = [
this] {
366 gROOT->GetListOfClosedObjects()->Add(
this);
373 if (strlen(
fUrl.GetProtocol()) != 0 && strcmp(
fUrl.GetProtocol(),
"file") != 0 && !
fOption.BeginsWith(
"NET") &&
376 "please use TFile::Open to access remote files:\n\tauto f = std::unique_ptr<TFile>{TFile::Open(\"%s\")};",
384 if (sfname1.Index(
"?") !=
kNPOS) {
385 TString s = sfname1(0, sfname1.Index(
"?"));
387 fNoAnchorInName = kTRUE;
394 fname1 =
fUrl.GetFile();
397 if (strstr(
fUrl.GetOptions(),
"filetype=raw"))
401 if (strstr(
fUrl.GetOptions(),
"filetype=pcm"))
404 if (
fUrl.HasOption(
"reproducible"))
425 fname1 =
fArchive->GetArchiveName();
428 if (!strlen(
fArchive->GetMemberName()))
433 if (
fOption.Contains(
"_WITHOUT_GLOBALREGISTRATION")) {
437 fList->UseRWLock(
false);
464 if (!fname1 || !fname1[0]) {
465 Error(
"TFile",
"file name is not specified");
471 if (!strcmp(fname1,
"/dev/null") &&
483 if (!
gSystem->ExpandPathName(fname)) {
491 Error(
"TFile",
"error expanding path %s", fname1);
499 if(
auto name=
fUrl.GetValueFromOptions(
"reproducible")) {
507 SysError(
"TFile",
"could not delete %s (errno: %d)",
518 Error(
"TFile",
"file %s already exists", fname.
Data());
528 Error(
"TFile",
"no write permission, could not open file %s", fname.
Data());
535 Error(
"TFile",
"file %s does not exist", fname.
Data());
540 Error(
"TFile",
"no read permission, could not open file %s", fname.
Data());
554 SysError(
"TFile",
"file %s can not be opened", fname.
Data());
566 SysError(
"TFile",
"file %s can not be opened for reading", fname.
Data());
593 fList->Delete(
"slow");
607 gROOT->GetListOfClosedObjects()->Remove(
this);
618 Info(
"~TFile",
"dtor called for %s [%zx]",
GetName(),(
size_t)
this);
644 Error(
"Init",
"archive %s can only be opened in read mode",
GetName());
660 if (
fArchive->SetCurrentMember() != -1)
663 Error(
"Init",
"member %s not found in archive %s",
686 if (
gEnv->GetValue(
"TFile.v630forwardCompatibility", 0) == 1)
706 char *header =
new char[
kBEGIN+200];
711 Error(
"Init",
"%s failed to read the file type data.",
718 if (strncmp(header,
"root", 4)) {
724 char *buffer = header + 4;
727 frombuf(buffer, &headerLength);
730 Int_t send,sfree,sinfo;
753 Error(
"Init",
"file %s has an incorrect header length (%lld) or incorrect end of file length (%lld)",
765 Warning(
"Init",
"file %s probably not closed, cannot read free segments",
GetName());
770 char *buffer_keyloc =
nullptr;
775 Error(
"Init",
"file %s has an incorrect header length (%lld) or incorrect end of file length (%lld)",
782 header =
new char[nbytes];
787 Error(
"Init",
"%s failed to read the file header information at %lld (size=%d)",
793 buffer_keyloc = header;
796 buffer_keyloc = header+
fBEGIN;
799 frombuf(buffer,&version); versiondir = version%1000;
804 if (version > 1000) {
809 Int_t sdir,sparent,skeys;
814 if (versiondir > 1)
fUUID.ReadBuffer(buffer);
817 buffer_keyloc +=
sizeof(
Int_t);
819 frombuf(buffer_keyloc, &keyversion);
821 if (keyversion > 1000) {
828 cname.ReadBuffer(buffer_keyloc);
829 cname.ReadBuffer(buffer_keyloc);
830 fTitle.ReadBuffer(buffer_keyloc);
833 Error(
"Init",
"cannot read directory info of file %s",
GetName());
850 if (
gEnv->GetValue(
"TFile.v630forwardCompatibility", 0) == 1)
874 Error(
"Init",
"file %s is truncated at %lld bytes: should be %lld, "
877 Error(
"Init",
"file %s is truncated at %lld bytes: should be %lld",
883 Warning(
"Init",
"file %s probably not closed, "
884 "trying to recover",
GetName());
892 Warning(
"Init",
"successfully recovered %d keys", nrecov);
894 Warning(
"Init",
"no keys recovered, file has been made a Zombie");
902 gROOT->GetListOfFiles()->Add(
this);
908 Int_t lenIndex =
gROOT->GetListOfStreamerInfo()->GetSize()+1;
909 if (lenIndex < 5000) lenIndex = 5000;
916 gROOT->GetListOfFiles()->Remove(
this);
921 if (
fKeys->GetSize()) {
923 const auto separator =
fVersion < 63200 ?
"/" :
".";
924 const auto thisVersion =
gROOT->GetVersionInt();
925 const auto msg =
"no StreamerInfo found in %s therefore preventing schema evolution when reading this file. "
926 "The file was produced with ROOT version %d.%02d%s%02d, "
927 "while the current version is %d.%02d.%02d";
931 thisVersion / 10000, (thisVersion / 100) % (100), thisVersion % 100);
941 while ((key = (
TKey*)next())) {
952 gROOT->GetListOfClosedObjects()->Add(
this);
1000 while ((key = iter()) !=
nullptr) {
1058 gROOT->GetListOfFiles()->Remove(
this);
1059 gROOT->GetListOfBrowsers()->RecursiveRemove(
this);
1060 gROOT->GetListOfClosedObjects()->Add(
this);
1071 return new TKey(obj,
name, bufsize, mother);
1079 return new TKey(obj, cl,
name, bufsize, mother);
1091 static TFile *currentFile =
nullptr;
1123 Info(
"Delete",
"deleting name = %s", namecycle);
1153 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFileDrawMap"))) {
1154 if (
h->LoadPlugin() == -1)
1156 h->ExecPlugin(3,
this, keys,
option);
1195 tobuf(buffer, version);
1211 if (
result >= (
double)std::numeric_limits<Int_t>::max()) {
1212 return std::numeric_limits<Int_t>::max() -1;
1228 Int_t nbytes, objlen, nwh = 64;
1229 char *header =
new char[
fBEGIN];
1235 while (idcur <
fEND-100) {
1250 if (nbytes == 0)
break;
1256 if (!objlen) objlen = nbytes-keylen;
1258 uncomp += keylen + objlen;
1328 if (first <
fBEGIN)
return 0;
1329 if (first >
fEND)
return 0;
1331 Int_t nread = maxbytes;
1332 if (first+maxbytes >
fEND) nread =
fEND-maxbytes;
1334 Warning(
"GetRecordHeader",
"%s: parameter maxbytes = %d must be >= 4",
1340 Warning(
"GetRecordHeader",
"%s: failed to read header data (maxbytes = %d)",
1351 if (nb < 0)
return nread;
1353 const Int_t headerSize = 16;
1354 if (nread < headerSize)
return nread;
1359 if (!olen) olen = nbytes-klen;
1378 Error(
"GetSize",
"cannot stat the file %s",
GetName());
1404 TList *list =
nullptr;
1407 auto key = std::make_unique<TKey>(
this);
1409 auto buf = buffer.data();
1413 Warning(
"GetRecordHeader",
"%s: failed to read the StreamerInfo data from disk.",
1415 return {
nullptr, 1, hash};
1418 if (lookupSICache) {
1425 Info(
"GetStreamerInfo",
"The streamer info record for file %s has already been treated, skipping it.",
GetName());
1426 for(
auto uid : *si_uids)
1428 return {
nullptr, 0, hash};
1431 key->ReadKeyBuffer(buf);
1432 list =
dynamic_cast<TList*
>(key->ReadObjWithBuffer(buffer.data()));
1435 list = (
TList*)
Get(
"StreamerInfo");
1439 Info(
"GetStreamerInfoList",
"cannot find the StreamerInfo record in file %s",
1441 return {
nullptr, 1, hash};
1444 return {list, 0, hash};
1511 if(!newfree)
return;
1515 if (nbytesl > 2000000000) nbytesl = 2000000000;
1518 char * buffer =
new char[nb];
1519 char * psave = buffer;
1520 tobuf(buffer, nbytes);
1593 bool forComp = options.
Contains(
"forcomp");
1594 bool extended = options.
Contains(
"extended");
1598 Int_t nbytes,date,time,objlen;
1606 constexpr Int_t nwheader = 512;
1608 char header[nwheader];
1609 char classname[512];
1614 unsigned char nDigits = std::log10(
fEND) + 1;
1616 while (idcur <
fEND) {
1618 Int_t nread = nwheader;
1619 if (idcur+nread >=
fEND) nread =
fEND-idcur-1;
1622 Warning(
"Map",
"%s: failed to read the key data from disk at %lld.",
1630 Printf(
"Address = %lld\tNbytes = %d\t=====E R R O R=======", idcur, nbytes);
1635 Printf(
"Address = %lld\tNbytes = %d\t=====G A P===========", idcur, nbytes);
1646 if (versionkey > 1000) {
1655 if ( ((buffer-header) + nwhc) > nwheader )
1656 nwhc = nwheader - (buffer-header);
1657 for (
int i = 0;
i < nwhc;
i++)
frombuf(buffer, &classname[
i]);
1658 classname[(
int)nwhc] =
'\0';
1659 if (idcur ==
fSeekFree) strlcpy(classname,
"FreeSegments",512);
1660 if (idcur ==
fSeekInfo) strlcpy(classname,
"StreamerInfo",512);
1661 if (idcur ==
fSeekKeys) strlcpy(classname,
"KeysList",512);
1664 if ( (buffer-header) >= nwheader )
1670 else if ( ((buffer-header) + nwhc) > nwheader )
1671 nwhc = nwheader - (buffer-header);
1673 for (
int i = 0;
i < nwhc;
i++)
frombuf(buffer, &keyname[
i]);
1674 keyname[(
int)nwhc] =
'\0';
1676 if ( (buffer-header) >= nwheader )
1682 else if ( ((buffer-header) + nwhc) > nwheader )
1683 nwhc = nwheader - (buffer-header);
1685 for (
int i = 0;
i < nwhc;
i++)
frombuf(buffer, &keytitle[
i]);
1686 keytitle[(
int)nwhc] =
'\0';
1688 extrainfo.
Form(
" name: %-16s title: %s", keyname, keytitle);
1693 if (objlen != nbytes - keylen) {
1695 Printf(
"%d/%06d At:%-*lld N=%-8d %-14s CX = %5.2f %s", date, time, nDigits + 1, idcur, nbytes, classname,
1696 cx, extrainfo.
Data());
1698 Printf(
"%d/%06d At:%-*lld N=%-8d %-14s %s", date, time, nDigits + 1, idcur, nbytes, classname, extrainfo.
Data());
1702 if (objlen != nbytes - keylen) {
1704 Printf(
"At:%-*lld N=%-8d K=%-3d O=%-8d %-14s CX = %5.2f %s", nDigits+1, idcur, nbytes, keylen, objlen, classname, cx, extrainfo.
Data());
1706 Printf(
"At:%-*lld N=%-8d K=%-3d O=%-8d %-14s CX = 1 %s", nDigits+1, idcur, nbytes, keylen, objlen, classname, extrainfo.
Data());
1712 Printf(
"%d/%06d At:%-*lld N=%-8d %-14s",date,time, nDigits+1, idcur,1,
"END");
1714 Printf(
"At:%-*lld N=%-8d K= O= %-14s", nDigits+1, idcur,1,
"END");
1769 Error(
"ReadBuffer",
"error reading all requested bytes from file %s, got %ld of %d",
1816 Error(
"ReadBuffer",
"error reading all requested bytes from file %s, got %ld of %d",
1847 for (
Int_t j = 0; j < nbuf; j++) {
1861 char *buf2 =
nullptr;
1864 cur = pos[
i]+
len[
i];
1867 if (bigRead || (
i>=nbuf)) {
1886 for (
Int_t j=0;j<
n;j++) {
1887 memcpy(&buf[k],&buf2[pos[
i-
n+j]-curbegin],
len[
i-
n+j]);
1897 curbegin =
i < nbuf ? pos[
i] : 0;
1900 if (buf2)
delete [] buf2;
1986 snprintf(pidname,32,
"ProcessID%d",pidf);
1989 printf(
"ReadProcessID, name=%s, file=%s, pid=%zx\n",pidname,
GetName(),(
size_t)pid);
1998 TIter next(pidslist);
2074 Int_t nbytes,date,time,objlen,nwheader;
2077 char *buffer, *bufread;
2083 Error(
"Recover",
"cannot stat the file %s",
GetName());
2094 Int_t nread = nwheader;
2096 while (idcur <
fEND) {
2098 if (idcur+nread >=
fEND) nread =
fEND-idcur-1;
2101 Error(
"Recover",
"%s: failed to read the key data from disk at %lld.",
2109 Error(
"Recover",
"Address = %lld\tNbytes = %d\t=====E R R O R=======", idcur, nbytes);
2124 if (versionkey > 1000) {
2133 char *classname =
nullptr;
2134 if (nwhc <= 0 || nwhc > 100)
break;
2135 classname =
new char[nwhc+1];
2136 int i, nwhci = nwhc;
2137 for (
i = 0;
i < nwhc;
i++)
frombuf(buffer, &classname[
i]);
2138 classname[nwhci] =
'\0';
2142 && strcmp(classname,
"TBasket")) {
2143 key =
new TKey(
this);
2145 if (!strcmp(key->
GetName(),
"StreamerInfo")) {
2156 delete [] classname;
2161 if (max_file_size <
fEND) max_file_size =
fEND+1000000000;
2168 if (nrecov)
Write();
2191 if (opt !=
"READ" && opt !=
"UPDATE") {
2192 Error(
"ReOpen",
"mode must be either READ or UPDATE, not %s", opt.
Data());
2199 if (opt ==
"READ") {
2235 SysError(
"ReOpen",
"file %s can not be opened in read mode",
GetName());
2257 SysError(
"ReOpen",
"file %s can not be opened in update mode",
GetName());
2266 Warning(
"ReOpen",
"file %s probably not closed, cannot read free segments",
GetName());
2287 Error(
"SetOffset",
"seeking from end in archive is not (yet) supported");
2311 Error(
"Seek",
"seeking from end in archive is not (yet) supported");
2316 SysError(
"Seek",
"cannot seek to position %lld in file %s, retpos=%lld",
2343 if (level < 0) level = 0;
2344 if (level > 99) level = 99;
2399 if (cache) cache->
SetFile(
this, action);
2429 if (
b.IsReading()) {
2490 Error(
"Write const",
"A const TFile object should not be saved. We try to proceed anyway.");
2491 return const_cast<TFile*
>(
this)->
Write(
n, opt, bufsize);
2522 Error(
"WriteBuffer",
"error writing all requested bytes to file %s, wrote %ld of %d",
2549 Error(
"WriteBuffer",
"error writing to cache");
2574 auto createKey = [
this]() {
2578 while ((afree = (
TFree*) next())) {
2579 nbytes += afree->
Sizeof();
2581 if (!nbytes)
return (
TKey*)
nullptr;
2587 return (
TKey*)
nullptr;
2592 TKey *key = createKey();
2609 char *start = buffer;
2613 while ((afree = (
TFree*) next())) {
2618 auto actualBytes = buffer-start;
2619 if ( actualBytes != nbytes ) {
2620 if (actualBytes < nbytes) {
2623 memset(buffer,0,nbytes-actualBytes);
2625 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);
2642 const char *root =
"root";
2643 char *psave =
new char[
fBEGIN];
2644 char *buffer = psave;
2646 memcpy(buffer, root, 4); buffer += 4;
2649 tobuf(buffer, version);
2651 if (version < 1000000) {
2655 tobuf(buffer, nfree);
2665 tobuf(buffer, nfree);
2675 fUUID.FillBuffer(buffer);
2676 Int_t nbytes = buffer - psave;
2757 parname =
gSystem->BaseName(dirname);
2759 pardir =
gSystem->GetDirName(dirname);
2762 void *dir =
gSystem->OpenDirectory(pardir);
2765 void *dirp =
gSystem->OpenDirectory(path);
2767 path +=
"/PROOF-INF";
2768 void *dirinf =
gSystem->OpenDirectory(path);
2769 const char *afile = 0;
2771 while ((afile =
gSystem->GetDirEntry(dirinf))) {
2772 if (strcmp(afile,
".") == 0)
continue;
2773 if (strcmp(afile,
"..") == 0)
continue;
2774 filepath.
Form(
"%s/%s", path.
Data(), afile);
2775 if (
gSystem->Unlink(filepath))
2776 Warning(
"MakeProject",
"1: problems unlinking '%s' ('%s', '%s')", filepath.
Data(), path.
Data(), afile);
2778 gSystem->FreeDirectory(dirinf);
2782 while ((afile =
gSystem->GetDirEntry(dirp))) {
2783 if (strcmp(afile,
".") == 0)
continue;
2784 if (strcmp(afile,
"..") == 0)
continue;
2785 filepath.
Form(
"%s/%s", path.
Data(), afile);
2786 if (
gSystem->Unlink(filepath))
2787 Warning(
"MakeProject",
"2: problems unlinking '%s' ('%s', '%s')", filepath.
Data(), path.
Data(), afile);
2791 Warning(
"MakeProject",
"problems unlinking '%s'", path.
Data());
2795 path.
Form(
"%s/%s/PROOF-INF", pardir.
Data(), parname.
Data());
2797 Error(
"MakeProject",
"problems creating '%s'", path.
Data());
2803 void *dir =
gSystem->OpenDirectory(dirname);
2812 }
else if (opt.
Contains(
"recreate")) {
2815 if (
gSystem->mkdir(dirname) < 0) {
2816 Error(
"MakeProject",
"cannot create directory '%s'",dirname);
2822 const char *afile =
gSystem->GetDirEntry(dir);
2824 if (strcmp(afile,
".") == 0)
continue;
2825 if (strcmp(afile,
"..") == 0)
continue;
2826 dirpath.
Form(
"%s/%s",dirname,afile);
2834 Error(
"MakeProject",
"cannot create directory %s, already existing",dirname);
2838 if (
gSystem->mkdir(dirname) < 0) {
2839 Error(
"MakeProject",
"cannot create directory '%s'",dirname);
2852 if (filelist) filelist = (
TList*)filelist->
Clone();
2854 Error(
"MakeProject",
"file %s has no StreamerInfo",
GetName());
2858 TString clean_dirname(dirname);
2859 if (makepar) clean_dirname.
Form(
"%s/%s", pardir.
Data(), parname.
Data());
2860 if (clean_dirname[clean_dirname.
Length()-1]==
'/') {
2862 }
else if (clean_dirname[clean_dirname.
Length()-1]==
'\\') {
2864 if (clean_dirname[clean_dirname.
Length()-1]==
'\\') {
2869 if (makepar) subdirname = parname;
2870 if (subdirname ==
"") {
2871 Error(
"MakeProject",
"Directory name must not be empty.");
2876 TString spath; spath.
Form(
"%s/%sProjectSource.cxx",clean_dirname.
Data(),subdirname.
Data());
2877 FILE *sfp = fopen(spath.
Data(),
"w");
2879 Error(
"MakeProject",
"Unable to create the source file %s.",spath.
Data());
2882 fprintf(sfp,
"namespace std {}\nusing namespace std;\n");
2883 fprintf(sfp,
"#include \"%sProjectHeaders.h\"\n\n",subdirname.
Data() );
2884 if (!
genreflex) fprintf(sfp,
"#include \"%sLinkDef.h\"\n\n",subdirname.
Data() );
2885 fprintf(sfp,
"#include \"%sProjectDict.cxx\"\n\n",subdirname.
Data() );
2886 fprintf(sfp,
"struct DeleteObjectFunctor {\n");
2887 fprintf(sfp,
" template <typename T>\n");
2888 fprintf(sfp,
" void operator()(const T *ptr) const {\n");
2889 fprintf(sfp,
" delete ptr;\n");
2890 fprintf(sfp,
" }\n");
2891 fprintf(sfp,
" template <typename T, typename Q>\n");
2892 fprintf(sfp,
" void operator()(const std::pair<T,Q> &) const {\n");
2893 fprintf(sfp,
" // Do nothing\n");
2894 fprintf(sfp,
" }\n");
2895 fprintf(sfp,
" template <typename T, typename Q>\n");
2896 fprintf(sfp,
" void operator()(const std::pair<T,Q*> &ptr) const {\n");
2897 fprintf(sfp,
" delete ptr.second;\n");
2898 fprintf(sfp,
" }\n");
2899 fprintf(sfp,
" template <typename T, typename Q>\n");
2900 fprintf(sfp,
" void operator()(const std::pair<T*,Q> &ptr) const {\n");
2901 fprintf(sfp,
" delete ptr.first;\n");
2902 fprintf(sfp,
" }\n");
2903 fprintf(sfp,
" template <typename T, typename Q>\n");
2904 fprintf(sfp,
" void operator()(const std::pair<T*,Q*> &ptr) const {\n");
2905 fprintf(sfp,
" delete ptr.first;\n");
2906 fprintf(sfp,
" delete ptr.second;\n");
2907 fprintf(sfp,
" }\n");
2908 fprintf(sfp,
"};\n\n");
2915 TIter flnext(filelist);
2922 if (strstr(info->
GetName(),
"@@")) {
2939 for(
auto rule : rules) {
2940 if( rule->IsRenameRule() || rule->IsAliasRule() )
2943 if ( rule->HasTarget( el->
GetName()) && rule->GetAttributes()[0] != 0 ) {
2946 if (
attr.Contains(
"owner")) {
2947 if (
attr.Contains(
"notowner")) {
2961 list->AddAfter(alternate, info);
2962 list->Remove(alternate);
2970 TIter nextextra(&extrainfos);
2973 filelist->
Add(info);
2984 TIter subnext(list);
2999 subClasses.
Add(subinfo);
3004 subClasses.
Clear(
"nodelete");
3006 extrainfos.
Clear(
"nodelete");
3009 path.
Form(
"%s/%sProjectHeaders.h",clean_dirname.
Data(),subdirname.
Data());
3010 FILE *allfp = fopen(path,
"a");
3012 Error(
"MakeProject",
"Cannot open output file:%s\n",path.
Data());
3014 fprintf(allfp,
"#include \"%sProjectInstances.h\"\n", subdirname.
Data());
3018 printf(
"MakeProject has generated %d classes in %s\n",ngener,clean_dirname.
Data());
3021 if (!opt.
Contains(
"+") && !makepar) {
3029 FILE *fpMAKE =
nullptr;
3034 path.
Form(
"%s/makep.cmd",clean_dirname.
Data());
3036 path.
Form(
"%s/MAKEP",clean_dirname.
Data());
3039 fpMAKE = fopen(path,
"wb");
3041 fpMAKE = fopen(path,
"w");
3044 Error(
"MakeProject",
"cannot open file %s", path.
Data());
3053 FILE *ifp =
nullptr;
3054 path.
Form(
"%s/%sProjectInstances.h",clean_dirname.
Data(),subdirname.
Data());
3056 ifp = fopen(path,
"wb");
3058 ifp = fopen(path,
"w");
3061 Error(
"MakeProject",
"cannot open path file %s", path.
Data());
3071 fprintf(fpMAKE,
"genreflex %sProjectHeaders.h -o %sProjectDict.cxx --comments --iocomments %s ",subdirname.
Data(),subdirname.
Data(),
gSystem->GetIncludePath());
3072 path.
Form(
"%s/%sSelection.xml",clean_dirname.
Data(),subdirname.
Data());
3074 fprintf(fpMAKE,
"rootcint -v1 -f %sProjectDict.cxx %s ", subdirname.
Data(),
gSystem->GetIncludePath());
3075 path.
Form(
"%s/%sLinkDef.h",clean_dirname.
Data(),subdirname.
Data());
3078 path.
Form(
"%s/%sLinkDef.h",clean_dirname.
Data(),subdirname.
Data());
3084 FILE *fp = fopen(path,
"wb");
3086 FILE *fp = fopen(path,
"w");
3089 Error(
"MakeProject",
"cannot open path file %s", path.
Data());
3098 fprintf(fp,
"<lcgdict>\n");
3101 fprintf(fp,
"#ifdef __CINT__\n");
3113 if (strncmp(info->
GetName(),
"auto_ptr<", strlen(
"auto_ptr<")) == 0) {
3122 for(
auto rule : rules) {
3125 rule->AsString(strrule,
"x");
3128 selections.
Append(strrule);
3131 rule->AsString(strrule);
3132 if (strncmp(strrule.
Data(),
"type=",5)==0) {
3135 fprintf(fp,
"#pragma %s;\n",strrule.
Data());
3142 std::vector<std::string> inside;
3149 switch ( stlkind ) {
3153 what =
"std::pair<";
3163 tmp.Form(
"<class name=\"%s\" />\n",
what.Data());
3167 tmp.Form(
"template class %s;\n",
what.Data());
3172 what.ReplaceAll(
"std::",
"");
3175 fprintf(fp,
"#pragma link C++ class %s+;\n",
what.Data());
3183 tmp.Form(
"<class name=\"%s\" />\n",key->
GetName());
3187 tmp.Form(
"template class %s;\n",key->
GetName());
3192 what.ReplaceAll(
"std::",
"");
3193 fprintf(fp,
"#pragma link C++ class %s+;\n",key->
GetName());
3204 tmp.Form(
"<class name=\"%s\" />\n",
what.Data());
3208 if (
what[
what.Length()-1] ==
'>') {
3209 tmp.Form(
"template class %s;\n",
what.Data());
3215 what.ReplaceAll(
"std::",
"");
3216 fprintf(fp,
"#pragma link C++ class %s+;\n",
what.Data());
3226 tmp.Form(
"<class name=\"%s\" />\n",
what.Data());
3230 tmp.Form(
"template class %s;\n",
what.Data());
3239 fprintf(ifp,
"#ifndef PROJECT_INSTANCES_H\n");
3240 fprintf(ifp,
"#define PROJECT_INSTANCES_H\n");
3241 fprintf(ifp,
"%s",instances.
Data());
3242 fprintf(ifp,
"#endif\n");
3243 fprintf(fp,
"%s",selections.
Data());
3244 fprintf(fp,
"</lcgdict>\n");
3246 fprintf(fp,
"#endif\n");
3257 cmd.ReplaceAll(
"$SourceFiles",sources.
Data());
3259 object.Append(
gSystem->GetObjExt() );
3260 cmd.ReplaceAll(
"$ObjectFiles",
object.Data());
3261 cmd.ReplaceAll(
"$IncludePath",
TString(
gSystem->GetIncludePath()) +
" -I" + clean_dirname.
Data());
3262 cmd.ReplaceAll(
"$SharedLib",sdirname+
"."+
gSystem->GetSoExt());
3263 cmd.ReplaceAll(
"$LinkedLibs",
gSystem->GetLibraries(
"",
"SDL"));
3264 cmd.ReplaceAll(
"$LibName",sdirname);
3265 cmd.ReplaceAll(
"$BuildDir",
".");
3267 TString rootbuild = ROOTBUILD;
3269 sOpt =
gSystem->GetFlagsOpt();
3271 sOpt =
gSystem->GetFlagsDebug();
3276 fprintf(fpMAKE,
"-s %sSelection.xml \n",subdirname.
Data());
3278 fprintf(fpMAKE,
"%sProjectHeaders.h ",subdirname.
Data());
3279 fprintf(fpMAKE,
"%sLinkDef.h \n",subdirname.
Data());
3282 fprintf(fpMAKE,
"%s\n",cmd.Data());
3284 printf(
"%s/MAKEP file has been generated\n", clean_dirname.
Data());
3293 Error(
"MakeProject",
"problems creating PAR make file '%s'", filemake.
Data());
3301 if (
gSystem->ExpandPathName(mkarchsrc))
3302 Warning(
"MakeProject",
"problems expanding '%s'", mkarchsrc.
Data());
3305 Error(
"MakeProject",
"problems retrieving '%s' to '%s'", mkarchsrc.
Data(), mkarchdst.
Data());
3314 Error(
"MakeProject",
"problems creating BUILD.sh and/or SETUP.C under '%s'", proofinf.
Data());
3327 chmod(cmod.
Data(), 00700);
3329 Printf(
"Files Makefile, Makefile.arch, PROOF-INF/BUILD.sh and"
3330 " PROOF-INF/SETUP.C have been generated under '%s'", clean_dirname.
Data());
3335 if (
gSystem->ChangeDirectory(pardir)) {
3338 if (
gSystem->ChangeDirectory(curdir)) {
3339 Info(
"MakeProject",
"PAR file %s.par generated", clean_dirname.
Data());
3341 Warning(
"MakeProject",
"problems changing directory back to '%s'", curdir.
Data());
3344 Error(
"MakeProject",
"problems changing directory to '%s' - skipping PAR file generation", pardir.
Data());
3347 Warning(
"MakeProject",
"on Windows systems the PAR file cannot be generated out of the package directory!");
3352 if (!makepar && !opt.
Contains(
"nocompilation")) {
3354 path =
gSystem->WorkingDirectory();
3357 gSystem->Exec(
"chmod +x MAKEP");
3358 int res = !
gSystem->Exec(
"./MAKEP");
3361 chmod(
"makep.cmd",00700);
3362 int res = !
gSystem->Exec(
"MAKEP");
3364 gSystem->ChangeDirectory(path);
3366 if (res) printf(
"Shared lib %s has been generated\n",path.
Data());
3371 if (res) printf(
"Shared lib %s has been dynamically linked\n",path.
Data());
3389 if (!filemake || (filemake && strlen(filemake) <= 0)) {
3390 Error(
"MakeProjectParMake",
"path for output file undefined!");
3395 if (!pack || (pack && strlen(pack) <= 0)) {
3396 Error(
"MakeProjectParMake",
"package name undefined!");
3401 FILE *fmk = fopen(filemake,
"wb");
3403 FILE *fmk = fopen(filemake,
"w");
3411 fprintf(fmk,
"# Makefile for the ROOT test programs.\n");
3412 fprintf(fmk,
"# This Makefile shows how to compile and link applications\n");
3413 fprintf(fmk,
"# using the ROOT libraries on all supported platforms.\n");
3414 fprintf(fmk,
"#\n");
3415 fprintf(fmk,
"# Copyright (c) 2000 Rene Brun and Fons Rademakers\n");
3416 fprintf(fmk,
"#\n");
3417 fprintf(fmk,
"# Author: this makefile has been automatically generated via TFile::MakeProject\n");
3419 fprintf(fmk,
"include Makefile.arch\n");
3421 fprintf(fmk,
"#------------------------------------------------------------------------------\n");
3423 fprintf(fmk,
"PACKO = %sProjectSource.$(ObjSuf)\n", pack);
3424 fprintf(fmk,
"PACKS = %sProjectSource.$(SrcSuf) %sProjectDict.$(SrcSuf)\n", pack, pack);
3425 fprintf(fmk,
"PACKSO = lib%s.$(DllSuf)\n", pack);
3427 fprintf(fmk,
"ifeq ($(PLATFORM),win32)\n");
3428 fprintf(fmk,
"PACKLIB = lib%s.lib\n", pack);
3429 fprintf(fmk,
"else\n");
3430 fprintf(fmk,
"PACKLIB = $(PACKSO)\n");
3431 fprintf(fmk,
"endif\n");
3433 fprintf(fmk,
"OBJS = $(PACKO)\n");
3435 fprintf(fmk,
"PROGRAMS =\n");
3437 fprintf(fmk,
"#------------------------------------------------------------------------------\n");
3439 fprintf(fmk,
".SUFFIXES: .$(SrcSuf) .$(ObjSuf) .$(DllSuf)\n");
3441 fprintf(fmk,
"all: $(PACKLIB)\n");
3443 fprintf(fmk,
"$(PACKSO): $(PACKO)\n");
3444 fprintf(fmk,
"ifeq ($(ARCH),aix)\n");
3445 fprintf(fmk,
"\t\t/usr/ibmcxx/bin/makeC++SharedLib $(OutPutOpt) $@ $(LIBS) -p 0 $^\n");
3446 fprintf(fmk,
"else\n");
3447 fprintf(fmk,
"ifeq ($(ARCH),aix5)\n");
3448 fprintf(fmk,
"\t\t/usr/vacpp/bin/makeC++SharedLib $(OutPutOpt) $@ $(LIBS) -p 0 $^\n");
3449 fprintf(fmk,
"else\n");
3450 fprintf(fmk,
"ifeq ($(PLATFORM),macosx)\n");
3451 fprintf(fmk,
"# We need to make both the .dylib and the .so\n");
3452 fprintf(fmk,
"\t\t$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(LIBS)\n");
3453 fprintf(fmk,
"ifneq ($(subst $(MACOSX_MINOR),,1234),1234)\n");
3454 fprintf(fmk,
"ifeq ($(MACOSX_MINOR),4)\n");
3455 fprintf(fmk,
"\t\tln -sf $@ $(subst .$(DllSuf),.so,$@)\n");
3456 fprintf(fmk,
"else\n");
3457 fprintf(fmk,
"\t\t$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ \\\n");
3458 fprintf(fmk,
"\t\t $(OutPutOpt) $(subst .$(DllSuf),.so,$@)\n");
3459 fprintf(fmk,
"endif\n");
3460 fprintf(fmk,
"endif\n");
3461 fprintf(fmk,
"else\n");
3462 fprintf(fmk,
"ifeq ($(PLATFORM),win32)\n");
3463 fprintf(fmk,
"\t\tbindexplib $* $^ > $*.def\n");
3464 fprintf(fmk,
"\t\tlib -nologo -MACHINE:IX86 $^ -def:$*.def \\\n");
3465 fprintf(fmk,
"\t\t $(OutPutOpt)$(PACKLIB)\n");
3466 fprintf(fmk,
"\t\t$(LD) $(SOFLAGS) $(LDFLAGS) $^ $*.exp $(LIBS) \\\n");
3467 fprintf(fmk,
"\t\t $(OutPutOpt)$@\n");
3468 fprintf(fmk,
"else\n");
3469 fprintf(fmk,
"\t\t$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(LIBS) $(EXPLLINKLIBS)\n");
3470 fprintf(fmk,
"endif\n");
3471 fprintf(fmk,
"endif\n");
3472 fprintf(fmk,
"endif\n");
3473 fprintf(fmk,
"endif\n");
3474 fprintf(fmk,
"\t\t@echo \"$@ done\"\n");
3476 fprintf(fmk,
"clean:\n");
3477 fprintf(fmk,
"\t\t@rm -f $(OBJS) core\n");
3479 fprintf(fmk,
"distclean: clean\n");
3480 fprintf(fmk,
"\t\t@rm -f $(PROGRAMS) $(PACKSO) $(PACKLIB) *Dict.* *.def *.exp \\\n");
3481 fprintf(fmk,
"\t\t *.so *.lib *.dll *.d *.log .def so_locations\n");
3482 fprintf(fmk,
"\t\t@rm -rf cxx_repository\n");
3484 fprintf(fmk,
"# Dependencies\n");
3486 fprintf(fmk,
"%sProjectSource.$(ObjSuf): %sProjectHeaders.h %sLinkDef.h %sProjectDict.$(SrcSuf)\n", pack, pack, pack, pack);
3488 fprintf(fmk,
"%sProjectDict.$(SrcSuf): %sProjectHeaders.h %sLinkDef.h\n", pack, pack, pack);
3489 fprintf(fmk,
"\t\t@echo \"Generating dictionary $@...\"\n");
3490 fprintf(fmk,
"\t\t@rootcint -f $@ $^\n");
3492 fprintf(fmk,
".$(SrcSuf).$(ObjSuf):\n");
3493 fprintf(fmk,
"\t\t$(CXX) $(CXXFLAGS) -c $<\n");
3511 if (!proofinf || (proofinf && strlen(proofinf) <= 0)) {
3512 Error(
"MakeProjectParProofInf",
"directory path undefined!");
3520 Error(
"MakeProjectParProofInf",
"path '%s' %s", proofinf,
3521 ((rcst == 0) ?
"is not a directory" :
"does not exist"));
3526 if (!pack || (pack && strlen(pack) <= 0)) {
3527 Error(
"MakeProjectParProofInf",
"package name undefined!");
3534 path.
Form(
"%s/BUILD.sh", proofinf);
3536 FILE *
f = fopen(path.
Data(),
"wb");
3538 FILE *
f = fopen(path.
Data(),
"w");
3541 Error(
"MakeProjectParProofInf",
"cannot create file '%s' (errno: %d)",
3546 fprintf(
f,
"#! /bin/sh\n");
3547 fprintf(
f,
"# Build libEvent library.\n");
3550 fprintf(
f,
"# The environment variables ROOTPROOFLITE and ROOTPROOFCLIENT can be used to\n");
3551 fprintf(
f,
"# adapt the script to the calling environment\n");
3553 fprintf(
f,
"# if test ! \"x$ROOTPROOFLITE\" = \"x\"; then\n");
3554 fprintf(
f,
"# echo \"event-BUILD: PROOF-Lite node (session has $ROOTPROOFLITE workers)\"\n");
3555 fprintf(
f,
"# elif test ! \"x$ROOTPROOFCLIENT\" = \"x\"; then\n");
3556 fprintf(
f,
"# echo \"event-BUILD: PROOF client\"\n");
3557 fprintf(
f,
"# else\n");
3558 fprintf(
f,
"# echo \"event-BUILD: standard PROOF node\"\n");
3559 fprintf(
f,
"# fi\n");
3561 fprintf(
f,
"if [ \"\" = \"clean\" ]; then\n");
3562 fprintf(
f,
" make distclean\n");
3563 fprintf(
f,
" exit 0\n");
3566 fprintf(
f,
"make\n");
3567 fprintf(
f,
"rc=$?\n");
3568 fprintf(
f,
"echo \"rc=$?\"\n");
3569 fprintf(
f,
"if [ $? != \"0\" ] ; then\n");
3570 fprintf(
f,
" exit 1\n");
3572 fprintf(
f,
"exit 0\n");
3578 path.
Form(
"%s/SETUP.C", proofinf);
3580 f = fopen(path.
Data(),
"wb");
3582 f = fopen(path.
Data(),
"w");
3585 Error(
"MakeProjectParProofInf",
"cannot create file '%s' (errno: %d)",
3590 fprintf(
f,
"Int_t SETUP()\n");
3594 fprintf(
f,
"// The environment variables ROOTPROOFLITE and ROOTPROOFCLIENT can be used to\n");
3595 fprintf(
f,
"// adapt the macro to the calling environment\n");
3597 fprintf(
f,
"// if (gSystem->Getenv(\"ROOTPROOFLITE\")) {\n");
3598 fprintf(
f,
"// Printf(\"event-SETUP: PROOF-Lite node (session has %%s workers)\",\n");
3599 fprintf(
f,
"// gSystem->Getenv(\"ROOTPROOFLITE\"));\n");
3600 fprintf(
f,
"// } else if (gSystem->Getenv(\"ROOTPROOFCLIENT\")) {\n");
3601 fprintf(
f,
"// Printf(\"event-SETUP: PROOF client\");\n");
3602 fprintf(
f,
"// } else {\n");
3603 fprintf(
f,
"// Printf(\"event-SETUP: standard PROOF node\");\n");
3604 fprintf(
f,
"// }\n");
3606 fprintf(
f,
" if (gSystem->Load(\"lib%s\") == -1)\n", pack);
3607 fprintf(
f,
" return -1;\n");
3608 fprintf(
f,
" return 0;\n");
3630 TList *list = listRetcode.fList;
3631 auto retcode = listRetcode.fReturnCode;
3644 if (version > 1000000) version -= 1000000;
3645 if (version < 53419 || (59900 < version && version < 59907)) {
3660 if (!base)
continue;
3671 std::vector<Int_t> si_uids;
3686 if (strcmp(obj->
GetName(),
"listOfRules")==0) {
3694 rulelnk = rulelnk->
Next();
3708 Warning(
"ReadStreamerInfo",
"The StreamerInfo for %s does not have a list of elements.",info->
GetName());
3713 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
3715 if ( (!isstl &&
mode ==0) || (isstl &&
mode ==1) ) {
3721 if (uid >= asize && uid <100000)
fClassIndex->Set(2*asize);
3722 if (uid >= 0 && uid < fClassIndex->
GetSize()) {
3723 si_uids.push_back(uid);
3727 printf(
"ReadStreamerInfo, class:%s, illegal uid=%d\n",info->
GetName(),uid);
3740 fgTsSIHashes.Insert(listRetcode.fHash, std::move(si_uids));
3837 listOfRules.
SetName(
"listOfRules");
3838 std::set<TClass*> classSet;
3844 if (
gDebug > 0) printf(
" -class: %s info number %d saved\n",info->
GetName(),uid);
3850 if ( classSet.find( clinfo ) == classSet.end() ) {
3851 if (
gDebug > 0) printf(
" -class: %s stored the I/O customization rules\n",info->
GetName());
3858 listOfRules.
Add(obj);
3860 classSet.insert(clinfo);
3871 list.Add(&listOfRules);
3878 fKeys->Remove(&key);
3903 "you want to read through a cache, but you have no valid cache "
3904 "directory set - reading remotely");
3905 ::Info(
"TFile::OpenFromCache",
"set cache directory using TFile::SetCacheFileDir()");
3913 "you want to read through a cache, but you are reading "
3914 "local files - CACHEREAD disabled");
3921 cachefilepath += fileurl.
GetFile();
3922 cachefilepathbasedir =
gSystem->GetDirName(cachefilepath);
3923 if ((
gSystem->mkdir(cachefilepathbasedir,
kTRUE) < 0) &&
3925 ::Warning(
"TFile::OpenFromCache",
"you want to read through a cache, but I "
3926 "cannot create the directory %s - CACHEREAD disabled",
3927 cachefilepathbasedir.
Data());
3932 cachefilepath +=
"__";
3936 if (strstr(
name,
"zip=")) {
3941 Int_t optioncount = 0;
3950 if (optioncount!=0) {
3955 newoptions +=
value;
3965 cachefilepath +=
"__";
3966 cachefilepath += zipname;
3977 if (!
gSystem->GetPathInfo(cachefilepath, &
id, &
size, &flags, &modtime)) {
3980 char cacheblock[256];
3981 char remotblock[256];
3984 cfurl = cachefilepath;
3985 cfurl +=
"?filetype=raw";
3988 ropt +=
"&filetype=raw";
4001 ::Error(
"TFile::OpenFromCache",
4002 "cannot open the cache file to check cache consistency");
4007 ::Error(
"TFile::OpenFromCache",
4008 "cannot open the remote file to check cache consistency");
4015 if ((!cachefile->
ReadBuffer(cacheblock,256)) &&
4017 if (memcmp(cacheblock, remotblock, 256)) {
4018 ::Warning(
"TFile::OpenFromCache",
"the header of the cache file "
4019 "differs from the remote file - forcing an update");
4023 ::Warning(
"TFile::OpenFromCache",
"the header of the cache and/or "
4024 "remote file are not readable - forcing an update");
4039 const auto cachefilepathtmp = cachefilepath + std::to_string(
gSystem->GetPid()) +
".tmp";
4042 "you want to read through a cache, but I "
4043 "cannot make a cache copy of %s - CACHEREAD disabled",
4044 cachefilepathbasedir.
Data());
4048 if (
gSystem->AccessPathName(cachefilepath))
4049 gSystem->Rename(cachefilepathtmp, cachefilepath);
4051 gSystem->Unlink(cachefilepathtmp);
4054 ::Info(
"TFile::OpenFromCache",
"using local cache copy of %s [%s]",
name, cachefilepath.
Data());
4057 fileurl.
SetFile(cachefilepath);
4060 tagfile = cachefilepath;
4061 tagfile +=
".ROOT.cachefile";
4119 if (!url || strlen(url) <= 0) {
4120 ::Error(
"TFile::Open",
"no url specified");
4125 gSystem->ExpandPathName(expandedUrl);
4129 if (
gEnv->GetValue(
"TFile.CrossProtocolRedirects", 1) == 1) {
4132 ssize_t
len = getxattr(fileurl.
GetFile(),
"eos.url.xroot",
nullptr, 0);
4134 std::string xurl(
len, 0);
4135 if (getxattr(fileurl.
GetFile(),
"eos.url.xroot", &xurl[0],
len) ==
len) {
4136 if ((
f =
TFile::Open(xurl.c_str(), options, ftitle, compress, netopt))) {
4137 if (!
f->IsZombie()) {
4156 TString sto = opts(ito + strlen(
"TIMEOUT="), opts.
Length());
4161 if (
gDebug > 0)
::Info(
"TFile::Open",
"timeout of %d millisec requested", toms);
4163 sto.
Insert(0,
"TIMEOUT=");
4181 ::Info(
"TFile::Open",
"waited %d millisec for asynchronous open", toms - xtms);
4183 ::Info(
"TFile::Open",
"timeout option not supported (requires asynchronous"
4188 ::Error(
"TFile::Open",
"timeout expired while opening '%s'", expandedUrl.
Data());
4195 ::Warning(
"TFile::Open",
"incomplete 'TIMEOUT=' option specification - ignored");
4201 const char *
option = opts;
4204 TString namelist(expandedUrl);
4211 FILE *fout =
gSystem->TempFileName(outf);
4214 gSystem->RedirectOutput(outf,
"w", &rh);
4221 while (namelist.
Tokenize(
n, from,
"|") && !
f) {
4224 if (!strcasecmp(
option,
"CACHEREAD") ||
4255 TString lfname =
gEnv->GetValue(
"Path.Localroot",
"");
4264 lfname = urlname.
GetUrl();
4271 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name))) {
4272 if (
h->LoadPlugin() == -1)
4280 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name))) {
4281 if (
h->LoadPlugin() == -1)
4289 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name)) &&
4290 h->LoadPlugin() == 0) {
4291 name.ReplaceAll(
"file:",
"");
4299 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name.Data()))) {
4300 if (
h->LoadPlugin() == -1)
4316 if (
f &&
f->IsZombie()) {
4319 if( newUrl.
Length() && (newUrl !=
name) &&
gEnv->GetValue(
"TFile.CrossProtocolRedirects", 1) )
4328 gSystem->RedirectOutput(0,
"", &rh);
4339 f &&
f->IsWritable() && !
f->IsRaw()) {
4374 const char *ftitle,
Int_t compress,
4382 if (!url || strlen(url) <= 0) {
4383 ::Error(
"TFile::AsyncOpen",
"no url specified");
4389 gSystem->ExpandPathName(namelist);
4395 TString outf =
".TFileAsyncOpen_";
4396 FILE *fout =
gSystem->TempFileName(outf);
4399 gSystem->RedirectOutput(outf,
"w", &rh);
4406 while (namelist.
Tokenize(
n, from,
"|") && !
f) {
4421 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TFile",
name)) &&
4422 (!strcmp(
h->GetClass(),
"TXNetFile") || !strcmp(
h->GetClass(),
"TNetXNGFile"))
4423 &&
h->LoadPlugin() == 0) {
4432 gSystem->RedirectOutput(0,
"", &rh);
4434 if (!notfound && !
f)
4479 if ((
f = fh->
GetFile()) && !(
f->IsZombie())) {
4481 Bool_t cr = (!strcmp(
f->GetOption(),
"CREATE") ||
4482 !strcmp(
f->GetOption(),
"RECREATE") ||
4493 if (
f)
f->fAsyncHandle = fh;
4505#if defined(R__WINGCC)
4509#elif defined(R__SEEK64)
4510 return ::open64(pathname, flags,
mode);
4512 return ::open(pathname, flags,
mode);
4521 if (fd < 0)
return 0;
4530 return ::read(fd, buf,
len);
4538 return ::write(fd, buf,
len);
4549#if defined (R__SEEK64)
4550 return ::lseek64(fd,
offset, whence);
4552 return ::_lseeki64(fd,
offset, whence);
4554 return ::lseek(fd,
offset, whence);
4581 return ::_commit(fd);
4652 if (!cached.EndsWith(
"/"))
4659 ::Error(
"TFile::SetCacheFileDir",
"no sufficient permissions on cache directory %s or cannot create it",
TString(cachedir).Data());
4701 cachetagfile +=
".tag.ROOT.cache";
4702 if (!
gSystem->GetPathInfo(cachetagfile, &
id, &
size, &flags, &modtime)) {
4705 if (lastcleanuptime < cleanupinterval) {
4706 ::Info(
"TFile::ShrinkCacheFileDir",
"clean-up is skipped - last cleanup %lu seconds ago - you requested %lu", lastcleanuptime, cleanupinterval);
4712 cachetagfile +=
"?filetype=raw";
4713 TFile *tagfile =
nullptr;
4715 if (!(tagfile =
TFile::Open(cachetagfile,
"RECREATE"))) {
4716 ::Error(
"TFile::ShrinkCacheFileDir",
"cannot create the cache tag file %s", cachetagfile.
Data());
4724#if defined(R__WIN32)
4725 cmd =
"echo <TFile::ShrinkCacheFileDir>: cleanup to be implemented";
4726#elif defined(R__MACOSX)
4727 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);
4729 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);
4735 if ((
gSystem->Exec(cmd)) != 0) {
4736 ::Error(
"TFile::ShrinkCacheFileDir",
"error executing clean-up script");
4815 return fFile->Matches(url);
4816 }
else if (
fName.Length() > 0){
4862 Bool_t forceRemote =
gEnv->GetValue(
"Path.ForceRemote", 0);
4863 forceRemote = (forceRemote) ?
kTRUE :
gEnv->GetValue(
"TFile.ForceRemote", 0);
4866 forceRemote =
kTRUE;
4867 else if (opts.
Contains(
"remote=0"))
4876 if (fname[0] ==
'/') {
4878 lfname.
Form(
"%s%s", prefix->
Data(), fname);
4881 }
else if (fname[0] ==
'~' || fname[0] ==
'$') {
4884 lfname.
Form(
"%s/%s",
gSystem->HomeDirectory(), fname);
4892 if (!
gSystem->ExpandPathName(fn)) {
4898 if (localFile && prefix)
4905 }
else if (
TPMERegexp(
"^(http[s]?|s3http[s]?|[a]?s3|gs|gshttp[s]?){1}:",
"i").Match(
name)) {
4909 }
else if (!strncmp(
name,
"file:", 5)) {
4935 if (of && (of->
GetSize() > 0)) {
4938 while ((
f = (
TFile *)nxf()))
4939 if (
f->Matches(
name))
4940 return f->GetAsyncOpenStatus();
4952 if (handle && handle->
fFile) {
4982 if (of && (of->
GetSize() > 0)) {
4985 while ((
f = (
TFile *)nxf()))
4986 if (
f->Matches(
name))
4987 return f->GetEndpointUrl();
4991 return (
const TUrl *)
nullptr;
4999 fprintf(stderr,
"[TFile::Cp] Total %.02f MB\t|", (
Double_t)
size/1048576);
5001 for (
int l = 0;
l < 20;
l++) {
5003 if (
l < 20*bytesread/
size)
5004 fprintf(stderr,
"=");
5005 else if (
l == 20*bytesread/
size)
5006 fprintf(stderr,
">");
5007 else if (
l > 20*bytesread/
size)
5008 fprintf(stderr,
".");
5010 fprintf(stderr,
"=");
5016 fprintf(stderr,
"| %.02f %% [%.01f MB/s]\r",
5017 100.0*(
size?(bytesread/((
float)
size)):1), (lCopy_time>0.)?bytesread/lCopy_time/1048576.:0.);
5041 if (opt !=
"") opt +=
"&";
5050 char *copybuffer =
nullptr;
5052 TFile *sfile =
this;
5053 TFile *dfile =
nullptr;
5059 if (
gSystem->AccessPathName(ourl)) {
5069 ::Error(
"TFile::Cp",
"cannot open destination file %s", dst);
5075 rmdestiferror =
kTRUE;
5080 copybuffer =
new char[buffersize];
5082 ::Error(
"TFile::Cp",
"cannot allocate the copy buffer");
5087 Long64_t read, written, totalread, filesize, b00;
5097 if (progressbar)
CpProgress(totalread, filesize,watch);
5102 if (filesize - b1 > (
Long64_t)buffersize) {
5103 readsize = buffersize;
5105 readsize = filesize - b1;
5108 if (readsize == 0)
break;
5114 if ((read <= 0) || readop) {
5115 ::Error(
"TFile::Cp",
"cannot read from source file %s. readsize=%lld read=%lld readop=%d",
5116 sfile->
GetName(), readsize, read, readop);
5123 if ((written != read) || writeop) {
5124 ::Error(
"TFile::Cp",
"cannot write %lld bytes to destination file %s", read, dst);
5128 }
while (read == (
Long64_t)buffersize);
5132 fprintf(stderr,
"\n");
5138 if (dfile) dfile->
Close();
5140 if (dfile)
delete dfile;
5141 if (copybuffer)
delete[] copybuffer;
5143 if (rmdestiferror && (success !=
kTRUE))
5166 if (opt !=
"") opt +=
"&";
5172 opt +=
TString::Format(
"&cachesz=%d&readaheadsz=%d&rmpolicy=1", 4*buffersize, 2*buffersize);
5175 TFile *sfile =
nullptr;
5181 ::Error(
"TFile::Cp",
"cannot open source file %s",
src);
5183 success = sfile->
Cp(dst, progressbar, buffersize);
5198#if defined(R__neverLINUX) && !defined(R__WINGCC)
5210 int advice = POSIX_FADV_WILLNEED;
5215 advice = POSIX_FADV_NORMAL;
5219#if defined(R__SEEK64)
void frombuf(char *&buf, Bool_t *x)
void tobuf(char *&buf, Bool_t x)
virtual RooAbsTestStatistic * create(const char *name, const char *title, RooAbsReal &real, RooAbsData &data, const RooArgSet &projDeps, Configuration const &cfg)=0
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
if(isa< VarDecl >(D)||isa< FieldDecl >(D)||isa< EnumConstantDecl >(D))
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
externTVirtualMutex * gROOTMutex
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Bool_t R_ISDIR(Int_t mode)
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)
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 ...
void AsString(TString &out, const char *options="") const
Add to the string 'out' the string representation of the rule.
static TArchiveFile * Open(const char *url, TFile *file)
Return proper archive file handler depending on passed url.
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.
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 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 a directory.
Int_t AppendKey(TKey *key) override
Insert key in the linked list of keys of this directory.
Int_t ReadKeys(Bool_t forceRead=kTRUE) override
Read the linked list of keys.
TDatime fDatimeM
Date and time of last modification.
void Save() override
Save recursively all directory keys and headers.
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.
Int_t WriteTObject(const TObject *obj, const char *name=nullptr, Option_t *option="", Int_t bufsize=0) override
Write object obj to this directory.
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.
virtual TList * GetList() const
TDirectory(const TDirectory &directory)=delete
void SetName(const char *newname) override
Set the name of the TNamed.
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.
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.
Int_t fReadCalls
Number of read calls ( not counting the cache calls )
static void SetFileBytesWritten(Long64_t bytes=0)
static Bool_t fgCacheFileForce
Indicates, to force all READ to CACHEREAD.
Long64_t fBytesRead
Number of bytes read from this file.
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.
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.
virtual Int_t GetNProcessIDs() const
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.
Int_t MakeProjectParProofInf(const char *packname, const char *proofinfdir)
Create BUILD.sh and SETUP.C under 'proofinf' for PAR package 'pack'.
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.
friend class TDirectoryFile
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 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.
TFile(const TFile &)=delete
Long64_t GetRelOffset() const
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.
virtual void IncrementProcessIDs()
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.
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t buffersize=1000000)
Allows to copy this file to the dst URL.
static ROOT::Internal::RConcurrentHashColl fgTsSIHashes
!TS Set of hashes built from read streamer infos
Long64_t fBytesReadExtra
Number of extra bytes (overhead) read by the readahead buffer.
Long64_t fBytesWrite
Number of bytes written to this file.
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 object namecycle.
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.
Long64_t fOffset
!Seek offset cache
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.
Int_t MakeProjectParMake(const char *packname, const char *filename)
Create makefile at 'filemake' for PAR package 'pack'.
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.
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsiz=0) override
Write memory objects to this file.
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
TObjArray * GetListOfProcessIDs() const
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.
Option_t * GetOption() const override
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
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 ...
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.
@ kCanDelete
if object in a list can be deleted
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Int_t Match(const TString &s, UInt_t start=0)
Runs a match on s against the regex 'this' was created with.
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 const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
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)
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.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified 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.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
static void ResetErrno()
Static function resetting system error number.
static Int_t GetErrno()
Static function returning system error number.
The TTimeStamp encapsulates seconds and ns since EPOCH.
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
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
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)
Abstract Interface class describing Streamer information for one class.
virtual Int_t GetClassVersion() const =0
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
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.