From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11064 Path: news.gmane.org!.POSTED!not-for-mail From: Markus Wichmann Newsgroups: gmane.linux.lib.musl.general Subject: Re: No definition of PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP in musl Date: Mon, 20 Feb 2017 17:24:19 +0100 Message-ID: <20170220162419.dxpcdbp23up3iopr@voyager> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1487607884 10124 195.159.176.226 (20 Feb 2017 16:24:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 20 Feb 2017 16:24:44 +0000 (UTC) User-Agent: NeoMutt/20170113 (1.7.2) To: musl@lists.openwall.com Original-X-From: musl-return-11079-gllmg-musl=m.gmane.org@lists.openwall.com Mon Feb 20 17:24:39 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cfqlL-0001sU-TN for gllmg-musl@m.gmane.org; Mon, 20 Feb 2017 17:24:32 +0100 Original-Received: (qmail 5346 invoked by uid 550); 20 Feb 2017 16:24:35 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 5318 invoked from network); 20 Feb 2017 16:24:34 -0000 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K0:41UcOZA+rD3VU5716nZOt8pO6qUNeY1oINR+GXBNgdeLy7NynBQ dqAl9n9aOFx6FpRU8Dbv4I0JSIDWGvV0LQWARt9Chr5wQuZCaSUnVRCKLLLRqyf+xU8wwkk PchhWA8XDN7/If5bXeoM1fq9c3CacoqB1mzNHuxxeotgEYc4TDcIXuySqxvhVYIDAYEXZY3 D14c9yzr1GMQSI6reb24w== X-UI-Out-Filterresults: notjunk:1;V01:K0:LAcU8j3QMYs=:MLKQ+ho4eHEpdRaVbB/1me pYSSK9gPlQBiDtbEoFOJGrbFuvJ5cJEs+Xp2FhlhrBaIVRO6NzZuY2zcetWs3FqLlG4iLAmDM pG8Bl4wcFiDaZwArhvNyZnkpWuk/OKVfJk/Bs7gOGbJPn5hUdUiy0W/QYKelagbw5A3qmFVvh CVlgOfc9GeOb3uaA4MEunEj3knby61XQgMJACU00AFXRp3jxkxITpHi2Xz1YXOXFebMtLV6oX Lc6FYJOHS7ugySbry+7mX09D1yzdPxzRBKigGwK3iwYZHxj03VNZcNU/ni7nXVdeJg/mK/2Dh z9J+J5A0hGcUhbvWB03/x0FR1mx65Zh4X+w6ePFguei4rF1dSNmbSW2sbYf2xdET2TICcIN93 HFBcY4nlIByZAY5geAKTlcTngxsz6sacG2zsenJAbKLS8KX0NGKm2iemcIfCWULyZXtH5NSHV 57O3TreR0jozhET92GSOND0VIKrObkzOUJ4Q0Y8rsdlV7EXpiyqByZMBksrgk23GreaezmCwM rJx/upC6ZgWomoExFtTkCfm/7bscHXUPJ7bSte4PJNhF7rB/blMxliVL76S2TtNSc5udSukDO QQ/eTtRZWDhazr5eH7dUULLKCXEw+VVjW22YLIqaDQJjihaRKrWJCpGaVUul4n5cn0YwlaUpJ 4MtyXe0xpyWsaAsGxE64KZJJ6a65NxCjFnLtPWnq++rjH7nTmldxaZdkZWpVzUfgGICiPYXZ1 yx9H+4lubsmKLCoKmiQMSpM8NggFwTGNvtVJYUs9ANoyU006cdHr2UpRUAM= Xref: news.gmane.org gmane.linux.lib.musl.general:11064 Archived-At: On Mon, Feb 20, 2017 at 03:22:41PM +0000, Raphael Cohn wrote: > Hi, > > Whilst trying to compile ReOpenLDAP (https://github.com/ReOpen/ReOpenLDAP), > a fork of OpenLDAP, I'm running into a wall. Some of the code wants a > definition of PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP. musl doesn't define > this; I suspect this is a non-portable glibc extension in pthread.h. Does > any one have any ideas how I might workaround this? Is there an alternative > construction that the code could use? > Well, not directly. PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is an initializer that makes a mutex recursive. What you could do is look for a single use initialization function. Then you could replace static pthread_mutex_t mut = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; with static pthread_mutex_t mut; ... pthread_mutexattr_t mutattr = {0}; pthread_mutexattr_init(&mutattr); pthread_mutexattr_settype(&mutattr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&mut, &mutattr); pthread_mutexattr_destroy(&mutattr); ... That's the portable way to do it. However, the nonportable solution is generally used to avoid the one-time initialization otherwise necessary. As such, there may not be a place for you to put the above snippet. In that case you may have to introduce such a function. Alternatively, you could look up the effects the above snippet has on the mutex under musl, at least at the moment, and declare the nonportable initializer yourself. At the moment, I think it would be #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP {{PTHREAD_MUTEX_RECURSIVE}} > Any help gladly appreciated. > Hope it helps. > Raph > Ciao, Markus