[Vm-dev] latest sources removal platforms/unix/vm/sunos.h
stes@PANDORA.BE
stes at telenet.be
Sun Nov 8 10:00:58 UTC 2020
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
In the past there was a rather odd definition in:
platforms/unix/vm/sqPlatformSpecific.h
#ifndef __sun__
#define ftell(s) ftello(s)
#define fseek(s,o,w) fseeko(s,o,w)
#endif /* __sun__ */
I don't know what the reasoning behind that was.
I would prudently say that it looks suspicious to have such special cases,
in the source code (the presence of those __sun__ or sunos.h header file,
is perhaps going back to old work in porting or developing squeak on SunOS).
These functions ftell and ftello are:
long ftell(FILE *stream);
off_t ftello(FILE *stream);
where off_t is the type that is intended for 64bit file offsets I think.
Also there exists a lseek64() function.
I have no idea whether this is correct, but if I change:
- --- a/platforms/unix/vm/sqImageFileAccess.h
+++ b/platforms/unix/vm/sqImageFileAccess.h
@@ -108,7 +108,7 @@ sqImageFileWrite(void *ptr_arg, size_t sz, size_t count, sqImageFile f)
static inline off_t
sqImageFilePosition(sqImageFile f)
{
- - off_t pos = lseek(f, 0, SEEK_CUR);
+ off_t pos = lseek64(f, 0, SEEK_CUR);
if (pos == (off_t)-1)
perror("sqImageFilePosition lseek");
return pos;
@@ -117,14 +117,14 @@ sqImageFilePosition(sqImageFile f)
static inline void
sqImageFileSeek(sqImageFile f,off_t pos)
{
- - if (lseek(f, pos, SEEK_SET) < 0)
+ if (lseek64(f, pos, SEEK_SET) < 0)
perror("sqImageFileSeek lseek");
}
static inline void
sqImageFileSeekEnd(sqImageFile f,off_t pos)
{
- - if (lseek(f, pos, SEEK_END) < 0)
+ if (lseek64(f, pos, SEEK_END) < 0)
perror("sqImageFileSeekEnd lseek");
}
Then the VM compiles in 32bit mode (as before) but now it succesfully loads
a 32bit VM image.
I'll have to think about this.
Maybe some "configure" script patch would be needed.
The old way to #undef lseek and so on seems ugly to me, personally.
(So I'm not unhappy about the cleanup that was done ...)
By the way, as I said before the 64bit VM on SunOS was and still is OK;
it is just after the recent change that the 32bit VM has this issue.
Regards,
David Stes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBCAAGBQJfp8FtAAoJEAwpOKXMq1MaVVYH/1Bz8MFEBs30KqfuFGk/oqjb
FNemHin321i/Elz0YZ04qn6Ch/1dV8PeotNPa1ZBZVczE6p9wBAJoSo9C/8uj83A
J+t2XwntLisUDgbEDb7Bo1Im8HlDn0ttuk4EHDMfhdHbXyF6F7XxSbT/T1H2UnAH
WH+qlaJUvqymTPJWUaDydlWR9AzJMk/wuXOzYqf5g1s/fWmD87U5OO3h5jhe2FcY
KAXdTc3Xeufy4kvAUmEnmVePE271oCIqEiQ1I+tcmwo92q1AUpzt3WJ3uPFp38/o
4GzMZIaKRyr1ddawM1L1R2zgV8XCM9iy/KVN+Mad2TyGv74GQokscGXuhcbZi28=
=WdhW
-----END PGP SIGNATURE-----
More information about the Vm-dev
mailing list