From owner-freebsd-stable Wed Jul 28 5:41:55 1999 Delivered-To: freebsd-stable@freebsd.org Received: from misha.cisco.com (misha.cisco.com [171.69.206.50]) by hub.freebsd.org (Postfix) with ESMTP id 6CCAB15472 for ; Wed, 28 Jul 1999 05:41:50 -0700 (PDT) (envelope-from mi@misha.cisco.com) Received: (from mi@localhost) by misha.cisco.com (8.9.3/8.9.1) id IAA08428; Wed, 28 Jul 1999 08:38:34 -0400 (EDT) (envelope-from mi) Message-Id: <199907281238.IAA08428@misha.cisco.com> Subject: Re: uthread_init.c: 'Cannot get stdio flags' :-( In-Reply-To: <379E8126.3541FDA9@vigrid.com> from "Daniel M. Eischen" at "Jul 28, 1999 00:03:50 am" To: "Daniel M. Eischen" Date: Wed, 28 Jul 1999 08:38:34 -0400 (EDT) Cc: jb@cimlogic.com.au, mi@aldan.algebra.com, stable@freebsd.org Reply-To: mi@aldan.algebra.com From: Mikhail Teterin X-Mailer: ELM [version 2.4ME+ PL60 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Daniel M. Eischen once wrote: > John Birrell wrote: > > Mikhail Teterin wrote: > > > Under what circumstances could a panic: > > > > > > Fatal error 'Cannot get stdio flags' at line ? in file > > > /usr/src/lib/libc_r/uthread/uthread_init.c (errno = ?) > > > > > > be triggered? > > > > > > We are trying to replace HylaFAX's ${PREFIX}/sbin/faxsend with our > > > own application, which is written with threads. The app works fine > > > if called directly -- from command line. But it dies a horrible > > > death when actually invoked by HylaFAX's ${PREFIX}/sbin/faxq. Here > > > is a rather short ktrace produced by replacing faxsend with a > > > shell wrapper: > > > > Looks like ${PREFIX}/sbin/faxq has closed file descriptor 0 (stdin). > > It's legal to do that, so our thread initialisation will have to > > check for EBADF and not fail in that case. > > Assuming it's also legal for stdout and stderr, is this what you had > in mind (not compiled or tested)? Thank you very much! We will try the patch today and let you know. Yours, -mi Index: uthread_init.c =================================================================== RCS file: /opt/b/CVS/src/lib/libc_r/uthread/uthread_init.c,v retrieving revision 1.16 diff -r1.16 uthread_init.c 309,313c309,320 < if ((_thread_fd_table_init(0) != 0) || < (_thread_fd_table_init(1) != 0) || < (_thread_fd_table_init(2) != 0)) { < PANIC("Cannot initialize stdio file descriptor " < "table entries"); --- > if ((_thread_fd_table_init(0) != 0) && > (errno != EBADF)) > PANIC("Cannot initialize stdin file descriptor " > "table entry"); > else if ((_thread_fd_table_init(1) != 0) && > (errno != EBADF)) > PANIC("Cannot initialize stdout file descriptor " > "table entry"); > else if ((_thread_fd_table_init(2) != 0) && > (errno != EBADF)) > PANIC("Cannot initialize stderr file descriptor " > "table entry"); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message