From owner-freebsd-threads@FreeBSD.ORG Mon Mar 14 11:01:34 2005 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E1C4B16A4EA for ; Mon, 14 Mar 2005 11:01:33 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C8BB43D3F for ; Mon, 14 Mar 2005 11:01:33 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j2EB1XFT090484 for ; Mon, 14 Mar 2005 11:01:33 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j2EB1Wg0090478 for freebsd-threads@freebsd.org; Mon, 14 Mar 2005 11:01:32 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 14 Mar 2005 11:01:32 GMT Message-Id: <200503141101.j2EB1Wg0090478@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Subject: Current problem reports assigned to you X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2005 11:01:34 -0000 Current FreeBSD problem reports Critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2004/04/22] threads/65883threads libkse's sigwait does not work after fork o [2005/01/26] threads/76690threads fork hang in child for (-lc_r & -lthr) 2 problems total. Serious problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/07/18] kern/20016 threads pthreads: Cannot set scheduling timer/Can o [2000/08/26] kern/20861 threads libc_r does not honor socket timeouts o [2001/01/20] threads/24472threads libc_r does not honor SO_SNDTIMEO/SO_RCVT o [2001/01/25] threads/24632threads libc_r delicate deviation from libc in ha o [2001/01/25] kern/24641 threads pthread_rwlock_rdlock can deadlock o [2001/11/26] bin/32295 threads pthread dont dequeue signals o [2002/02/01] threads/34536threads accept() blocks other threads o [2002/05/25] kern/38549 threads the procces compiled whith pthread stoppe o [2002/06/27] threads/39922threads [PATCH?] Threaded applications executed w o [2002/08/04] kern/41331 threads Pthread library open sets O_NONBLOCK flag o [2003/03/02] threads/48856threads Setting SIGCHLD to SIG_IGN still leaves z o [2003/03/10] threads/49087threads Signals lost in programs linked with libc o [2003/05/08] threads/51949threads thread in accept cannot be cancelled s [2004/03/15] kern/64313 threads FreeBSD (OpenBSD) pthread implicit set/un o [2004/08/26] threads/70975threads unexpected and unreliable behaviour when o [2004/09/14] threads/71725threads Mysql Crashes frequently giving Sock Erro o [2004/10/05] threads/72353threads Assertion fails in /usr/src/lib/libpthrea o [2004/10/07] threads/72429threads threads blocked in stdio (fgets, etc) are o [2004/10/21] threads/72953threads fork() unblocks blocked signals w/o PTHRE o [2004/11/25] threads/74370threads Cannot get lwp 0 registers in gdb o [2004/12/08] threads/74856threads dig/host broken w/ libthr o [2004/12/19] threads/75273threads FBSD 5.3 libpthread (KSE) bug o [2004/12/21] threads/75374threads pthread_kill() ignores SA_SIGINFO flag o [2005/01/04] threads/75795threads applications linked with -lc_r can't clos o [2005/01/26] threads/76694threads fork cause hang in dup()/close() function o [2005/03/10] threads/78660threads Java hangs unkillably in STOP state after 26 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/05/26] kern/18824 threads gethostbyname is not thread safe o [2000/06/13] kern/19247 threads uthread_sigaction.c does not do anything o [2000/10/21] kern/22190 threads A threaded read(2) from a socketpair(2) f o [2001/09/09] threads/30464threads pthread mutex attributes -- pshared o [2002/05/02] threads/37676threads libc_r: msgsnd(), msgrcv(), pread(), pwri s [2002/07/16] threads/40671threads pthread_cancel doesn't remove thread from o [2004/07/13] threads/69020threads pthreads library leaks _gc_mutex o [2004/09/21] threads/71966threads Mlnet Core Dumped : Fatal error '_pq_inse o [2004/11/21] threads/74180threads KSE problem. Applications those riched ma o [2005/01/20] threads/76513threads libpthread is not working o [2005/01/29] threads/76821threads Add access to gdb unique thread id o [2005/02/01] threads/76938threads include/unistd.h: ttyname_r prototype mis 12 problems total. From owner-freebsd-threads@FreeBSD.ORG Wed Mar 16 03:31:54 2005 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 760C916A4CE; Wed, 16 Mar 2005 03:31:54 +0000 (GMT) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id EFAA143D3F; Wed, 16 Mar 2005 03:31:53 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from h00609772adf0.ne.client2.attbi.com ([66.30.114.143]) by comcast.net (rwcrmhc12) with ESMTP id <2005031603315201400k030ae>; Wed, 16 Mar 2005 03:31:52 +0000 Received: from h00609772adf0.ne.client2.attbi.com (localhost [127.0.0.1]) j2G3Vdxl067582; Tue, 15 Mar 2005 22:31:39 -0500 (EST) (envelope-from rodrigc@h00609772adf0.ne.client2.attbi.com) Received: (from rodrigc@localhost)j2G3VSmV066994; Tue, 15 Mar 2005 22:31:28 -0500 (EST) (envelope-from rodrigc) Date: Tue, 15 Mar 2005 22:31:28 -0500 (EST) Message-Id: <200503160331.j2G3VSmV066994@h00609772adf0.ne.client2.attbi.com> To: FreeBSD-gnats-submit@freebsd.org From: Craig Rodrigues X-send-pr-version: 3.113 X-GNATS-Notify: cc: das@freebsd.org cc: freebsd-threads@freebsd.org Subject: does not define pthread types X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Craig Rodrigues List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Mar 2005 03:31:54 -0000 >Submitter-Id: current-users >Originator: Craig Rodrigues >Organization: >Confidential: no >Synopsis: does not define pthread types >Severity: serious >Priority: medium >Category: standards >Class: sw-bug >Release: FreeBSD 6.0-CURRENT i386 >Environment: System: FreeBSD dibbler.crodrigues.org 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Tue Mar 15 03:41:34 EST 2005 rodrigc@dibbler.crodrigues.org:/opt/home/rodrigc/xfs/xfs_kernel/sys/i386/compile/XFS_KERNEL i386 >Description: According to: http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html #include should include the definitions of pthread types. This was reported by Brooks Davis: http://lists.freebsd.org/pipermail/freebsd-threads/2005-March/002951.html FreeBSD's currently does not do this, breaking compilation of some software like GridEngine. Creating a new private header file which is included by and should solve this problem. >How-To-Repeat: >Fix: --- src/include/pthread.h.orig Tue Mar 15 11:10:39 2005 +++ src/include/pthread.h Tue Mar 15 22:08:29 2005 @@ -44,6 +44,7 @@ #include #include #include +#include /* * Run-time invariant values: @@ -81,62 +82,6 @@ #define PTHREAD_CANCEL_DEFERRED 0 #define PTHREAD_CANCEL_ASYNCHRONOUS 2 #define PTHREAD_CANCELED ((void *) 1) - -/* - * Forward structure definitions. - * - * These are mostly opaque to the user. - */ -struct pthread; -struct pthread_attr; -struct pthread_cond; -struct pthread_cond_attr; -struct pthread_mutex; -struct pthread_mutex_attr; -struct pthread_once; -struct pthread_rwlock; -struct pthread_rwlockattr; -struct pthread_barrier; -struct pthread_barrier_attr; -struct pthread_spinlock; - -/* - * Primitive system data type definitions required by P1003.1c. - * - * Note that P1003.1c specifies that there are no defined comparison - * or assignment operators for the types pthread_attr_t, pthread_cond_t, - * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. - */ -typedef struct pthread *pthread_t; -typedef struct pthread_attr *pthread_attr_t; -typedef struct pthread_mutex *pthread_mutex_t; -typedef struct pthread_mutex_attr *pthread_mutexattr_t; -typedef struct pthread_cond *pthread_cond_t; -typedef struct pthread_cond_attr *pthread_condattr_t; -typedef int pthread_key_t; -typedef struct pthread_once pthread_once_t; -typedef struct pthread_rwlock *pthread_rwlock_t; -typedef struct pthread_rwlockattr *pthread_rwlockattr_t; -typedef struct pthread_barrier *pthread_barrier_t; -typedef struct pthread_barrierattr *pthread_barrierattr_t; -typedef struct pthread_spinlock *pthread_spinlock_t; - -/* - * Additional type definitions: - * - * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for - * use in header symbols. - */ -typedef void *pthread_addr_t; -typedef void *(*pthread_startroutine_t)(void *); - -/* - * Once definitions. - */ -struct pthread_once { - int state; - pthread_mutex_t mutex; -}; /* * Flags for once initialization. --- src/sys/sys/_pthreadtypes.h.orig Tue Mar 15 22:13:13 2005 +++ src/sys/sys/_pthreadtypes.h Tue Mar 15 22:12:14 2005 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu + * Copyright (c) 1995-1998 by John Birrell + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS__PTHREADTYPES_H_ +#define _SYS__PTHREADTYPES_H_ + +/* + * Forward structure definitions. + * + * These are mostly opaque to the user. + */ +struct pthread; +struct pthread_attr; +struct pthread_cond; +struct pthread_cond_attr; +struct pthread_mutex; +struct pthread_mutex_attr; +struct pthread_once; +struct pthread_rwlock; +struct pthread_rwlockattr; +struct pthread_barrier; +struct pthread_barrier_attr; +struct pthread_spinlock; + +/* + * Primitive system data type definitions required by P1003.1c. + * + * Note that P1003.1c specifies that there are no defined comparison + * or assignment operators for the types pthread_attr_t, pthread_cond_t, + * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. + */ +typedef struct pthread *pthread_t; +typedef struct pthread_attr *pthread_attr_t; +typedef struct pthread_mutex *pthread_mutex_t; +typedef struct pthread_mutex_attr *pthread_mutexattr_t; +typedef struct pthread_cond *pthread_cond_t; +typedef struct pthread_cond_attr *pthread_condattr_t; +typedef int pthread_key_t; +typedef struct pthread_once pthread_once_t; +typedef struct pthread_rwlock *pthread_rwlock_t; +typedef struct pthread_rwlockattr *pthread_rwlockattr_t; +typedef struct pthread_barrier *pthread_barrier_t; +typedef struct pthread_barrierattr *pthread_barrierattr_t; +typedef struct pthread_spinlock *pthread_spinlock_t; + +/* + * Additional type definitions: + * + * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for + * use in header symbols. + */ +typedef void *pthread_addr_t; +typedef void *(*pthread_startroutine_t)(void *); + +/* + * Once definitions. + */ +struct pthread_once { + int state; + pthread_mutex_t mutex; +}; + +#endif /* _SYS__PTHREADTYPES_H_ */ + --- src/sys/sys/types.h.orig Tue Mar 15 22:16:05 2005 +++ src/sys/sys/types.h Tue Mar 15 22:16:22 2005 @@ -44,6 +44,9 @@ #include #include +/* Pthread types */ +#include + #if __BSD_VISIBLE typedef unsigned char u_char; typedef unsigned short u_short; From owner-freebsd-threads@FreeBSD.ORG Thu Mar 17 15:37:05 2005 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6900916A4CF; Thu, 17 Mar 2005 15:37:05 +0000 (GMT) Received: from rwcrmhc11.comcast.net (rwcrmhc14.comcast.net [216.148.227.89]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF6F843D39; Thu, 17 Mar 2005 15:37:04 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from h00609772adf0.ne.client2.attbi.com ([66.30.114.143]) by comcast.net (rwcrmhc14) with ESMTP id <2005031715370401400n3418e>; Thu, 17 Mar 2005 15:37:04 +0000 Received: from h00609772adf0.ne.client2.attbi.com (localhost [127.0.0.1]) j2HFb4nr047096; Thu, 17 Mar 2005 10:37:04 -0500 (EST) (envelope-from rodrigc@h00609772adf0.ne.client2.attbi.com) Received: (from rodrigc@localhost)j2HFb3KW047078; Thu, 17 Mar 2005 10:37:03 -0500 (EST) (envelope-from rodrigc) Date: Thu, 17 Mar 2005 10:37:02 -0500 From: Craig Rodrigues To: Robert Watson Message-ID: <20050317153702.GA45332@crodrigues.org> References: <20050218211808.GA12700@crodrigues.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i cc: tmclaugh@sdf.lonestar.org cc: freebsd-gnats-submit@FreeBSD.org cc: freebsd-threads@FreeBSD.org Subject: Re: threads/76938: include/unistd.h: ttyname_r prototype missing X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Mar 2005 15:37:05 -0000 On Sat, Feb 19, 2005 at 01:32:41PM +0000, Robert Watson wrote: > You might want to ask Kris Kenneway if he could do a scan of the > ports/packages to see what links against the ttyname_r symbol, if > anything. > > Robert N M Watson ----- Forwarded message from Kris Kennaway ----- Date: Wed, 16 Mar 2005 20:54:32 +0000 From: Kris Kennaway To: Craig Rodrigues Subject: ttyname_r Here are the packages that contain a reference to ttyname_r on 5.x. Some may be false positives (e.g. the agenda ones probably are). pointyhat# bzgrep -r ttyname_r . Binary file ./perl-5.8.6_2.tbz matches Binary file ./compat4x-i386-5.3.tbz matches Binary file ./calife-2.8.6.tbz matches Binary file ./gpgme-1.0.2.tbz matches Binary file ./agenda-headers-1.2.0.tbz matches Binary file ./agenda-static-libs-1.2.0.tbz matches Binary file ./agenda-snow-libs-1.2.0.tbz matches Binary file ./splint-3.1.1_2.tbz matches Binary file ./fpc-devel-1.9.2_1.tbz matches Binary file ./elvis-2.2.0.tbz matches Binary file ./xproto-6.6.2.tbz matches Binary file ./bed-0.2.19_2.tbz matches Binary file ./p5-PAR-0.87.tbz matches Binary file ./xorg-libraries-6.8.1_1.tbz matches Binary file ./open-motif-2.2.3_1.tbz matches Binary file ./megapov-1.0_1.tbz matches Binary file ./monodoc-1.0.6.tbz matches Kris -- In God we Trust -- all others must submit an X.509 certificate. -- Charles Forsythe ----- End forwarded message ----- -- Craig Rodrigues rodrigc@crodrigues.org From owner-freebsd-threads@FreeBSD.ORG Thu Mar 17 15:40:06 2005 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78C7C16A4CE for ; Thu, 17 Mar 2005 15:40:06 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF48743D54 for ; Thu, 17 Mar 2005 15:40:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j2HFe5Mj064500 for ; Thu, 17 Mar 2005 15:40:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j2HFe5uB064499; Thu, 17 Mar 2005 15:40:05 GMT (envelope-from gnats) Date: Thu, 17 Mar 2005 15:40:05 GMT Message-Id: <200503171540.j2HFe5uB064499@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: Craig Rodrigues Subject: Re: threads/76938: include/unistd.h: ttyname_r prototype missing X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Craig Rodrigues List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Mar 2005 15:40:06 -0000 The following reply was made to PR threads/76938; it has been noted by GNATS. From: Craig Rodrigues To: Robert Watson Cc: freebsd-gnats-submit@FreeBSD.org, tmclaugh@sdf.lonestar.org, freebsd-threads@FreeBSD.org Subject: Re: threads/76938: include/unistd.h: ttyname_r prototype missing Date: Thu, 17 Mar 2005 10:37:02 -0500 On Sat, Feb 19, 2005 at 01:32:41PM +0000, Robert Watson wrote: > You might want to ask Kris Kenneway if he could do a scan of the > ports/packages to see what links against the ttyname_r symbol, if > anything. > > Robert N M Watson ----- Forwarded message from Kris Kennaway ----- Date: Wed, 16 Mar 2005 20:54:32 +0000 From: Kris Kennaway To: Craig Rodrigues Subject: ttyname_r Here are the packages that contain a reference to ttyname_r on 5.x. Some may be false positives (e.g. the agenda ones probably are). pointyhat# bzgrep -r ttyname_r . Binary file ./perl-5.8.6_2.tbz matches Binary file ./compat4x-i386-5.3.tbz matches Binary file ./calife-2.8.6.tbz matches Binary file ./gpgme-1.0.2.tbz matches Binary file ./agenda-headers-1.2.0.tbz matches Binary file ./agenda-static-libs-1.2.0.tbz matches Binary file ./agenda-snow-libs-1.2.0.tbz matches Binary file ./splint-3.1.1_2.tbz matches Binary file ./fpc-devel-1.9.2_1.tbz matches Binary file ./elvis-2.2.0.tbz matches Binary file ./xproto-6.6.2.tbz matches Binary file ./bed-0.2.19_2.tbz matches Binary file ./p5-PAR-0.87.tbz matches Binary file ./xorg-libraries-6.8.1_1.tbz matches Binary file ./open-motif-2.2.3_1.tbz matches Binary file ./megapov-1.0_1.tbz matches Binary file ./monodoc-1.0.6.tbz matches Kris -- In God we Trust -- all others must submit an X.509 certificate. -- Charles Forsythe ----- End forwarded message ----- -- Craig Rodrigues rodrigc@crodrigues.org From owner-freebsd-threads@FreeBSD.ORG Fri Mar 18 00:51:10 2005 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF54916A4CE; Fri, 18 Mar 2005 00:51:10 +0000 (GMT) Received: from straycat.dhs.org (h0050da134090.ne.client2.attbi.com [24.60.174.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0E84C43D3F; Fri, 18 Mar 2005 00:51:10 +0000 (GMT) (envelope-from tmclaugh@sdf.lonestar.org) Received: from compass.straycat.dhs.org (compass.straycat.dhs.org [192.168.1.48]) by straycat.dhs.org (8.13.0/8.13.0) with ESMTP id j2I0qJJa018883; Thu, 17 Mar 2005 19:52:20 -0500 (EST) From: Tom McLaughlin To: Craig Rodrigues In-Reply-To: <20050317153702.GA45332@crodrigues.org> References: <20050218211808.GA12700@crodrigues.org> <20050317153702.GA45332@crodrigues.org> Content-Type: text/plain Date: Thu, 17 Mar 2005 19:51:17 -0500 Message-Id: <1111107077.24131.31.camel@compass.straycat.dhs.org> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit cc: freebsd-gnats-submit@FreeBSD.org cc: Robert Watson cc: freebsd-threads@FreeBSD.org Subject: Re: threads/76938: include/unistd.h: ttyname_r prototype missing X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2005 00:51:10 -0000 On Thu, 2005-03-17 at 10:37 -0500, Craig Rodrigues wrote: > ----- Forwarded message from Kris Kennaway ----- > > Date: Wed, 16 Mar 2005 20:54:32 +0000 > From: Kris Kennaway > To: Craig Rodrigues > Subject: ttyname_r > > Here are the packages that contain a reference to ttyname_r on 5.x. > Some may be false positives (e.g. the agenda ones probably are). > > pointyhat# bzgrep -r ttyname_r . > > Binary file ./monodoc-1.0.6.tbz matches Monodoc is mine and it is a false positive too. Thanks. Tom -- BSD# Project - Porting Mono to FreeBSD http://forge.novell.com/modules/xfmod/project/?bsd-sharp From owner-freebsd-threads@FreeBSD.ORG Fri Mar 18 01:00:14 2005 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CCB4016A4CE for ; Fri, 18 Mar 2005 01:00:14 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB2EB43D46 for ; Fri, 18 Mar 2005 01:00:14 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j2I10Egg026353 for ; Fri, 18 Mar 2005 01:00:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j2I10EvQ026352; Fri, 18 Mar 2005 01:00:14 GMT (envelope-from gnats) Date: Fri, 18 Mar 2005 01:00:14 GMT Message-Id: <200503180100.j2I10EvQ026352@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: Tom McLaughlin Subject: Re: threads/76938: include/unistd.h: ttyname_r prototype missing X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Tom McLaughlin List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2005 01:00:14 -0000 The following reply was made to PR threads/76938; it has been noted by GNATS. From: Tom McLaughlin To: Craig Rodrigues Cc: Robert Watson , freebsd-gnats-submit@FreeBSD.org, freebsd-threads@FreeBSD.org Subject: Re: threads/76938: include/unistd.h: ttyname_r prototype missing Date: Thu, 17 Mar 2005 19:51:17 -0500 On Thu, 2005-03-17 at 10:37 -0500, Craig Rodrigues wrote: > ----- Forwarded message from Kris Kennaway ----- > > Date: Wed, 16 Mar 2005 20:54:32 +0000 > From: Kris Kennaway > To: Craig Rodrigues > Subject: ttyname_r > > Here are the packages that contain a reference to ttyname_r on 5.x. > Some may be false positives (e.g. the agenda ones probably are). > > pointyhat# bzgrep -r ttyname_r . > > Binary file ./monodoc-1.0.6.tbz matches Monodoc is mine and it is a false positive too. Thanks. Tom -- BSD# Project - Porting Mono to FreeBSD http://forge.novell.com/modules/xfmod/project/?bsd-sharp From owner-freebsd-threads@FreeBSD.ORG Fri Mar 18 01:30:07 2005 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CF00E16A4CE for ; Fri, 18 Mar 2005 01:30:07 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7C67743D1D for ; Fri, 18 Mar 2005 01:30:07 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j2I1U7v1031410 for ; Fri, 18 Mar 2005 01:30:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j2I1U7Uk031396; Fri, 18 Mar 2005 01:30:07 GMT (envelope-from gnats) Date: Fri, 18 Mar 2005 01:30:07 GMT Message-Id: <200503180130.j2I1U7Uk031396@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: Craig Rodrigues Subject: Re: threads/76938: include/unistd.h: ttyname_r prototype missing X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Craig Rodrigues List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2005 01:30:08 -0000 The following reply was made to PR threads/76938; it has been noted by GNATS. From: Craig Rodrigues To: freebsd-gnats-submit@freebsd.org Cc: tmclaugh@sdf.lonestar.org Subject: Re: threads/76938: include/unistd.h: ttyname_r prototype missing Date: Thu, 17 Mar 2005 20:19:51 -0500 Hi, Poul-Henning recently modified ttyname, but still kept our non-standard ttyname_r, so I am submitting a modified patch. --- lib/libc/gen/ttyname.3.orig Wed Mar 9 17:13:58 2005 +++ lib/libc/gen/ttyname.3 Thu Mar 17 20:00:02 2005 @@ -37,6 +37,7 @@ .Os .Sh NAME .Nm ttyname , +.Nm ttyname_r , .Nm isatty , .Nm ttyslot .Nd get name of associated terminal (tty) from file descriptor @@ -46,7 +47,7 @@ .In unistd.h .Ft char * .Fn ttyname "int fd" -.Ft char * +.Ft int .Fn ttyname_r "int fd" "char *buf" "size_t len" .Ft int .Fn isatty "int fd" @@ -82,7 +83,13 @@ gets the related device name of a file descriptor for which .Fn isatty -is true +is true. +.Pp +.Fn ttyname +returns the name stored in a static buffer which will be overwritten +on subsequent calls. +.Fn ttyname_r +takes a buffer and length as arguments to avoid this problem. .Pp The .Fn ttyslot @@ -100,12 +107,25 @@ a .Dv NULL pointer is returned. +The +.Fn ttyname_r +function returns 0 if successful. Otherwise an error number is returned. .Pp The .Fn ttyslot function returns the unit number of the device file if found; otherwise the value zero is returned. +.Sh ERRORS +.Fn ttyname_r +may return the following error codes: +.Bl -tag -width Er +.It Bq Er ENOTTY +.Fa fd +is not a valid file descriptor. +.It Bq Er ERANGE +.Fa bufsize +is smaller than the length of the string to be returned. .Sh FILES .Bl -tag -width /etc/ttys -compact .It Pa /dev/\(** @@ -123,11 +143,6 @@ function appeared in .At v7 . -.Sh BUGS -The -.Fn ttyname -function leaves its result in an internal static object and returns -a pointer to that object. -Subsequent calls to -.Fn ttyname -will modify the same object. +.Fn ttyname_r +appeared in +.Fx 6.0 . --- lib/libc/gen/ttyname.c.orig Thu Mar 17 10:39:08 2005 +++ lib/libc/gen/ttyname.c Thu Mar 17 11:15:42 2005 @@ -50,6 +50,7 @@ #include #include #include +#include #include "un-namespace.h" #include "libc_private.h" @@ -60,34 +61,32 @@ static pthread_key_t ttyname_key; static int ttyname_init = 0; -char * +int ttyname_r(int fd, char *buf, size_t len) { struct stat sb; - char *rval; struct fiodgname_arg fgn; - rval = NULL; *buf = '\0'; /* Must be a terminal. */ if (!isatty(fd)) - return (rval); + return (ENOTTY); /* Must be a character device. */ if (_fstat(fd, &sb) || !S_ISCHR(sb.st_mode)) - return (rval); + return (ENOTTY); /* Must have enough room */ if (len <= sizeof(_PATH_DEV)) - return (rval); + return (ERANGE); strcpy(buf, _PATH_DEV); fgn.len = len - strlen(buf); fgn.buf = buf + strlen(buf); if (!_ioctl(fd, FIODGNAME, &fgn)) - return(buf); + return (EINVAL); devname_r(sb.st_rdev, S_IFCHR, buf + strlen(buf), sizeof(buf) - strlen(buf)); - return (buf); + return (0); } char * @@ -95,8 +94,12 @@ { char *buf; - if (__isthreaded == 0) - return (ttyname_r(fd, ttyname_buf, sizeof ttyname_buf)); + if (__isthreaded == 0) { + if (ttyname_r(fd, ttyname_buf, sizeof ttyname_buf) != 0) + return (NULL); + else + return (ttyname_buf); + } if (ttyname_init == 0) { _pthread_mutex_lock(&ttyname_lock); @@ -121,6 +124,7 @@ return (NULL); } } - return (ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN)); + ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN); + return (buf); } --- include/unistd.h.orig Thu Feb 17 17:37:41 2005 +++ include/unistd.h Thu Feb 17 17:38:19 2005 @@ -365,6 +365,7 @@ pid_t tcgetpgrp(int); int tcsetpgrp(int, pid_t); char *ttyname(int); +int ttyname_r(int, char *, size_t); int unlink(const char *); ssize_t write(int, const void *, size_t); -- Craig Rodrigues rodrigc@crodrigues.org From owner-freebsd-threads@FreeBSD.ORG Fri Mar 18 15:20:04 2005 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 48A0E16A4DB for ; Fri, 18 Mar 2005 15:20:04 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id F262143D53 for ; Fri, 18 Mar 2005 15:20:03 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j2IFK3NT068765 for ; Fri, 18 Mar 2005 15:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j2IFK3mK068764; Fri, 18 Mar 2005 15:20:03 GMT (envelope-from gnats) Date: Fri, 18 Mar 2005 15:20:03 GMT Message-Id: <200503181520.j2IFK3mK068764@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: Craig Rodrigues Subject: Re: threads/76938: include/unistd.h: ttyname_r prototype missing X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Craig Rodrigues List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2005 15:20:04 -0000 The following reply was made to PR threads/76938; it has been noted by GNATS. From: Craig Rodrigues To: freebsd-gnats-submit@freebsd.org Cc: tmclaugh@sdf.lonestar.org Subject: Re: threads/76938: include/unistd.h: ttyname_r prototype missing Date: Fri, 18 Mar 2005 10:19:30 -0500 Hi, I updated the patch to take care of some buildworld problems in libc_r and libthr (remove two extern declarations of ttyname_r). --- lib/libc/gen/ttyname.3.orig Wed Mar 9 17:13:58 2005 +++ lib/libc/gen/ttyname.3 Thu Mar 17 20:00:02 2005 @@ -37,6 +37,7 @@ .Os .Sh NAME .Nm ttyname , +.Nm ttyname_r , .Nm isatty , .Nm ttyslot .Nd get name of associated terminal (tty) from file descriptor @@ -46,7 +47,7 @@ .In unistd.h .Ft char * .Fn ttyname "int fd" -.Ft char * +.Ft int .Fn ttyname_r "int fd" "char *buf" "size_t len" .Ft int .Fn isatty "int fd" @@ -82,7 +83,13 @@ gets the related device name of a file descriptor for which .Fn isatty -is true +is true. +.Pp +.Fn ttyname +returns the name stored in a static buffer which will be overwritten +on subsequent calls. +.Fn ttyname_r +takes a buffer and length as arguments to avoid this problem. .Pp The .Fn ttyslot @@ -100,12 +107,25 @@ a .Dv NULL pointer is returned. +The +.Fn ttyname_r +function returns 0 if successful. Otherwise an error number is returned. .Pp The .Fn ttyslot function returns the unit number of the device file if found; otherwise the value zero is returned. +.Sh ERRORS +.Fn ttyname_r +may return the following error codes: +.Bl -tag -width Er +.It Bq Er ENOTTY +.Fa fd +is not a valid file descriptor. +.It Bq Er ERANGE +.Fa bufsize +is smaller than the length of the string to be returned. .Sh FILES .Bl -tag -width /etc/ttys -compact .It Pa /dev/\(** @@ -123,11 +143,6 @@ function appeared in .At v7 . -.Sh BUGS -The -.Fn ttyname -function leaves its result in an internal static object and returns -a pointer to that object. -Subsequent calls to -.Fn ttyname -will modify the same object. +.Fn ttyname_r +appeared in +.Fx 6.0 . --- lib/libc/gen/ttyname.c.orig Thu Mar 17 10:39:08 2005 +++ lib/libc/gen/ttyname.c Thu Mar 17 11:15:42 2005 @@ -50,6 +50,7 @@ #include #include #include +#include #include "un-namespace.h" #include "libc_private.h" @@ -60,34 +61,32 @@ static pthread_key_t ttyname_key; static int ttyname_init = 0; -char * +int ttyname_r(int fd, char *buf, size_t len) { struct stat sb; - char *rval; struct fiodgname_arg fgn; - rval = NULL; *buf = '\0'; /* Must be a terminal. */ if (!isatty(fd)) - return (rval); + return (ENOTTY); /* Must be a character device. */ if (_fstat(fd, &sb) || !S_ISCHR(sb.st_mode)) - return (rval); + return (ENOTTY); /* Must have enough room */ if (len <= sizeof(_PATH_DEV)) - return (rval); + return (ERANGE); strcpy(buf, _PATH_DEV); fgn.len = len - strlen(buf); fgn.buf = buf + strlen(buf); if (!_ioctl(fd, FIODGNAME, &fgn)) - return(buf); + return (EINVAL); devname_r(sb.st_rdev, S_IFCHR, buf + strlen(buf), sizeof(buf) - strlen(buf)); - return (buf); + return (0); } char * @@ -95,8 +94,12 @@ { char *buf; - if (__isthreaded == 0) - return (ttyname_r(fd, ttyname_buf, sizeof ttyname_buf)); + if (__isthreaded == 0) { + if (ttyname_r(fd, ttyname_buf, sizeof ttyname_buf) != 0) + return (NULL); + else + return (ttyname_buf); + } if (ttyname_init == 0) { _pthread_mutex_lock(&ttyname_lock); @@ -121,6 +124,7 @@ return (NULL); } } - return (ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN)); + ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN); + return (buf); } --- include/unistd.h.orig Thu Feb 17 17:37:41 2005 +++ include/unistd.h Thu Feb 17 17:38:19 2005 @@ -365,6 +365,7 @@ pid_t tcgetpgrp(int); int tcsetpgrp(int, pid_t); char *ttyname(int); +int ttyname_r(int, char *, size_t); int unlink(const char *); ssize_t write(int, const void *, size_t); --- lib/libc_r/uthread/pthread_private.h.orig Thu Mar 17 21:49:16 2005 +++ lib/libc_r/uthread/pthread_private.h Thu Mar 17 22:13:39 2005 @@ -1213,7 +1213,6 @@ __BEGIN_DECLS char *__ttyname_basic(int); char *__ttyname_r_basic(int, char *, size_t); -char *ttyname_r(int, char *, size_t); void _cond_wait_backout(pthread_t); void _fd_lock_backout(pthread_t); int _find_thread(pthread_t); --- lib/libthr/thread/thr_private.h.orig Thu Mar 17 22:09:53 2005 +++ lib/libthr/thread/thr_private.h Thu Mar 17 22:11:06 2005 @@ -771,7 +771,6 @@ __BEGIN_DECLS char *__ttyname_basic(int); char *__ttyname_r_basic(int, char *, size_t); -char *ttyname_r(int, char *, size_t); void _cond_wait_backout(pthread_t); int _find_thread(pthread_t); pthread_t _get_curthread(void); -- Craig Rodrigues rodrigc@crodrigues.org