Date: Wed, 28 Jul 1999 08:38:34 -0400 (EDT) From: Mikhail Teterin <mi@aldan.algebra.com> To: "Daniel M. Eischen" <eischen@vigrid.com> Cc: jb@cimlogic.com.au, mi@aldan.algebra.com, stable@freebsd.org Subject: Re: uthread_init.c: 'Cannot get stdio flags' :-( Message-ID: <199907281238.IAA08428@misha.cisco.com> In-Reply-To: <379E8126.3541FDA9@vigrid.com> from "Daniel M. Eischen" at "Jul 28, 1999 00:03:50 am"
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907281238.IAA08428>
