|
Packit |
c32a2d |
Regarding largefile setup, client apps can be built three ways:
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
1. _FILE_OFFSET_BITS == 64 (header maps to mpg123_open_64)
|
|
Packit |
c32a2d |
2. _FILE_OFFSET_BITS == 32 (header maps to mpg123_open_32)
|
|
Packit |
c32a2d |
3. _FILE_OFFSET_BITS == <nothing> (header maps to mpg123_open)
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
The libmpg123 build needs to be prepared for everything. Also, it needs to keep
|
|
Packit |
c32a2d |
in mind the days before introducing large file support --- binaries should still
|
|
Packit |
c32a2d |
work with updated libmpg123. So, mpg123_open should always match what is the
|
|
Packit |
c32a2d |
default build on a platform without added settings. Those are the platform
|
|
Packit |
c32a2d |
variants:
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
1. 64 bit native system, long == off_t
|
|
Packit |
c32a2d |
libmpg123: mpg123_open
|
|
Packit |
c32a2d |
lfs_alias: mpg123_open_64 -> mpg123_open
|
|
Packit |
c32a2d |
lfs_wrap: <none>
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
2. largefile-sensitive, long = 32, off_t = 64 (if enabled)
|
|
Packit |
c32a2d |
libmpg123: mpg123_open_64
|
|
Packit |
c32a2d |
lfs_alias: mpg123_open_32 -> mpg123_open
|
|
Packit |
c32a2d |
lfs_wrap: mpg123_open -> mpg123_open_64
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
3. largefile, long = 32, off_t = 64 (FreeBSD)
|
|
Packit |
c32a2d |
libmpg123: mpg123_open
|
|
Packit |
c32a2d |
lfs_alias: mpg123_open_64 -> mpg123_open
|
|
Packit |
c32a2d |
lfs_wrap: <none>
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
This is what mpg123 does in version 1.15.4 and it works. Well, for cases 1
|
|
Packit |
c32a2d |
(Linux/Solaris x86-64) and 2 (Linux/Solaris x86). Case 3 needs to be added
|
|
Packit |
c32a2d |
properly. Actually, let's have a second look at case 2: When mpg123 is built
|
|
Packit |
c32a2d |
with --disable-largefile:
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
2a. largefile-sensitive, mpg123 built with off_t = 32 == long
|
|
Packit |
c32a2d |
libmpg123: mpg123_open
|
|
Packit |
c32a2d |
lfs_alias: mpg123_open_32 -> mpg123_open
|
|
Packit |
c32a2d |
lfs_wrap: <none>
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
So, this is still correct. Now, what about case 3? What does mpg123 do
|
|
Packit |
c32a2d |
currently, as of 1.15.4?
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
3a. largefile, long = 32, off_t = 64 (... and mpg123 not really aware of that)
|
|
Packit |
c32a2d |
libmpg123: mpg123_open
|
|
Packit |
c32a2d |
lfs_alias: mpg123_open_32(long) -> mpg123_open(off_t)
|
|
Packit |
c32a2d |
lfs_wrap: <none>
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
This is _wrong_. Luckily, this does not cause binary compatibility issues, as
|
|
Packit |
c32a2d |
mpg123_open_32 won't be called by anyone unless that someone tries to define
|
|
Packit |
c32a2d |
_FILE_OFFSET_BITS=32, which is nonsense. Perhaps old FreeBSD binaries before
|
|
Packit |
c32a2d |
LFS times? Well, back then, there was no libmpg123. So let's ignore that case.
|
|
Packit |
c32a2d |
The issue at hand is that the alias should be from mpg123_open_64 to
|
|
Packit |
c32a2d |
mpg123_open, for clients that insist on defining _FILE_OFFSET_BITS=64.
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
The change needed now is to fix the naming and also change the type the
|
|
Packit |
c32a2d |
alias functions use: It is not long int anymore!
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
Let's revisit case 1 for a moment: My old lfs_alias.c provides for the case
|
|
Packit |
c32a2d |
lfs_alias: mpg123_open -> mpg123_open_64. Is that actually possible?
|
|
Packit |
c32a2d |
What means enforcing _FILE_OFFSET_BITS=64 from the outside, which _could_
|
|
Packit |
c32a2d |
happen when libmpg123 is included someplace and folks are on the wrong side
|
|
Packit |
c32a2d |
of paranoid regarding this. So, there is
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
1a. 64 bit native system, long == off_t = 64 and _FILE_OFFSET_BITS=64
|
|
Packit |
c32a2d |
libmpg123: mpg123_open_64
|
|
Packit |
c32a2d |
lfs_alias: mpg123_open -> mpg123_open_64
|
|
Packit |
c32a2d |
lfs_wrap: <none>
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
(Works also for any system with long == off_t in any width)
|
|
Packit |
c32a2d |
Likewise, there is largefile-sensitive system with enforced 32 bits:
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
2b. largefile-sensitive, mpg123 with enforced _FILE_OFFSET_BITS=32
|
|
Packit |
c32a2d |
libmpg123: mpg123_open_32
|
|
Packit |
c32a2d |
lfs_alias: mpg123_open -> mpg123_open_32
|
|
Packit |
c32a2d |
lfs_wrap: <none>
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
All cases are supported with this significant change from 1.15.4:
|
|
Packit |
c32a2d |
Make the aliases use a defined lfs_alias_t, which can be long or off_t,
|
|
Packit |
c32a2d |
depending on what is the default type for offsets on the platform.
|
|
Packit |
c32a2d |
Folks who try _FILE_OFFSET_BITS=32 on a system that only supports
|
|
Packit |
c32a2d |
64 bit get a linking error during mpg123 build (from the _64 aliases),
|
|
Packit |
c32a2d |
which I consider to be a feature.
|
|
Packit |
c32a2d |
|
|
Packit |
c32a2d |
I salute anyone who is not confused after reading this.
|