This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Remove set debug lin-lwp-async, new ui_file.to_write_async_safe
- From: Pedro Alves <pedro at codesourcery dot com>
- To: Doug Evans <dje at google dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 10 May 2011 22:30:29 +0100
- Subject: Re: [RFA] Remove set debug lin-lwp-async, new ui_file.to_write_async_safe
- References: <20110510204641.A4C73246199@ruffy.mtv.corp.google.com>
On Tuesday 10 May 2011 21:46:41, Doug Evans wrote:
> static void
> +stdio_file_write_async_safe (struct ui_file *file,
> + const char *buf, long length_buf)
> +{
> + struct stdio_file *stdio = ui_file_data (file);
> +
> + if (stdio->magic != &stdio_file_magic)
> + {
> + const char *msg = _("stdio_file_write_async_safe: bad magic number\n");
> + write (2, msg, strlen (msg));
> + return;
> + }
> +
> + write (fileno (stdio->file), buf, length_buf);
fileno is not required to be async signal safe by posix, AFAIK.
(nor are strlen or _/gettext either).
[gdbserver calls write/sizeof directly in linux-low.c,
if you haven't seen it]
--
Pedro Alves