|
Message-ID: <20110816130350.GF26140@barfooze.de> Date: Tue, 16 Aug 2011 15:03:50 +0200 From: Moritz Wilhelmy <ml+musl@...f.de> To: musl@...ts.openwall.com Subject: Re: Anti-bloat side project Hello, While debugging mlmmj, my mailing list manager of choice, I noted that it calls read(2) really, really often, in order to read a single byte out of a fd, and then read the next byte, like this: open("/var/spool/mlmmj/foo/control/listaddress", O_RDONLY) = 4 read(4, "f", 1) = 1 read(4, "o", 1) = 1 read(4, "o", 1) = 1 read(4, "@", 1) = 1 read(4, "l", 1) = 1 read(4, "i", 1) = 1 read(4, "s", 1) = 1 read(4, "t", 1) = 1 read(4, "s", 1) = 1 read(4, ".", 1) = 1 read(4, "e", 1) = 1 read(4, "x", 1) = 1 read(4, "a", 1) = 1 read(4, "m", 1) = 1 read(4, "p", 1) = 1 read(4, "l", 1) = 1 read(4, "e", 1) = 1 read(4, ".", 1) = 1 read(4, "c", 1) = 1 read(4, "o", 1) = 1 read(4, "m", 1) = 1 read(4, "\n", 1) = 1 close(4) = 0 It does this for every file it touches as well as network connections it reads from. I don't know yet, how and why exactly it does it this way, but it seems rather insane to me, so I think it might need some patches in order to clean it up. It turned out that attempting to subscribe someone to a mailing list used 794 read(x, y, 1) style syscalls. I don't think I want to know how often it calls read() in order to post a message to all members of the list. Maybe this could be solved by using getline(3) instead, which is in POSIX.1-2008 and implemented on current versions of at least glibc, FreeBSD, NetBSD and of course musl. I will contact the mlmmj developers and try to resolve the issue. Solar, maybe you should still wait a bit before switching openwall over to mlmmj ;) Best, Moritz
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.