RTEMS5 and file descriptors

Chris Johns chrisj at rtems.org
Thu Oct 20 00:44:37 UTC 2022


On 20/10/2022 4:03 am, Michael Davidsaver wrote:
> On 10/17/22 22:50, Chris Johns wrote:
>> On 18/10/2022 4:42 pm, Sebastian Huber wrote:
>>> On 18/10/2022 06:15, Chris Johns wrote:
>>>> On 18/10/2022 2:22 pm, Michael Davidsaver wrote:
>>>>> On 10/17/22 16:20, Chris Johns wrote:
>>>>>> 2. Look at kqueue, it is a better interface for this type of blocking
>>>>> Maybe not relevant in Miroslaw's application, but I've found
>>>>> that the RTEMS kqueue implementation doesn't notify when a
>>>>> TCP connection is closed by reset.  I think this is a lack
>>>>> of NOTE_EOF *.
>>>> Thanks. I cannot find a ticket for this? Do you know if one has been created?
> 
> Not by me.  I ran into this incidentally while testing some
> new networking code using libevent, which helped me towards
> finding:
> 
> https://www.mail-archive.com/freebsd-hackers@freebsd.org/msg43808.html
> 
> Which leads with a reasonably clear statement that kqueue
> is/was not 100% functionally equivalent to select()/poll().
> At that point I configured libevent to use poll() and
> continued with my own troubleshooting.  Then unfortunately,
> I forgot about it until I read this thread.
> 
> https://github.com/mdavidsaver/pvxs/blob/6ee82fac6533d6551b18aa489cb263adc1333018/src/evhelper.cpp#L171-L178
> 
> That freebsd thread is 19 years old, and I haven't spent the
> time to investigate what happened since then.
> 
> libevent has:
> 
>> #ifdef NOTE_EOF
>>         /* Make it behave like select() and poll() */
>>         if (filter == EVFILT_READ)
>>             out->fflags = NOTE_EOF;
>> #endif
> https://github.com/libevent/libevent/blob/8f47d8de281b877450474734594fdc0a60ee35d1/kqueue.c#L193-L197
> 
> 
>>> This looks like a general FreeBSD limitation.
> 
> This was my general assessment at the time.
> 
>  
>> Is NOTE_EOF the same as EV_EOF? I noticed EV_EOF in the FreeBSD man page for
>> kqueue.
> 
> I'm no expert on the kqueue mechanism, but I think not.
> 
> https://man.openbsd.org/kqueue.2
> 
> This openbsd manpage mentions both, although 'NOTE_EOF' is
> only mentioned in passing, with no definition given.
> 
> Some searching leads me to think that EV_EOF is a "flag"
> while NOTE_EOF is an "fflag" (filter flag).  I have not
> investigated the precise distinction between the two.

Thanks for the response. It is unusual compatibility between implementations of
kqueue is not a major concern.

Chris


More information about the users mailing list