Thanks for the comments Sharyathi,

Sharyathi Nagesh wrote:
> Helge
>    It is fine replacing those 2 conditional checks with __GLIBC_PREREQ 
> as long as it is defined in LTP, I don't see it defined any where ( I 
> may be looking at older version)

You won't find it in LTP sources, since __GLIBC_PREREQ is defined in the 
glibc sources.
Just look in /usr/include/features.h
It's defined there exactly for this kind of check.


>   In the second part you have removed the check for x86_64, we need to 
> check glibc version only for x86_64. So code has to be:
> ---------------
> #elif defined(__x86_64__)
> #if __GLIBC_PREREQ(2,6)
>         return *cpu_id = sched_getcpu();
> #endif
> #endif

Yes, your original code checked for the glibc version for x86_64 only.
I intentionally removed the x86_64 dependency, since my patch is about 
to make it possible to run this specific testcase on other architectures 
as well (in my case for HPPA).
So, either we could do as you say:

#elif defined(__x86_64__)
# if __GLIBC_PREREQ(2,6)
         return *cpu_id = sched_getcpu();
# endif
#elif defined(__hppa__)
# if __GLIBC_PREREQ(2,6)
         return *cpu_id = sched_getcpu();
# endif
#elif defined(__ia64__)
# if __GLIBC_PREREQ(2,6)
         return *cpu_id = sched_getcpu();
# endif
....arm...sparc...xxx

or:
just do it once (as my patch did) and what is equivalent:
/* no check for architecture */
#if __GLIBC_PREREQ(2,6)
         return *cpu_id = sched_getcpu();
#endif

Regards,
Helge

> ---------------
> Thanks
> Sharyathi
> 
> 
> Subrata Modak wrote:
>> Sharyathi,
>>
>> Can you please comment on this ?
>>
>> Regards--
>> Subrata
>>
>> On Fri, 2008-09-05 at 22:46 +0200, Helge Deller wrote:
>>> This patch fixes the getcpu patch for parisc (and probably other 
>>> platforms as well).
>>>
>>> The check for "__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 6" is wrong.
>>> It breaks as soon as a glibc 3.0 would be published. Replace it with 
>>> __GLIBC_PREREQ(2,6).
>>>
>>> Tested on parisc and i386.
>>>
>>> Signed-off-by: Helge Deller <[EMAIL PROTECTED]>
>>>
>>> diff -u -p -r1.1 getcpu01.c
>>> --- testcases/kernel/syscalls/getcpu/getcpu01.c    22 Aug 2008 
>>> 21:09:59 -0000    1.1
>>> +++ testcases/kernel/syscalls/getcpu/getcpu01.c    5 Sep 2008 
>>> 20:37:25 -0000
>>> @@ -61,8 +61,7 @@
>>>  #include <dirent.h>
>>>
>>>  #if defined(__i386__) || defined(__x86_64__)
>>> -    #if defined(__GLIBC__) && defined(__GLIBC_MINOR__) \
>>> -        && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 6
>>> +    #if __GLIBC_PREREQ(2,6)
>>>      #if defined(__x86_64__)
>>>          #include <utmpx.h>      #endif
>>> @@ -165,12 +164,8 @@ static inline int getcpu(unsigned *cpu_i
>>>  {
>>>      #if defined(__i386__)
>>>          return syscall(318, cpu_id,node_id,cache_struct);
>>> -    #elif defined(__x86_64__) -        #if defined(__GLIBC__) && 
>>> defined(__GLIBC_MINOR__) \
>>> -            && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 6
>>> -            return *cpu_id = sched_getcpu();
>>> -        #endif
>>> -    return 0;
>>> +    #elif __GLIBC_PREREQ(2,6)
>>> +        return *cpu_id = sched_getcpu();
>>>      #endif
>>>      return 0;
>>>  }
>>
> 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to