On 08/27/2013 04:16 PM, [email protected] wrote:
> Hi!
>> Signed-off-by: Stanislav Kholmanskikh <[email protected]>
>> ---
>>   testcases/kernel/syscalls/getgroups/compat_16.h   |   78 
>> +++++++++++++++++++++
>>   testcases/kernel/syscalls/getgroups/getgroups01.c |   22 +++---
>>   testcases/kernel/syscalls/getgroups/getgroups03.c |   17 +++--
>>   3 files changed, 99 insertions(+), 18 deletions(-)
>>   create mode 100644 testcases/kernel/syscalls/getgroups/compat_16.h
>>
>> diff --git a/testcases/kernel/syscalls/getgroups/compat_16.h 
>> b/testcases/kernel/syscalls/getgroups/compat_16.h
>> new file mode 100644
>> index 0000000..79d006e
>> --- /dev/null
>> +++ b/testcases/kernel/syscalls/getgroups/compat_16.h
>> @@ -0,0 +1,78 @@
>> +/*
>> + * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License as
>> + * published by the Free Software Foundation; either version 2 of
>> + * the License, or (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it would be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write the Free Software Foundation,
>> + * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
>> + *
>> + * Author: Stanislav Kholmanskikh <[email protected]>
>> + *
>> + */
>> +
>> +#ifndef __GETGROUPS_COMPAT_16_H__
>> +#define __GETGROUPS_COMPAT_16_H__
>> +
>> +#include "compat_gid.h"
>> +#include "linux_syscall_numbers.h"
>> +
>> +#ifdef TST_USE_COMPAT16_SYSCALL
>> +
>> +int SETGROUPS(size_t size, const GID_T *list16)
>> +{
>> +    int r;
>> +    int i;
>> +
>> +    gid_t *list32;
>> +    list32 = calloc(size, sizeof(gid_t));
>> +    if (list32 == NULL)
>> +            tst_brkm(TBROK | TERRNO, NULL,
>> +                    "calloc() failed to allocate %zu bytes",
>> +                    size * sizeof(gid_t));
>> +
>> +    for (i = 0; i < size; i++)
>> +            list32[i] = list16[i];
>> +
>> +    r = setgroups(size, list32);
>> +
>> +    free(list32);
>> +
>> +    return r;
>> +}
> I think that we should just use the 16 bit variant here as well, as
> well. It's available if the compat getgroups is and there is no need to
> call the 32 bit version.
>
> Or do you want to explicitly assert that the 32 bit syscall returns the
> same as the 16 bit? That would make some sense.
>
>> +int GETGROUPS(int size, GID_T *list16)
>> +{
>> +# if (__NR_getgroups32 != __LTP__NR_INVALID_SYSCALL)
>> +    /* __NR_getgroups - 16-bit version of getgroups() syscall */
>> +    return ltp_syscall(__NR_getgroups, size, list16);
>> +# else
>> +    /* The platform has no 16-bit version of getgroups() syscall */
>> +    tst_brkm(TCONF, NULL,
>> +            "16-bit version of getgroups() is not supported on your arch");
>> +# endif /* __NR_getgroups32 */
>> +}
>> +
>> +#else
>> +
>> +int SETGROUPS(size_t size, const GID_T *list32)
>> +{
>> +    return setgroups(size, list32);
>> +}
>> +
>> +int GETGROUPS(int size, GID_T *list32)
>> +{
>> +    return getgroups(size, list32);
>> +}
>> +
>> +#endif /* TST_USE_COMPAT16_SYSCALL */
>> +
>> +#endif /* __GETGROUPS_COMPAT_16_H__ */
> But still it duplicates code in the tree, lets move it into some header
> under 'LTP/include/sys/' and move compat_gid.h there as well.
>
Hi!

Ok. I'm managing this (compat_16.h from several testcases, compat_uid.h, 
compat_gid.h).

But I need one more clarification.

Look at LTP/testcases/kernel/include. There are linux_syscalls_numbers.h 
and numa_helper.h

Maybe move all these compat headers not into LTP/include/sys, but into 
LTP/testcases/kernel/include?

I think It's a more appropriate directory.

How do you think?



------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to