From owner-freebsd-questions Tue Jul 27 18:53:21 1999 Delivered-To: freebsd-questions@freebsd.org Received: from misha.cisco.com (misha.cisco.com [171.69.206.50]) by hub.freebsd.org (Postfix) with ESMTP id 5EB4215403; Tue, 27 Jul 1999 18:53:09 -0700 (PDT) (envelope-from mi@misha.cisco.com) Received: (from mi@localhost) by misha.cisco.com (8.9.3/8.9.1) id VAA07686; Tue, 27 Jul 1999 21:50:33 -0400 (EDT) (envelope-from mi) Message-Id: <199907280150.VAA07686@misha.cisco.com> Subject: uthread_init.c: 'Cannot get stdio flags' :-( To: questions@freebsd.org, stable@freebsd.org Date: Tue, 27 Jul 1999 21:50:32 -0400 (EDT) Cc: eischen@vigrid.com, jb@cimlogic.com.au 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-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello! 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: 1157 ktrace RET ktrace 0 1157 ktrace CALL execve(0xbfbfdc23,0xbfbfdaec,0xbfbfdb00) 1157 ktrace NAMI "/usr/local/sbin/faxsend.bin" 1157 faxsend.bin RET execve 0 1157 faxsend.bin CALL getpid 1157 faxsend.bin RET getpid 1157/0x485 1157 faxsend.bin CALL fcntl(0,0x3,0) 1157 faxsend.bin RET fcntl -1 errno 9 Bad file descriptor 1157 faxsend.bin CALL write(0x2,0xbfbfd9ac,0x6e) 1157 faxsend.bin GIO fd 2 wrote 110 bytes "Fatal error 'Cannot get stdio flags' at line ? in file /usr/src/lib/libc_r/ut\ hread/uthread_init.c (errno = ?) " 1157 faxsend.bin RET write 110/0x6e 1157 faxsend.bin CALL setitimer(0x2,0xbfbfd968,0) 1157 faxsend.bin RET setitimer 0 1157 faxsend.bin CALL close(0xffffffff) 1157 faxsend.bin RET close -1 errno 9 Bad file descriptor 1157 faxsend.bin CALL close(0xffffffff) 1157 faxsend.bin RET close -1 errno 9 Bad file descriptor 1157 faxsend.bin PSIG SIGSEGV SIG_DFL First the thread library panics and then segfaults before our main() even gets a chance to do anything... The entire app is compiled with "-D_THREADSAFE -pthread" and linked with "-pthread -static" (tried dynamic too). The only other library -- -lm is not rebuilt with thread awareness, though. The problem is perfectly reproducible on FreeBSD 3.0-RELEASE as well as on 3.2-RELEASE... Thanks in advance for any hints. Yours sincerely, -mi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message