One problem about ioctl during porting from Solaris to Linux

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

Reply to
Gavin Yu
Loading thread data ...

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.

Reply to
Ari Rankum

Worse than that, I_PUSH is a STREAMS module push. Linux does not use STREAMS and hence the existance of LiS

formatting link
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

For email, leave the web and we're not so small.
Reply to
John McCallum

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.