Project

General

Profile

Bug #6993

DEFAULT_TYPE should be probably be removed from pthread.h

Added by Richard PALO over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
lib - userland libraries
Start date:
2016-05-24
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

pthread.h has the following:

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

as this is only seen :

head/pthread.h:#define  _DEFAULT_TYPE                   PTHREAD_PROCESS_PRIVATE
head/pthread.h:#define  DEFAULT_TYPE                    _DEFAULT_TYPE
head/pthread.h: {{0, 0, 0, _DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}
head/pthread.h: {{{0, 0, 0, 0}, _DEFAULT_TYPE, _COND_MAGIC}, 0}
head/pthread.h: {0, _DEFAULT_TYPE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER,       \
lib/libc/port/threads/pthr_barrier.c:           type = DEFAULT_TYPE;
lib/libc/port/threads/pthr_cond.c:      ap->pshared = DEFAULT_TYPE;
lib/libc/port/threads/pthr_cond.c:              type = DEFAULT_TYPE;
lib/libc/port/threads/pthr_mutex.c:     ap->pshared = DEFAULT_TYPE;
lib/libc/port/threads/pthr_mutex.c:             type = DEFAULT_TYPE | PTHREAD_MUTEX_DEFAULT |
lib/libc/port/threads/pthr_rwlock.c:    ap->pshared = DEFAULT_TYPE;
lib/libc/port/threads/pthr_rwlock.c:            type = DEFAULT_TYPE;

and
uts/intel/io/dnet/dnet.c:                               dnetp->vendor_21140 = DEFAULT_TYPE;
uts/intel/io/dnet/dnet.h:enum   { DEFAULT_TYPE, COGENT_EM_TYPE, ASANTE_TYPE};

the man page doesn't document this at all so it should be safe to remove
and convert gate usage to _DEFAULT_TYPE if not directly to PTHREAD_PROCESS_PRIVATE
as do other pthread implementations.


Files

#1

Updated by Richard PALO over 4 years ago

that didn't come out quite as intended,
dnet defines an enum with an element name having the same value (=0)

#3

Updated by Electric Monk over 4 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit a90d75b828f0c01a350c4ecfc3924fd6456fffaf

commit  a90d75b828f0c01a350c4ecfc3924fd6456fffaf
Author: Richard PALO <richard@NetBSD.org>
Date:   2016-06-06T15:00:22.000Z

    6993 DEFAULT_TYPE should be probably be removed from pthread.h
    Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Robert Mustacchi <rm@joyent.com>

Also available in: Atom PDF