Bug 215745

Summary: O_ASYNC does not work linux timers
Product: IO/Storage Reporter: janezz55
Component: AIOAssignee: Badari Pulavarty (pbadari)
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.16.16-arch1-1 Subsystem:
Regression: No Bisected commit-id:

Description janezz55 2022-03-26 13:40:18 UTC
setting the O_ASYNC flag via fcntl() on a linux timer fd will not report an error, but no signals will be sent. I asked a question on SO about it:

https://stackoverflow.com/questions/71619056/linux-timers-with-o-async

and no one seems to know anything. I know that POSIX timers fill this niche (timer_create(), ...) and they work well, but POSIX timers do not conform to linux/unix file-centric tradition (i.e. POSIX timer handles are NOT file descriptors, but linux timer handles are - I believe this is the reason why linux timers were implemented). I am convinced O_ASYNC should be supported with linux timers, or an error should be returned, if the user wants to set the O_ASYNC flag on a linux timer fd via fcntl() (but I'd prefer the former, as I like to see the unix traditions upheld).

As for code:
https://github.com/user1095108/cr/blob/master/loop.hpp

I tried to handle the linux timers just like sockets, setting O_ASYNC and then waiting for signals, but no signals came, so I had to switch to POSIX timers.