1、系统调用:Linux下用户程序是通过系统调用来从用户态到内核态,调用内核功能来完成相应的服务。网络栈的一些功能是通过系统调用sys_socketcall来完成的具体的代码在net/socket.c中,该文件中的函数就相当于一个桥梁,在系统调用和内核网络栈之间。[cpp] viewplaincopyprint?1./* 2. * System call vectors. Since I (RIB) want to rewrite sockets as streams, 3. * we have this level of indirection. Not a lot of overhead
2、, since more of 4. * the work is done via read/write/select directly. 5. * 6. * I'm now expanding this up to a higher level to separate the assorted 7. * kernel/user space manipulations and global assumptions from the protocol 8. * layers proper - AC. 9. */ 10. 11.asmlinkage int sys_socketcal
3、l(int call, unsigned long *args) 12.{ 13. int er; 14. switch(call) 15. { 16. case SYS_SOCKET: 17. er=verify_area(VERIFY_READ, args, 3 * sizeof(long)); 18. if(er) 19. return er; 20. return(sock_socket(get_fs_long(args+0), 21.