If this is a bug in inode.c, whether is my previous mail to
linux-usb-devel mailing list is sufficient for bug report or we need
to send report to some other mailing list regarding linux kernel?
Zoran Marceta
Alan Stern wrote:
> On Wed, 21 Jun 2006, Zoran Marceta wrote:
>
>
>> I was looking at catching a signal using usbfs to tell when a device has
>> been detached.
>> I used an ioctl call with USBDEVFS_DISCSIGNAL to set a signal handler, and I
>> was able to detect the detachment.
>> >From inode.c (drivers/usb/core/inode.c) file in kernel source I concluded
>> >that disc_signal.context is copied
>> into si_addr field of siginfo_t structure, but when signal handler was
>> called (when I remove USB device)
>> I'm always get NULL in info->si_addr (it is not value that I put into
>> disc_signal.context field).
>>
> ...
>
>> After analyzing real-time signal handling in kernel (kernel/signal.c) I
>> modified function usbfs_remove_device in
>> drivers/usb/core/inode.c file at line 699.
>>
>> static void usbfs_remove_device(struct usb_device *dev)
>> {
>> .
>> .
>> .
>> if (ds->discsignr) {
>> sinfo.si_signo = ds->discsignr; /* SIGPIPE replaced with
>> ds->discsignr */
>> sinfo.si_errno = EPIPE;
>> sinfo.si_code = SI_ASYNCIO;
>> sinfo.si_addr = ds->disccontext;
>> kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid,
>> ds->disc_uid, ds->disc_euid);
>> }
>> .
>> .
>> }
>>
>> Into field si_signo of siginfo_t structure instead of SIGPIPE I put
>> ds->discsignr value.
>>
>> After this change in kernel source I was able to get correct value (equal to
>> disc_signal.context) in si_addr field in signal handler.
>> Kernel version is 2.6.16-1.2115_FC4. I check latest kernel stable version
>> 2.6.17.1 and it has same code in inode.c file.
>>
>> Is this a bug in usb device removal signal generating or I something missed
>> in signal handler registering.
>>
>
> It looks like you are right and this is a bug in inode.c.
>
> It's also not clear why si_errno is set to EPIPE, but I guess that's as
> good as anything else. There's a corresponding line in devio.c:
>
> sinfo.si_errno = as->urb->status;
>
> Since urb->status is a negative error code, this should really be
>
> sinfo.si_errno = - as->urb->status;
>
> But such a change would be visible to user programs.
>
> Alan Stern
>
>
> __________ NOD32 1.1613 (20060621) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel