[comp.unix.questions] Talk & select

eed_waek@jhunix (Alexander Kaplan) (05/13/89)

I am trying to compile the BSD talk program (include old/talk
and ntalk) in our mips machine running Umip V.  The operating
system is a mix of Unix V 3.1 with BSD 4.3 socket.  After
some hacking, I found out that I need to modified some ioctl
and signal calls.  I changed all these and setup the inetd.
When I ran both talk and ntalk, I got the same errors.
Let me describe the error from old/talk which is seemed to have
less trouble.
1) When I initiate talk in a hardwired tty line, I get a message
   error waiting daemon with errno 22 -- invalid argument.
2) When I initiate talk in a ttyq line (i.e. ethernet connection),
   I get the same message: error waiting daemon with errno 2 --
   no such file or directory.
3) When I initiate talk in a ttyq line but redirect output to a
   file, I get the same message except with another errno 25 --
   not a typewriter.

When I looked into the program, I found this error was generated
after a call to select.

I am confused!!  Help!  How can different errno result from the
same call under slightly different condition??  Where is the
possible error?  Is it related to the signal and ioctl call?

Any help or pointer will be very much appreciated!

Chiu T. Law
e-mail address:
lawc@super.ece.jhu.edu
lawc@ef.ecn.purdue.edu
lawc@alpha.ece.jhu.edu
ph: (301)-338-7976

dougm@ico.ISC.COM (Doug McCallum) (05/16/89)

In article <1790@jhunix.HCF.JHU.EDU> eed_waek@jhunix (Alexander Kaplan) writes:
...
>system is a mix of Unix V 3.1 with BSD 4.3 socket.  After
...
>1) When I initiate talk in a hardwired tty line, I get a message
>   error waiting daemon with errno 22 -- invalid argument.
>2) When I initiate talk in a ttyq line (i.e. ethernet connection),
>   I get the same message: error waiting daemon with errno 2 --
>   no such file or directory.
>3) When I initiate talk in a ttyq line but redirect output to a
>   file, I get the same message except with another errno 25 --
>   not a typewriter.
>
>When I looked into the program, I found this error was generated
>after a call to select.

Unless the V.3 vendor added support for select for tty devices, select
won't work.  V.3 does not have a native select.  It does have the "poll"
system call which is similar in functionality but only for STREAMS descriptors.
Poll returns EINVAL (errno 22) when handed an non-STREAMS file descriptor.
It sounds like your select is implemented with a call to poll.

Another note about select and applications like talk that would use 
curses/termcap under V.3.  There is a very primitive select emulation
that will cause problems.  You need to be sure to load your network
library before -lcurses.

Doug McCallum
Interactive Systems Corp
dougm@ico.isc.com