This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Remove set debug lin-lwp-async, new ui_file.to_write_async_safe


On Tue, May 10, 2011 at 2:30 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> 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).

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,
> ?if you haven't seen it]

Yeah.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]