fopen calls isatty()???

Hi,
I’m having some problem using a resource manager. The manager basically
provides an interface to an ethernet driver. Everytime there is an fopen
call to that rscmgr the fopen is resulting in a call to isatty() and
subsequently to devctl (cmd = DCMD_CHR_ISATTY).

Could someone please explain why this is happening? Can this be turned
off? I’ve included a dump of the stack trace where this happens:

Thanks.


#0 0xfe32ee5c in MsgSendv () from
/opt/QNXsdk/target/qnx6/ppcbe/lib/libc.so.2
#1 0xfe34d824 in _devctl () from
/opt/QNXsdk/target/qnx6/ppcbe/lib/libc.so.2 (cmd=DCMD_CHR_ISATTY)
#2 0xfe3163d8 in isatty () from /opt/QNXsdk/target/qnx6/ppcbe/lib/libc.so.2
#3 0xfe33bb3c in __fpbufinit ()
from /opt/QNXsdk/target/qnx6/ppcbe/lib/libc.so.2
#4 0xfe33bc04 in __fpinit () from
/opt/QNXsdk/target/qnx6/ppcbe/lib/libc.so.2
#5 0xfe33c174 in fdopen () from /opt/QNXsdk/target/qnx6/ppcbe/lib/libc.so.2
#6 0xfe33bda0 in _fsopen () from
/opt/QNXsdk/target/qnx6/ppcbe/lib/libc.so.2
#7 0xfe33c804 in fopen () from /opt/QNXsdk/target/qnx6/ppcbe/lib/libc.so.2
#8 0x480b62d8 in nets_gal_get_media_phy (portid=9, p_type=0x4803d9a8)

Dweep Chanana <dweep@photuris.com> wrote:
: I’m having some problem using a resource manager. The manager basically
: provides an interface to an ethernet driver. Everytime there is an fopen
: call to that rscmgr the fopen is resulting in a call to isatty() and
: subsequently to devctl (cmd = DCMD_CHR_ISATTY).
: Could someone please explain why this is happening? Can this be turned
: off? I’ve included a dump of the stack trace where this happens:

fopen() is trying to decide the default buffering mode; if the file is
a terminal device then it sets the mode to line buffering (refer to
setvbuf() docs for description of the various modes). This can not
be turned off, but is completely harmless … just make sure that
your devctl routine in your rscmgr returns ENOSYS for it (if you let it
fall into the default iofunc_devctl_default()) then this is done for you.