日期:2014-05-16 浏览次数:21037 次
?
一、socket()库函数到系统调用,再到内核
movl $SYS_ify(socketcall), %eax /* System call number in %eax. */
/* Use ## so `socket' is a separate token that might be #define'd. */
movl $P(SOCKOP_,socket), %ebx /* Subcode is first arg to syscall. */
lea 4(%esp), %ecx /* Address of args is 2nd arg. */
/* Do the system call trap. */
ENTER_KERNEL
这里,#define SYS_ify(syscall_name) __NR_##syscall_name;P宏定义为:glibc-2.3.6/sysdept/unix/sysv/linux/i386/socket.S
#define P(a, b) P2(a, b) #define P2(a, b) a##b其中,##为连接符号;
#define __NR_socketcall 102