Skip to content

Commit

Permalink
6993 DEFAULT_TYPE should be probably be removed from pthread.h
Browse files Browse the repository at this point in the history
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Robert Mustacchi <rm@joyent.com>
  • Loading branch information
Richard PALO authored and rmustacc committed Jun 6, 2016
1 parent 565657c commit a90d75b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 21 deletions.
11 changes: 3 additions & 8 deletions usr/src/head/pthread.h
Expand Up @@ -69,11 +69,6 @@ extern "C" {
#define PTHREAD_PROCESS_SHARED 1 /* = USYNC_PROCESS */
#define PTHREAD_PROCESS_PRIVATE 0 /* = USYNC_THREAD */

#define _DEFAULT_TYPE PTHREAD_PROCESS_PRIVATE
#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
#define DEFAULT_TYPE _DEFAULT_TYPE
#endif

/*
* mutex types
* keep these in synch which sys/synch.h lock flags
Expand Down Expand Up @@ -113,13 +108,13 @@ extern "C" {
* should be consistent with the definition for pthread_mutex_t).
*/
#define PTHREAD_MUTEX_INITIALIZER /* = DEFAULTMUTEX */ \
{{0, 0, 0, _DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}
{{0, 0, 0, PTHREAD_PROCESS_PRIVATE, _MUTEX_MAGIC}, {{{0}}}, 0}

#define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \
{{{0, 0, 0, 0}, _DEFAULT_TYPE, _COND_MAGIC}, 0}
{{{0, 0, 0, 0}, PTHREAD_PROCESS_PRIVATE, _COND_MAGIC}, 0}

#define PTHREAD_RWLOCK_INITIALIZER /* = DEFAULTRWLOCK */ \
{0, _DEFAULT_TYPE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER, \
{0, PTHREAD_PROCESS_PRIVATE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER, \
PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER}

/* cancellation type and state */
Expand Down
4 changes: 1 addition & 3 deletions usr/src/lib/libc/port/threads/pthr_barrier.c
Expand Up @@ -24,8 +24,6 @@
* Use is subject to license terms.
*/

#pragma ident "%Z%%M% %I% %E% SMI"

#include "lint.h"
#include "thr_uberdata.h"
#include <pthread.h>
Expand Down Expand Up @@ -94,7 +92,7 @@ pthread_barrier_init(pthread_barrier_t *barrier,
int type;

if (attr == NULL)
type = DEFAULT_TYPE;
type = PTHREAD_PROCESS_PRIVATE;
else if ((ap = attr->__pthread_barrierattrp) != NULL)
type = ap->pshared;
else
Expand Down
6 changes: 2 additions & 4 deletions usr/src/lib/libc/port/threads/pthr_cond.c
Expand Up @@ -24,8 +24,6 @@
* Use is subject to license terms.
*/

#pragma ident "%Z%%M% %I% %E% SMI"

#include "lint.h"
#include "thr_uberdata.h"

Expand All @@ -41,7 +39,7 @@ pthread_condattr_init(pthread_condattr_t *attr)

if ((ap = lmalloc(sizeof (cvattr_t))) == NULL)
return (ENOMEM);
ap->pshared = DEFAULT_TYPE;
ap->pshared = PTHREAD_PROCESS_PRIVATE;
ap->clockid = CLOCK_REALTIME;
attr->__pthread_condattrp = ap;
return (0);
Expand Down Expand Up @@ -143,7 +141,7 @@ pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
int error;

if (attr == NULL) {
type = DEFAULT_TYPE;
type = PTHREAD_PROCESS_PRIVATE;
clock_id = CLOCK_REALTIME;
} else if ((ap = attr->__pthread_condattrp) != NULL) {
type = ap->pshared;
Expand Down
4 changes: 2 additions & 2 deletions usr/src/lib/libc/port/threads/pthr_mutex.c
Expand Up @@ -40,7 +40,7 @@ pthread_mutexattr_init(pthread_mutexattr_t *attr)

if ((ap = lmalloc(sizeof (mattr_t))) == NULL)
return (ENOMEM);
ap->pshared = DEFAULT_TYPE;
ap->pshared = PTHREAD_PROCESS_PRIVATE;
ap->type = PTHREAD_MUTEX_DEFAULT;
ap->protocol = PTHREAD_PRIO_NONE;
ap->robustness = PTHREAD_MUTEX_STALLED;
Expand Down Expand Up @@ -222,7 +222,7 @@ pthread_mutex_init(pthread_mutex_t *_RESTRICT_KYWD mutex,
if (ap->protocol == PTHREAD_PRIO_PROTECT)
prioceiling = ap->prioceiling;
} else {
type = DEFAULT_TYPE | PTHREAD_MUTEX_DEFAULT |
type = PTHREAD_PROCESS_PRIVATE | PTHREAD_MUTEX_DEFAULT |
PTHREAD_PRIO_NONE | PTHREAD_MUTEX_STALLED;
}

Expand Down
6 changes: 2 additions & 4 deletions usr/src/lib/libc/port/threads/pthr_rwlock.c
Expand Up @@ -24,8 +24,6 @@
* Use is subject to license terms.
*/

#pragma ident "%Z%%M% %I% %E% SMI"

#include "lint.h"
#include "thr_uberdata.h"

Expand All @@ -41,7 +39,7 @@ pthread_rwlockattr_init(pthread_rwlockattr_t *attr)

if ((ap = lmalloc(sizeof (rwlattr_t))) == NULL)
return (ENOMEM);
ap->pshared = DEFAULT_TYPE;
ap->pshared = PTHREAD_PROCESS_PRIVATE;
attr->__pthread_rwlockattrp = ap;
return (0);
}
Expand Down Expand Up @@ -109,7 +107,7 @@ pthread_rwlock_init(pthread_rwlock_t *_RESTRICT_KYWD rwlock,
int type;

if (attr == NULL)
type = DEFAULT_TYPE;
type = PTHREAD_PROCESS_PRIVATE;
else if ((ap = attr->__pthread_rwlockattrp) != NULL)
type = ap->pshared;
else
Expand Down

0 comments on commit a90d75b

Please sign in to comment.