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