uclibc-0.9.30 - ppoll returns invalid argument

Ursus ursus at pajkc.eu
Wed Jan 28 15:03:18 UTC 2009


Hello

I'm using buildroot-avr32-2.3.0 (board ATNGW100) based on uclibc-0.9.30 
and linux-2.6.27.6. I've been trying  to use function ppoll along with 
the following example:
int main(int argc, char* argv[])
{
    const nfds_t count = 1;
    struct pollfd fds[1];
    const int STDIN = 0;
    fds[0].fd = STDIN;
    fds[0].events = POLLIN;

    sigset_t sigmask;
    sigemptyset(&sigmask);

    struct timespec timeout;
    timeout.tv_sec = 5;
    timeout.tv_nsec = 0;

    const int poll_return = ppoll(fds, count, &timeout, &sigmask);
    return 0;
}

But when I ran the example strace returned:
...
ppoll([{fd=0, events=POLLIN}], 1, {5, 0}, [], 2144239476) = -1 EINVAL 
(Invalid argument)
...

In the uclibc sources I found that uclibc calls kernel ppoll with four 
arguments:
_syscall4(int, __libc_ppoll, struct pollfd *, fds,
        nfds_t, nfds, const struct timespec *, timeout,
        const __sigset_t *, sigmask)

But the kernel ppoll (sys_ppoll) declaration specifies five parameters:
long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
        struct timespec __user *tsp, const sigset_t __user *sigmask,
        size_t sigsetsize)


I substituted the ordinary ppoll call with indirect call to see if above 
is true.
syscall(SYS_ppoll, fds, count, &timeout, &sigmask, sizeof(sigset_t));
Strace returned:
...
ppoll([{fd=0, events=POLLIN}], 1, {5, 0}, [], 128) = -1 EINVAL (Invalid 
argument)
...

I made a little research and figured out that the kernel expects last 
argument to be 16 (128 / 8). That confused me because I thought the 
sizeof(sigset_t) returns the same in kernel and user space.

Thanks,
Ursus


More information about the uClibc mailing list