ioctl() failed at command FIONBIO: Invalid argument

From: UFPEL - CPMET <ufpelrm_at_eu.ansp.br>
Date: Fri, 14 Jun 1996 09:49:18 -0300 (GMT-0300)

Hi managers

My configuration:

        DEC 3000/600, DU V3.2 214, 64MB RAM
        DECserver 90L+
        MicroVAX II, MicroVMS V4.7 (OK, it's old but it's mine)

I'm writing a program to receive data from a MicroVAX's serial port,
attached to the DECServer90L+. I configured LAT on the 3000/600 to bind
the port to a specific lat device, adding the following line to
/etc/latstartup.conf:

/usr/sbin/latcp -A -p 623 -H DEC_SERVER_00 -R MVAX

DEC_SERVER_00 is the server's LAT name and MVAX is the port 7. No
problems in this phase.

I tried to test the port using C-Kemit and the result was a system crash.
Not bad for a simple user proccess, eh?

I wrote a program based on dial.c, a LAT programming example found in the
directory /usr/examples/lat. The program is running OK, but I still get
the message "ioctl() failed at command FIONBIO: Invalid argument". Here
is the code source:

main(argc,argv)
int argc;
char *argv[];
{
   int flags, on = 1;
   struct termios tty_termios;
   struct sgttyb sgtty;

   /*
   * Open reverse LAT device.
   */

   if ( (fd = open(argv[1],O_RDWR)) < 0 ) {
      perror(argv[0]);
      exit(1);
   }
   
   /*
   * get current line attributes
   */
   if ((tcgetattr(fd,&tty_termios) == -1)){
      perror("tcgetattr() failed");
      exit(1);
   }

   /*
   * If CLOCAL happened not to be set, then set it. We need to
   * be in "local" mode to talk to the modem".
   */
   if ((tty_termios.c_cflag & CLOCAL) == 0) {
      tty_termios.c_cflag |= CLOCAL;
      if ((tcsetattr (fd, TCSANOW, &tty_termios) == -1)) {
         perror("tcsetattr() failed at TCSANOW");
         exit(1);
      }
   }

   /*
   * turn off O_NONBLOCK, we don't need it any more
   */
   flags = fcntl (fd, F_GETFL);
   if (flags == -1) {
      perror("fcntl() failed at command F_GETFL");
      exit(1);
   }

   if ((fcntl(fd, F_SETFL, flags & ~O_NONBLOCK) == -1)) {
      perror("fcntl() failed at command F_SETFL");
      exit(1);
   }
 
   /*
   * give LAT time to establish session settings
   */
   sleep(2);

   /*
   * Configura a porta para operacao no modo "transparente"
   */
   if (ioctl(fd, TIOCGETP, &sgtty) < 0)
      perror("ioctl() failed at command TIOCGETP");
   sgtty.sg_flags |= RAW;
   sgtty.sg_flags &= ~ECHO;
   if (ioctl(fd, TIOCSETP, &sgtty) < 0)
      perror("ioctl() failed at command TIOCSETP");

/***** HERE IS THE PROBLEM ********************************************/
   if (ioctl(fd, FIONBIO, &on) < 0)
      perror("ioctl() failed at command FIONBIO");
/**********************************************************************/

   if ((tcgetattr(fd,&tty_termios) == -1))
      perror("tcgetattr() failed");

   if ((tty_termios.c_cflag & CLOCAL) != 0) {
      tty_termios.c_cflag &= ~CLOCAL;
      if ((tcsetattr (fd, TCSANOW, &tty_termios) == -1))
         perror("tcsetattr() failed at TCSANOW");
   }

   /*
   * Captura os sinais de interrupcao, para garantir a restauracao dos
   * parametros da linha.
   */
   signal(SIGHUP, resettty);
   signal(SIGINT, resettty);
   signal(SIGQUIT, resettty);
   signal(SIGBUS, resettty);
   signal(SIGSEGV, resettty);

   rmv_handle();

   close(fd);
   fprintf(stderr,"\nrmvinput: recepcao concluida.\n\n");
}

Can I simply ignore the message, since the program is already running OK?

Side note: Is there any program which will allow to configure the
DECserver90L+ from DU (workstation console)? The only way I found was to
connect a PC with terminal emulator program to a port. The DECserver
owner's manual mention the use of MOP from ULTRIX and VMS but I did not
found MOP under DU.

TIA

I will post a summary, off course...

-----
Carlos A M dos Santos - Analista de Sistemas
Universidade Federal de Pelotas - Centro de Pesquisas Meteorologicas
Pelotas, RS, Brasil - e-mail: ufpelrm_at_eu.ansp.br
Received on Fri Jun 14 1996 - 15:39:16 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT