From owner-freebsd-i386@FreeBSD.ORG Sun Apr 10 23:50:22 2005 Return-Path: Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 87B3A16A4CE for ; Sun, 10 Apr 2005 23:50:22 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B5C443D41 for ; Sun, 10 Apr 2005 23:50:22 +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 j3ANoMN6060610 for ; Sun, 10 Apr 2005 23:50:22 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j3ANoMwn060608; Sun, 10 Apr 2005 23:50:22 GMT (envelope-from gnats) Resent-Date: Sun, 10 Apr 2005 23:50:22 GMT Resent-Message-Id: <200504102350.j3ANoMwn060608@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Bill Middleton Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D8C7616A4CE for ; Sun, 10 Apr 2005 23:49:22 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD27C43D4C for ; Sun, 10 Apr 2005 23:49:22 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j3ANnMvF031859 for ; Sun, 10 Apr 2005 23:49:22 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id j3ANnMEJ031857; Sun, 10 Apr 2005 23:49:22 GMT (envelope-from nobody) Message-Id: <200504102349.j3ANnMEJ031857@www.freebsd.org> Date: Sun, 10 Apr 2005 23:49:22 GMT From: Bill Middleton To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: i386/79772: Setting thread stacksize to PTHREAD_STACK_MIN disables thread creation X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2005 23:50:22 -0000 >Number: 79772 >Category: i386 >Synopsis: Setting thread stacksize to PTHREAD_STACK_MIN disables thread creation >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Apr 10 23:50:21 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Bill Middleton >Release: 6.0-CURRENT >Organization: >Environment: FreeBSD myhostname.com 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Wed Apr 6 02:41:00 CEST 2005 flashdict@gmail.com:/u2/freebsd/src/sys/i386/compile/MYKERNEL i386 >Description: Setting stacksize to PTHREAD_STACK_MIN disables new thread creation with EAGAIN and strerror: Resource temporarily unavailable This when linked against libthr or libpthread. libc_r works ok. >How-To-Repeat: Compile the following C program and link against each of the three libs. void thread_main (void *arg) { sleep (10); } int main () { static pthread_t t1,t2; static pthread_attr_t attr; int ret; size_t mysize; ret = pthread_attr_init (&attr); ret = pthread_attr_getstacksize (&attr, &mysize); printf("Current stacksize is %d\n",mysize); printf("Starting a new thread\n"); pthread_create (&t1, &attr, thread_main, NULL); if(ret == 0) printf("Thread created ok\n"); printf("Setting stacksize to PTHREAD_STACK_MIN: %d\n",PTHREAD_STACK_MIN); ret = pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN); if(ret == 0) printf("Stacksize changed ok\n"); else printf("Couldn't set stacksize: %s",strerror (ret)); ret = pthread_attr_getstacksize (&attr, &mysize); printf("New stacksize is %d\n",mysize); printf("Starting another new thread\n"); ret = pthread_create (&t2, &attr, thread_main, NULL); if(ret == 0) printf("Thread created ok\n"); else printf("Couldn't create thread: %s\n",strerror (ret)); } >Fix: Heh. I wish. >Release-Note: >Audit-Trail: >Unformatted: