This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: where is the system call code


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]