fopen calls isatty()???

I’m seeing some peculiar behaviour using a resource manager. The rsc.
mgr basically provides an interface to an ethernet driver. Everytime
there is an fopen call to the driver, it internally seems to be calling
isatty() which results in a devctl (cmd=DCMD_CHR_ISATTY). The fopen is a
frequent call but the extra devctl seems to be unnecessary overhead.

Could someone please explain why this is happening? Can it be turned off
in anyway? I’m including a stack trace of the thread when it is blocked
on devctl().

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
#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 seeing some peculiar behaviour using a resource manager. The rsc.
mgr basically provides an interface to an ethernet driver. Everytime
there is an fopen call to the driver, it internally seems to be calling
isatty() which results in a devctl (cmd=DCMD_CHR_ISATTY). The fopen is a
frequent call but the extra devctl seems to be unnecessary overhead.

John told you why it happens – it can’t be turned off.

If you really don’t like it – don’t use the FILE stream libraries.
They do lots of “convenience” stuff for you, which generally results in
extra overhead, but kinda “nice” behaviour.

Instead, use the Posix level – open(), read(), write().

-David

QNX Training Services
I do not answer technical questions by email.