Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jul 1999 21:50:32 -0400 (EDT)
From:      Mikhail Teterin <mi@aldan.algebra.com>
To:        questions@freebsd.org, stable@freebsd.org
Cc:        eischen@vigrid.com, jb@cimlogic.com.au
Subject:   uthread_init.c: 'Cannot get stdio flags' :-(
Message-ID:  <199907280150.VAA07686@misha.cisco.com>

next in thread | raw e-mail | index | archive | help
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-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907280150.VAA07686>