Re: Fwd: TFile::Open(): distinguish application level and filesystem level errors

From: Fons Rademakers <Fons.Rademakers_at_cern.ch>
Date: Wed, 16 Feb 2011 15:48:05 +0100


Hi Thiemo,

   we cannot change the return value of TFile::Open(), it must be either a TFile pointer or 0. However, we could change the signature to:

    static TFile       *Open(const char *name, Option_t *option = "",
                             const char *ftitle = "", Int_t compress = 1,
                             Int_t netopt = 0, Int_t *fserr = 0);

in which case you could use:

Int_t err;
TFile *f = TFile::Open("bla.root", "", "", 1, 0, &err); if (err != 0) {

    // err = -1: fs not mounted
    // err = -2: max descriptors
    // err = -3: etc

    if (f) delete f;
}

Would that work for you?

Cheers, Fons.

On 16/02/2011 15:10, Rene Brun wrote:
> Subject: [ROOT] TFile::Open(): distinguish application level and
> filesystem level errors
> Date: Tue, 15 Feb 2011 15:50:46 +0100
> From: Thiemo Nagel <thiemo.nagel_at_tum.de>
> To: <roottalk_at_cern.ch>
>
>
>
> Dear ROOTers,
>
> may I ask for your opinion about an issue concerning TFile::Open()?
>
> I'm looking for a way to distinguish between application level and
> filesystem level errors in TFile::Open() because I'd like to ignore only
> the former in hadd. For the moment I'm thinking along the lines of
> adding another status bit in TFile, "kFSError" or similar, but as far as
> I've seen, further changes would be necessary, i.e. TFile::Open() could
> not return NULL anymore.
>
> What do you think? Would you accept a patch?
>
> The use case is: I'd like to merge large amounts of job-output-files,
> of which some are truncated because sometimes jobs are aborted. I'd
> like to ignore these truncated files without becoming blind to errors on
> the filesystem level, like eg. volume not mounted, or maximum number of
> open filedescriptors exceeded.
>
> Cheers,
> Thiemo
> --
> +-----------------------------------+--------------------------+
> | Dipl.-Phys. Thiemo Nagel | |
> | Technische Universitaet Muenchen | Room PH1 3276 |
> | Physik-Department E18 | |
> | James-Franck-Strasse | Phone +49 89 289-12379 |
> | D-85747 Garching | Fax +49 89 289-12570 |
> +-----------------------------------+--------------------------+
>
>

-- 
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 Feb 16 2011 - 15:48:10 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 17 2011 - 17:50:01 CET