1 /* libc/sys/linux/machine/i386/socketcall.h - x86 linux socket system calls */ 2 3 /* Copyright 2002, Red Hat Inc. */ 4 5 #ifndef _SOCKETCALL_H 6 7 #define _SOCKETCALL_H 8 9 #include <machine/weakalias.h> 10 #include <sys/errno.h> 11 #include <asm/unistd.h> 12 #include "sockops.h" 13 14 /* 15 * PIC uses %ebx, so we need to save it during system calls 16 */ 17 18 #define __sockcall_base(type, name) \ 19 { \ 20 long __res; \ 21 __asm__ volatile ("push %%ebx; movl %2,%%ebx; lea 8(%%ebp),%%ecx; int $0x80; pop %%ebx" \ 22 : "=a" (__res) \ 23 : "0" (__NR_socketcall),"r" (SOCK_##name)); \ 24 __syscall_return(type,__res); \ 25 } 26 27 #undef _sockcall1 28 #define _sockcall1(type,name,type1,arg1) \ 29 type __libc_##name(type1 arg1) \ 30 __sockcall_base(type,name) \ 31 weak_alias(__libc_##name,name) 32 33 #undef _sockcall2 34 #define _sockcall2(type,name,type1,arg1,type2,arg2) \ 35 type __libc_##name(type1 arg1, type2 arg2) \ 36 __sockcall_base(type,name) \ 37 weak_alias(__libc_##name,name) 38 39 #undef _sockcall3 40 #define _sockcall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ 41 type __libc_##name(type1 arg1, type2 arg2, type3 arg3) \ 42 __sockcall_base(type,name) \ 43 weak_alias(__libc_##name,name) 44 45 #undef _sockcall4 46 #define _sockcall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ 47 type __libc_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ 48 __sockcall_base(type,name) \ 49 weak_alias(__libc_##name,name) 50 51 #undef _sockcall5 52 #define _sockcall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ 53 type __libc_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ 54 __sockcall_base(type,name) \ 55 weak_alias(__libc_##name,name) 56 57 #undef _sockcall6 58 #define _sockcall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ 59 type __libc_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ 60 __sockcall_base(type,name) \ 61 weak_alias(__libc_##name,name) 62 63 #endif /* _SOCKETCALL_H */ 64