epoll_create wrapper function is not used

Dmitry V. Levin ldv at altlinux.org
Wed Jul 8 10:20:41 UTC 2020


On Sun, Jul 05, 2020 at 08:47:40AM +0530, Bran S wrote:
> On Tue, 30 Jun 2020 at 22:13, Dmitry V. Levin wrote:
> > On Sun, Jun 28, 2020 at 10:24:23PM +0530, Bran S wrote:
> > > In tests/epoll_create.c:
> > >     const long int size = (long int) 0xdeadbeefffffffffULL;
> > >     long rc = syscall(__NR_epoll_create, size);
> > >
> > > Why syscall(__NR_epoll_create) is used when a wrapper function is
> > > available for it in #include <sys/epoll.h>? Are they different in some
> > > way? What is the reason for not using the wrapper?
> > >
> > > In manpage of epoll_create there is a line:
> > > "Library support is provided in glibc starting with version 2.3.2."
> > > Is this the reason? So that machines with glibc 2.3.2 can also use this?
> >
> > epoll_create is a syscall obsoleted by epoll_create1, so some libc (e.g.
> > musl) implement epoll_create function using epoll_create1 syscall.
> 
> But epoll_create1 is also tested the same way by using
> `syscall(__NR_epoll_create1)`
> Why not use the epoll_create1 wrapper?

epoll_create1 syscall was added in Linux 2.6.27, libc wrapper was added
in glibc 2.9.  I suppose it was easier to invoke the syscall directly
rather than deal with portability issues.

Another case when direct syscall invocation is preferable: test decoding
of 32-bit syscall arguments (e.g. file descriptors) on 64-bit systems.


-- 
ldv


More information about the Strace-devel mailing list