Open3 : tcgetattr: Inappropriate ioctl for device

  • Permalink
  • submit to reddit
  • Email
  • Follow

I'm using Open3 to simulate a pseudo-terminal connection with ssh.
Everything seems to work well except i get the following warning/error
when connecting :

tcgetattr: Inappropriate ioctl for device

here is my ruby code :
#! /usr/bin/env ruby

require 'open3'


system "stty cbreak isig" #  isig unusefull ?

# tcgetattr: Inappropriate ioctl for device
Open3.popen3("ssh -t -t TT") { |stdin, stdout, stderr|
  #stdin.puts "cd /mnt/fat/4tt;ls -Al"
  Thread.start do
    while c=STDIN.getc
      stdin.print c.chr
  Thread.start do
    while line=stderr.gets
      puts ansi_red+line.chomp+ansi_clear
  while c=stdout.getc
    print c.chr

system "stty -cbreak -isig"

what could be the right ioctl setup ?
I'm a complete newbie in using process, pipe, fork and tty...
Une B�vue
Reply unbewusst.sein859 (187) 9/7/2008 7:42:55 AM

See related articles to this posting
comp.lang.ruby 48846 articles. 5 followers. Post

0 Replies

Similar Articles

[PageSpeed] 32


Similar Artilces:

Inappropriate ioctl for device
My host is using PHP Version 5.2.6, I have no control it's setup There is something strange going on: I pass a variable to a page with tables it works, pass the same to a page using CSS <div> instead of <table> I get the warning PHP "Inappropriate ioctl for device" I am learning how to use CSS, PHP and templates which is supose to simplify life. I is only making mine more confused. The test site is at The problem is with this script I think, it is identical in both file since I cut and paste it. <?php include_once($config['tem...

stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device I am getting this error in a standard ksh script it really doesnt do anything fancy, so Im having a hard time tracking it down.. My main clue is that it does not happen when I run it on a different box in a similar environment.. The only stty that the shell sets is stty istrip. Any ideas (or solutions of course ) appreciated (reasons also appreciated). Thanks Rob On 10/15/2003 10:44 AM, Robert Gease wrote: > stty: : Inappropriate ioctl for device > > I am getting this error in a standard ksh script > it really doesnt do anything fa...

pexpect/termios error: Inappropriate ioctl for device
Hi All, I have a python program that downloads database backups from a remote server, and tries to replace the local database with the downloaded backup. The database is a PostgreSQL server and my program calls the pg_restore command with the aid of the wonderful pexpect module. Everything works fine if I start this program from a tty. When I try to start the same program from cron, I get this nasty exception: Traceback (most recent call last): File "/root/", line 82, in ? main() File "/root/", line 79, in main restore...

Inappropriate ioctl for device when calling tcsetpgrp() on Solaris
Hi all, I'm writing a shell program that will do background/foreground executions. I also implemented the 'fg' command that will bring a background job to the foreground. All work fine on Linux. However, on Solaris (SunOS 5.9) when the shell passes terminal control to the background child process, the tcsetpgrp(fd, child_pgrp_id) call returns an error: "Inappropriate ioctl for device". Although I use same open() call for Linux and Solaris to get the file descriptor of the controlling terminal, Linux successfully returns a fd that I can use while Solaris returns -1 for...

"Inappropriate ioctl for device" error
Hi All I have a korn shell script that calls a child script in the background. The strucuture of my script is as follows: # !bin/ksh .. ... .... while read line do ksh anotherscript.ksh $line & done < file wait exit 0 Everything seems to work well. I see the desired results but the problem (rather small issue is) when i check the log file created by parent process, i see following line appearing multiple times stty: Inappropriate ioctl for device I dont know what this error is and am not sure about the potential threat this poses let's say going forward in pre-production a...

Inappropriate ioctl for device using system("useradd")
My line of code is simply... system("/usr/sbin/useradd $luser -M -n -c '$opts[4]' -d $opts[5] -s $opts[6]") || die "Useradd : $!\n"; and dying with: Useradd : Inappropriate ioctl for device I haven't a clue : ) Running CentOS, 4.4 up to date. Any help is vastly appreciated. -- samasama samasama wrote: > My line of code is simply... > > system("/usr/sbin/useradd $luser -M -n -c '$opts[4]' -d $opts[5] -s > $opts[6]") || die "Useradd : $!\n"; > > and dying with: > Useradd : Inappropriate ioctl for device ...

(unable to open "/dev/acd0"): Inappropriate ioctl for device
I tried to install the port "sysutils/dvd+rw-tools" on a release 5.4 FreeBSD box. The installation process seems to complete without error. But when I tried to issue the command cd /usr/local/bin ./dvd+rw-format /dev/acd0 to format a dvd+rw disk in the drive, I got the following error message: DVD RW/-RAM format utility by, version 4.10 :-(unable to open "/dev/acd0"): Inappropraite ioctl for device I have verified with dmesg to make sure that my DVD+RW drive is at acd0. What does "ioctl for device" mean? What doe...

"Inappropriate ioctl for device" while upload()ing using
I'm using the procedural upload() function from In this line: my $fd_file = upload( 'file' ) or die( "upload() ( $! )" ); I encounter the weird-looking error: "Inappropriate ioctl for device". I don't understand what could be the problem. I did exactly like they say in the manual. Can you please help me solve this problem? Thanks a lot! wrote: > I'm using the procedural upload() function from > In this line: > my $fd_file = upload( 'file' ) or die( "upload() ( $! )" ); What makes you th...

got errstr: "25: Inappropriate ioctl for device" when open ssl....
Hello, I got an error message when trying following script: <? //...... if (!$handle = fsockopen ("ssl://", 443, $errno, $errstr, $timeout = 30)) { print "$errno: $errstr\n"; return -1; /* connection failed */ } /* The site WAS installed with a SSL certificate, and it works perfect if access from a browser with 'https://' prefix. */ //...... ?> The errstr said "25: Inappropriate ioctl for device". I'm using PHP 4.3.0, but not sure if properly compiled with OpenSSL support. How can I check out this? And, even compiled with O...

Unappropriate ioctl for device
Hello, I upgraded Perl from 5.6 to 5.8. The software I develop used to work fine with Perl 5.6 and now, sometimes, I get the error "Unappropriate ioctl for device" when I try to open a file for write. My Perl version is v5.8.0 included in the Debian 'sid' - unstable. Does somebody have an idea ? Thanks, Benoit. -- Ce message a ete poste via la plateforme Web This message has been posted by the Web platform Also sprach Benoit Guillon: > I upgraded Perl from 5.6 to 5.8. The software I develop use...

ioctl and char devices
Hi all, I'm a newbie at least for what regards these 2 topics and I'd like to get some knowledge about them (as I found a lot of confusion around which probably messed up my mind more than explaining). In particular I have my kernel module for a network interface and I'd wish it to communicate with the user space. I'd like to create my OWN private IOCTLS which to use with my userspace app. I read around that what I could try to do is create a character device and make the kernel module and the app access it in read/write mode .. is this possible ? how ? Example code is appreci...

IOCTL problem for network device
Hi all, Iam writing PCI device driver for the custom board that is registered as network driver "zzz0" using register_netdevice() that does bus master DMA data transfer. 1. In my driver, I could do DMA transfer (filling dma memory in the kernel itself) data between pc to board and vice versa by programming the memory mapped device DMA register. Now what I want is that,I want the user application to fill the dma buffer area through IOCTL and to start the transfer. Iam not clear with copy_from_user/ copy_to_user with mmap() function. I hope using mmap gives high preformance. Let m...

call IOCTL for device from dpc?
Hi, can a dpc routine invoke an ioctl of some device ? if that is not possible, then is it possible that the dpc lowers the irql of the processor , starts a system thread at PASSIVE_LEVEL which invokes the ioctl. will this thread be scheduled by the dispatcher or start executign str8 away at the point that the dpc invoked it? thanks kutty No. Just call ExQueueWorkItem from the DPC to call the IOCTL. BTW - on what IOCTL you're speaking about? -- Maxim Shatskih, Windows DDK MVP StorageCraft Corporation ...

define my own IOCTL numbers for a network device
Hi all, I'm writing a driver module for a wireless interface (under linux). The module is currently able to process the ioctls coming from wireless tools (such as changing ESSID or freq etc... I see that iwtools offer a set of "private" IOCTL numbers for driver specific purposes (SIOCIWFIRSTPRIV). What I don't understand is HOW to define my own *additional* ioctl numbers and using them from the userspace. I've been trying something like this in the kernel module: #define IOCTL_APP_TYPE 'k' #define USER_APP_IOCTL _IOWR(IOCTL_APP_TYPE,0, struct iwreq *...

burncd: ioctl(CDIOCSTART): Device busy
I used to be able to burn CDs, but a couple of days ago, while I was writing some backups, it stopped working. dmesg shows that the device is still recognized: ata1-master: two atapi devices on this channel, no DMA acd0: CDROM <CREATIVE CD4830E> at ata1-master PIO4 ata1-slave: two atapi devices on this channel, no DMA acd1: CD-RW <IDE128 CDWriter> at ata1-slave PIO4 I have /dev/cdrw symlinked to /dev/acd1c, and I used to have no trouble with burncd. This would work fine if I had an ISO image ready: burncd -v -f /dev/cdrw data burn.iso fixate But now...

net device and ioctls communication with sockets
Hi all, I'm wondering why, in order to talk to an net device, I need to open a socket. Even more, I don't understand the reason why this socket has to be AF_INET instead of a std unix socket... which seems more reasonable to me.. Thanks in advance! RM InuY4sha <> writes: >Hi all, >I'm wondering why, in order to talk to an net device, I need to open a >socket. Even more, I don't understand the reason why this socket has >to be AF_INET instead of a std unix socket... which seems more >reasonable to me.. >Thanks in advan...

$! is set to "Inappropriate ioctl..." on Linux
Hi. Running perl5.8.* on Linux (more details later), I get: ============== >echo 'hi' > zzz >echo 'bye' >> zzz >perl -we 'print ".$\!.\n";open FOO, "<zzz" or die "foo\n";print ".$\!.\n"; print <FOO>' ... ..Inappropriate ioctl for device. hi bye ============== - Why is $! getting set if the open was successful? - My open command seems pretty darn simple. Am I doing something wrong? - Is this a known issue? More details: This problem happened on a variety of 2.4 RedHat Linux kernels (Intel and AMD), pl...

Hi 2 weeks ago, i've upgraded my system from kernel 2.6.18 to 2.6.21, now i'm having a situation that i can't understand: I'm having trouble with one program... xdtv xdtv shows only black, no picture, but the sound works ok... my tv-card looks like is running fine because kdetv, tvtime, camstream, etc, all get video and sound from the tv-card, it is just xdtv that doesn't, and i used to use xdtv for recordings. xdtv starts fine, but then it start to give me this errors without stoping: ioctl VIDIOC_STREAMON: Invalid argument ioctl VIDIOC_REQBUFS: Device or resource bu...

fssnap: ioctl: error 16: Device busy
Hello. On a Solaris 9 machine, I'm trying to create a UFS snapshot of my /var, /usr and /opt filesystems. They all fail like this: # fssnap -F ufs -o backing-store=/.backup/backing-stores/opt /opt fssnap: ioctl: error 16: Device busy Why do I get that error message? What's so busy, that a snapshot cannot be created? I read somewhere, that a running NTP daemon might cause this problem - but there's no NTPd running on that box. $ ps -ef | grep -v grep | grep ntp $ I can create snapshots of other filesystems just fine: $ fssnap -i ...

implementing ioctl's for device drivers
hi all, we are beginners in kernel programming. we are writing a device driver. we tried a very simple ioctl to pass an integer pointer from user to kernel space. the problem is that the ioctl_param argument which is supposed to hold the address of the memory in user space(from wer data is to be copied to kernel space,i.e driver)is not getting passed correctly. wen we print the address in user space & wen we print the address getting passed to kernel space they r different. the correct user space location is not getting accessed at all. we have used the get_user to transfer...

[Q] USB Mass Storage Device IOCTL failure
I'm developing a USB mass storage device with an additional functionality. There is no problem in locating the device's symbolic link, using SetupDiXXX functions. But if I try to DeviceIoControl() IOCTL_STORAGE_GET_DEVICE_NUMBER, IOCTL_SCSI_GET_INQUIRY_DATA, and other disk and storage control codes as well, after opening the device through CreateFile() with the following symbolic link name, it fails with the error code 50, which means ERROR_NOT_SUPPORTED. \??\USB#Vid_0c76&Pid_0005#0304281630200#{a5dcbf10-6530-11d2-901f-00c04fb951ed} To be more precise, my USB storage...

implementing ioctl's for device drivers #3
oops ! typing errors... temp is typecast as an int pointer not char pointer as typed. also, the message & msg_ptr are not required. they r actually parts of a bigger code.. not reqd now. ...

implementing ioctl's for device drivers #2
hi, thanks for the help.. im inserting the code ive used for the simple ioctl. //chardev.c /*all necessary header files included*/ #include chardev.h /*header file for ioctl*/ static int Device_open=0; static char Message[80]; static char *msg_ptr; static int device_open(struct inode *inode, struct file *file) { if(Device_open) return -EBUSY; Device_open++; MOD_INC_USE_COUNT; return 0; } static void device_release(struct inode *inode, struct file *file) { Device_open--; MOD_DEC_USE_COUNT; return 0; } int device_ioctl(...

stty: tcgetattr: A specified file does not support the ioctl system call.
This error was found in VCS log on an IBM 570 running AIX 5.2, VCS 3.5. When tried to shutdown/start a resource, this error was logged. (Background, when shutdown/start a resource - VCS engine calls shutdown/startup scripts.) I suspect the error was generated due to root's .profile a line like stty erase ^ I've changed the .profile as follow: tty -s && stty erase ^ Haven't have a chance to run startup/shutdown again. Anyone has seen this error? > This error was found in VCS log on an IBM 570 running AIX 5.2, VCS 3.5. > I suspect the error was generated due to r...