[PATCH v3 01/13] loader: Use long instead of int for syscall return type in i386 code.

Jinoh Kang jinoh.kang.kr at gmail.com
Tue Jan 25 09:23:22 CST 2022


Although int = long effectively in i386, this makes it clear that a
machine word-width value is being returned.

Also, future patches adding syscalls returning pointers can use the same
type (long) for return value consistently.

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---

Notes:
    v1 -> v2: don't change SYSCALL_RET().

 loader/preloader.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/loader/preloader.c b/loader/preloader.c
index 585be50624f..937843eb9c5 100644
--- a/loader/preloader.c
+++ b/loader/preloader.c
@@ -247,7 +247,7 @@ static inline __attribute__((noreturn)) void wld_exit( int code )
 
 static inline int wld_open( const char *name, int flags )
 {
-    int ret;
+    long ret;
     __asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
                           : "=a" (ret) : "0" (5 /* SYS_open */), "r" (name), "c" (flags) );
     return SYSCALL_RET(ret);
@@ -255,7 +255,7 @@ static inline int wld_open( const char *name, int flags )
 
 static inline int wld_close( int fd )
 {
-    int ret;
+    long ret;
     __asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
                           : "=a" (ret) : "0" (6 /* SYS_close */), "r" (fd) );
     return SYSCALL_RET(ret);
@@ -263,7 +263,7 @@ static inline int wld_close( int fd )
 
 static inline ssize_t wld_read( int fd, void *buffer, size_t len )
 {
-    int ret;
+    long ret;
     __asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
                           : "=a" (ret)
                           : "0" (3 /* SYS_read */), "r" (fd), "c" (buffer), "d" (len)
@@ -273,7 +273,7 @@ static inline ssize_t wld_read( int fd, void *buffer, size_t len )
 
 static inline ssize_t wld_write( int fd, const void *buffer, size_t len )
 {
-    int ret;
+    long ret;
     __asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
                           : "=a" (ret) : "0" (4 /* SYS_write */), "r" (fd), "c" (buffer), "d" (len) );
     return SYSCALL_RET(ret);
@@ -281,7 +281,7 @@ static inline ssize_t wld_write( int fd, const void *buffer, size_t len )
 
 static inline int wld_mprotect( const void *addr, size_t len, int prot )
 {
-    int ret;
+    long ret;
     __asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
                           : "=a" (ret) : "0" (125 /* SYS_mprotect */), "r" (addr), "c" (len), "d" (prot) );
     return SYSCALL_RET(ret);
@@ -328,7 +328,7 @@ __ASM_GLOBAL_FUNC(wld_mmap,
 
 static inline int wld_prctl( int code, long arg )
 {
-    int ret;
+    long ret;
     __asm__ __volatile__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
                           : "=a" (ret) : "0" (172 /* SYS_prctl */), "r" (code), "c" (arg) );
     return SYSCALL_RET(ret);
-- 
2.31.1




More information about the wine-devel mailing list