Re: eventfd(2) and timerfd(2) APIs

2021-09-19 Thread David Holland
On Sun, Sep 19, 2021 at 07:43:32AM -0700, Jason Thorpe wrote:
 > >> | else plumbs it through either, but I'll go ahead and do so.
 > >> 
 > >> Please do.   What other things don't permit fcntl() to work?   We
 > >> should fix any of those.
 > > 
 > > Well, I?ll fix these 2 anyway.
 > 
 > ?and I just double-checked this as well? F_GETFL and F_SETFL
 > don?t need any specific hooks in the implementation; the flags are
 > all handled in common code.

Pretty much all of fcntl does (or should) happen at the fd level;
that's why it's different from ioctl.

In fact, I'd go so far as to say that anything in the fcntl path that
calls into the object is a bug...

-- 
David A. Holland
dholl...@netbsd.org


Re: eventfd(2) and timerfd(2) APIs

2021-09-19 Thread Jason Thorpe


> On Sep 18, 2021, at 4:59 PM, John Nemeth  wrote:
> 
> Nice.  timerfd(2) is Asterisk's preferred timing source.  This
> should improve our support for Asterisk.  As you might guess, I'm
> all for the addition of these.

Yes, I remember you mentioning that before, and I just double-checked to make 
sure that Asterisk isn’t using anything that isn’t supported by this 
implementation (Linux has some additional non-standard clock IDs that we don’t 
support).

-- thorpej



Re: eventfd(2) and timerfd(2) APIs

2021-09-19 Thread Jason Thorpe


> On Sep 18, 2021, at 3:54 PM, Jason Thorpe  wrote:
> 
>> 
>> | else plumbs it through either, but I'll go ahead and do so.
>> 
>> Please do.   What other things don't permit fcntl() to work?   We
>> should fix any of those.
> 
> Well, I’ll fix these 2 anyway.

…and I just double-checked this as well… F_GETFL and F_SETFL don’t need any 
specific hooks in the implementation; the flags are all handled in common code.

-- thorpej



Re: eventfd(2) and timerfd(2) APIs

2021-09-19 Thread Jason Thorpe



> On Sep 18, 2021, at 6:26 PM, Jason Thorpe  wrote:
> 
>> On Sep 18, 2021, at 5:51 PM, Robert Elz  wrote:
>> 
>> | You'll get EBADF if you try it on anything else
>> 
>> and that's definitely wrong, on a pipe the system is allowed to return 
>> EINVAL,
>> and that's what ought to be returned whenever the fd is not something that
>> supports chmod (etc).   EBADF should only be used when the process doesn't
>> have the fd open.
> 
> Oops, I may be wrong about that specific detail.  I’ll double-check later.

Indeed, I was mistaken, you do get EINVAL in the “good fd that’s not a vnode” 
case.

-- thorpej