Commit 0ae38162 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Use the syscall function instead of inline assembly.

parent 91ecb05f
...@@ -98,38 +98,17 @@ struct inotify_event { ...@@ -98,38 +98,17 @@ struct inotify_event {
static inline int inotify_init( void ) static inline int inotify_init( void )
{ {
int ret; return syscall( SYS_inotify_init );
__asm__ __volatile__( "int $0x80"
: "=a" (ret)
: "0" (SYS_inotify_init));
if (ret<0) { errno = -ret; ret = -1; }
return ret;
} }
static inline int inotify_add_watch( int fd, const char *name, unsigned int mask ) static inline int inotify_add_watch( int fd, const char *name, unsigned int mask )
{ {
int ret; return syscall( SYS_inotify_add_watch, fd, name, mask );
__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;
} }
static inline int inotify_rm_watch( int fd, int wd ) static inline int inotify_rm_watch( int fd, int wd )
{ {
int ret; return syscall( SYS_inotify_rm_watch, fd, wd );
__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;
} }
#define USE_INOTIFY #define USE_INOTIFY
......
...@@ -127,38 +127,20 @@ struct epoll_event ...@@ -127,38 +127,20 @@ struct epoll_event
epoll_data_t data; 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 ) static inline int epoll_create( int size )
{ {
int ret; return syscall( 254 /*NR_epoll_create*/, size );
__asm__( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
: "=a" (ret) : "0" (254 /*NR_epoll_create*/), "r" (size) );
SYSCALL_RET(ret);
} }
static inline int epoll_ctl( int epfd, int op, int fd, const struct epoll_event *event ) static inline int epoll_ctl( int epfd, int op, int fd, const struct epoll_event *event )
{ {
int ret; return syscall( 255 /*NR_epoll_ctl*/, epfd, op, fd, event );
__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);
} }
static inline int epoll_wait( int epfd, struct epoll_event *events, int maxevents, int timeout ) static inline int epoll_wait( int epfd, struct epoll_event *events, int maxevents, int timeout )
{ {
int ret; return syscall( 256 /*NR_epoll_wait*/, epfd, events, maxevents, timeout );
__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);
} }
#undef SYSCALL_RET
#endif /* linux && __i386__ && HAVE_STDINT_H */ #endif /* linux && __i386__ && HAVE_STDINT_H */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment