Thomas Sailer wrote: > > johan verrept wrote: > > > If you have reasons not to do this, please let me know. > > Do you know what the AIO code does? I would prefer to do the same > as the AIO code, because that will be the least surprise solution...
The parts of the code I have found that sends siginfo SIGIO, in fs/fcntl.c (__kill_fasync()) and fs/dnotify.c (__inode_dir_notify()) retrieve the f_own struct from the file * (which is set by F_SETOWN). The manpage of fcntl, especially the description of F_SETOWN and F_SETSIG, seems to point to what I suggest. Following manpages seems to be the way of the least surprise? man pages fcntl(2) qouted below. J. F_SETOWN Set the process ID or process group that will receive SIGIO and SIGURG signals for events on file descriptor fd. Process groups are specified using negative values. (F_SETSIG can be used to specify a different signal instead of SIGIO). If you set the O_ASYNC status flag on a file descriptor (either by providing this flag with the open(2) call, or by using the F_SETFL command of fcntl), a SIGIO signal is sent whenever input or output becomes possible on that file descriptor. The process or process group to receive the signal can be selected by using the F_SETOWN command to the fcntl function. If the file descriptor is a socket, this also selects the recipient of SIGURG signals that are delivered when out-of-band data arrives on that socket. (SIGURG is sent in any situation where select(2) would report the socket as having an "exceptional condition".) If the file descriptor corresponds to a terminal device, then SIGIO signals are sent to the foreground process group of the terminal. F_SETSIG Sets the signal sent when input or output becomes possible. A value of zero means to send the default SIGIO signal. Any other value (including SIGIO) is the signal to send instead, and in this case additional info is available to the signal handler if installed with SA_SIGINFO. By using F_SETSIG with a non-zero value, and set ting SA_SIGINFO for the signal handler (see sigac tion(2)), extra information about I/O events is passed to the handler in a siginfo_t structure. If the si_code field indicates the source is SI_SIGIO, the si_fd field gives the file descriptor associ ated with the event. Otherwise, there is no indi cation which file descriptors are pending, and you should use the usual mechanisms (select(2), poll(2), read(2) with O_NONBLOCK set etc.) to determine which file descriptors are available for I/O. By selecting a POSIX.1b real time signal (value >= SIGRTMIN), multiple I/O events may be queued using the same signal numbers. (Queuing is dependent on available memory). Extra information is available if SA_SIGINFO is set for the signal handler, as above. _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel