Why does Perl5 implicitly seem to run unnecessary ioctl() tty checks against various file handles?
From what I understand, this is a long-standing feature of Perl5 and nobody seems to consider it for change. When I say change, I mean 'implement a change to Perl5 to facilitate the enablement or disablement of such ioctl() tty checks' on file handles which you KNOW are NOT tty handles.
I have a TCP/IP socket program and after accept() returns on a new socket, the following strace shows the ioctl()s being called on the new handle. In this context, the ioctl() calls are a waste of CPU and load. Of course, if accept() and ioctl() is called only once, it means nothing much. However, over time, with multiple processes, multiple ioctl() calls...it all adds up.
Is there an existing way to explicitly disable such superfluous ioctl() tty checks on file handles and sockets etc?
If it cannot be disabled, does anyone think such a contextual ability to disable/enable checks is worthy?
Here is the strace excerpt showing a client socket initial connection:
18:21:59.818126 select(8, [6], NULL, NULL, {tv_sec=10, tv_usec=0}) = 1 (in [6], left {tv_sec=9, tv_usec=999997})
18:21:59.818321 accept4(6, {sa_family=AF_INET, sin_port=htons(56124), sin_addr=inet_addr("127.0.0.1")}, [4096->16], SOCK_CLOEXEC) = 7
18:21:59.818419 fcntl(7, F_SETFD, FD_CLOEXEC) = 0
18:21:59.818453 ioctl(7, TCGETS, 0x7ffff5befcd0) = -1 ENOTTY (Inappropriate ioctl for device)