]> sourceware.org Git - newlib-cygwin.git/commitdiff
2009-06-17 Michael Eager <eager@eagercon.com>
authorJeff Johnston <jjohnstn@redhat.com>
Wed, 17 Jun 2009 16:47:02 +0000 (16:47 +0000)
committerJeff Johnston <jjohnstn@redhat.com>
Wed, 17 Jun 2009 16:47:02 +0000 (16:47 +0000)
        * libc/include/pthread.h: Support XMK (Xilinx) BSP, add RTEMS to
        PTHREAD_MUTEX_NORMAL.
        * libc/include/sys/features.h: Same.
        * libc/include/sys/types.h: Same.

newlib/ChangeLog
newlib/libc/include/pthread.h
newlib/libc/include/sys/features.h
newlib/libc/include/sys/types.h

index 21d31f7b7dd55de3e5a7f2f052db3cd16baf9e06..34aa64995d7197efb4f849610c70ec7d10c5b160 100644 (file)
@@ -1,3 +1,10 @@
+2009-06-17  Michael Eager <eager@eagercon.com>
+
+       * libc/include/pthread.h: Support XMK (Xilinx) BSP, add RTEMS to
+       PTHREAD_MUTEX_NORMAL.
+       * libc/include/sys/features.h: Same.
+       * libc/include/sys/types.h: Same.
+
 2009-06-16  Corinna Vinschen  <corinna@vinschen.de>
        
        * libc/include/locale.h (struct lconv): Add missing members required
index de61bf535f1ed367de3e99942ee09e1fdd54718e..8dc787244f600ced7949459a0db4e66bc038016e 100644 (file)
@@ -44,7 +44,7 @@ extern "C" {
   
     NOTE: RTEMS does not provide pthread_atfork().  */
 
-#if !defined(__rtems__)
+#if !defined(__rtems__) && !defined(__XMK__)
 #warning "Add pthread_atfork() prototype"
 #endif
 
index 866044f606ca564a8ca8727c2ec8bfb1e4a230a5..1fa5427897dbc25ad9463b232b1bf91c0852f7de 100644 (file)
@@ -75,6 +75,13 @@ extern "C" {
 
 #endif
 
+/* XMK loosely adheres to POSIX -- 1003.1 */
+#ifdef __XMK__
+#define _POSIX_THREADS                         1
+#define _POSIX_THREAD_PRIORITY_SCHEDULING      1
+#endif
+
+
 #ifdef __svr4__
 # define _POSIX_JOB_CONTROL     1
 # define _POSIX_SAVED_IDS       1
index 3f1893c204d52f063fca5c54c2562a1ec8437449..290c77a2bb3d524496dda269dffbd60c4edfd624 100644 (file)
@@ -165,7 +165,12 @@ typedef __uid_t uid_t;
 typedef __gid_t gid_t;
 #endif
 
+#if defined(__XMK__)
+typedef signed char pid_t;
+#else
 typedef int pid_t;
+#endif
+
 #ifndef __CYGWIN__
 typedef        long key_t;
 #endif
@@ -271,7 +276,11 @@ typedef long suseconds_t;
  *  2.5 Primitive System Data Types,  P1003.1c/D10, p. 19.
  */
 
+#if defined(__XMK__)
+typedef unsigned int pthread_t;          /* identify a thread */
+#else
 typedef __uint32_t pthread_t;            /* identify a thread */
+#endif
 
 /* P1003.1c/D10, p. 118-119 */
 #define PTHREAD_SCOPE_PROCESS 0
@@ -287,6 +296,51 @@ typedef __uint32_t pthread_t;            /* identify a thread */
 #define PTHREAD_CREATE_DETACHED 0
 #define PTHREAD_CREATE_JOINABLE  1
 
+#if defined(__XMK__) || defined(__rtems__)
+/* The following defines are part of the X/Open System Interface (XSI). */
+
+/* This type of mutex does not detect deadlock. A thread attempting to relock this mutex without first unlocking 
+ * it shall deadlock. Attempting to unlock a mutex locked by a different thread results in undefined behavior. 
+ * Attempting to unlock an unlocked mutex results in undefined behavior. 
+ */
+#define PTHREAD_MUTEX_NORMAL  1
+
+/* 
+ * This type of mutex provides error checking. A thread attempting to relock this mutex without first unlocking 
+ * it shall return with an error. A thread attempting to unlock a mutex which another thread has locked shall return 
+ * with an error. A thread attempting to unlock an unlocked mutex shall return with an error. 
+ */
+#define PTHREAD_MUTEX_ERRORCHECK  2 
+
+/* A thread attempting to relock this mutex without first unlocking it shall succeed in locking the mutex. 
+ * The relocking deadlock which can occur with mutexes of type PTHREAD_MUTEX_NORMAL cannot occur with this type of mutex. 
+ * Multiple locks of this mutex shall require the same number of unlocks to release the mutex before another thread can 
+ * acquire the mutex. A thread attempting to unlock a mutex which another thread has locked shall return with an error. 
+ * A thread attempting to unlock an unlocked mutex shall return with an error. 
+ */
+#define PTHREAD_MUTEX_RECURSIVE  3
+
+/* Attempting to recursively lock a mutex of this type results in undefined behavior. Attempting to unlock a 
+ * mutex of this type which was not locked by the calling thread results in undefined behavior. Attempting to 
+ * unlock a mutex of this type which is not locked results in undefined behavior. An implementation may map this 
+ * mutex to one of the other mutex types.
+ */
+#define PTHREAD_MUTEX_DEFAULT  4 
+
+#endif /* defined(__XMK__) || defined(__rtems__) */
+
+#if defined(__XMK__)
+typedef struct pthread_attr_s {
+  int contentionscope;
+  struct sched_param schedparam;
+  int  detachstate;
+  void *stackaddr;
+  size_t stacksize;
+} pthread_attr_t;
+
+#define PTHREAD_STACK_MIN       200
+
+#else /* !defined(__XMK__) */
 typedef struct {
   int is_initialized;
   void *stackaddr;
@@ -295,6 +349,7 @@ typedef struct {
   int inheritsched;
   int schedpolicy;
   struct sched_param schedparam;
+#endif /* !defined(__XMK__) */
 
   /* P1003.4b/D8, p. 54 adds cputime_clock_allowed attribute.  */
 #if defined(_POSIX_THREAD_CPUTIME)
@@ -334,6 +389,13 @@ typedef struct {
 
 #endif
 
+#if defined(__XMK__)
+typedef unsigned int pthread_mutex_t;    /* identify a mutex */
+
+typedef struct {
+    int type;
+} pthread_mutexattr_t;
+#else /* !defined(__XMK__) */
 typedef __uint32_t pthread_mutex_t;      /* identify a mutex */
 
 typedef struct {
@@ -350,6 +412,7 @@ typedef struct {
 #endif
   int   recursive;
 } pthread_mutexattr_t;
+#endif /* !defined(__XMK__) */
 
 /* Condition Variables */
 
This page took 0.055946 seconds and 5 git commands to generate.