R8B-0 devpoll patch

Per Bergqvist <>
Thu Feb 28 22:03:22 CET 2002


> Per Bergqvist <> writes:                                
>                                                                     
> > [snip]                                                            
                                                                      
> >                                                                   
                                                                      
> > > Unfortunately not all files support kqueues. Pipes, fifos,      
regular files                                                         
> > > sockets and ttys, as well as processes and signals, are         
supported, but                                                        
> > > more weird devices like usb stuff, audio, radio, etc. are not   
supported.                                                            
> >                                                                   
                                                                      
> > Eventpoll in Linux has exactly the same problem. For this reason  
                                                                      
> > I added poll support to the /dev/epoll device itself.             
                                                                      
> > By doing that I can have a smaller result with "weird" files on   
                                                                      
> > which I actually call poll(). If readiness is indicated on the    
                                                                      
> > eventpoll file descriptor I do a EP_POLL to get the actual        
                                                                      
> > events.                                                           
                                                                      
> >                                                                   
                                                                      
> > Would it be possible to multiplex with kqueue in a similiar way ? 
                                                                      
>                                                                     
> Yes, you can select(2)/poll(2) on kqueue descriptors. You can also  
> register kqueue descriptors on another kqueue just to add to the    
> orthogonality.                                                      
>                                                                     
                                                                      
Great.                                                                
A few other questions:                                                
                                                                      
1) What is the best way to check if the fd should use poll or kqueue ?
(in the Linux I do a fstat and test the mode)                         
2) Do you have to register EVFILT_READ and WRITE as separate event    
filters or can you simply OR them in one event ?                      
(Check a few examples on the web and they all register separate       
events)                                                               
                                                                      
Will get access to a FreeBSD machine next week to test it ...         
                                                                      
/Per                                                                  
                                                                      
> //art                                                               
>                                                                     
=========================================================             
Per Bergqvist                                                         
Synapse Systems AB                                                    
Phone: +46 709 686 685                                                
Email:                                                    



More information about the erlang-questions mailing list