Loans - Credit Card - Cheap Car Insurance - Auto Loans - Loans
One problem about ioctl during porting from Solaris to Linux [Archive] - DunLUG - Dunedin Linux Users Group

View Full Version : One problem about ioctl during porting from Solaris to Linux


Gavin Yu
22-09-2005, 09:09 PM
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

John McCallum
23-09-2005, 01:24 AM
Ari Rankum wrote:

> 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 (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

For email, leave the web and we're not so small.