diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-04 16:58:05 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-04 16:58:05 +0100 |
| commit | 9165ec875a36b2d146b7749f8da9bc14f3bb635b (patch) | |
| tree | ca4ba6d04d55456e432e92b1b8cd7f9ac2897bd9 /src | |
| parent | 6a7997b41eccd62c9743b52e80033a586aebd006 (diff) | |
| download | box64-9165ec875a36b2d146b7749f8da9bc14f3bb635b.tar.gz box64-9165ec875a36b2d146b7749f8da9bc14f3bb635b.zip | |
[BOX32] Some fixes to a few file related 32bits wrapped function (now windows gog installer can be used with box32 and wine)
Diffstat (limited to 'src')
| -rwxr-xr-x | src/include/myalign32.h | 12 | ||||
| -rwxr-xr-x | src/libtools/myalign64_32.c | 30 | ||||
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibctypes32.h | 2 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc.c | 22 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 4 |
6 files changed, 47 insertions, 25 deletions
diff --git a/src/include/myalign32.h b/src/include/myalign32.h index b7d49cbd..3f4ae6a5 100755 --- a/src/include/myalign32.h +++ b/src/include/myalign32.h @@ -153,18 +153,18 @@ struct i386_statfs { }; struct i386_statfs64 { - uint32_t f_type; - uint32_t f_bsize; + long_t f_type; + long_t f_bsize; uint64_t f_blocks; uint64_t f_bfree; uint64_t f_bavail; uint64_t f_files; uint64_t f_ffree; struct i386_fsid f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + long_t f_namelen; + long_t f_frsize; + long_t f_flags; + long_t f_spare[4]; }; struct i386_statvfs64 { diff --git a/src/libtools/myalign64_32.c b/src/libtools/myalign64_32.c index 326dc373..30592aa7 100755 --- a/src/libtools/myalign64_32.c +++ b/src/libtools/myalign64_32.c @@ -43,18 +43,18 @@ struct native_fsid { }; struct native_statfs64 { - uint32_t f_type; - uint32_t f_bsize; + long f_type; + long f_bsize; uint64_t f_blocks; uint64_t f_bfree; uint64_t f_bavail; uint64_t f_files; uint64_t f_ffree; struct native_fsid f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + long f_namelen; + long f_frsize; + long f_flags; + long f_spare[4]; }; // f_flags is not always defined, but then f_spare is [5] in that case void UnalignStatFS64_32(const void* source, void* dest) @@ -62,21 +62,21 @@ void UnalignStatFS64_32(const void* source, void* dest) struct i386_statfs64 *i386st = (struct i386_statfs64*)dest; struct native_statfs64 *st = (struct native_statfs64*) source; - i386st->f_type = st->f_type; - i386st->f_bsize = st->f_bsize; + i386st->f_type = to_long(st->f_type); + i386st->f_bsize = to_long(st->f_bsize); i386st->f_blocks = st->f_blocks; i386st->f_bfree = st->f_bfree; i386st->f_bavail = st->f_bavail; i386st->f_files = st->f_files; i386st->f_ffree = st->f_ffree; memcpy(&i386st->f_fsid, &st->f_fsid, sizeof(i386st->f_fsid)); - i386st->f_namelen = st->f_namelen; - i386st->f_frsize = st->f_frsize; - i386st->f_flags = st->f_flags; - i386st->f_spare[0] = st->f_spare[0]; - i386st->f_spare[1] = st->f_spare[1]; - i386st->f_spare[2] = st->f_spare[2]; - i386st->f_spare[3] = st->f_spare[3]; + i386st->f_namelen = to_long(st->f_namelen); + i386st->f_frsize = to_long(st->f_frsize); + i386st->f_flags = to_long(st->f_flags); + i386st->f_spare[0] = to_long(st->f_spare[0]); + i386st->f_spare[1] = to_long(st->f_spare[1]); + i386st->f_spare[2] = to_long(st->f_spare[2]); + i386st->f_spare[3] = to_long(st->f_spare[3]); } void UnalignStatFS_32(const void* source, void* dest) diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index d72fbf5f..d62e1a1e 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -1814,6 +1814,8 @@ wrappedlibc: - vEpu: - vEpp: - iEip: + - fstatvfs + - fstatvfs64 - futimens - futimes - iEup: diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h index aa0683f0..98426e51 100644 --- a/src/wrapped32/generated/wrappedlibctypes32.h +++ b/src/wrapped32/generated/wrappedlibctypes32.h @@ -160,6 +160,8 @@ typedef int32_t (*iEpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void GO(ctime, pErl__t) \ GO(asctime, pEriiiiiiiiilt__t) \ GO(_obstack_newchunk, vEpi_t) \ + GO(fstatvfs, iEip_t) \ + GO(fstatvfs64, iEip_t) \ GO(futimens, iEip_t) \ GO(futimes, iEip_t) \ GO(getrlimit, iEup_t) \ diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index 5e9ccfe9..e5fa0d71 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -457,7 +457,7 @@ EXPORT int my32_statvfs64(x64emu_t* emu, void* f, void* r) { struct statvfs s = {0}; int ret = statvfs(f, &s); - if(r) + if(r>=0) UnalignStatVFS64_32(&s, r); return ret; } @@ -466,7 +466,25 @@ EXPORT int my32_statvfs(x64emu_t* emu, void* f, void* r) { struct statvfs s = {0}; int ret = statvfs(f, &s); - if(r) + if(r>=0) + UnalignStatVFS_32(&s, r); + return ret; +} + +EXPORT int my32_fstatvfs64(x64emu_t* emu, int fd, void* r) +{ + struct statvfs s = {0}; + int ret = fstatvfs(fd, &s); + if(r>=0) + UnalignStatVFS64_32(&s, r); + return ret; +} + +EXPORT int my32_fstatvfs(x64emu_t* emu, int fd, void* r) +{ + struct statvfs s = {0}; + int ret = fstatvfs(fd, &s); + if(r>=0) UnalignStatVFS_32(&s, r); return ret; } diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 3e9dd212..5c904598 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -419,8 +419,8 @@ GO(__fsetlocking, iESi) GO(fsetxattr, iEippLi) GOWM(fstatfs, iEip) //%%,noE GOWM(fstatfs64, iEip) //%%,noE -//GO(fstatvfs, iEip) -GOW(fstatvfs64, iEip) // alignment? +GOM(fstatvfs, iEEip) +GOWM(fstatvfs64, iEEip) GOW(fsync, iEi) GOWM(ftell, lEES) GO(ftello, lES) |