This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH] Fix build error MicroBlaze with __XMK__
- From: Michael Eager <eager at eagercon dot com>
- To: Newlib <newlib at sourceware dot org>
- Date: Thu, 10 Dec 2009 08:48:00 -0800
- Subject: [PATCH] Fix build error MicroBlaze with __XMK__
When building the MicroBlaze target support routines, there are some
duplicate defines.
2009-12-10 Michael Eager <eager@eagercon.com>
Fix errors when building with __XMK__.
* libc/include/sys/types.h: Remove defines PTHREAD_MUTEX_NORMAL,
PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE,
PTHREAD_MUTEX_DEFAULT, PTHREAD_STACK_MIN. Remove pthread_attr_s,
pthread_attr_t, pthread_mutexattr_t.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
Index: libc/include/sys/types.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/types.h,v
retrieving revision 1.31
diff -u -p -r1.31 types.h
--- libc/include/sys/types.h 28 Sep 2009 16:42:21 -0000 1.31
+++ libc/include/sys/types.h 10 Dec 2009 16:43:34 -0000
@@ -349,7 +349,6 @@ 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)
@@ -359,6 +358,8 @@ typedef struct {
} pthread_attr_t;
+#endif /* !defined(__XMK__) */
+
#if defined(_POSIX_THREAD_PROCESS_SHARED)
/* NOTE: P1003.1c/D10, p. 81 defines following values for process_shared. */
@@ -395,63 +396,6 @@ typedef unsigned int pthread_mutex_t;
typedef struct {
int type;
} pthread_mutexattr_t;
-
-
-#if defined(__XMK__)
-/* 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
-
-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
-
-#endif /* defined(__XMK__) */
-
-typedef struct {
- int type;
-} pthread_mutexattr_t;
#else /* !defined(__XMK__) */
typedef __uint32_t pthread_mutex_t; /* identify a mutex */