Proposed Pthread affinity APIs

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Nov 12 19:41:35 UTC 2013


On 11/12/2013 08:27 PM, Joel Sherrill wrote:
> On 11/12/2013 1:23 PM, Sebastian Huber wrote:
>> On 11/12/2013 08:13 PM, Joel Sherrill wrote:
>>
>>> _GNU_SOURCE is transformed into multiple other
>>> defines in features.h in glibc.
>>>
>>> #ifdef  _GNU_SOURCE
>>> # define __USE_GNU      1
>>> #endif
>>>
>>> Our sys/features.h does not have the comparable
>>> ifdef. We are likely missing others as it turns
>>> on about ten other feature flags in the glibc
>>> features.h.
>>>
>>> I guess we need to follow this pattern and add
>>> _GNU_SOURCE to our sys/features.h. The others
>>> need another round of thought.
>> Another option would be to add this to the Newlib <sys/cdefs.h> since
>> here we already have defines related to _POSIX_SOURCE etc.   Here we
>> should use __GNU_VISIBLE to be in line with the BSD names.
>>
> Where's the best place to add this in <sys/cdefs.h> to not
> screw up merging future versions from BSD land.
>
>

In case this _GNU_SOURCE is independent of the other defines, e.g. if it 
is valid to use this

#define _POSIX_C_SOURCE 200809
#define _GNU_SOURCE
#include <pthread.h>

we can use a separate define block.  Maybe like this:

diff --git a/newlib/libc/include/sys/cdefs.h 
b/newlib/libc/include/sys/cdefs.h
index 3861683..cb87084 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -701,4 +701,10 @@
  #endif
  #endif

+#ifdef _GNU_SOURCE
+#define __GNU_VISIBLE 1
+#else
+#define __GNU_VISIBLE 0
+#endif
+
  #endif /* !_SYS_CDEFS_H_ */

We have also this "Deal with _ANSI_SOURCE:" comment in <sys/cdefs.h>.  
Not sure how this works together with _GNU_SOURCE.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list