38#if defined(R__SUN) || defined(R__HPUX) || \
39 defined(R__AIX) || defined(R__LINUX) || defined(R__SOLARIS) || \
40 defined(R__HIUX) || defined(R__FBSD) || defined(R__MACOSX) || \
41 defined(R__HURD) || defined(R__OBSD)
72 const char *ftitle,
Int_t compress):
73 TFile(path,
"NET", ftitle, compress)
76 path = pathString.
Data();
89 if (!create && !recreate && !
update && !read) {
97 const char *fnameWithPrefix;
100 fnameWithPrefix = fname = path;
110 fnameWithPrefix = stmp2;
112 Error(
"TDCacheFile",
"error expanding path %s", path);
125 Error(
"TDCacheFile",
"file %s already exists", fname);
134 Error(
"TDCacheFile",
"no write permission, could not open file %s", fname);
144 fD =
SysOpen(fname, O_RDWR | O_CREAT, 0644);
149 SysError(
"TDCacheFile",
"file %s can not be opened", fname);
161 Error(
"TDCacheFile",
"file %s does not exist", fname);
165 Error(
"TDCacheFile",
"no read permission, could not open file %s", fname);
168 SysError(
"TDCacheFile",
"file %s can not be opened for reading", fname);
179 const char *DCACHE_RA_BUFFER =
gSystem->
Getenv(
"DCACHE_RA_BUFFER");
180 if (DCACHE_RA_BUFFER) {
181 int ra_buffer = atoi(DCACHE_RA_BUFFER);
182 dcache_RAHEAD_SIZE = ra_buffer<=0 ? dcache_RAHEAD_SIZE : ra_buffer;
184 dc_setBufferSize(
fD, dcache_RAHEAD_SIZE);
253 vector = (iovec2 *)
malloc(
sizeof(iovec2)*nbuf);
256 for (
Int_t i = 0; i < nbuf; i++) {
257 vector[i].buf = &buf[total_len];
259 vector[i].len =
len[i];
263 Int_t rc = dc_readv2(
fD, vector, nbuf);
282 Long64_t high = pos[nbuf-1] +
len[nbuf-1] - pos[0];
285 for(
Int_t j=0; j < nbuf; j++) {
291 char *temp =
new char[high];
296 for (
Int_t i = 0; i < nbuf; i++) {
297 memcpy(&buf[k], &(temp[pos[i]-pos[0]]),
len[i]);
306 for (
Int_t i = 0; i < nbuf; i++) {
343 path = pathString.
Data();
347 if (dc_stage(path, after, location) == 0)
364 path = pathString.
Data();
368 if (dc_check(path, location) == 0)
382 dc_setOpenTimeout(
n);
398 dc_setReplyHostName((
char*)host_name);
406 return getDcapVersion();
419 dc_setClientActive();
440 Int_t rc = dc_close(fd);
474 Int_t rc = dc_write(fd, (
char *)buf,
len);
545 path = pathString.
Data();
547 if (path && (dc_stat64(path, &statbuf) >= 0)) {
554 *
id = (statbuf.st_dev << 24) + statbuf.st_ino;
556 *
size = statbuf.st_size;
558 *modtime = statbuf.st_mtime;
561 if (statbuf.st_mode & ((S_IEXEC)|(S_IEXEC>>3)|(S_IEXEC>>6)))
563 if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
565 if ((statbuf.st_mode & S_IFMT) != S_IFREG &&
566 (statbuf.st_mode & S_IFMT) != S_IFDIR)
626 path = pathString.
Data();
628 rc = dc_mkdir(path, 0755);
644 path = pathString.
Data();
646 fDirp = dc_opendir(path);
663 rc = dc_closedir((DIR *)dirp);
681 ent = dc_readdir((DIR *)dirp);
687 return !ent ? 0 : ent->d_name;
698 path = pathString.
Data();
700 return dc_access(path,
mode);
712 path = pathString.
Data();
716 if (path && (dc_stat64(path, &sbuf) >= 0)) {
718 buf.
fDev = sbuf.st_dev;
719 buf.
fIno = sbuf.st_ino;
720 buf.
fMode = sbuf.st_mode;
721 buf.
fUid = sbuf.st_uid;
722 buf.
fGid = sbuf.st_gid;
723 buf.
fSize = sbuf.st_size;
724 buf.
fMtime = sbuf.st_mtime;
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
static const char *const DCACHE_PREFIX
static const size_t DCAP_PREFIX_LEN
static const size_t DCACHE_PREFIX_LEN
static const char *const DCAP_PREFIX
#define RAHEAD_BUFFER_SIZE
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.
static unsigned int total
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 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 mode
R__EXTERN TSystem * gSystem
A TDCacheFile is like a normal TFile except that it may read and write its data via a dCache server (...
void ResetErrno() const override
Method resetting the dc_errno and errno.
Bool_t fStatCached
! (transient) is file status cached?
Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf) override
Read the nbuf blocks described in arrays pos and len, where pos[i] is the seek position of block i of...
static Bool_t CheckFile(const char *path, const char *location=0)
CheckFile() returns kTRUE on success and kFALSE on failure.
Int_t SysSync(Int_t fd) override
Interface to system sync.
static void SetOnError(EOnErrorAction=kOnErrorDefault)
Set on error handler.
static void SetOpenTimeout(UInt_t secs)
Set file open timeout.
Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence) override
Interface to system seek. All arguments like in POSIX lseek.
EOnErrorAction
Note: This must be kept in sync with values #defined in dcap.h.
Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime) override
Get info about a file: id, size, flags, modification time.
static Bool_t Stage(const char *path, UInt_t secs, const char *location=0)
Stage() returns kTRUE on success and kFALSE on failure.
~TDCacheFile() override
Close and cleanup dCache file.
struct stat64 fStatBuffer
! (transient) Cached file status buffer (for performance)
static const char * GetDcapVersion()
Return dCache version string.
Int_t SysWrite(Int_t fd, const void *buf, Int_t len) override
Interface to system write. All arguments like in POSIX write.
Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode) override
Interface to system open. All arguments like in POSIX open.
Int_t SysRead(Int_t fd, void *buf, Int_t len) override
Interface to system read. All arguments like in POSIX read.
Int_t SysClose(Int_t fd) override
Interface to system close. All arguments like in POSIX close.
static TString GetDcapPath(const char *path)
Transform the input path into a path usuable by the dcap C library, i.e either dcap://nodename....
Bool_t ReadBuffer(char *buf, Int_t len) override
Read specified byte range from remote file via dCache daemon.
Bool_t WriteBuffer(const char *buf, Int_t len) override
Write specified byte range to remote file via dCache daemon.
static void SetReplyHostName(const char *host_name)
Set reply host name.
void * fDirp
directory handler
Int_t MakeDirectory(const char *name) override
Create a directory.
Int_t GetPathInfo(const char *path, FileStat_t &buf) override
Get info about a file.
void * OpenDirectory(const char *name) override
Open a directory.
Bool_t AccessPathName(const char *path, EAccessMode mode) override
Returns FALSE if one can access a file using the specified access mode.
void FreeDirectory(void *dirp) override
Close a directory.
TDCacheSystem()
Create helper class that allows directory access via dCache.
const char * GetDirEntry(void *dirp) override
Get a directory entry.
Bool_t fWritable
True if directory is writable.
A cache when reading files over the network.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Long64_t fBytesRead
Number of bytes read from this file.
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 void SetFileBytesRead(Long64_t bytes=0)
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.
Long64_t fArchiveOffset
!Offset at which file starts in archive
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
virtual void Init(Bool_t create)
Initialize a TFile object.
TString fOption
File options.
virtual Bool_t WriteBuffer(const char *buf, Int_t len)
Write a buffer to the file.
TFileCacheRead * fCacheRead
!Pointer to the read 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.
void Close(Option_t *option="") override
Close a file.
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
const char * GetName() const override
Returns name of object.
virtual void SetName(const char *name)
Set the name of the TNamed.
const char * Data() const
void ToUpper()
Change string to upper case.
Abstract base class defining a generic interface to the underlying Operating System.
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 ~.
virtual const char * Getenv(const char *env)
Get environment variable.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
void SetErrorStr(const char *errstr)
Set the system error string.
This class represents a WWW compatible URL.
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
const char * GetFile() const
const char * GetHost() const
const char * GetProtocol() const