- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Getting error 25 (ENOTTY) when calling BLOPEN on a...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 01:37 PM - last edited on 12-26-2022 12:39 AM by support_s
12-14-2022 01:37 PM - last edited on 12-26-2022 12:39 AM by support_s
Getting error 25 (ENOTTY) when calling BLOPEN on a file descriptor for a PTS slave device
We are trying to convert from a physical HP9000, HP-UX 10.20 system, to an HP SRP container. We have noticed that when we telnet to the physical HP9000 system we connect as a TTY device, but when we connect the container we connect as a PTS pseudo-terminal. Some of the programs that we run within the system are now complaining that this is not a TTY device (ENOTTY error 25).
I have written a test C program to try to isolate which call is causing the issue, and it seems to be the "BLOPEN" command to open a block mode file descriptor.
#include <stdio.h> #include <sys/fcntl.h> #include <errno.h> #include <sys/ioctl.h> #include <termio.h> #include <signal.h> #include <stropts.h> int main() { int fdm; int fds; char *slavename; int j_bfd; FILE *pf_stream; unsigned short i_c_lflagsav; unsigned short i_c_oflagsav; struct termio s_termio; if ((fdm = open("/dev/ptmx",O_RDWR)) == -1){ printf("Error getting file descriptor %d\n", errno); return -1; } printf("Opened /dev/ptmx\n"); printf("before grantpt\n"); grantpt(fdm); printf("after grantpt\n"); printf("before unlockpt\n"); unlockpt(fdm); printf("after unlockpt\n"); slavename = ptsname(fdm); printf("Slavename\n"); printf("%s\n",slavename); if ((fds = open(slavename,O_RDWR)) == -1){ printf("Error opening slavename\n"); return -1; } ioctl(fds, I_PUSH, "ptem"); /* push ptem */ ioctl(fds, I_PUSH, "ldterm"); /* push ldterm */ /* no echo. */ printf("before no echo\n"); if (ioctl(fds,TCGETA,&s_termio) == -1) { printf("No echo error\n"); return(-1); } i_c_lflagsav = s_termio.c_lflag; i_c_oflagsav = s_termio.c_oflag; printf("Before no tabs\n"); if ((s_termio.c_oflag & TAB3) != 0) { /* set the output mode flag for no altering of tabs */ s_termio.c_oflag &= ~TAB3; /* set new value */ if (ioctl(fds,TCSETA,&s_termio) == -1) { printf("Error\n"); /* try to reset driver to the way it was before we changed it */ s_termio.c_oflag = i_c_oflagsav; /* set old value */ ioctl(fds,TCSETA,&s_termio); return(-1); } } /* get a block mode file descriptor from blopen */ printf("Before block mode open\n"); if ((j_bfd=blopen(fds,O_RDWR)) < 0 ) { printf("Error %d during blopen\n", errno); /* if we changed tab handling then try to reset the driver back. */ printf("Before reset\n"); if (((s_termio.c_oflag & TAB3) != 0)) ioctl(fds,TCSETA,&s_termio); printf("Error getting block mode file descriptor %d\n", j_bfd); return(-1); } return 0; }
The output of the program is
Opened /dev/ptmx
before grantpt
after grantpt
before unlockpt
after unlockpt
Slavename
/dev/pts/0 (I always get /dev/pts/0, even if I run this from multiple terminals? I would've thought I'd get /dev/pts/1, /dev/pts/2, on subsequent terminals?)
before no echo
Before no tabs
Before block mode open
Error 25 during blopen
Before reset
Error getting block mode file descriptor -1
So my question is, does anyone know what causes BLOPEN to generate an error 25? How does it determine if it's a TTY device or not?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 12:15 AM
12-15-2022 12:15 AM
Re: Getting error 25 (ENOTTY) when calling BLOPEN on a file descriptor for a PTS slave dev
I have same problem...