One problem about ioctl during porting from Solaris to Linux

Sep 22, 2005 2 Replies

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


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.

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.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required