Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TNetFile.cxx
Go to the documentation of this file.
1// @(#)root/net:$Id$
2// Author: Fons Rademakers 14/08/97
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12//////////////////////////////////////////////////////////////////////////
13// //
14// TNetFile //
15// //
16// A TNetFile is like a normal TFile except that it reads and writes //
17// its data via a rootd server (for more on the rootd daemon see the //
18// source files root/rootd/src/*.cxx). TNetFile file names are in //
19// standard URL format with protocol "root" or "roots". The following //
20// are valid TNetFile URL's: //
21// //
22// root://hpbrun.cern.ch/root/hsimple.root //
23// root://pcna49a:5151/~na49/data/run821.root //
24// root://pcna49d.cern.ch:5050//v1/data/run810.root //
25// //
26// The only difference with the well known httpd URL's is that the root //
27// of the remote file tree is the user's home directory. Therefore an //
28// absolute pathname requires a // after the host or port specifier //
29// (see last example). Further the expansion of the standard shell //
30// characters, like ~, $, .., are handled as expected. //
31// TNetFile (actually TUrl) uses 1094 as default port for rootd. //
32// //
33// Connecting to a rootd requires the remote user id and password. //
34// TNetFile allows three ways for you to provide your login: //
35// 1) Setting it globally via the static functions: //
36// TAuthenticate::SetGlobalUser() and //
37// TAuthenticate::SetGlobalPasswd() //
38// 2) Getting it from the ~/.netrc file (same file as used by ftp) //
39// 3) Command line prompt //
40// The different methods will be tried in the order given above. //
41// On machines with AFS rootd will authenticate using AFS (if it was //
42// compiled with AFS support). //
43// //
44// If the protocol is specified as "rootk" kerberos5 will be used for //
45// authentication. //
46// //
47// The rootd daemon lives in the directory $ROOTSYS/bin. It can be //
48// started either via inetd or by hand from the command line (no need //
49// to be super user). For more info about rootd see the web page: //
50// Begin_Html <a href=http://root.cern.ch/root/NetFile.html>NetFile</a> //
51// End_Html //
52// //
53//////////////////////////////////////////////////////////////////////////
54
55#include <errno.h>
56
57#include "Bytes.h"
58#include "NetErrors.h"
59#include "TApplication.h"
60#include "TEnv.h"
61#include "TNetFile.h"
62#include "TPSocket.h"
63#include "TROOT.h"
64#include "TSysEvtHandler.h"
65#include "TSystem.h"
66#include "TTimeStamp.h"
67#include "TVirtualPerfStats.h"
68
69// fgClientProtocol is now in TAuthenticate
70
73
74////////////////////////////////////////////////////////////////////////////////
75/// Create a TNetFile object. This is actually done inside Create(), so
76/// for a description of the options and other arguments see Create().
77/// Normally a TNetFile is created via TFile::Open().
78
79TNetFile::TNetFile(const char *url, Option_t *option, const char *ftitle, Int_t compress, Int_t netopt)
80 : TFile(url, strstr(option, "_WITHOUT_GLOBALREGISTRATION") != nullptr ? "NET_WITHOUT_GLOBALREGISTRATION" : "NET",
81 ftitle, compress),
82 fEndpointUrl(url)
83{
84 fSocket = 0;
85 Create(url, option, netopt);
86}
87
88////////////////////////////////////////////////////////////////////////////////
89/// Create a TNetFile object. To be used by derived classes, that need
90/// to initialize the TFile base class but not open a connection at this
91/// moment.
92
93TNetFile::TNetFile(const char *url, const char *ftitle, Int_t compress, Bool_t)
94 : TFile(url, "NET", ftitle, compress), fEndpointUrl(url)
95{
96 fSocket = 0;
97 fProtocol = 0;
98 fErrorCode = 0;
99 fNetopt = 0;
100}
101
102////////////////////////////////////////////////////////////////////////////////
103/// TNetFile dtor. Send close message and close socket.
104
106{
107 Close();
108}
109
110////////////////////////////////////////////////////////////////////////////////
111/// Open a remote file. Requires fOption to be set correctly.
112
113Int_t TNetFile::SysOpen(const char * /*file*/, Int_t /*flags*/, UInt_t /*mode*/)
114{
115 if (!fSocket) {
116
118 if (!fSocket) return -1;
119
120 } else {
121
122 if (fProtocol > 15) {
123 fSocket->Send(Form("%s %s", fUrl.GetFile(), ToLower(fOption).Data()),
125 } else {
126 // Old daemon versions expect an additional slash at beginning
127 fSocket->Send(Form("/%s %s", fUrl.GetFile(), ToLower(fOption).Data()),
129 }
130
131 EMessageTypes kind;
132 int stat;
133 Recv(stat, kind);
134
135 if (kind == kROOTD_ERR) {
136 PrintError("SysOpen", stat);
137 return -1;
138 }
139 }
140
141 // This means ok for net files
142 return -2; // set as fD in ReOpen
143}
144
145////////////////////////////////////////////////////////////////////////////////
146/// Close currently open file.
147
149{
150 if (fSocket)
152
153 return 0;
154}
155
156////////////////////////////////////////////////////////////////////////////////
157/// Return file stat information. The interface and return value is
158/// identical to TSystem::GetPathInfo().
159
161{
162 if (fProtocol < 3) return 1;
163
164 if (!fSocket) return 1;
165
167
168 char msg[1024];
169 Int_t kind;
170 fSocket->Recv(msg, sizeof(msg), kind);
171
172 Int_t mode, uid, gid, islink;
173 Long_t dev, ino;
174
175 if (fProtocol > 12) {
176#ifdef R__WIN32
177 sscanf(msg, "%ld %ld %d %d %d %I64d %ld %d", &dev, &ino, &mode,
178 &uid, &gid, size, modtime, &islink);
179#else
180 sscanf(msg, "%ld %ld %d %d %d %lld %ld %d", &dev, &ino, &mode,
181 &uid, &gid, size, modtime, &islink);
182#endif
183 if (dev == -1)
184 return 1;
185 if (id)
186 *id = (dev << 24) + ino;
187 if (flags) {
188 *flags = 0;
189 if (mode & (kS_IXUSR|kS_IXGRP|kS_IXOTH))
190 *flags |= 1;
191 if (R_ISDIR(mode))
192 *flags |= 2;
193 if (!R_ISREG(mode) && !R_ISDIR(mode))
194 *flags |= 4;
195 }
196 } else {
197#ifdef R__WIN32
198 sscanf(msg, "%ld %I64d %ld %ld", id, size, flags, modtime);
199#else
200 sscanf(msg, "%ld %lld %ld %ld", id, size, flags, modtime);
201#endif
202 if (*id == -1)
203 return 1;
204 }
205
206 return 0;
207}
208
209////////////////////////////////////////////////////////////////////////////////
210/// Close remote file.
211
213{
214 if (!fSocket) return;
215
216 TFile::Close(opt);
217
218 if (fProtocol > 6)
220
222
223 fD = -1; // so TFile::IsOpen() returns false when in TFile::~TFile
224}
225
226////////////////////////////////////////////////////////////////////////////////
227/// Flush file to disk.
228
230{
232
233 if (fSocket && fWritable)
235}
236
237////////////////////////////////////////////////////////////////////////////////
238/// Initialize a TNetFile object.
239
241{
242 Seek(0);
243
244 TFile::Init(create);
245 fD = -2; // so TFile::IsOpen() returns true when in TFile::~TFile
246}
247
248////////////////////////////////////////////////////////////////////////////////
249/// Retruns kTRUE if file is open, kFALSE otherwise.
250
252{
253 return fSocket == 0 ? kFALSE : kTRUE;
254}
255
256////////////////////////////////////////////////////////////////////////////////
257/// Print some info about the net file.
258
260{
261 const char *fname = fUrl.GetFile();
262 Printf("URL: %s", ((TUrl*)&fUrl)->GetUrl());
263 Printf("Remote file: %s", &fname[1]);
264 Printf("Remote user: %s", fUser.Data());
265 Printf("Title: %s", fTitle.Data());
266 Printf("Option: %s", fOption.Data());
267 Printf("Bytes written: %lld", fBytesWrite);
268 Printf("Bytes read: %lld", fBytesRead);
269}
270
271////////////////////////////////////////////////////////////////////////////////
272/// Print error string depending on error code.
273
274void TNetFile::PrintError(const char *where, Int_t err)
275{
276 fErrorCode = err;
277 Error(where, "%s", gRootdErrStr[err]);
278}
279
280////////////////////////////////////////////////////////////////////////////////
281/// Reopen a file with a different access mode, like from READ to
282/// UPDATE or from NEW, CREATE, RECREATE, UPDATE to READ. Thus the
283/// mode argument can be either "READ" or "UPDATE". The method returns
284/// 0 in case the mode was successfully modified, 1 in case the mode
285/// did not change (was already as requested or wrong input arguments)
286/// and -1 in case of failure, in which case the file cannot be used
287/// anymore.
288
290{
291 if (fProtocol < 7) {
292 Error("ReOpen", "operation not supported by remote rootd (protocol = %d)",
293 fProtocol);
294 return 1;
295 }
296
297 return TFile::ReOpen(mode);
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// Read specified byte range from remote file via rootd daemon.
302/// Returns kTRUE in case of error.
303
305{
306 if (!fSocket) return kTRUE;
307 if (len == 0)
308 return kFALSE;
309
310 Bool_t result = kFALSE;
311
312 Int_t st;
313 if ((st = ReadBufferViaCache(buf, len))) {
314 if (st == 2)
315 return kTRUE;
316 return kFALSE;
317 }
318
321
322 Double_t start = 0;
323 if (gPerfStats) start = TTimeStamp();
324
325 if (fSocket->Send(Form("%lld %d", fOffset, len), kROOTD_GET) < 0) {
326 Error("ReadBuffer", "error sending kROOTD_GET command");
327 result = kTRUE;
328 goto end;
329 }
330
331 Int_t stat, n;
332 EMessageTypes kind;
333
334 fErrorCode = -1;
335 if (Recv(stat, kind) < 0 || kind == kROOTD_ERR) {
336 PrintError("ReadBuffer", stat);
337 result = kTRUE;
338 goto end;
339 }
340
341 while ((n = fSocket->RecvRaw(buf, len)) < 0 && TSystem::GetErrno() == EINTR)
343
344 if (n != len) {
345 Error("ReadBuffer", "error receiving buffer of length %d, got %d", len, n);
346 result = kTRUE;
347 goto end;
348 }
349
350 fOffset += len;
351
352 fBytesRead += len;
353 fReadCalls++;
354#ifdef R__WIN32
357#else
358 fgBytesRead += len;
359 fgReadCalls++;
360#endif
361
362end:
363
364 if (gPerfStats)
365 gPerfStats->FileReadEvent(this, len, start);
366
369
370 return result;
371}
372
373////////////////////////////////////////////////////////////////////////////////
374/// Read specified byte range from remote file via rootd daemon.
375/// Returns kTRUE in case of error.
376
378{
379 SetOffset(pos);
380 return ReadBuffer(buf, len);
381}
382
383////////////////////////////////////////////////////////////////////////////////
384/// Read a list of buffers given in pos[] and len[] and return it in a single
385/// buffer.
386/// Returns kTRUE in case of error.
387
388Bool_t TNetFile::ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
389{
390 if (!fSocket) return kTRUE;
391
392 // If it's an old version of the protocol try the default TFile::ReadBuffers
393 if (fProtocol < 17)
394 return TFile::ReadBuffers(buf, pos, len, nbuf);
395
396 Int_t stat;
397 Int_t blockSize = 262144; //Let's say we transfer 256KB at the time
398 Bool_t result = kFALSE;
399 EMessageTypes kind;
400 TString data_buf; // buf to put the info
401
404
405 Double_t start = 0;
406 if (gPerfStats) start = TTimeStamp();
407
408 // Make the string with a list of offsets and lengths
409 Long64_t total_len = 0;
410 Long64_t actual_pos;
411 for(Int_t i = 0; i < nbuf; i++) {
412 data_buf += pos[i] + fArchiveOffset;
413 data_buf += "-";
414 data_buf += len[i];
415 data_buf += "/";
416 total_len += len[i];
417 }
418
419 // Send the command with the length of the info and number of buffers
420 if (fSocket->Send(Form("%d %d %d", nbuf, data_buf.Length(), blockSize),
421 kROOTD_GETS) < 0) {
422 Error("ReadBuffers", "error sending kROOTD_GETS command");
423 result = kTRUE;
424 goto end;
425 }
426 // Send buffer with the list of offsets and lengths
427 if (fSocket->SendRaw(data_buf, data_buf.Length()) < 0) {
428 Error("ReadBuffers", "error sending buffer");
429 result = kTRUE;
430 goto end;
431 }
432
433 fErrorCode = -1;
434 if (Recv(stat, kind) < 0 || kind == kROOTD_ERR) {
435 PrintError("ReadBuffers", stat);
436 result = kTRUE;
437 goto end;
438 }
439
440 actual_pos = 0;
441 while (actual_pos < total_len) {
442 Long64_t left = total_len - actual_pos;
443 if (left > blockSize)
444 left = blockSize;
445
446 Int_t n;
447 while ((n = fSocket->RecvRaw(buf + actual_pos, Int_t(left))) < 0 &&
448 TSystem::GetErrno() == EINTR)
450
451 if (n != Int_t(left)) {
452 Error("GetBuffers", "error receiving buffer of length %d, got %d",
453 Int_t(left), n);
454 result = kTRUE ;
455 goto end;
456 }
457 actual_pos += left;
458 }
459
460 fBytesRead += total_len;
461 fReadCalls++;
462#ifdef R__WIN32
463 SetFileBytesRead(GetFileBytesRead() + total_len);
465#else
466 fgBytesRead += total_len;
467 fgReadCalls++;
468#endif
469
470end:
471
472 if (gPerfStats)
473 gPerfStats->FileReadEvent(this, total_len, start);
474
477
478 // If found problems try the generic implementation
479 if (result) {
480 if (gDebug > 0)
481 Info("ReadBuffers", "Couldnt use the specific implementation, calling TFile::ReadBuffers");
482 return TFile::ReadBuffers(buf, pos, len, nbuf);
483 }
484
485 return result;
486}
487
488////////////////////////////////////////////////////////////////////////////////
489/// Write specified byte range to remote file via rootd daemon.
490/// Returns kTRUE in case of error.
491
492Bool_t TNetFile::WriteBuffer(const char *buf, Int_t len)
493{
494 if (!fSocket || !fWritable) return kTRUE;
495
496 Bool_t result = kFALSE;
497
498 Int_t st;
499 if ((st = WriteBufferViaCache(buf, len))) {
500 if (st == 2)
501 return kTRUE;
502 return kFALSE;
503 }
504
506
507 if (fSocket->Send(Form("%lld %d", fOffset, len), kROOTD_PUT) < 0) {
509 Error("WriteBuffer", "error sending kROOTD_PUT command");
510 result = kTRUE;
511 goto end;
512 }
513 if (fSocket->SendRaw(buf, len) < 0) {
515 Error("WriteBuffer", "error sending buffer");
516 result = kTRUE;
517 goto end;
518 }
519
520 Int_t stat;
521 EMessageTypes kind;
522
523 fErrorCode = -1;
524 if (Recv(stat, kind) < 0 || kind == kROOTD_ERR) {
526 PrintError("WriteBuffer", stat);
527 result = kTRUE;
528 goto end;
529 }
530
531 fOffset += len;
532
533 fBytesWrite += len;
534#ifdef R__WIN32
536#else
537 fgBytesWrite += len;
538#endif
539
540end:
542
543 return result;
544}
545
546////////////////////////////////////////////////////////////////////////////////
547/// Return status from rootd server and message kind. Returns -1 in
548/// case of error otherwise 8 (sizeof 2 words, status and kind).
549
551{
552 kind = kROOTD_ERR;
553 status = 0;
554
555 if (!fSocket) return -1;
556
557 Int_t what;
558 Int_t n = fSocket->Recv(status, what);
559 kind = (EMessageTypes) what;
560 return n;
561}
562
563////////////////////////////////////////////////////////////////////////////////
564/// Set position from where to start reading.
565
567{
568 SetOffset(offset, pos);
569}
570
571////////////////////////////////////////////////////////////////////////////////
572/// Connect to remote rootd server.
573
575 Int_t tcpwindowsize, Bool_t forceOpen,
576 Bool_t forceRead)
577{
578 TString fn = fUrl.GetFile();
579
580 // Create Authenticated socket
581 Int_t sSize = netopt < -1 ? -netopt : 1;
582 TString url(fUrl.GetProtocol());
583 if (url.Contains("root")) {
584 url.Insert(4,"dp");
585 } else {
586 url = "rootdp";
587 }
588 url += TString(Form("://%s@%s:%d",
590 fSocket = TSocket::CreateAuthSocket(url, sSize, tcpwindowsize, fSocket, stat);
591 if (!fSocket || (fSocket && !fSocket->IsAuthenticated())) {
592 if (sSize > 1)
593 Error("TNetFile", "can't open %d-stream connection to rootd on "
594 "host %s at port %d", sSize, fUrl.GetHost(), fUrl.GetPort());
595 else
596 Error("TNetFile", "can't open connection to rootd on "
597 "host %s at port %d", fUrl.GetHost(), fUrl.GetPort());
598 *kind = kROOTD_ERR;
599 goto zombie;
600 }
601
602 // Check if rootd supports new options
604 if (forceRead && fProtocol < 5) {
605 Warning("ConnectServer", "rootd does not support \"+read\" option");
606 forceRead = kFALSE;
607 }
608
609 // Open the file
610 if (fProtocol < 16)
611 // For backward compatibility we need to add a '/' at the beginning
612 fn.Insert(0,"/");
613 if (forceOpen)
614 fSocket->Send(Form("%s %s", fn.Data(),
615 ToLower("f"+fOption).Data()), kROOTD_OPEN);
616 else if (forceRead)
617 fSocket->Send(Form("%s %s", fn.Data(), "+read"), kROOTD_OPEN);
618 else
619 fSocket->Send(Form("%s %s", fn.Data(),
620 ToLower(fOption).Data()), kROOTD_OPEN);
621
622 EMessageTypes tmpkind;
623 int tmpstat;
624 Recv(tmpstat, tmpkind);
625 *stat = tmpstat;
626 *kind = tmpkind;
627
628 return;
629
630zombie:
631 // error in file opening occured, make this object a zombie
632 MakeZombie();
635}
636
637////////////////////////////////////////////////////////////////////////////////
638/// Create a NetFile object. A net file is the same as a TFile
639/// except that it is being accessed via a rootd server. The url
640/// argument must be of the form: root[k]://host.dom.ain/file.root.
641/// When protocol is "rootk" try using kerberos5 authentication.
642/// If the file specified in the URL does not exist, is not accessable
643/// or can not be created the kZombie bit will be set in the TNetFile
644/// object. Use IsZombie() to see if the file is accessable.
645/// If the remote daemon thinks the file is still connected, while you are
646/// sure this is not the case you can force open the file by preceding the
647/// option argument with an "-", e.g.: "-recreate". Do this only
648/// in cases when you are very sure nobody else is using the file.
649/// To bypass the writelock on a file, to allow the reading of a file
650/// that is being written by another process, explicitly specify the
651/// "+read" option ("read" being the default option).
652/// The netopt argument can be used to specify the size of the tcp window in
653/// bytes (for more info see: http://www.psc.edu/networking/perf_tune.html).
654/// The default and minimum tcp window size is 65535 bytes.
655/// If netopt < -1 then |netopt| is the number of parallel sockets that will
656/// be used to connect to rootd. This option should be used on fat pipes
657/// (i.e. high bandwidth, high latency links). The ideal number of parallel
658/// sockets depends on the bandwidth*delay product. Generally 5-7 is a good
659/// number.
660/// For a description of the option and other arguments see the TFile ctor.
661/// The preferred interface to this constructor is via TFile::Open().
662
663void TNetFile::Create(const char * /*url*/, Option_t *option, Int_t netopt)
664{
665 Int_t tcpwindowsize = 65535;
666
667 fErrorCode = -1;
668 fNetopt = netopt;
669 fOption = option;
670
671 Bool_t forceOpen = kFALSE;
672 if (option[0] == '-') {
673 fOption = &option[1];
674 forceOpen = kTRUE;
675 }
676 // accept 'f', like 'frecreate' still for backward compatibility
677 if (option[0] == 'F' || option[0] == 'f') {
678 fOption = &option[1];
679 forceOpen = kTRUE;
680 }
681
682 Bool_t forceRead = kFALSE;
683 if (!strcasecmp(option, "+read")) {
684 fOption = &option[1];
685 forceRead = kTRUE;
686 }
687
689
690 if (fOption == "NEW")
691 fOption = "CREATE";
692
693 Bool_t create = (fOption == "CREATE") ? kTRUE : kFALSE;
694 Bool_t recreate = (fOption == "RECREATE") ? kTRUE : kFALSE;
695 Bool_t update = (fOption == "UPDATE") ? kTRUE : kFALSE;
696 if (!create && !recreate && !update) {
697 fOption = "READ";
698 }
699
700 if (!fUrl.IsValid()) {
701 Error("Create", "invalid URL specified: %s", fUrl.GetUrl());
702 goto zombie;
703 }
704
705 if (netopt > tcpwindowsize)
706 tcpwindowsize = netopt;
707
708 // Open connection to remote rootd server
709 EMessageTypes kind;
710 Int_t stat;
711 ConnectServer(&stat, &kind, netopt, tcpwindowsize, forceOpen, forceRead);
712 if (gDebug > 2) Info("Create", "got from host %d %d", stat, kind);
713
714 if (kind == kROOTD_ERR) {
715 PrintError("Create", stat);
716 Error("Create", "failing on file %s", fUrl.GetUrl());
717 goto zombie;
718 }
719
720 if (recreate) {
721 create = kTRUE;
722 fOption = "CREATE";
723 }
724
725 if (update && stat > 1) {
726 create = kTRUE;
727 stat = 1;
728 }
729
730 if (stat == 1)
732 else
734
735 Init(create);
736 return;
737
738zombie:
739 // error in file opening occured, make this object a zombie
740 MakeZombie();
743}
744
745////////////////////////////////////////////////////////////////////////////////
746/// Create a NetFile object using an existing connection (socket s).
747/// Provided for use in TXNetFile.
748/// See:
749/// TNetFile::Create(const char *url, Option_t *option, Int_t netopt)
750/// for details about the arguments.
751
752void TNetFile::Create(TSocket *s, Option_t *option, Int_t netopt)
753{
754 // Import socket
755 fSocket = s;
756
757 // Create the connection
758 Create(s->GetUrl(), option, netopt);
759}
760
761////////////////////////////////////////////////////////////////////////////////
762/// Return kTRUE if 'url' matches the coordinates of this file.
763/// Check the full URL, including port and FQDN.
764
765Bool_t TNetFile::Matches(const char *url)
766{
767 // Run standard check on fUrl, first
768 Bool_t rc = TFile::Matches(url);
769 if (rc)
770 // Ok, standard check enough
771 return kTRUE;
772
773 // Check also endpoint URL
774 TUrl u(url);
775 if (!strcmp(u.GetFile(),fEndpointUrl.GetFile())) {
776 // Candidate info
777 TString fqdn = u.GetHostFQDN();
778
779 // Check ports
780 if (u.GetPort() == fEndpointUrl.GetPort()) {
781 TString fqdnref = fEndpointUrl.GetHostFQDN();
782 if (fqdn == fqdnref)
783 // Ok, coordinates match
784 return kTRUE;
785 }
786 }
787
788 // Default is not matching
789 return kFALSE;
790}
791
792//
793// TNetSystem: the directory handler for net files
794//
795
796////////////////////////////////////////////////////////////////////////////////
797/// Create helper class that allows directory access via rootd.
798/// Use ftpowner = TRUE (default) if this instance is responsible
799/// for cleaning of the underlying TFTP connection; this allows
800/// to have control on the order of the final cleaning.
801
803 : TSystem("-root", "Net file Helper System")
804{
805 // name must start with '-' to bypass the TSystem singleton check
806 SetName("root");
807
808 fDir = kFALSE;
809 fDirp = 0;
810 fFTP = 0;
811 fFTPOwner = ftpowner;
812 fUser = "";
813 fHost = "";
814 fPort = -1;
816}
817
818////////////////////////////////////////////////////////////////////////////////
819/// Create helper class that allows directory access via rootd.
820/// Use ftpowner = TRUE (default) if this instance is responsible
821/// for cleaning of the underlying TFTP connection; this allows
822/// to have control on the order of the final cleaning.
823
824TNetSystem::TNetSystem(const char *url, Bool_t ftpowner)
825 : TSystem("-root", "Net file Helper System")
826{
827 // name must start with '-' to bypass the TSystem singleton check
828 SetName("root");
829
830 fFTPOwner = ftpowner;
832 Create(url);
833}
834
835////////////////////////////////////////////////////////////////////////////////
836/// Parse and save coordinates of the remote entity (user, host, port, ...)
837
838void TNetSystem::InitRemoteEntity(const char *url)
839{
840 TUrl turl(url);
841
842 // Remote username: local as default
843 fUser = turl.GetUser();
844 if (!fUser.Length()) {
846 if (u)
847 fUser = u->fUser;
848 delete u;
849 }
850
851 // Check and save the host FQDN ...
852 fHost = turl.GetHostFQDN();
853
854 // Remote port: the default should be 1094 because we are here
855 // only if the protocol is "root://"
856 fPort = turl.GetPort();
857}
858
859////////////////////////////////////////////////////////////////////////////////
860/// Create a TNetSystem object.
861
862void TNetSystem::Create(const char *url, TSocket *sock)
863{
864 // If we got here protocol must be at least its short form "^root.*:" :
865 // make sure that it is in the full form to avoid problems in TFTP
866 TString surl(url);
867 if (!surl.Contains("://")) {
868 surl.Insert(surl.Index(":")+1,"//");
869 }
870 TUrl turl(surl);
871
872 fDir = kFALSE;
873 fDirp = 0;
874 fFTP = 0;
875
876 // Check locality, taking into account possible prefixes
877 fLocalPrefix = "";
879 // We may have been asked explicitly to go through the daemon
880 Bool_t forceRemote = gEnv->GetValue("Path.ForceRemote", 0);
881 TString opts = TUrl(url).GetOptions();
882 if (opts.Contains("remote=1"))
883 forceRemote = kTRUE;
884 else if (opts.Contains("remote=0"))
885 forceRemote = kFALSE;
886 if (!forceRemote) {
887 if ((fIsLocal = TSystem::IsPathLocal(url))) {
888 fLocalPrefix = gEnv->GetValue("Path.Localroot","");
889 // Nothing more to do
890 return;
891 }
892 }
893
894 // Fill in user, host, port
895 InitRemoteEntity(surl);
896
897 // Build a TFTP url
898 if (fHost.Length()) {
899 TString eurl = "";
900 // First the protocol
901 if (strlen(turl.GetProtocol())) {
902 eurl = turl.GetProtocol();
903 eurl += "://";
904 } else
905 eurl = "root://";
906 // Add user, if specified
907 if (strlen(turl.GetUser())) {
908 eurl += turl.GetUser();
909 eurl += "@";
910 }
911 // Add host
912 eurl += fHost;
913 // Add port
914 eurl += ":";
915 eurl += turl.GetPort();
916
917 fFTP = new TFTP(eurl, 1, TFTP::kDfltWindowSize, sock);
918 if (fFTP && fFTP->IsOpen()) {
919 if (fFTP->GetSocket()->GetRemoteProtocol() < 12) {
920 Error("Create",
921 "remote daemon does not support 'system' functionality");
922 fFTP->Close();
923 delete fFTP;
924 } else {
927 // If responsible for the TFTP connection, remove it from the
928 // socket global list to avoid problems with double deletion
929 // at final cleanup
930 if (fFTPOwner)
931 gROOT->GetListOfSockets()->Remove(fFTP);
932 }
933 }
934 }
935}
936
937////////////////////////////////////////////////////////////////////////////////
938/// Destructor
939
941{
942 // Close FTP connection
943 if (fFTPOwner) {
944 if (fFTP) {
945 if (fFTP->IsOpen()) {
946
947 // Close remote directory if still open
948 if (fDir) {
950 fDir = kFALSE;
951 }
952 fFTP->Close();
953 }
954 delete fFTP;
955 }
956 }
957 fDirp = 0;
958 fFTP = 0;
959}
960
961////////////////////////////////////////////////////////////////////////////////
962/// Make a directory via rootd.
963
965{
966 // If local, use the local TSystem
967 if (fIsLocal) {
968 TString edir = TUrl(dir).GetFile();
969 if (!fLocalPrefix.IsNull())
970 edir.Insert(0, fLocalPrefix);
971 return gSystem->MakeDirectory(edir);
972 }
973
974 if (fFTP && fFTP->IsOpen()) {
975 // Extract the directory name
976 TString edir = TUrl(dir).GetFile();
977 return fFTP->MakeDirectory(edir,kFALSE);
978 }
979 return -1;
980}
981
982////////////////////////////////////////////////////////////////////////////////
983/// Open a directory and return an opaque pointer to a dir structure.
984/// Returns nullptr in case of error.
985
986void *TNetSystem::OpenDirectory(const char *dir)
987{
988 // If local, use the local TSystem
989 if (fIsLocal) {
990 TString edir = TUrl(dir).GetFile();
991 if (!fLocalPrefix.IsNull())
992 edir.Insert(0, fLocalPrefix);
993 return gSystem->OpenDirectory(edir);
994 }
995
996 if (!fFTP || !fFTP->IsOpen())
997 return nullptr;
998
999 if (fDir) {
1000 if (gDebug > 0)
1001 Info("OpenDirectory", "a directory is already open: close it first");
1003 fDir = kFALSE;
1004 }
1005
1006 // Extract the directory name
1007 TString edir = TUrl(dir).GetFile();
1008
1009 if (fFTP->OpenDirectory(edir,kFALSE)) {
1010 fDir = kTRUE;
1011 fDirp = (void *)&fDir;
1012 return fDirp;
1013 } else
1014 return nullptr;
1015}
1016
1017////////////////////////////////////////////////////////////////////////////////
1018/// Free directory via rootd.
1019
1021{
1022 // If local, use the local TSystem
1023 if (fIsLocal) {
1024 gSystem->FreeDirectory(dirp);
1025 return;
1026 }
1027
1028 if (dirp != fDirp) {
1029 Error("FreeDirectory", "invalid directory pointer (should never happen)");
1030 return;
1031 }
1032
1033 if (fFTP && fFTP->IsOpen()) {
1034 if (fDir) {
1036 fDir = kFALSE;
1037 fDirp = 0;
1038 }
1039 }
1040}
1041
1042////////////////////////////////////////////////////////////////////////////////
1043/// Get directory entry via rootd. Returns 0 in case no more entries.
1044
1045const char *TNetSystem::GetDirEntry(void *dirp)
1046{
1047 // If local, use the local TSystem
1048 if (fIsLocal) {
1049 return gSystem->GetDirEntry(dirp);
1050 }
1051
1052 if (dirp != fDirp) {
1053 Error("GetDirEntry", "invalid directory pointer (should never happen)");
1054 return 0;
1055 }
1056
1057 if (fFTP && fFTP->IsOpen() && fDir) {
1058 return fFTP->GetDirEntry(kFALSE);
1059 }
1060 return 0;
1061}
1062
1063////////////////////////////////////////////////////////////////////////////////
1064/// Get info about a file. Info is returned in the form of a FileStat_t
1065/// structure (see TSystem.h).
1066/// The function returns 0 in case of success and 1 if the file could
1067/// not be stat'ed.
1068
1070{
1071 // If local, use the local TSystem
1072 if (fIsLocal) {
1073 TString epath = TUrl(path).GetFile();
1074 if (!fLocalPrefix.IsNull())
1075 epath.Insert(0, fLocalPrefix);
1076 return gSystem->GetPathInfo(epath, buf);
1077 }
1078
1079 if (fFTP && fFTP->IsOpen()) {
1080 // Extract the directory name
1081 TString epath = TUrl(path).GetFile();
1082 fFTP->GetPathInfo(epath, buf, kFALSE);
1083 return 0;
1084 }
1085 return 1;
1086}
1087
1088////////////////////////////////////////////////////////////////////////////////
1089/// Returns FALSE if one can access a file using the specified access mode.
1090/// Mode is the same as for the Unix access(2) function.
1091/// Attention, bizarre convention of return value!!
1092
1094{
1095 // If local, use the local TSystem
1096 if (fIsLocal) {
1097 TString epath = TUrl(path).GetFile();
1098 if (!fLocalPrefix.IsNull())
1099 epath.Insert(0, fLocalPrefix);
1100 return gSystem->AccessPathName(epath, mode);
1101 }
1102
1103 if (fFTP && fFTP->IsOpen()) {
1104 // Extract the directory name
1105 TString epath = TUrl(path).GetFile();
1106 return fFTP->AccessPathName(epath, mode, kFALSE);
1107 }
1108 return kTRUE;
1109}
1110
1111////////////////////////////////////////////////////////////////////////////////
1112/// Check consistency of this helper with the one required
1113/// by 'path' or 'dirptr'.
1114
1115Bool_t TNetSystem::ConsistentWith(const char *path, void *dirptr)
1116{
1117 // Standard check: only the protocol part of 'path' is required to match
1118 Bool_t checkstd = TSystem::ConsistentWith(path, dirptr);
1119 if (!checkstd) return kFALSE;
1120
1121 // Require match of 'user' and 'host'
1122 Bool_t checknet = path ? kFALSE : kTRUE;
1123 if (path && strlen(path)) {
1124
1125 // Get user name
1126 TUrl url(path);
1127 TString user = url.GetUser();
1128 if (user.IsNull() && !fUser.IsNull()) {
1130 if (u)
1131 user = u->fUser;
1132 delete u;
1133 }
1134
1135 // Get host name
1136 TString host = url.GetHostFQDN();
1137
1138 // Get port
1139 Int_t port = url.GetPort();
1140 if (gDebug > 1)
1141 Info("ConsistentWith", "fUser:'%s' (%s), fHost:'%s' (%s), fPort:%d (%d)",
1142 fUser.Data(), user.Data(), fHost.Data(), host.Data(),
1143 fPort, port);
1144
1145 if (user == fUser && host == fHost && port == fPort)
1146 checknet = kTRUE;
1147 }
1148
1149 return (checkstd && checknet);
1150}
1151
1152////////////////////////////////////////////////////////////////////////////////
1153/// Remove a path
1154
1155Int_t TNetSystem::Unlink(const char *path)
1156{
1157 // If local, use the local TSystem
1158 if (fIsLocal) {
1159 TString epath = TUrl(path).GetFile();
1160 if (!fLocalPrefix.IsNull())
1161 epath.Insert(0, fLocalPrefix);
1162 return gSystem->Unlink(epath);
1163 }
1164
1165 // Not implemented for rootd
1166 Warning("Unlink", "functionality not implemented - ignored (path: %s)", path);
1167 return -1;
1168}
EMessageTypes
@ kROOTD_FSTAT
@ kROOTD_OPEN
@ kROOTD_BYE
@ kROOTD_GET
@ kROOTD_PUT
@ kROOTD_ERR
@ kROOTD_CLOSE
@ kROOTD_FLUSH
@ kROOTD_GETS
R__EXTERN const char * gRootdErrStr[]
Definition NetErrors.h:72
#define SafeDelete(p)
Definition RConfig.hxx:537
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
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:101
long Long_t
Definition RtypesCore.h:54
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:80
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
R__EXTERN TApplication * gApplication
#define gDirectory
Definition TDirectory.h:385
R__EXTERN TEnv * gEnv
Definition TEnv.h:170
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:220
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:187
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:231
Int_t gDebug
Definition TROOT.cxx:592
#define gROOT
Definition TROOT.h:404
TString ToLower(const TString &s)
Return a lower-case version of str.
Definition TString.cxx:1455
char * Form(const char *fmt,...)
void Printf(const char *fmt,...)
EAccessMode
Definition TSystem.h:43
Bool_t R_ISREG(Int_t mode)
Definition TSystem.h:118
Bool_t R_ISDIR(Int_t mode)
Definition TSystem.h:115
R__EXTERN TSystem * gSystem
Definition TSystem.h:559
@ kS_IXOTH
Definition TSystem.h:112
@ kS_IXUSR
Definition TSystem.h:104
@ kS_IXGRP
Definition TSystem.h:108
#define gPerfStats
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.
Definition TEnv.cxx:491
Definition TFTP.h:34
Int_t MakeDirectory(const char *dir, Bool_t print=kFALSE) const
Make a remote directory.
Definition TFTP.cxx:667
void FreeDirectory(Bool_t print=kFALSE)
Free a remotely open directory via rootd.
Definition TFTP.cxx:956
@ kDfltWindowSize
Definition TFTP.h:70
Int_t GetPathInfo(const char *path, FileStat_t &buf, Bool_t print=kFALSE)
Get info about a file.
Definition TFTP.cxx:1029
Bool_t OpenDirectory(const char *name, Bool_t print=kFALSE)
Open a directory via rootd.
Definition TFTP.cxx:914
TSocket * GetSocket() const
Definition TFTP.h:108
const char * GetDirEntry(Bool_t print=kFALSE)
Get directory entry via rootd.
Definition TFTP.cxx:988
Int_t Close()
Close ftp connection.
Definition TFTP.cxx:884
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.
Definition TFTP.cxx:1111
Bool_t IsOpen() const
Definition TFTP.h:85
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:54
static std::atomic< Long64_t > fgBytesRead
Number of bytes read by all TFile objects.
Definition TFile.h:132
Int_t fReadCalls
Number of read calls ( not counting the cache calls )
Definition TFile.h:90
static void SetFileBytesWritten(Long64_t bytes=0)
Definition TFile.cxx:4529
Long64_t fBytesRead
Number of bytes read from this file.
Definition TFile.h:77
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode.
Definition TFile.cxx:2100
virtual Bool_t Matches(const char *name)
Return kTRUE if 'url' matches the coordinates of this file.
Definition TFile.cxx:4684
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
Definition TFile.cxx:4501
static void SetFileBytesRead(Long64_t bytes=0)
Definition TFile.cxx:4526
static void SetFileReadCalls(Int_t readcalls=0)
Definition TFile.cxx:4532
TUrl fUrl
!URL of file
Definition TFile.h:111
Int_t WriteBufferViaCache(const char *buf, Int_t len)
Write buffer via cache.
Definition TFile.cxx:2457
static Long64_t GetFileBytesRead()
Static function returning the total number of bytes read from all files.
Definition TFile.cxx:4492
Int_t ReadBufferViaCache(char *buf, Int_t len)
Read buffer via cache.
Definition TFile.cxx:1827
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.
Definition TFile.cxx:1759
Long64_t fArchiveOffset
!Offset at which file starts in archive
Definition TFile.h:102
virtual void Init(Bool_t create)
Initialize a TFile object.
Definition TFile.cxx:574
TString fOption
File options.
Definition TFile.h:92
ERelativeTo
Definition TFile.h:193
Int_t fD
File descriptor.
Definition TFile.h:83
Bool_t FlushWriteCache()
Flush the write cache if active.
Definition TFile.cxx:1098
Long64_t fBytesWrite
Number of bytes written to this file.
Definition TFile.h:76
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
Definition TFile.cxx:2191
Long64_t fOffset
!Seek offset cache
Definition TFile.h:97
static std::atomic< Long64_t > fgBytesWrite
Number of bytes written by all TFile objects.
Definition TFile.h:131
void Close(Option_t *option="") override
Close a file.
Definition TFile.cxx:899
static std::atomic< Int_t > fgReadCalls
Number of bytes read from all TFile objects.
Definition TFile.h:134
@ kWriteError
Definition TFile.h:188
static Int_t GetFileReadCalls()
Static function returning the total number of read calls from all files.
Definition TFile.cxx:4509
TString fTitle
Definition TNamed.h:33
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
Open a remote file. Requires fOption to be set correctly.
Definition TNetFile.cxx:113
void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
Definition TNetFile.cxx:566
void Print(Option_t *option) const
Print some info about the net file.
Definition TNetFile.cxx:259
Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
Return file stat information.
Definition TNetFile.cxx:160
virtual void Create(const char *url, Option_t *option, Int_t netopt)
Create a NetFile object.
Definition TNetFile.cxx:663
Int_t fProtocol
Definition TNetFile.h:40
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.
Definition TNetFile.cxx:574
Int_t Recv(Int_t &status, EMessageTypes &kind)
Return status from rootd server and message kind.
Definition TNetFile.cxx:550
Bool_t IsOpen() const
Retruns kTRUE if file is open, kFALSE otherwise.
Definition TNetFile.cxx:251
TNetFile()
Definition TNetFile.h:64
TUrl fEndpointUrl
Definition TNetFile.h:37
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.
Definition TNetFile.cxx:388
TString fUser
Definition TNetFile.h:38
Bool_t Matches(const char *url)
Return kTRUE if 'url' matches the coordinates of this file.
Definition TNetFile.cxx:765
Int_t SysClose(Int_t fd)
Close currently open file.
Definition TNetFile.cxx:148
void PrintError(const char *where, Int_t err)
Print error string depending on error code.
Definition TNetFile.cxx:274
Bool_t ReadBuffer(char *buf, Int_t len)
Read specified byte range from remote file via rootd daemon.
Definition TNetFile.cxx:304
void Init(Bool_t create)
Initialize a TNetFile object.
Definition TNetFile.cxx:240
Bool_t WriteBuffer(const char *buf, Int_t len)
Write specified byte range to remote file via rootd daemon.
Definition TNetFile.cxx:492
Int_t fNetopt
Definition TNetFile.h:42
Int_t fErrorCode
Definition TNetFile.h:41
void Close(Option_t *option="")
Close remote file.
Definition TNetFile.cxx:212
virtual ~TNetFile()
TNetFile dtor. Send close message and close socket.
Definition TNetFile.cxx:105
void Flush()
Flush file to disk.
Definition TNetFile.cxx:229
TSocket * fSocket
Definition TNetFile.h:39
Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode, like from READ to UPDATE or from NEW, CREATE,...
Definition TNetFile.cxx:289
const char * GetDirEntry(void *dirp=0)
Get directory entry via rootd. Returns 0 in case no more entries.
TString fLocalPrefix
Definition TNetFile.h:103
TString fHost
Definition TNetFile.h:91
TString fUser
Definition TNetFile.h:93
void InitRemoteEntity(const char *url)
Parse and save coordinates of the remote entity (user, host, port, ...)
Definition TNetFile.cxx:838
Int_t MakeDirectory(const char *name)
Make a directory via rootd.
Definition TNetFile.cxx:964
void Create(const char *url, TSocket *sock=0)
Create a TNetSystem object.
Definition TNetFile.cxx:862
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 fDir
Definition TNetFile.h:88
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.
Definition TNetFile.cxx:940
void * fDirp
Definition TNetFile.h:89
Bool_t fFTPOwner
Definition TNetFile.h:92
TFTP * fFTP
Definition TNetFile.h:90
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.
Definition TNetFile.cxx:986
Int_t fPort
Definition TNetFile.h:94
Bool_t fIsLocal
Definition TNetFile.h:102
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:949
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:766
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:963
void MakeZombie()
Definition TObject.h:53
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:937
const char * GetHost() const
Definition TSecContext.h:75
const char * GetUser() const
Definition TSecContext.h:82
void HandleDelayedSignal()
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Definition TSocket.cxx:818
Int_t GetRemoteProtocol() const
Definition TSocket.h:126
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
Definition TSocket.cxx:898
TSecContext * GetSecContext() const
Definition TSocket.h:127
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
Definition TSocket.cxx:620
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...
Definition TSocket.cxx:1432
const char * GetUrl() const
Definition TSocket.h:130
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
Definition TSocket.cxx:522
virtual Bool_t IsAuthenticated() const
Definition TSocket.h:131
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
TString & Insert(Ssiz_t pos, const char *s)
Definition TString.h:649
const char * Data() const
Definition TString.h:369
void ToUpper()
Change string to upper case.
Definition TString.cxx:1163
Bool_t IsNull() const
Definition TString.h:407
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:624
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:639
Abstract base class defining a generic interface to the underlying Operating System.
Definition TSystem.h:266
virtual void IgnoreInterrupt(Bool_t ignore=kTRUE)
If ignore is true ignore the interrupt signal, else restore previous behaviour.
Definition TSystem.cxx:605
static void ResetErrno()
Static function resetting system error number.
Definition TSystem.cxx:279
static Int_t GetErrno()
Static function returning system error number.
Definition TSystem.cxx:263
virtual void FreeDirectory(void *dirp)
Free a directory.
Definition TSystem.cxx:846
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition TSystem.cxx:837
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
Definition TSystem.cxx:1305
virtual int MakeDirectory(const char *name)
Make a directory.
Definition TSystem.cxx:828
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.
Definition TSystem.cxx:1398
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition TSystem.cxx:1296
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
Definition TSystem.cxx:854
virtual int Unlink(const char *name)
Unlink, i.e.
Definition TSystem.cxx:1381
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
Definition TSystem.cxx:1599
virtual Bool_t ConsistentWith(const char *path, void *dirptr=nullptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Definition TSystem.cxx:805
The TTimeStamp encapsulates seconds and ns since EPOCH.
Definition TTimeStamp.h:71
This class represents a WWW compatible URL.
Definition TUrl.h:33
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Definition TUrl.cxx:389
const char * GetFile() const
Definition TUrl.h:69
Bool_t IsValid() const
Definition TUrl.h:79
const char * GetUser() const
Definition TUrl.h:65
const char * GetHost() const
Definition TUrl.h:67
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
Definition TUrl.cxx:471
const char * GetOptions() const
Definition TUrl.h:71
const char * GetProtocol() const
Definition TUrl.h:64
Int_t GetPort() const
Definition TUrl.h:78
const Int_t n
Definition legend1.C:16
static const char * what
Definition stlLoader.cc:6
TString fUser
Definition TSystem.h:141