Print

Print


Hi Pete,

  I bounced this message to the mailing list, since it can be of 
interest for some people.

Peter Elmer wrote:
>   Hi Fabrizio,
> 
> On Mon, Jan 24, 2005 at 02:44:42PM +0000, Fabrizio Furano wrote:
> 
>> SysStatX should be working now. Its syntax is like
>>
>>$ans = XrdClientAdmin::XrdSysStatX("/tmp/xyz.zip\n/tmp/dsf");
>>
>> You can check in the tiny perl test for another example.
>>
>> Sorry for the mess, i did not remember that the function was there, 
>>since I supposed that people was using ExistFiles, ExistDirs etc..
> 
> 
>   Perhaps I'm confused. What exactly is supposed to be returned here?
> 

  SysStatX returns a string containing an ascii version of the binary 
string returned by the server. For each file you statX, a digit is 
returned, which is the number coming from the combination of the flag 
values the server returns for each of the files. If there is some error, 
you have an empty string.

>   I updated my script to do:
> 
> $ans = XrdClientAdmin::XrdExistFiles($par);
> print "\nThe answer of XrdClientAdmin::XrdExistFiles($par) is: \"$ans\" \n";
> 
> $ans = XrdClientAdmin::XrdSysStatX($par);
> print "\nThe output of XrdClientAdmin::XrdSysStatX($par) is: \"$ans\" \n\n\n";
> 
> and this gives:
> 
> 050124 12:29:13 001 Xrd:  (C) 2004 SLAC XrdClientAdmin 0.3
> 
> The answer of XrdClientAdmin::XrdExistFiles(/store/what.root) is: "1" 
> 
> The output of XrdClientAdmin::XrdSysStatX(/store/what.root) is: "0" 
> 
> The file _is_ there. What exactly does the return value mean? (Especially
> if I pass it a list of files...)

I know, the protocol specs are not very intuitive. However, they are 
correct. The exact meaning of the number you get is in the protocol 
docs, unnder the command StatX.

Here is a cut&paste from the proto:
----------------
flags     identifies the entry’s attributes as a binary character. The 
entry should be assumed to be an immediately available regular file 
unless one or more of the following bits are set.

             kXR_xset         - Either an executable file or a 
searchable directory.

             kXR_isDir      - This is a directory.

             kXR_other      - This neither a file nor a directory, or 
does not exist.

      kXR_offline - For files, the file is not online (i.e., on disk).
-------------------

This means that if you get 0, none of those flags is set, hence the 
filename identifies an immediately available regular file.
It's confirmed by ExistFiles, which is only a simple wrapper over 
SysStatX, but more easy to understand.


Ah, if you pass a list of (\n-separated) files, what you get is a digit 
for each of the files you gave.

Fabrizio


> 
>                                  thanks,
>                                    Pete
> 
> 
>>Wilko Kroeger wrote:
>>
>>>Hello Pete
>>>
>>>I was wrong before. sysStatX is kind of working. The right info is
>>>sent from the server but I also don't quite understand how the perl
>>>wrapper is working. I will look into it.
>>>
>>>Cheers,
>>> Wilko
>>>
>>>
>>>On Fri, 21 Jan 2005, Peter Elmer wrote:
>>>
>>>
>>>
>>>>Hi Fabrizio and Wilko,
>>>>
>>>>I tried:
>>>>
>>>># ---------------------------------------------------
>>>>
>>>>use XrdClientAdmin;
>>>>my $have_xrd = eval { require XrdClientAdmin; 1; };
>>>>
>>>>die "FATAL: Requesting xrootd features, but cannot find XrdClientAdmin 
>>>>module\n" unless $have_xrd;
>>>>
>>>>$prefix = "root://noric02.slac.stanford.edu:2525/prod/";
>>>>
>>>>XrdClientAdmin::XrdInitialize($prefix, 0);
>>>>
>>>>$par = "/store/what.root";
>>>>$npar = 1;
>>>>
>>>>$ans = XrdClientAdmin::XrdExistFiles($par);
>>>>print "\nThe answer of XrdClientAdmin::XrdExistFiles($par) is: \"$ans\" 
>>>>\n";
>>>>
>>>>$ans = XrdClientAdmin::XrdSysStatX($par, $output, $npar);
>>>>print "\nThe output of XrdClientAdmin::XrdSysStatX($par) is: \"$output\" 
>>>>\n\n\n";
>>>>
>>>>XrdClientAdmin::XrdTerminate();
>>>>
>>>># ---------------------------------------------------
>>>>
>>>>but this gives:
>>>>
>>>>noric01> ./bunk.pl
>>>>050121 13:59:47 001 Xrd:  (C) 2004 SLAC XrdClientAdmin 0.3
>>>>
>>>>The answer of XrdClientAdmin::XrdExistFiles(/store/what.root) is: "1"
>>>>
>>>>The output of XrdClientAdmin::XrdSysStatX(/store/what.root) is: ""
>>>>
>>>>i.e. the $output isn't filled. What am I missing?
>>>>
>>>>                               thanks,
>>>>                                 Pete
>>>>
> 
> 
> 
> 
> -------------------------------------------------------------------------
> Peter Elmer     E-mail: [log in to unmask]      Phone: +41 (22) 767-4644
> Address: CERN Division PPE, Bat. 32 2C-14, CH-1211 Geneva 23, Switzerland
> -------------------------------------------------------------------------