ioctl call for /dev/ttyb

ioctl call for /dev/ttyb

Post by spect.. » Thu, 03 Jun 1993 05:56:07

After opening Sun serial port /dev/ttyb with

     if ((fd = open("/dev/ttyb", O_RDWR)) < 0) {
        printf("Error opening /dev/ttyb, errno %d\n", errno);

which is successful, any attempt at an ioctl call, such as

     ioctl(fd, TCGETA, &buf);

where buf is defined via

     struct termio buf;

returns -1, with an errno of 25 (inappropriate ioctl for device).  This
happens for all ioctl requests listed in the manual pages for termio(4).

I find this mightily puzzling.  Any helpful comments?

Thanks in advance.

BJD Marrocco


ioctl call for /dev/ttyb

Post by Graeme G Love IE » Fri, 04 Jun 1993 23:51:02

>After opening Sun serial port /dev/ttyb with

>which is successful, any attempt at an ioctl call, such as

>     ioctl(fd, TCGETA, &buf);

>returns -1, with an errno of 25 (inappropriate ioctl for device).  This
>happens for all ioctl requests listed in the manual pages for termio(4).

>BJD Marrocco

Are you using the gcc compiler. I had similar problems with ioctl() calls
when I used gcc but they all cleared up when I switched to cc. Apparently
there is some options flag which can be used with gcc to solve this sort
of problem (but I don't know what :-)

Hope this is of some help






1. Sun to Linux via term, NOGO: term < /dev/ttyb > /dev/ttyb,

Hi, well, what I am trying to do is have a Sun at work dial my Linux box
at home, Sun
logs onto Linux starts 'term' up, escapes and then runs 'term' on Sun.
Then all will
be good with the world since I, sitting at my Linux box, can now trsh,
tupload, etc.
all around the world...

My system works fine when I originate the call from Linux, start term on Sun,
escape to Linux and do 'term < /dev/modem > /dev/modem'. Trouble is I'm
doing it the other way round now, and when on the Sun I escape and do
'term < /dev/ttyb > /dev/ttyb', I get something like:   /dev/ttyb: Device Busy.

Well, it makes sense that the Sun should be 'protecting' that device that is
in use. Linux is kind of free and easy and let's me do term < /dev/modem
even though the device is in use (as though Linux thinks I actually know what I
am doing :-).  Are there any workarounds to this? the permission of the modem
serial line on Sun are:

crw-rw-rw-  1 root      12,   0 Sep 16 22:45 /dev/ttyb

And it stays this way while in use.
(I barely know enough about file permissions and devices under Linux, please
forgive me that I know even less about SunOS) On the Sun I've tried using both
kermit and tip, doesn't matter, both give Device Busy errors. term -v/dev/ttyb
also fails.

Is there another way to go about things? I would like to still run term
< /dev/modem > /dev/modem
on Linux side, but how do I run term on the Sun side? I have no shell
running on Sun
connected via modem to Linux. Arrrg this is driving me batty!! Is there
a way I can have
the Sun dial to Linux _and_ provide getty to me (presumably I sit in a
comm package
and do ATA when Sun calls, then log into it).

Any help would be greatly appreciated, I've been banging my head against
the wall
on this for days!


2. catch exec #@$%@!

3. Locking /dev/ttya or /dev/ttyb

4. Please help urgent win98 network printer set up with Rh6

5. Solaris 2.5.1 and SIOCG* ioctl calls on /dev/tcp

6. splitinf problem

7. ioctl() calls on /dev/ttya

8. HOW TO: get setenv?

9. ioctl call for block-dev size

10. Setting the line speed on /dev/ttyb

11. My /dev/ttyb is dead :-(

12. Help - no /dev/ttyb on Solaris 2.1 for x86

13. Configuring serial port (/dev/ttyb) on Ultra1