One problem about ioctl during porting from Solaris to Linux

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi,

During porting one application from Solaris to Linux, we encountered one
problem about the function iotcl.
Our codes are as below:
===============================================================
        if (ioctl(4, I_PUSH, "ptem") < 0) {
            printf(" Error\n");
        }
===============================================================

we found the return value of ioctl is always <0.
Could anyone tell us how to deal with this issue? Is there any replacement
on Linux?

Thanks in advance!

Yu




Re: One problem about ioctl during porting from Solaris to Linux
Quoted text here. Click to load it


This looks like code for managing a pseudo-terminal.  My first guess
would be that the very bad idea of supplying the file descriptor as a
constant in your ioctl call has come back to bite you as you port the
code.  Any additional or fewer opens of file descriptors prior to
creating the pseudo terminal will break your code.  Assign the return
from the open of the pseudo terminal to a variable and supply that
variable to your ioctl call.

Re: One problem about ioctl during porting from Solaris to Linux

Quoted text here. Click to load it

Worse than that, I_PUSH is a STREAMS module push. Linux does not use STREAMS
and hence the existance of LiS (http://www.gcom.com/home/linux/lis /). He
just needs Linux specific pseudo terminal code.

There have been several responses in: comp.os.linux.development.system

Cheers,
--
John McCallum,
Artesyn CP, Edinburgh

We've slightly trimmed the long signature. Click to see the full one.

Site Timeline