Vojtech Pavlik wrote:

On Sun, Nov 28, 2004 at 11:03:11PM +0100, Manfred Spraul wrote:



Hi pavel,



My name is Vojtech. ;)



Up, sorry.

CHECK_OWNERSHIP in drivers/usb/input/hid-tmff.c tests for current->pid==0. The same code is used in several files (hid-lgff.c, usb/input/pid.c, drivers/input/joystick/iforce/iforce.h)
Do you know why? I don't understand the reason for the test.
There are two cases where current->pid is 0: for the idle thread(s) and historically for dead threads (not true anymore). current can't be dead and I don't think that it makes sense to check if current is an idle thread.



I think it's to check whether there is a process associated with the device, with 0 being a special value "no process".



So the USB layer overwrites current->pid? Are you sure?

The actual test is
#define CHECK_OWNERSHIP(effect) (current->pid == 0 \
       || effect.owner == current->pid)

Note that it's current->pid==0, not effect.owner==0.

--
   Manfred



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to