Re: [hatari-devel] Windows build currently broken?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Am Fri, 28 Dec 2018 21:53:06 +0200
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:

> Hi,
> 
> On 12/28/18 6:44 PM, Thomas Huth wrote:> Am Fri, 28 Dec 2018 17:32:03
>  > O_NDELAY and O_NONBLOCK seem to be the same, just a different
>  > name, so it does not make much sense to use both here. O_NDELAY is
>  > working with MinGW since it is defined to 0 in cpu/sysdeps.h, so
>  > let's simply use only that one.  
> 
> They're same on Linux, but not on all Unix systems.  Apparently on
> some systems O_NDELAY "would block" indication is same as "end of
> file". Googling shows some projects using O_NONBLOCK when available,
> and O_NDELAY when it's not.
> 
> 
> On 12/28/18 6:54 PM, Thorsten Otto wrote:
> > On Freitag, 28. Dezember 2018 17:44:34 CET Thomas Huth wrote:  
> >> . I wonder why they have that in Aranym?  
> > 
> > Because fcntl(F_SETFL, 0) will remove the O_NONBLOCK flag, which
> > might have an effect on the following close().  
> 
> Not sure what impact that has a on close.  Will it then block
> until locks have been unlocked & writes have finished, instead
> of potentially failing with some error (when non-blocking mode
> isn't removed)?

According to
https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html :

"If O_NONBLOCK is not set and there have been no signals posted for the
 STREAM, and if there is data on the module's write queue, close() shall
 wait for an unspecified time (for each module and driver) for any output
 to drain before dismantling the STREAM. [...] If the O_NONBLOCK flag is
 set, or if there are any pending signals, close() shall not wait for
 output to drain, and shall dismantle the STREAM immediately."

So that sounds like some characters could be lost indeed if one uses
close() with O_NONBLOCK. But since we only call that UnInit() function
when the settings are changed or Hatari is shutdown, that's like an
interruption of the transmission on the serial line anyway. So if you
transfer some bytes over the serial line and you suddenly switch of
the sender or receiver side while the transfer is not finished yet, you
likely get an incomplete transfer anyway, so I don't think the fcntl() is
really urgently required in Hatari here, is it?

 Thomas



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/