where is the system call code

Amerigo Wang xiyou.wangcong@gmail.com
Fri Apr 30 02:30:00 GMT 2010


On Thu, Apr 29, 2010 at 09:33:27PM +0300, Sasha Sirotkin wrote:
>Hi.
>
>I'm trying to understand how system calls are implemented in glibc.
>For instance, I tried to find the recv() implementation, but only
>found this:
>ssize_t
>__recv (fd, buf, n, flags)
>     int fd;
>     void *buf;
>     size_t n;
>     int flags;
>{
>  __set_errno (ENOSYS);
>  return -1;INLINE_SYSCALL
>}
>weak_alias (__recv, recv)
>
>Where is the actual recv code, the code that calls INLINE_SYSCALL
>

No, this is just a weak alias for recv(2), which means if there
is no actual definition on this arch, it will use this one. So
you are not interested in this one.

The real definition of recv(2) you want is actually generated
by a script, i.e. sysdeps/unix/make-syscalls.sh, every syscall
that are generated by this script has a template, i.e.
sysdeps/unix/syscall-template.S. Also, there are some lists
of these syscalls, you can find the one which contains recv(2)
in sysdeps/unix/inet/syscalls.list.

Thanks.



More information about the Libc-help mailing list