Module: wine Branch: master Commit: 0ae38162640084c432c92397c76a2c38dbd257ed URL: http://source.winehq.org/git/wine.git/?a=commit;h=0ae38162640084c432c92397c7...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Dec 23 16:10:12 2010 +0100
server: Use the syscall function instead of inline assembly.
---
server/change.c | 27 +++------------------------ server/fd.c | 24 +++--------------------- 2 files changed, 6 insertions(+), 45 deletions(-)
diff --git a/server/change.c b/server/change.c index 2bdc444..5eb1df6 100644 --- a/server/change.c +++ b/server/change.c @@ -98,38 +98,17 @@ struct inotify_event {
static inline int inotify_init( void ) { - int ret; - __asm__ __volatile__( "int $0x80" - : "=a" (ret) - : "0" (SYS_inotify_init)); - if (ret<0) { errno = -ret; ret = -1; } - return ret; + return syscall( SYS_inotify_init ); }
static inline int inotify_add_watch( int fd, const char *name, unsigned int mask ) { - int ret; - __asm__ __volatile__( "pushl %%ebx;\n\t" - "movl %2,%%ebx;\n\t" - "int $0x80;\n\t" - "popl %%ebx" - : "=a" (ret) : "0" (SYS_inotify_add_watch), - "r" (fd), "c" (name), "d" (mask) ); - if (ret<0) { errno = -ret; ret = -1; } - return ret; + return syscall( SYS_inotify_add_watch, fd, name, mask ); }
static inline int inotify_rm_watch( int fd, int wd ) { - int ret; - __asm__ __volatile__( "pushl %%ebx;\n\t" - "movl %2,%%ebx;\n\t" - "int $0x80;\n\t" - "popl %%ebx" - : "=a" (ret) : "0" (SYS_inotify_rm_watch), - "r" (fd), "c" (wd) ); - if (ret<0) { errno = -ret; ret = -1; } - return ret; + return syscall( SYS_inotify_rm_watch, fd, wd ); }
#define USE_INOTIFY diff --git a/server/fd.c b/server/fd.c index bc1d853..e0ec708 100644 --- a/server/fd.c +++ b/server/fd.c @@ -127,38 +127,20 @@ struct epoll_event epoll_data_t data; };
-#define SYSCALL_RET(ret) do { \ - if (ret < 0) { errno = -ret; ret = -1; } \ - return ret; \ - } while(0) - static inline int epoll_create( int size ) { - int ret; - __asm__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx" - : "=a" (ret) : "0" (254 /*NR_epoll_create*/), "r" (size) ); - SYSCALL_RET(ret); + return syscall( 254 /*NR_epoll_create*/, size ); }
static inline int epoll_ctl( int epfd, int op, int fd, const struct epoll_event *event ) { - int ret; - __asm__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx" - : "=a" (ret) - : "0" (255 /*NR_epoll_ctl*/), "r" (epfd), "c" (op), "d" (fd), "S" (event), "m" (*event) ); - SYSCALL_RET(ret); + return syscall( 255 /*NR_epoll_ctl*/, epfd, op, fd, event ); }
static inline int epoll_wait( int epfd, struct epoll_event *events, int maxevents, int timeout ) { - int ret; - __asm__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx" - : "=a" (ret) - : "0" (256 /*NR_epoll_wait*/), "r" (epfd), "c" (events), "d" (maxevents), "S" (timeout) - : "memory" ); - SYSCALL_RET(ret); + return syscall( 256 /*NR_epoll_wait*/, epfd, events, maxevents, timeout ); } -#undef SYSCALL_RET
#endif /* linux && __i386__ && HAVE_STDINT_H */