This is under -current.  I don't know when it started, but I think whatever
    change is causing this was in the last week or two.

    This isn't a 'bug', per say, but it bothers me that a small 128 byte
    write() is being somehow broken apart into two smaller read()s.  It isn't
    efficient, and it shouldn't be happening.

                                        -Matt
                                        Matthew Dillon 
                                        <dil...@backplane.com>

apollo:/home/dillon> ./x
read 96
read 32

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>             /* unix domain sockets  */
#include <netinet/in.h>         /* internet sockets     */
#include <netinet/tcp.h>        /* TCP_NODELAY sockopt  */
#include <stdio.h>
#include <fcntl.h>

int
main(int ac, char **av)
{
    int fds[2];
    int n;
    char buf[128];
    fd_set rfds;

    if (socketpair(PF_UNIX, SOCK_STREAM, IPPROTO_IP, fds) < 0)
        perror("socketpair");
    fcntl(fds[0], F_SETFL, O_NONBLOCK);
    FD_ZERO(&rfds);
    FD_SET(fds[0], &rfds);
    if (fork() == 0) {
        sleep(1);
        write(fds[1], buf, sizeof(buf));
        _exit(1);
    }
    select(fds[0] + 1, &rfds, NULL, NULL, NULL);
    while ((n = read(fds[0], buf, sizeof(buf))) > 0)
        printf("read %d\n", n);
    return(0);
}



To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message

Reply via email to