Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^4: Should I worry about "Inappropriate ioctl for device"? (updated)

by jcb (Parson)
on Aug 09, 2020 at 02:29 UTC ( #11120511=note: print w/replies, xml ) Need Help??

in reply to Re^3: Should I worry about "Inappropriate ioctl for device"? (updated)
in thread Should I worry about "Inappropriate ioctl for device"?

Most likely, errno (the system C variable behind the $! magic) was used uninitialized in both cases. The C runtime library never clears errno and only sets errno to report an error. If no such error has occurred since the program started, the value of errno is undefined, which (in C) means unspecified — it is still an integer, as there is no undef value in C. (NULL pointers are a related but slightly different concept — if you could dereference a NULL pointer, you would logically get undef. In reality, you get SIGSEGV if you dereference a NULL pointer and your program crashes.)

Replies are listed 'Best First'.
Re^5: Should I worry about "Inappropriate ioctl for device"? (updated)
by dave_the_m (Monsignor) on Aug 09, 2020 at 08:28 UTC
    More likely still, some part of the C library is doing a terminal-related ioctl() system call on one of the standard filehandles like STDIN, finding that its not in fact a terminal (e.g. because STDIN hs been redirected) and safely ignoring the harmless error. I.e. the C library logic is along the lines of "if this file handle is a terminal do some extra initialisation, otherwise don't worry about it".

    I used to see this on Solaris all the time when doing a truss(1); I don't see it on linux though.


      Updating myself: I can see it on linux too: an ioctl(fh, TCGETS) system call is being done on each file handle that gets opened.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11120511]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2021-06-12 12:35 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (51 votes). Check out past polls.