From owner-freebsd-current Sun Feb 14 12:08:17 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA02874 for freebsd-current-outgoing; Sun, 14 Feb 1999 12:08:17 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id MAA02869 for ; Sun, 14 Feb 1999 12:08:16 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id MAA07550; Sun, 14 Feb 1999 12:08:16 -0800 (PST) (envelope-from dillon) Date: Sun, 14 Feb 1999 12:08:16 -0800 (PST) From: Matthew Dillon Message-Id: <199902142008.MAA07550@apollo.backplane.com> To: freebsd-current@FreeBSD.ORG Subject: Weird piecemeal reads over socketpair() pipe breaks up small writes into even smaller reads. Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 apollo:/home/dillon> ./x read 96 read 32 #include #include #include /* unix domain sockets */ #include /* internet sockets */ #include /* TCP_NODELAY sockopt */ #include #include 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 majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message