From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Neil Jerram" Newsgroups: gmane.lisp.guile.devel Subject: Re: `scm_c_read ()' and `swap_buffer' trick harmful Date: Thu, 20 Nov 2008 22:25:26 +0000 Message-ID: <49dd78620811201425j5dcd7e0g4165c8ea4c6b08ce@mail.gmail.com> References: <87vduo92nj.fsf@gnu.org> <49dd78620811200522k315281c8m9d952a17145b2479@mail.gmail.com> <871vx6ik42.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_81825_4920851.1227219933124" X-Trace: ger.gmane.org 1227220195 5862 80.91.229.12 (20 Nov 2008 22:29:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Nov 2008 22:29:55 +0000 (UTC) Cc: guile-devel@gnu.org To: "=?ISO-8859-1?Q?Ludovic_Court=E8s?=" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Nov 20 23:30:56 2008 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L3I34-0006Qi-BD for guile-devel@m.gmane.org; Thu, 20 Nov 2008 23:30:55 +0100 Original-Received: from localhost ([127.0.0.1]:57298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L3I1v-0002Q9-AU for guile-devel@m.gmane.org; Thu, 20 Nov 2008 17:29:43 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L3Hy0-0000AV-Jw for guile-devel@gnu.org; Thu, 20 Nov 2008 17:25:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L3Hxw-00008E-OO for guile-devel@gnu.org; Thu, 20 Nov 2008 17:25:39 -0500 Original-Received: from [199.232.76.173] (port=51804 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L3Hxv-00007x-ND for guile-devel@gnu.org; Thu, 20 Nov 2008 17:25:35 -0500 Original-Received: from mu-out-0910.google.com ([209.85.134.187]:11776) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L3Hxv-0008Gt-2R for guile-devel@gnu.org; Thu, 20 Nov 2008 17:25:35 -0500 Original-Received: by mu-out-0910.google.com with SMTP id i2so628522mue.6 for ; Thu, 20 Nov 2008 14:25:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=FQ2YyaFPaJa17f3Hc+zpiQtfoX5IOjsgl5Y23qZSk/8=; b=AgLkH9VvqFLBbzrdJpUpzdPyWQxI8PWI1Zg3SPhDwkGLlz0FY2YazX0QLEX4ORtz3G Tb2VTKyg8LmzUWziYmu++Hq0ECfVlstVRpKt9W9pVvPnFevobCcCaouZ1E+tWXKpNNmg fJafjs/EoZ8CjL/QbUxI6oqDAhu2uC79QgQbk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=AEDWlC6AHpJNfPMPRlk9hAU9oUVrE6I0kXkxGfxcDdNKTZtxvTLxqQRkDZJtAVq4Vb hWRv5CoiTXiZixaNfEFVe7kdLx/lQDYO4pWhkQmGs05BGYm1gBIPkdqtHXlGINT78SbY pI00gcBPWRLjROvlSw0XrfvrSGjIt9BY18UWc= Original-Received: by 10.187.201.15 with SMTP id d15mr660726faq.11.1227219933120; Thu, 20 Nov 2008 14:25:33 -0800 (PST) Original-Received: by 10.187.238.17 with HTTP; Thu, 20 Nov 2008 14:25:26 -0800 (PST) In-Reply-To: <871vx6ik42.fsf@gnu.org> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:7874 Archived-At: ------=_Part_81825_4920851.1227219933124 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 2008/11/20 Ludovic Court=E8s : > > In theory, yes. In practice, the notion of "unbuffered port" is > ill-defined, I'm afraid. The `SCM_BUF0' flag probably can't be relied > on, as it appears to be only really used on `fports.c'. Actually, for > some reason (probably copy & paste), make_cbip() creates ports with > "SCM_OPN | SCM_RDNG | SCM_BUF0", although `SCM_BUF0' is probably not > needed. So I think "unbuffered port" means "read_buf_size <=3D 1". That's what I was thinking too. Please see the attached. Neil ------=_Part_81825_4920851.1227219933124 Content-Type: text/plain; name=0001-Make-scm_c_read-use-caller-buffer-only-for-unbuffere.patch Content-Transfer-Encoding: base64 X-Attachment-Id: f_fnryzbuq0 Content-Disposition: attachment; filename=0001-Make-scm_c_read-use-caller-buffer-only-for-unbuffere.patch RnJvbSA5OTYzODRhOTM1MjI0YmFhMjQ4MGFiMDJlNTBmYWE5MWUyNGI1NjEzIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBOZWlsIEplcnJhbSA8bmVpbEBvc3NhdS51a2xpbnV4Lm5ldD4K RGF0ZTogVGh1LCAyMCBOb3YgMjAwOCAyMTo0OTozNSArMDAwMApTdWJqZWN0OiBbUEFUQ0hdIE1h a2Ugc2NtX2NfcmVhZCB1c2UgY2FsbGVyIGJ1ZmZlciBvbmx5IGZvciB1bmJ1ZmZlcmVkIHBvcnRz LgoKV2UgcmVjZW50bHkgbW9kaWZpZWQgc2NtX2NfcmVhZCBzbyB0aGF0IGl0IHRlbXBvcmFyaWx5 IHN3YXBzIHRoZQpjYWxsZXIncyBidWZmZXIgd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