asmlinkage long sys_socketcall(int call, unsigned long _user *args)
unsigned long a; unsigned long a0,a1; int err;
err = sys_socket(a0,a1,a); break; case SYS_BIND:
err = sys_bind(a0,(struct sockaddr _user *)a1, a);
break; case SYS_CONNECT:
err = sys_connect(a0, (struct sockaddr _user *)a1, a);
break; case SYS_LISTEN:
err = sys_recvmsg(a0, (struct msghdr _user *) a1, a);
Formally, only one void pointer is passed because the number of system call arguments varies according to the multiplexing constant. The first task is therefore to determine the required number of arguments and to fill the individual elements of the a array (this involves manipulating pointers and arrays and is not discussed here). The call parameter is then referenced to decide which kernel function will be responsible for further processing.
Regardless of their complexity, all handler functions have one thing in common. Each function declaration includes the additional (asmlinkage) qualifier, which is not a standard element of C syntax. asmlinkage is an assembler macro defined in <linkage.h>. What is its purpose? For most platforms, the answer is very simple — it does nothing at all!
However, the macro is used in conjunction with the GCC enhancement (_attribute_) discussed in Appendix C on IA-32 and IA-64 systems only in order to inform the compiler of the special calling conventions for the function (examined in the next section).
Continue reading here: Dispatching and Parameter Passing
Was this article helpful?