Re: [PWM PATCH 1/7] API to consolidate PWM devices behind a commonuser and kernel interface

From: Bill Gatliff
Date: Tue Feb 09 2010 - 23:18:26 EST


Bill Gatliff wrote:
>>> +
>>> + p->requester = requester;
>>> + if (!strcmp(requester, REQUEST_SYSFS))
>>> + p->pid = current->pid;
>>>
>>>
>> This is new.. What's the reason for saving the pid?
>>
>>
>
> I've gotten complaints from those who say, "Ok, so it reported 'sysfs'
> back to me, but how can I be sure that it's because *I* own it now, and
> not another user process?" Seemed easy enough to add the PID so they
> can check. Of course, you could argue that I could report just the PID,
> and skip the "sysfs" string altogether. I'd be inclined to agree with you.
>
> Of course, if you are like me and do the request with cat(1), then the
> PID is pretty meaningless. :)
>

For the record, this request activity is mostly advisory. I can't
actually implement something where only the requester is subsequently
allowed to manipulate the state of the channel. You really wouldn't
want to even if it was possible, because then you'd probably lose the
ability to control the output using cat(1) and echo(1).

I'm just trying to provide a tool that allows users to Play Nice if they
choose to. In fact, it's currently possible to manipulate the state of
the channel from userspace without requesting ownership first. Not sure
I'm happy with that, but since I can't enforce any sort of access
restrictions it seems pointless to even go so far as to require ownership...


b.g.

--
Bill Gatliff
Embedded systems training and consulting
http://billgatliff.com
bgat@xxxxxxxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/