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)
71 const char *ftitle,
Int_t compress):
72 TFile(path,
"NET", ftitle, compress)
75 path = pathString.
Data();
88 if (!create && !recreate && !
update && !read) {
96 const char *fnameWithPrefix;
99 fnameWithPrefix = fname = path;
103 if ((tname =
gSystem->ExpandPathName(path))) {
109 fnameWithPrefix = stmp2;
111 Error(
"TDCacheFile",
"error expanding path %s", path);
124 Error(
"TDCacheFile",
"file %s already exists", fname);
133 Error(
"TDCacheFile",
"no write permission, could not open file %s", fname);
143 fD =
SysOpen(fname, O_RDWR | O_CREAT, 0666);
148 SysError(
"TDCacheFile",
"file %s can not be opened", fname);
160 Error(
"TDCacheFile",
"file %s does not exist", fname);
164 Error(
"TDCacheFile",
"no read permission, could not open file %s", fname);
167 SysError(
"TDCacheFile",
"file %s can not be opened for reading", fname);
178 const char *DCACHE_RA_BUFFER =
gSystem->Getenv(
"DCACHE_RA_BUFFER");
179 if (DCACHE_RA_BUFFER) {
180 int ra_buffer = atoi(DCACHE_RA_BUFFER);
181 dcache_RAHEAD_SIZE = ra_buffer<=0 ? dcache_RAHEAD_SIZE : ra_buffer;
183 dc_setBufferSize(
fD, dcache_RAHEAD_SIZE);
255 for (
Int_t i = 0; i < nbuf; i++) {
256 vector[i].buf = &buf[total_len];
281 Long64_t high = pos[nbuf-1] + len[nbuf-1] - pos[0];
284 for(
Int_t j=0; j < nbuf; j++) {
290 char *temp =
new char[high];
295 for (
Int_t i = 0; i < nbuf; i++) {
296 memcpy(&buf[k], &(temp[pos[i]-pos[0]]), len[i]);
305 for (
Int_t i = 0; i < nbuf; i++) {
342 path = pathString.
Data();
346 if (dc_stage(path, after, location) == 0)
350 gSystem->SetErrorStr(dc_strerror(dc_errno));
363 path = pathString.
Data();
367 if (dc_check(path, location) == 0)
371 gSystem->SetErrorStr(dc_strerror(dc_errno));
381 dc_setOpenTimeout(
n);
397 dc_setReplyHostName((
char*)host_name);
405 return getDcapVersion();
418 dc_setClientActive();
422 Int_t rc = dc_open(pathname, flags, (
Int_t) mode);
426 gSystem->SetErrorStr(dc_strerror(dc_errno));
439 Int_t rc = dc_close(fd);
443 gSystem->SetErrorStr(dc_strerror(dc_errno));
456 Int_t rc = dc_read(fd, buf, len);
460 gSystem->SetErrorStr(dc_strerror(dc_errno));
473 Int_t rc = dc_write(fd, (
char *)buf, len);
477 gSystem->SetErrorStr(dc_strerror(dc_errno));
490 Long64_t rc = dc_lseek64(fd, offset, whence);
494 gSystem->SetErrorStr(dc_strerror(dc_errno));
513 gSystem->SetErrorStr(dc_strerror(dc_errno));
544 path = pathString.
Data();
546 if (path && (dc_stat64(path, &statbuf) >= 0)) {
553 *
id = (statbuf.st_dev << 24) + statbuf.st_ino;
555 *
size = statbuf.st_size;
557 *modtime = statbuf.st_mtime;
560 if (statbuf.st_mode & ((S_IEXEC)|(S_IEXEC>>3)|(S_IEXEC>>6)))
562 if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
564 if ((statbuf.st_mode & S_IFMT) != S_IFREG &&
565 (statbuf.st_mode & S_IFMT) != S_IFDIR)
625 path = pathString.
Data();
627 rc = dc_mkdir(path, 0755);
630 gSystem->SetErrorStr(dc_strerror(dc_errno));
643 path = pathString.
Data();
645 fDirp = dc_opendir(path);
648 gSystem->SetErrorStr(dc_strerror(dc_errno));
662 rc = dc_closedir((DIR *)dirp);
665 gSystem->SetErrorStr(dc_strerror(dc_errno));
680 ent = dc_readdir((DIR *)dirp);
683 gSystem->SetErrorStr(dc_strerror(dc_errno));
686 return !ent ? 0 : ent->d_name;
697 path = pathString.
Data();
699 return dc_access(path, mode);
711 path = pathString.
Data();
715 if (path && (dc_stat64(path, &sbuf) >= 0)) {
717 buf.
fDev = sbuf.st_dev;
718 buf.
fIno = sbuf.st_ino;
719 buf.
fMode = sbuf.st_mode;
720 buf.
fUid = sbuf.st_uid;
721 buf.
fGid = sbuf.st_gid;
722 buf.
fSize = sbuf.st_size;
723 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
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char).
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
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
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
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.
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.
TFile(const TFile &)=delete
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
static void ResetErrno()
Static function resetting system error number.
TSystem(const TSystem &)=delete
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