where is the system call code

Sasha Sirotkin demiurg@femtolinux.com
Sat May 1 11:09:00 GMT 2010

On Fri, Apr 30, 2010 at 5:34 AM, Amerigo Wang <xiyou.wangcong@gmail.com> wrote:
> On Thu, Apr 29, 2010 at 09:33:27PM +0300, Sasha Sirotkin wrote:
>>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:
>>__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.

I should have probably found it myself, but I think that after I spent
a few hours digging through the code it is OK to ask this on the
mailing list - how can one add an architecture-specfic system call C
implementation, for instance something like
ports/sysdeps/unix/sysv/linux/mips/mips64/recv.c for ARM ?

Thanks a lot.

> Thanks.

More information about the Libc-help mailing list