This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: where is the system call code
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.
Thanks. It is more clear now, even though I did not find the
"sysdeps/unix/syscall-template.S" file. I read this -
http://www.gnu.org/software/libc/manual/html_node/Porting.html, but I
guess it is obsolete as it does not mention the ports directory at
all.
>
> Thanks.
>
>