80 :
TFile(url, strstr(option,
"_WITHOUT_GLOBALREGISTRATION") != nullptr ?
"NET_WITHOUT_GLOBALREGISTRATION" :
"NET",
85 Create(url, option, netopt);
94 :
TFile(url,
"NET", ftitle, compress), fEndpointUrl(url)
172 Int_t mode, uid, gid, islink;
177 sscanf(msg,
"%ld %ld %d %d %d %I64d %ld %d", &dev, &ino, &mode,
178 &uid, &gid,
size, modtime, &islink);
180 sscanf(msg,
"%ld %ld %d %d %d %lld %ld %d", &dev, &ino, &mode,
181 &uid, &gid,
size, modtime, &islink);
186 *
id = (dev << 24) + ino;
198 sscanf(msg,
"%ld %I64d %ld %ld",
id,
size, flags, modtime);
200 sscanf(msg,
"%ld %lld %ld %ld",
id,
size, flags, modtime);
263 Printf(
"Remote file: %s", &fname[1]);
292 Error(
"ReOpen",
"operation not supported by remote rootd (protocol = %d)",
326 Error(
"ReadBuffer",
"error sending kROOTD_GET command");
345 Error(
"ReadBuffer",
"error receiving buffer of length %d, got %d", len,
n);
397 Int_t blockSize = 262144;
411 for(
Int_t i = 0; i < nbuf; i++) {
422 Error(
"ReadBuffers",
"error sending kROOTD_GETS command");
428 Error(
"ReadBuffers",
"error sending buffer");
441 while (actual_pos < total_len) {
442 Long64_t left = total_len - actual_pos;
443 if (left > blockSize)
452 Error(
"GetBuffers",
"error receiving buffer of length %d, got %d",
473 gPerfStats->FileReadEvent(
this, total_len, start);
481 Info(
"ReadBuffers",
"Couldnt use the specific implementation, calling TFile::ReadBuffers");
509 Error(
"WriteBuffer",
"error sending kROOTD_PUT command");
515 Error(
"WriteBuffer",
"error sending buffer");
581 Int_t sSize = netopt < -1 ? -netopt : 1;
593 Error(
"TNetFile",
"can't open %d-stream connection to rootd on "
596 Error(
"TNetFile",
"can't open connection to rootd on "
605 Warning(
"ConnectServer",
"rootd does not support \"+read\" option");
624 Recv(tmpstat, tmpkind);
665 Int_t tcpwindowsize = 65535;
672 if (option[0] ==
'-') {
677 if (option[0] ==
'F' || option[0] ==
'f') {
683 if (!strcasecmp(option,
"+read")) {
696 if (!create && !recreate && !
update) {
705 if (netopt > tcpwindowsize)
706 tcpwindowsize = netopt;
711 ConnectServer(&stat, &kind, netopt, tcpwindowsize, forceOpen, forceRead);
712 if (
gDebug > 2)
Info(
"Create",
"got from host %d %d", stat, kind);
803 :
TSystem(
"-root",
"Net file Helper System")
825 :
TSystem(
"-root",
"Net file Helper System")
921 "remote daemon does not support 'system' functionality");
1001 Info(
"OpenDirectory",
"a directory is already open: close it first");
1028 if (dirp !=
fDirp) {
1029 Error(
"FreeDirectory",
"invalid directory pointer (should never happen)");
1052 if (dirp !=
fDirp) {
1053 Error(
"GetDirEntry",
"invalid directory pointer (should never happen)");
1119 if (!checkstd)
return kFALSE;
1123 if (path && strlen(path)) {
1141 Info(
"ConsistentWith",
"fUser:'%s' (%s), fHost:'%s' (%s), fPort:%d (%d)",
1149 return (checkstd && checknet);
1166 Warning(
"Unlink",
"functionality not implemented - ignored (path: %s)", path);
R__EXTERN const char * gRootdErrStr[]
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
R__EXTERN TApplication * gApplication
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
TString ToLower(const TString &s)
Return a lower-case version of str.
char * Form(const char *fmt,...)
void Printf(const char *fmt,...)
Bool_t R_ISREG(Int_t mode)
Bool_t R_ISDIR(Int_t mode)
R__EXTERN TSystem * gSystem
TSignalHandler * GetSignalHandler() const
Bool_t fWritable
True if directory is writable.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Int_t MakeDirectory(const char *dir, Bool_t print=kFALSE) const
Make a remote directory.
void FreeDirectory(Bool_t print=kFALSE)
Free a remotely open directory via rootd.
Int_t GetPathInfo(const char *path, FileStat_t &buf, Bool_t print=kFALSE)
Get info about a file.
Bool_t OpenDirectory(const char *name, Bool_t print=kFALSE)
Open a directory via rootd.
TSocket * GetSocket() const
const char * GetDirEntry(Bool_t print=kFALSE)
Get directory entry via rootd.
Int_t Close()
Close ftp connection.
Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists, Bool_t print=kFALSE)
Returns kFALSE if one can access a file using the specified access mode.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
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)
Long64_t fBytesRead
Number of bytes read from this file.
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode.
virtual Bool_t Matches(const char *name)
Return kTRUE if 'url' matches the coordinates of this file.
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
static void SetFileBytesRead(Long64_t bytes=0)
static void SetFileReadCalls(Int_t readcalls=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.
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.
Long64_t fArchiveOffset
!Offset at which file starts in archive
virtual void Init(Bool_t create)
Initialize a TFile object.
TString fOption
File options.
Bool_t FlushWriteCache()
Flush the write cache if active.
Long64_t fBytesWrite
Number of bytes written to this file.
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.
void Close(Option_t *option="") override
Close a file.
static std::atomic< Int_t > fgReadCalls
Number of bytes read from all TFile objects.
static Int_t GetFileReadCalls()
Static function returning the total number of read calls from all files.
virtual void SetName(const char *name)
Set the name of the TNamed.
Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
Open a remote file. Requires fOption to be set correctly.
void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
void Print(Option_t *option) const
Print some info about the net file.
Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
Return file stat information.
virtual void Create(const char *url, Option_t *option, Int_t netopt)
Create a NetFile object.
virtual void ConnectServer(Int_t *stat, EMessageTypes *kind, Int_t netopt, Int_t tcpwindowsize, Bool_t forceOpen, Bool_t forceRead)
Connect to remote rootd server.
Int_t Recv(Int_t &status, EMessageTypes &kind)
Return status from rootd server and message kind.
Bool_t IsOpen() const
Retruns kTRUE if file is open, kFALSE otherwise.
Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Read a list of buffers given in pos[] and len[] and return it in a single buffer.
Bool_t Matches(const char *url)
Return kTRUE if 'url' matches the coordinates of this file.
Int_t SysClose(Int_t fd)
Close currently open file.
void PrintError(const char *where, Int_t err)
Print error string depending on error code.
Bool_t ReadBuffer(char *buf, Int_t len)
Read specified byte range from remote file via rootd daemon.
void Init(Bool_t create)
Initialize a TNetFile object.
Bool_t WriteBuffer(const char *buf, Int_t len)
Write specified byte range to remote file via rootd daemon.
void Close(Option_t *option="")
Close remote file.
virtual ~TNetFile()
TNetFile dtor. Send close message and close socket.
void Flush()
Flush file to disk.
Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode, like from READ to UPDATE or from NEW, CREATE,...
const char * GetDirEntry(void *dirp=0)
Get directory entry via rootd. Returns 0 in case no more entries.
void InitRemoteEntity(const char *url)
Parse and save coordinates of the remote entity (user, host, port, ...)
Int_t MakeDirectory(const char *name)
Make a directory via rootd.
void Create(const char *url, TSocket *sock=0)
Create a TNetSystem object.
void FreeDirectory(void *dirp=0)
Free directory via rootd.
Bool_t ConsistentWith(const char *path, void *dirptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
virtual ~TNetSystem()
Destructor.
TNetSystem(const TNetSystem &)
int Unlink(const char *path)
Remove a path.
void * OpenDirectory(const char *name)
Open a directory and return an opaque pointer to a dir structure.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
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 Info(const char *method, const char *msgfmt,...) const
Issue info message.
const char * GetHost() const
const char * GetUser() const
void HandleDelayedSignal()
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Int_t GetRemoteProtocol() const
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
TSecContext * GetSecContext() const
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
static TSocket * CreateAuthSocket(const char *user, const char *host, Int_t port, Int_t size=0, Int_t tcpwindowsize=-1, TSocket *s=0, Int_t *err=0)
Creates a socket or a parallel socket and authenticates to the remote server specified in 'url' on re...
const char * GetUrl() const
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
virtual Bool_t IsAuthenticated() const
TString & Insert(Ssiz_t pos, const char *s)
const char * Data() const
void ToUpper()
Change string to upper case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Abstract base class defining a generic interface to the underlying Operating System.
virtual void IgnoreInterrupt(Bool_t ignore=kTRUE)
If ignore is true ignore the interrupt signal, else restore previous behaviour.
static void ResetErrno()
Static function resetting system error number.
static Int_t GetErrno()
Static function returning system error number.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
virtual int MakeDirectory(const char *name)
Make a directory.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual int Unlink(const char *name)
Unlink, i.e.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
virtual Bool_t ConsistentWith(const char *path, void *dirptr=nullptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
The TTimeStamp encapsulates seconds and ns since EPOCH.
This class represents a WWW compatible URL.
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
const char * GetFile() const
const char * GetUser() const
const char * GetHost() const
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
const char * GetOptions() const
const char * GetProtocol() const