libcdio-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libcdio-help] Large file support and binary compatibility on 32 bit


From: Bastiaan Timmer
Subject: Re: [Libcdio-help] Large file support and binary compatibility on 32 bit systems
Date: Thu, 7 Jul 2011 07:45:39 -0700 (PDT)

There is something mysterious here because the typeset for off_t does not come from libcdio but rather from from the system. On Ubuntu it seems it comes from <sys/types.h>.
Well, the typedef comes from <sys/types.h> here as well, but what it is defined as is dependant on _FILE_OFFSET_BITS which does come from libcdio. Or at least I think it does, as it's set to 32 on my system, but after running 'configure', a config.h is generated (and included in all cdio sources) that has the line '#define _FILE_OFFSET_BITS 64' in it. That define is what breaks programs linking to the library on my system (and other systems with 32 bit off_t's by default). So, I thought (but I could be wrong), that maybe one should just never change the value of FILE_OFFSET_BITS from the system default. And only provide large file enabled functions through specialized functions (like [fl]seek64) on 32-bit platforms.

So the fact that there is garbage in the upper 4 bytes on 32-bit systems feels to me like a design flaw.
The upper 4 bytes of the off_t received by cdio_paranoia_seek are not exactly garbage though, they are simply the 4 bytes of the int parameter ('int whence'). So you could actually work around this problem by giving the off_t a value of 0, and setting the int whence to the frame you want to seek to. The garbage value that ends up in the int will always (?) fall through the switch (in paranoia.c line 2479) and behave like it was set to SEEK_CUR. Not a very nice solution though... ;)

There now is. When libcdio installs it installs ... include/cdio/cdio_config.h  and that has values that were set from its config.h. Previously I had installed a truncated version of config.h. I just made a change in git to store the entire config.h.

But I have a little trepidation with this change, so it is an experiment and may change. The C preprocessor symbols are from a global namespace. That is the names there are not prefaced with say CDIO_.  _FILE_OFFSET_BITS in particular is such a global namespace variable. So this means you may need to be careful with the order of includes because some other include may set _FILE_OFFSET_BITS and, at least on Ubuntu, <sys/types.h> uses the value of the #define.
Great, I just checked out the code and it seems to work. But, indeed, it might be a good idea to rename the symbols somehow as it may cause trouble. I don't know how difficult that would be though.

Right. I'll put on the list of things to do to change cdio_paranoia_seek to use an int32_t rather than an off_t.
Right, well that is awesome! That would completely solve my problem and make the rest of this message somewhat less important (for me), but still...

Anyway, thanks for the help en quick reply,
Bas Timmer


reply via email to

[Prev in Thread] Current Thread [Next in Thread]