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

Doug Evans
2011-05-10T22:19:58Z

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.