Re: [PATCH v2 4/7] staging: android: binder: fix BINDER_SET_MAX_THREADSdeclaration

From: Arve Hjønnevåg
Date: Wed Apr 10 2013 - 17:50:37 EST


On Wed, Apr 10, 2013 at 5:37 AM, Serban Constantinescu
<Serban.Constantinescu@xxxxxxx> wrote:
> On 10/04/13 00:53, Arve Hjønnevåg wrote:
>>
>> On Tue, Apr 9, 2013 at 3:00 AM, Serban Constantinescu
>> <serban.constantinescu@xxxxxxx> wrote:
>>>
>>> This change will fix the BINDER_SET_MAX_THREADS ioctl to use __s32
>>> instead of size_t for setting the max threads. Thus using the same
>>> handler for 32 and 64bit kernels.
>>>
>>> This value is stored internally in struct binder_proc as an int and
>>> is set to 15 on open_binder() in the libbinder API (thus no need for
>>> a 64bit size_t on 64bit platforms).
>>>
>>
>> Why switch to a signed type?
>
>
> The value passed through BINDER_SET_MAX_THREADS ioctl is stored in a
> binder_proc structure as an int.It also mimics the use of pid_t(typedef int
> __kernel_pid_t).
>

This is a thread count not a pid.

> However using __s32 or __u32 here would have the same effect since the ioctl
> macro will compute both as sizeof(32bit).
>
> Let me know if you would like this changed to __u32.
>

The user-space api uses a size_t, so __u32 would be a closer match.
Keeping it a size_t would also work since this value is not shared
between processes.

--
Arve Hjønnevåg
--
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/