diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2024-10-09 16:01:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-09 10:01:26 +0200 |
| commit | b760c21414cddd00e3c122bce957321b1a065226 (patch) | |
| tree | 82af5d84b2617776fb74087ab24b53d1686021e5 /src | |
| parent | bb651298c4a42adc2912c95acc5d34075a8b8443 (diff) | |
| download | box64-b760c21414cddd00e3c122bce957321b1a065226.tar.gz box64-b760c21414cddd00e3c122bce957321b1a065226.zip | |
[BOX32] Fixed fcntl flock macros definitions (#1915)
Diffstat (limited to 'src')
| -rwxr-xr-x | src/wrapped32/wrappedlibc.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index 5a829510..609a660a 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -107,6 +107,13 @@ #undef nftw #undef glob +#define MY32_F_GETLK 5 +#define MY32_F_SETLK 6 +#define MY32_F_SETLKW 7 +#define MY32_F_GETLK64 12 +#define MY32_F_SETLK64 13 +#define MY32_F_SETLKW64 14 + #define LIBNAME libc static const char* libcName = @@ -2118,16 +2125,14 @@ EXPORT int32_t my32_fcntl64(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, ui if(!lib) return 0; if(b==F_SETFL) d1 = of_convert32(d1); - if(b==F_GETLK64 || b==F_SETLK64 || b==F_SETLKW64) - { + if (b == MY32_F_GETLK64 || b == MY32_F_SETLK64 || b == MY32_F_SETLKW64) { my_flock64_t fl = {0}; AlignFlock64_32(&fl, from_ptrv(d1)); - int ret = fcntl(a, b, &fl); + int ret = fcntl(a, b - (MY32_F_GETLK64 - MY32_F_GETLK), &fl); UnalignFlock64_32(from_ptrv(d1), &fl); return ret; } - if(b==F_GETLK || b==F_SETLK || b==F_SETLKW) - { + if (b == MY32_F_GETLK || b == MY32_F_SETLK || b == MY32_F_SETLKW) { struct flock fl = {0}; AlignFlock_32(&fl, from_ptrv(d1)); int ret = fcntl(a, b, &fl); @@ -2157,16 +2162,14 @@ EXPORT int32_t my32_fcntl(x64emu_t* emu, int32_t a, int32_t b, uint32_t d1, uint } if(b==F_SETFL) d1 = of_convert32(d1); - if(b==F_GETLK64 || b==F_SETLK64 || b==F_SETLKW64) - { + if (b == MY32_F_GETLK64 || b == MY32_F_SETLK64 || b == MY32_F_SETLKW64) { my_flock64_t fl = {0}; AlignFlock64_32(&fl, from_ptrv(d1)); - int ret = fcntl(a, b, &fl); + int ret = fcntl(a, b - (MY32_F_GETLK64 - MY32_F_GETLK), &fl); UnalignFlock64_32(from_ptrv(d1), &fl); return ret; } - if(b==F_GETLK || b==F_SETLK || b==F_SETLKW) - { + if (b == MY32_F_GETLK || b == MY32_F_SETLK || b == MY32_F_SETLKW) { struct flock fl = {0}; AlignFlock_32(&fl, from_ptrv(d1)); int ret = fcntl(a, b, &fl); |