This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: where is the system call code
- From: Sasha Sirotkin <demiurg at femtolinux dot com>
- To: Amerigo Wang <xiyou dot wangcong at gmail dot com>
- Cc: libc-help at sourceware dot org
- Date: Sat, 1 May 2010 14:08:51 +0300
- Subject: Re: where is the system call code
- References: <j2t478c82f01004291133m920d2342kc91d060f8c4be837@mail.gmail.com> <20100430023403.GA3989@cr0.nay.redhat.com>
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:
>>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.
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.
>
>