Re: du in ROOT

From: Fons Rademakers <Fons.Rademakers_at_cern.ch>
Date: Wed, 26 Nov 2008 18:06:21 +0100


Hi Chiara,

   don't use pointers ;-), but like this:

            root [0] Long_t id;
            root [1] Long_t bsize;
            root [2] Long_t blocks;
            root [3] Long_t bfree;
            root [4] Int_t ciccio = 
(TUnixSystem*)gSystem->GetFsInfo("/dev/hda4/",&id,&bsize,&blocks,&bfree)
            root [5] bfree

Cheers, Fons.

Chiara Zampolli wrote:
> Hi Valeri,
>
> thanks a lot! I have tried in fact, but I don't get anything back. Am
> i missing something? See below:
>
>
> zampolli_at_pcalice134:/home/zampolli/SOFT/AliRoot/AliRoot_NewTrunk>df -h
> Filesystem Size Used Avail Use% Mounted on
> /dev/hda2 9.7G 7.5G 1.7G 82% /
> /dev/hda1 99M 23M 71M 25% /boot
> none 1013M 0 1013M 0% /dev/shm
> /dev/hda4 99G 42M 99G 1% /mnt/extra
> /dev/sda1 280G 46G 235G 17% /mnt/sata
> AFS 8.6G 0 8.6G 0% /afs
>
> zampolli_at_pcalice134:/home/zampolli/SOFT/AliRoot/AliRoot_NewTrunk>root -l
>
> WELCOME to ALICE
>
> root [0] Long_t* id;
> root [1] Long_t* bsize;
> root [2] Long_t* blocks;
> root [3] Long_t* bfree;
> root [4] Int_t ciccio =
> (TUnixSystem*)gSystem->GetFsInfo("/dev/hda4/",id,bsize$
> root [5] ciccio
> (Int_t)(1)
> root [6]
>
> I have tried also to pass as the first argument the path of where the
> file system is mounted, but in this case it crashes, see here.
> Thanks again,
>
> chiara
>
> ****
> root [0] Long_t* id;
> root [1] Long_t* bsize;
> root [2] Long_t* blocks;
> root [3] Long_t* bfree;
> root [4] Int_t ciccio =
> (TUnixSystem*)gSystem->GetFsInfo("/mnt/sata/",id,bsize$
>
> *** Break *** segmentation violation
> Using host libthread_db library "/lib/tls/libthread_db.so.1".
> Attaching to program: /proc/24812/exe, process 24812
> [Thread debugging using libthread_db enabled]
> [New Thread -1209039168 (LWP 24812)]
> 0x005de7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
> #1 0x00682f13 in __waitpid_nocancel () from /lib/tls/libc.so.6
> #2 0x0062c7b9 in do_system () from /lib/tls/libc.so.6
> #3 0x0088298d in system () from /lib/tls/libpthread.so.0
> #4 0x00b25380 in TUnixSystem::Exec (this=0x87cf528,
> #5 0x00b25834 in TUnixSystem::StackTrace (this=0x87cf528)
> at core/unix/src/TUnixSystem.cxx:2121
> #6 0x00b23679 in TUnixSystem::DispatchSignals (this=0x87cf528,
> sig=kSigSegmentationViolation) at core/unix/src/TUnixSystem.cxx:1089
> #7 0x00b21515 in SigHandler (sig=kSigSegmentationViolation)
> at core/unix/src/TUnixSystem.cxx:351
> #8 0x00b2858c in sighandler (sig=11) at core/unix/src/TUnixSystem.cxx:3344
> #9 <signal handler called>
> #10 0x00b29027 in TUnixSystem::UnixFSstat (path=0x8a2641c "/mnt/sata/",
> id=0x0, bsize=0x0, blocks=0x0, bfree=0x0)
> at core/unix/src/TUnixSystem.cxx:3790
> #11 0x00b244c2 in TUnixSystem::GetFsInfo (this=0x87cf528,
> path=0x8a2641c "/mnt/sata/", id=0x0, bsize=0x0, blocks=0x0, bfree=0x0)
> at core/unix/src/TUnixSystem.cxx:1463
> #12 0x00c2c5c2 in G__G__Base2_221_0_89 ()
> ....
>
> Fine, Valeri wrote:

>> Check
>>
>> http://root.cern.ch/root/html/TSystem.html#TSystem:GetFsInfo
>>
>>   Get info about a file system:
>>   fs type,   block size,   number of blocks,
>>   number of free blocks.
>>
>> http://root.cern.ch/root/html/TUnixSystem.html#TUnixSystem:GetFsInfo
>>
>>
>> Best Regards
>>                          Valeri Fine
>> ---------------
>> Brookhaven National Laboratory
>> Upton, NY 11973, USA
>> Phone: +1 631 344 7806
>> Fax:     +1 631 344 4206
>> E-mail: fine_at_bnl.gov
>>
>>  
>>> -----Original Message-----
>>> From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch]
>>>     
>> On
>>  
>>> Behalf Of Chiara Zampolli
>>> Sent: Wednesday, November 26, 2008 10:29 AM
>>> To: Rene Brun
>>> Cc: Root
>>> Subject: Re: [ROOT] du in ROOT
>>>
>>> Hi Rene,
>>>
>>>     yes, I know. I was wondering whether this was already implemented
>>>     
>> as
>>  
>>> a method of some class, because what I would need is then to see how
>>> much free space I have left (in percentage), which would mean to call
>>> awk, but if you had something like GetDiskUsed() and
>>>     
>> GetDiskAvailable(),
>>  
>>> it would have been nicer...
>>>     Thanks!
>>>
>>>              c.
>>>
>>>
>>> Rene Brun wrote:
>>>    
>>>> Chiara,
>>>>
>>>> You can always do:
>>>> gSystem->Exec("du . >du.log")
>>>>
>>>> Rene Brun
>>>>
>>>> Chiara Zampolli wrote:
>>>>      
>>>>> Hi all,
>>>>>
>>>>>    is there a way in ROOT to get the same information as those one
>>>>> can get from the unix command du?
>>>>>    Thanks and cheers,
>>>>>
>>>>>             Chiara
>>>>>
>>>>>         
>>
>>   

>
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers_at_cern.ch              Phone: +41 22 7679248
WWW:    http://fons.rademakers.org           Fax:   +41 22 7669640
Received on Wed Nov 26 2008 - 18:06:24 CET

This archive was generated by hypermail 2.2.0 : Wed Nov 26 2008 - 23:50:01 CET