From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io0-f177.google.com ([209.85.223.177]) by ur; Sun Aug 23 19:52:22 EDT 2015 Received: by iodt126 with SMTP id t126so131586953iod.2 for <9front@9front.org>; Sun, 23 Aug 2015 16:51:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version :content-transfer-encoding:subject:message-id:in-reply-to:references :user-agent:date:from:to; bh=yRAKhyMuvwwx4D9SunSZO/M8w4Dn7mbaXcXi58+E3hQ=; b=jiHpqJ1w4KyEGN9VOwexrcP28/B7NQXbzWuXB5ONwUoeaVDsF4Ot1D7HJUtLhA/KCM yNLwjBqHBWU2grkvcvkQyEYWqNol8awhUiL3CP83VxXmfcY3FHsihhT77DlUWiYzKqUx +EbWEa5RL/HdLRuXpq+8DwGZl52Nx7rTPHuvRfRj70jT++LxEliuW14dAvn/3q1FG6Ar CFSYRlrBBY8UBLrwTj8oUG6mLdg0RuiwEix0aK7wG9mVmZupXHL38rkCA1PQnKYpcBcK YNmxYsMqf8T//knBraWpJgfMV97yAXdFgWPK0DRDuDGdNMw/xDMiHq0IrxOukCSPebcV tUrw== X-Gm-Message-State: ALoCoQlbJmryfaEmrrn/D05y6w9QAShzxgg+tbAxCOO+lyTxlBVb0H+G42kliYaY2exv2u0oiUmP X-Received: by 10.107.167.199 with SMTP id q190mr21198037ioe.119.1440373861815; Sun, 23 Aug 2015 16:51:01 -0700 (PDT) Return-Path: Received: from delta ([172.56.9.65]) by smtp.gmail.com with ESMTPSA id j3sm7767512ige.0.2015.08.23.16.50.59 for <9front@9front.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Aug 2015 16:51:00 -0700 (PDT) Received: from localhost (delta [local]) by delta (OpenSMTPD) with ESMTPA id 730e7aae for <9front@9front.org>; Sun, 23 Aug 2015 23:50:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PATCH 7 of 8] tee: use iounit for reads X-Mercurial-Node: eb135d711d3e30fa57cfa2c87d53a2ac1a1ee34d X-Mercurial-Series-Index: 7 X-Mercurial-Series-Total: 8 Message-Id: List-ID: <9front.9front.org> X-Glyph: ➈ X-Bullshit: self-healing component injection DOM control X-Mercurial-Series-Id: <72294b856560ea15445f.1440373751@delta> In-Reply-To: References: User-Agent: Mercurial-patchbomb/3.3.2 Date: Sun, 23 Aug 2015 16:49:17 -0700 From: mischief To: 9front@9front.org # HG changeset patch # User mischief # Date 1440366687 25200 # Sun Aug 23 14:51:27 2015 -0700 # Node ID eb135d711d3e30fa57cfa2c87d53a2ac1a1ee34d # Parent 8a7a4824b69f9c20955f3b96a01c142801f5af1f tee: use iounit for reads diff -r 8a7a4824b69f -r eb135d711d3e sys/src/cmd/tee.c --- a/sys/src/cmd/tee.c Sun Aug 23 14:51:27 2015 -0700 +++ b/sys/src/cmd/tee.c Sun Aug 23 14:51:27 2015 -0700 @@ -12,7 +12,9 @@ int uflag; int aflag; -char in[8192]; + +int buflen; +char *buf; int intignore(void*, char*); @@ -61,12 +63,20 @@ argv++; } + buflen = iounit(0); + if(buflen <= 0) + buflen = IOUNIT; + + buf = sbrk(buflen); + if(buf == (void*)-1) + sysfatal("out of memory"); + for(;;) { - r = read(0, in, sizeof in); + r = read(0, buf, buflen); if(r <= 0) exits(nil); for(i=0; i