From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24024 invoked by alias); 10 May 2011 22:19:58 -0000 Received: (qmail 24014 invoked by uid 22791); 10 May 2011 22:19:58 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 May 2011 22:19:40 +0000 Received: from wpaz29.hot.corp.google.com (wpaz29.hot.corp.google.com [172.24.198.93]) by smtp-out.google.com with ESMTP id p4AMJd9F018137 for ; Tue, 10 May 2011 15:19:39 -0700 Received: from ywk9 (ywk9.prod.google.com [10.192.11.9]) by wpaz29.hot.corp.google.com with ESMTP id p4AMIc6X006580 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 10 May 2011 15:19:38 -0700 Received: by ywk9 with SMTP id 9so3149053ywk.21 for ; Tue, 10 May 2011 15:19:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.244.4 with SMTP id r4mr6832512ybh.153.1305065976989; Tue, 10 May 2011 15:19:36 -0700 (PDT) Received: by 10.150.186.1 with HTTP; Tue, 10 May 2011 15:19:36 -0700 (PDT) In-Reply-To: <201105102230.29758.pedro@codesourcery.com> References: <20110510204641.A4C73246199@ruffy.mtv.corp.google.com> <201105102230.29758.pedro@codesourcery.com> Date: Tue, 10 May 2011 22:19:00 -0000 Message-ID: Subject: Re: [RFA] Remove set debug lin-lwp-async, new ui_file.to_write_async_safe From: Doug Evans To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00263.txt.bz2 On Tue, May 10, 2011 at 2:30 PM, Pedro Alves wrote: > On Tuesday 10 May 2011 21:46:41, Doug Evans wrote: >> =A0static void >> +stdio_file_write_async_safe (struct ui_file *file, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0const char *buf= , long length_buf) >> +{ >> + =A0struct stdio_file *stdio =3D ui_file_data (file); >> + >> + =A0if (stdio->magic !=3D &stdio_file_magic) >> + =A0 =A0{ >> + =A0 =A0 =A0const char *msg =3D _("stdio_file_write_async_safe: bad mag= ic number\n"); >> + =A0 =A0 =A0write (2, msg, strlen (msg)); >> + =A0 =A0 =A0return; >> + =A0 =A0} >> + >> + =A0write (fileno (stdio->file), buf, length_buf); > > fileno is not required to be async signal safe by posix, AFAIK. > (nor are strlen or _/gettext either). If it became an issue, one could record fileno ahead of time. For gettext(), I'd be happy with just removing it for this particular case. > [gdbserver calls write/sizeof directly in linux-low.c, > =A0if you haven't seen it] Yeah.