Re: recv(2), MSG_TRUNK and kernels older than 2.6.22

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Tuesday, July 20, 2010 - 1:54 am

Le mardi 20 juillet 2010 à 09:26 +0100, Roy Marples a écrit :

Is it for the dhcpcd problem we talk about few week ago, disturbed by
new 64bit stats ?

Why do you want to have a fixed size of 256 bytes ?

Using 8192 bytes on stack would avoid MSG_TRUNK mess.

static int
get_netlink(int fd, int flags,
    int (*callback)(struct nlmsghdr *))
{
        char buffer[8192];
        ssize_t bytes;
        struct nlmsghdr *nlm;
        int r = -1;

        for (;;) {
                bytes = recv(fd, buffer, sizeof(buffer), flags);
                if (bytes == -1) {
                        if (errno == EAGAIN) {
                                r = 0;
                                goto eexit;
                        }
                        if (errno == EINTR)
                                continue;
                        goto eexit;
                }




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
recv(2), MSG_TRUNK and kernels older than 2.6.22, Roy Marples, (Tue Jul 20, 1:26 am)
Re: recv(2), MSG_TRUNK and kernels older than 2.6.22, Eric Dumazet, (Tue Jul 20, 1:54 am)
Re: recv(2), MSG_TRUNK and kernels older than 2.6.22, Roy Marples, (Tue Jul 20, 2:08 am)
Re: recv(2), MSG_TRUNK and kernels older than 2.6.22, Eric Dumazet, (Tue Jul 20, 2:24 am)
Re: recv(2), MSG_TRUNK and kernels older than 2.6.22, Eric Dumazet, (Tue Jul 20, 3:02 am)
Re: recv(2), MSG_TRUNK and kernels older than 2.6.22, Roy Marples, (Tue Jul 20, 3:04 am)