Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jul 1999 12:22:49 -0400
From:      "Lawrence D. Lopez" <lawlopez@cisco.com>
To:        mi@aldan.algebra.com
Cc:        questions@freebsd.org, stable@freebsd.org, eischen@vigrid.com, jb@cimlogic.com.au
Subject:   Re: uthread_init.c: 'Cannot get stdio flags' :-(
Message-ID:  <379F2E59.FA8EA348@cisco.com>
References:  <199907280157.VAA07727@misha.cisco.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Oh shucks, give me something hard.

HylaFAX closed fd 0 before it did
a fork exec.

Threads require fd 0 to exist.

	Larry

Mikhail Teterin wrote:
> 
> 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?379F2E59.FA8EA348>