OSDN Git Service

7c19739624d0f6d9a0a3b9e671d7ed190f40c826
[pf3gnuchains/sourceware.git] / newlib / libc / sys / linux / machine / i386 / socketcall.h
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 <sys/errno.h>
10 #include <asm/unistd.h>
11 #include "sockops.h"
12
13 /*
14  * PIC uses %ebx, so we need to save it during system calls
15  */
16
17 #define __sockcall_base(type, name) \
18 { \
19 long __res; \
20 __asm__ volatile ("push %%ebx; movl %2,%%ebx; lea 8(%%esp),%%ecx; int $0x80; pop %%ebx" \
21         : "=a" (__res) \
22         : "0" (__NR_socketcall),"r" (SOCK_##name)); \
23 __syscall_return(type,__res); \
24 }
25
26 #undef _sockcall1
27 #define _sockcall1(type,name,type1,arg1) \
28 type name(type1 arg1) \
29 __sockcall_base(type,name)
30
31 #undef _sockcall2
32 #define _sockcall2(type,name,type1,arg1,type2,arg2) \
33 type name(type1 arg1, type2 arg2) \
34 __sockcall_base(type,name)
35
36 #undef _sockcall3
37 #define _sockcall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
38 type name(type1 arg1, type2 arg2, type3 arg3) \
39 __sockcall_base(type,name)
40
41 #undef _sockcall4
42 #define _sockcall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
43 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
44 __sockcall_base(type,name)
45
46 #undef _sockcall5
47 #define _sockcall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
48 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
49 __sockcall_base(type,name)
50
51 #undef _sockcall6
52 #define _sockcall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
53 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
54 __sockcall_base(type,name)
55
56 #endif /* _SOCKETCALL_H */