X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=vml1x7SdD7FFl4Hc+RMMAoLIbRtn+BBjNzQeHGwBM9Z3MdgD3qoOV loGHyAx2GDFkBPhDrmcZ6v2H5iLgvvPymiEVe0sqmRPCEMJVYLywuYzKkNMIzY/H DTkxQmC4q+8JlQwlyS5Evz+cZK+5y7WPZSRI/Yx9dlD7//L9O7zcMI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=kkVX4eVUatqQNWYbqm38NEOggCQ=; b=HbZQbZvHqQkW0bs7lIRa3tdCeA84 mPRv/hzU4aomXEEdICLrJBpCgW6QgYweHIVeMUHuNReliB9Mq2eil2tOow7slnwC /EJkz0mpBI4kezgQlSUCe41TMv6s93tM9Co2gpjLSnUCdvSOLi1iPmXln1N0VCZr Myvg/hR+JxyKvW4= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-96.6 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=Hx-languages-length:1598 X-HELO: calimero.vinschen.de Date: Wed, 20 Apr 2016 12:50:16 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Cc: "Canham, Timothy K (348C)" Subject: Re: pthread_attr_init() returning errors Message-ID: <20160420105016.GB26118@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com, "Canham, Timothy K (348C)" References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Y7xTucakfITjPcLV" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) --Y7xTucakfITjPcLV Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Apr 19 19:49, Canham, Timothy K (348C) wrote: > I have some code to start a task that suddenly started failing. This is p= retty mature code. Here is the code fragment with my added printf() >=20 > pthread_attr_t att; > int stat =3D pthread_attr_init(&att); > if (stat !=3D 0) { > printf("pthread_attr_init: (%d)(%d): %s\n",stat,errno,strerro= r(stat)); > // return > } >=20 > Here is the output: >=20 > pthread_attr_init: (16)(0): Device or resource busy This is most unusual. What happens is this: A pthread_attr_t is a pointer to a pointer to a struct with a magic number. And at the start of pthread_attr_init this magic number is tested if it's already the magic number expected for an object of type pthread_attr_t. And only if so, the pthread_attr_init function fails with EBUSY. That means, the arbitrary value in the uninitialized att prior to=20 the call to pthread_attr_init is a pointer value which points to valid memory which has the magic value 0xdf0df048. Wow. This means we can't keep up with the tests in the pthread_FOO_init functions since they could point to an *supposedly* initialized=20 object, while in fact the value they point to is only accidentally so that it looks like an initialized object. I provided new developer snapshots on https://cygwin.com/snapshots/ and I've just uploaded a 2.5.1-0.1 test release which you can install via setup as soon as your mirror has catched up. Pleaser give any of them a try. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --Y7xTucakfITjPcLV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXF17nAAoJEPU2Bp2uRE+gijMQAIZ8zf738am+kZf3uYiGdc1x kgZgzVWEQFK4ZJGuPHpfYYlr3ioOjnjOPCl0FjFlonv88mAE+zYrDB7CMHbABRJv hNna+wKJNVcFnqyWtdx5JdpNax0W+AGDqhVkSV7ZyVkAB+iVhFcrzCPm/eV8HaJe +hpJ3UcRIQjMOYQ6YMcKU1wIXZ8/UAZ+7szZsa27EON9Bn4eTTNFfSRuDkEznm/t 86ge3Y+nZHSv1dImlOy87qQIQ9GdJwNmEMb7ADxQw1jwPLgNE3ggrvxD0i6g2GWH xi/G6y9fjSgVm2Yi9hdW35SJahwk24WznvEIHXOgGLRLi8+8x+AGU0J9jBF3dYBW mYhDkDvjOu+IUTKvPlbmKGOc7YRCiZTQjsqUE1E60LjlA5pX/MYgfDy2XdEL9h8M Jyvq8LxSoagzO53yny2CL0edOyBrPuzmyQ+h6XakDK6UqC+IgmSbfY0niomXQDs1 rG4/dFeakc2Op4pUQS8kcd00TyFQ5sB2qK8veOwKN/Jt7iFZGa88v9Xj6L8gCMQJ GzUhsL36jgq/QDJppRbK7t0JjQRl/+BcJYFVo3kfdsa+JHgkBb10uvONKbNMUyXc 8SUU2hlQKotdSo2GNKb/TZE+dBAMnmnPsS2jTYcDGSLuo9fr4LgtWBYAx4Nd/tdC rBebHh5oZnB8yBSAze56 =gGWw -----END PGP SIGNATURE----- --Y7xTucakfITjPcLV--