Re: [ROOT] Re: root under windows

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Jan 28 2002 - 17:54:58 MET


I've corrected the confusing comments.

Cheers, Fons.



On Mon, 2002-01-28 at 17:39, Valeri Fine wrote:
> 
> 
> > Hi Valery,
> > 
> >   no specific Win32 ifdef's are needed. We don't yet support 64bit
> > files on any platform. In the TFile layer we have forseen that Seek_t
> > can be 64 bit and there is also a hook in the file format saying if
> > it is a 64 bit file or not, but in TFile we still need to make the
> > case for all I/O system methods to be called in 64bit.
> 
> 
>  I made two points:
> 
>   -  the documentation is confusing about "64-bits" and "man lseek
> 
>   -   interface is protected and is not designed for the external use, since it requires
>       the user to introduce some system header files in addition. 
>       Nothing wrong with that  but documentation. 
> 
>   The documentation has been proved to confuse the user and should be corrected. 
> 
>                                 Cheers, Valeri
> 
> > -- Fons
> > 
> > 
> > 
> > On Mon, 2002-01-28 at 15:54, Valeri Fine wrote:
> > > ----- Original Message ----- 
> > > From: "geffroy" <sgeffroy@lasim.univ-lyon1.fr>
> > > To: "Fine Valeri" <fine@bnl.gov>
> > > Sent: Monday, January 28, 2002 8:57 AM
> > > Subject: root under windows
> > > 
> > > 
> > > > hello
> > > > 
> > > > i'm a root user under win2000
> > > > I would like to use the command :
> > > > 
> > > > Seek_t TFile::SysSeek(Int_t fd, Seek_t offset, Int_t whence)
> > > > 
> > > > but the root manual on-line said that this command use directly the lseek
> > > > system command
> > >
> > lseek() is a POSIX call, to seek on the and Win32 implements it the
> > same way. Look in you online Visual C++ manual.
> > 
> > > 
> > >   ROOT manual doesn't say this method doesn't work under Windows, or
> > >   it is for UNIX platform only. (By some reason one doesn't provide
> > >   any Windows implementation for 64-bits file system. Why ? )
> > >
> > Like said above its a POSIX call supported by WIn32 too. We don't have
> > yet general support for 64 bit file systems on any platform. All the
> > hooks are there in the file format, but we don't use yet the 64 bit
> > versions of the I/O functions.
> > 
> > > 
> > >  The placement of this method in the TFile class rather TSystem is confusing also.
> > > 
> > >  Even though on either platform one can use TFile::SysSeek method as ROOT manual describes
> > >  the comment there is confusing  for Windows user:
> > > 
> > >                        "All arguments like in "man 2 lseek"
> > > 
> > >  ( http://root.cern.ch/root/htmldoc/TFile.html#TFile:SysSeek )
> > >  Many Windows users have no idea what the combination of the words above 
> > > "man 2 lseek" does mean.
> > > 
> > > It suggests this works properly on UNIX platform only.
> > > On other hande this method is "protected". 
> > > This sounds it is not designed to be used by the "regular" user.
> > > 
> > > May be the direct explanation of the parameters is more appropriated:
> > > 
> > > TFile::SysSeek - Interface to system lseek.
> > > 
> > >       The method repositions  the  offset of the file
> > >        descriptor "fildes" to the argument "offset" according to  the
> > >        directive "whence" as follows:
> > > 
> > >        SEEK_SET
> > >               The offset is set to offset bytes.
> > > 
> > >        SEEK_CUR
> > >               The offset is set to its current location plus offset bytes.
> > > 
> > >        SEEK_END
> > >               The offset is set to the size of the file plus offset bytes.
> > > 
> > > RETURN VALUES
> > >        Upon  successful  completion, lseek returns the resulting offset location
> > >        as measured in bytes from the beginning of the file.  Otherwise, a  value
> > >        of (Seek_t)-1 is returned and errno is set to indicate the error.
> > > 
> > > 
> > >  On other hand to use this method it is not enough to provide TFile class header file, namely 
> > > "TFile.h" one has to provide the platform specific system header files also  (Why ?)
> > > ( see: TFile.cxx file http://root.cern.ch/root/htmldoc/src/TFile.cxx.html) namely:
> > > 
> > > #include <fcntl.h>
> > > #include <errno.h>
> > > #include <sys/stat.h>
> > > #ifndef WIN32
> > > #   include <unistd.h>
> > > #else
> > > #   define ssize_t int
> > > #   include <io.h>
> > > #   include <sys/types.h>
> > > #endif
> > > 
> > > The comment:
> > > 
> > >  "... // except that the offset and return value are Long_t to be able to
> > >       // handle 64 bit file systems. ..."
> > > 
> > > is still confusing. 
> > > 
> > > [rcas6028] /afs/rhic/star/ROOT/3.02.01/include > grep Seek_t *.h
> > > 
> > > Rtypes.h:typedef int            Seek_t;      //File pointer
> > > Rtypes.h:typedef int            Seek_t;      //File pointer
> > > 
> > > How "int Seek_t" can accomodate 64-bits is unclear.
> > > 
> > > Very likely one may ask the Team to create a  "cross-platform" interface for this method.
> > > (The right place for such sort of method is TSystem class of course).
> > > Some kind of  ROOT-specific enumerate statement would be useful also:
> > > 
> > > TFile.h:
> > > 
> > > enum {kSeekSet, kSeekCur, kSeekEnd} EFileSeek;
> > > 
> > > TFile.cxx:
> > > 
> > > static const int gSeekMap[kSeekEnd+1] = {SEEK_SET, SEEK_CUR, SEEK_END};
> > > 
> > > Seek_t TFile::SysSeek(Int_t fd, Seek_t offset,  EFileSeek whence) {
> > > #ifndef WIN32
> > >  return ::lseek(fd, offset, gSeekMap[whence]);
> > > #else
> > >  return ::lseek64(fd, offset, gSeekMap[whence]);
> > > #endif
> > > }
> > >  
> > > > my question is what is the equivalent for Win2000 ?
> > > 
> > >  For 32-bits file system one can use TFile::SysSeek "as is"
> > >  for 64-bits one can call the  "lseek64" directly
> > > 
> > >  Either way under Window you have to provide "#include <io.h>" yourself 
> > >  to get your code compiled.
> > > 
> > >                 Hope this helps,  Valeri
> > > > 
> > > > thank a lot
> > > > 
> > > > -------
> > > > Sylvain Geffroy
> > > > http://lasim.univ-lyon1.fr/perso/geffroy/
> > > > 
> > -- 
> > Org:    CERN, European Laboratory for Particle Physics.
> > Mail:   1211 Geneve 23, Switzerland
> > E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> > WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480
> > 
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:40 MET