Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2013-11-30 03:14:57 +0400
committerJoel Sherrill <joel.sherrill@oarcorp.com>2013-11-30 03:14:57 +0400
commit62c28b76acd5190377c9311e5ef5009f9df175c5 (patch)
treeef058610ccc8e7d489ac99c1bdecfff75b2eb5ae /newlib/libc/include
parent8116e5e59b4a652db82ad0923683c569017599a9 (diff)
2013-11-29 Jennifer Averett <jennifer.averett@oarcorp.com>
* libc/include/pthread.h (pthread_attr_setaffinity_np): Add pthread SMP affinity attributes to methods to RTEMS for compatibility with GNU/Linux. (pthread_attr_getaffinity_np): Likewise. (pthread_setaffinity_np): Likewise. (pthread_getaffinity_np): Likewise. (pthread_getattr_np): Add for GNU/Linux compatibility. * libc/include/sys/types.h: Add cpuset to pthread_attr_t for RTEMS. * libc/include/sys/cdefs.h (_GNU_SOURCE): Defining _GNU_SOURCE turns on all _XXX_VISBLE feature flags.
Diffstat (limited to 'newlib/libc/include')
-rw-r--r--newlib/libc/include/pthread.h26
-rw-r--r--newlib/libc/include/sys/cdefs.h8
-rw-r--r--newlib/libc/include/sys/types.h10
3 files changed, 41 insertions, 3 deletions
diff --git a/newlib/libc/include/pthread.h b/newlib/libc/include/pthread.h
index ff7f354fd..935de4119 100644
--- a/newlib/libc/include/pthread.h
+++ b/newlib/libc/include/pthread.h
@@ -2,7 +2,7 @@
*
* Written by Joel Sherrill <joel@OARcorp.com>.
*
- * COPYRIGHT (c) 1989-2010.
+ * COPYRIGHT (c) 1989-2013.
* On-Line Applications Research Corporation (OAR).
*
* Permission to use, copy, modify, and distribute this software for any
@@ -32,6 +32,7 @@ extern "C" {
#include <sys/types.h>
#include <time.h>
#include <sys/sched.h>
+#include <sys/cdefs.h>
/* Register Fork Handlers */
int _EXFUN(pthread_atfork,(void (*prepare)(void), void (*parent)(void),
@@ -206,6 +207,29 @@ int _EXFUN(pthread_attr_getguardsize,
int _EXFUN(pthread_attr_setguardsize,
(pthread_attr_t *__attr, size_t __guardsize));
+/* POSIX thread APIs beyond the POSIX standard but provided
+ * in GNU/Linux. They may be provided by other OSes for
+ * compatibility.
+ */
+#if defined(__GNU_VISIBLE)
+#if defined(__rtems__)
+int _EXFUN(pthread_attr_setaffinity_np,
+ (pthread_attr_t *__attr, size_t __cpusetsize,
+ const cpu_set_t *__cpuset));
+int _EXFUN(pthread_attr_getaffinity_np,
+ (const pthread_attr_t *__attr, size_t __cpusetsize,
+ cpu_set_t *__cpuset));
+
+int _EXFUN(pthread_setaffinity_np,
+ (pthread_t __id, size_t __cpusetsize, const cpu_set_t *__cpuset));
+int _EXFUN(pthread_getaffinity_np,
+ (const pthread_t __id, size_t __cpusetsize, cpu_set_t *__cpuset));
+
+int _EXFUN(pthread_getattr_np,
+ (pthread_t __id, pthread_attr_t *__attr));
+#endif /* defined(__rtems__) */
+#endif /* defined(__GNU_VISIBLE) */
+
/* Thread Creation, P1003.1c/Draft 10, p. 144 */
int _EXFUN(pthread_create,
diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index 38616834e..4a7339c79 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -693,7 +693,13 @@
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 2011
-#else /* Default environment: show everything. */
+#elif defined(_GNU_SOURCE) /* Everything and the kitchen sink. */
+#define __POSIX_VISIBLE 200809
+#define __XSI_VISIBLE 700
+#define __BSD_VISIBLE 1
+#define __ISO_C_VISIBLE 2011
+#define __GNU_VISIBLE 1
+#else /* Default: everything except __GNU_VISIBLE. */
#define __POSIX_VISIBLE 200809
#define __XSI_VISIBLE 700
#define __BSD_VISIBLE 1
diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h
index 0627ca9fb..ed33e0a61 100644
--- a/newlib/libc/include/sys/types.h
+++ b/newlib/libc/include/sys/types.h
@@ -322,6 +322,10 @@ typedef __uint32_t pthread_t; /* identify a thread */
#define PTHREAD_CREATE_DETACHED 0
#define PTHREAD_CREATE_JOINABLE 1
+#if defined(__rtems__)
+ #include <sys/cpuset.h>
+#endif
+
#if defined(__XMK__)
typedef struct pthread_attr_s {
int contentionscope;
@@ -351,7 +355,11 @@ typedef struct {
int cputime_clock_allowed; /* see time.h */
#endif
int detachstate;
-
+#if defined(__rtems__)
+ size_t affinitysetsize;
+ cpu_set_t *affinityset;
+ cpu_set_t affinitysetpreallocated;
+#endif
} pthread_attr_t;
#endif /* !defined(__XMK__) */