Welcome to mirror list, hosted at ThFree Co, Russian Federation.

socketcall.h « i386 « machine « linux « sys « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 07908767ffac3587a01b6ccd9a90e997f331a746 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* libc/sys/linux/machine/i386/socketcall.h - x86 linux socket system calls */

/* Copyright 2002, Red Hat Inc. */

#ifndef _SOCKETCALL_H

#define _SOCKETCALL_H 

#include <machine/weakalias.h>
#include <sys/errno.h>
#include <asm/unistd.h>
#include "sockops.h"

/*
 * PIC uses %ebx, so we need to save it during system calls
 */

#define __sockcall_base(type, name) \
{ \
long __res; \
__asm__ volatile ("push %%ebx; movl %2,%%ebx; lea 8(%%ebp),%%ecx; int $0x80; pop %%ebx" \
	: "=a" (__res) \
	: "0" (__NR_socketcall),"r" (SOCK_##name)); \
__syscall_return(type,__res); \
}

#undef _sockcall1
#define _sockcall1(type,name,type1,arg1) \
type __libc_##name(type1 arg1) \
__sockcall_base(type,name) \
weak_alias(__libc_##name,name)

#undef _sockcall2
#define _sockcall2(type,name,type1,arg1,type2,arg2) \
type __libc_##name(type1 arg1, type2 arg2) \
__sockcall_base(type,name) \
weak_alias(__libc_##name,name)

#undef _sockcall3
#define _sockcall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
type __libc_##name(type1 arg1, type2 arg2, type3 arg3) \
__sockcall_base(type,name) \
weak_alias(__libc_##name,name)

#undef _sockcall4
#define _sockcall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
type __libc_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
__sockcall_base(type,name) \
weak_alias(__libc_##name,name)

#undef _sockcall5
#define _sockcall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
type __libc_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
__sockcall_base(type,name) \
weak_alias(__libc_##name,name)

#undef _sockcall6
#define _sockcall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
type __libc_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
__sockcall_base(type,name) \
weak_alias(__libc_##name,name)

#endif /* _SOCKETCALL_H */