[comp.unix.questions] select

tombre@crin.UUCP (Karl Tombre) (11/20/86)

We are running several versions of UNIX on different machines. One of them
is Berkeley 4.2, on a VAX 11/785. We also have some SM90 machines under SMX
5.1, which is supposed to be System 5 compatible.

As we wanted to port some programs from the VAX to the SM90, we got trouble
with a system function called select. It is found in 4.2 but not in SMX.
Looking in the sources of 4.2, I only find some assembler stuff and no C
program.

So my questions are ?

1) What is select for?

2) Does it exist for system V?

3) If not, which function is the equivalent, if any?

Please mail the answer. Many thanks,
-- 
--- Karl Tombre @ CRIN (Centre de Recherche en Informatique de Nancy)
UUCP:    ...!mcvax!inria!crin!tombre     EUROKOM: Karl Tombre CRIN
POST:    Karl Tombre, CRIN, B.P. 239, 54506 VANDOEUVRE CEDEX, France
TEL :    (+33) 83.91.21.20

       "Il n'y a de honte qu'a` n'en point avoir" - Blaise Pascal

mark@adec23.UUCP (Mark Salyzyn) (03/02/89)

I have a UNIX V5 like system. No select(2) call. I would like to ask the
net if there is a select(2) man page available so that I can implement the
call `correctly'. I may implement it in the kernel or as a subset library
routine, this will be decided when I see the full definition of select.

please e-mail me if you have it (and are willing to send it :-} ) and I will
get back to you if you are the closest machine.

Thanks in advance,
Ciao,
-- Mark Salyzyn @ alberta!(edm,ncc,uofaee)!adec23!mark
			or dragos!adec23!mark

jeff@questar.QUESTAR.MN.ORG (Jeff Holmes) (01/11/90)

	Could someone who understands the select() system call
	better than I do tell me...

		if there is any way to get select() to 
		tell me HOW MANY characters there are
		in the buffer that are waiting to be
		read, similar to using FIONREAD with
		ioctl() under BSD?

	Thank you,
		Jeff

-- 
Jeff Holmes	                  DOMAIN: jeff@questar.mn.org 
Questar Data Systems                UUCP: amdahl!bungia!questar!jeff
St. Paul, MN 55121		    AT&T: +1 612 688 0089

ssj@castle.ed.ac.uk (S Johal) (02/02/90)

I have an application that is event driven. I use select (- actually
I use XtAddInput form X Toolkit Intrinsics stuff). That tells me if
any input has arrived. I then use stdio.h gear to read from the
descriptor.

I read 'units' of information using stdio, the number of units arriving
being an unknown integer number. My problem is that I could not find any
stdio function that would do the equivilant of select - ie. as sort of 
"is there any more data left to be read ? - without actually reading it".

So, what I did was look at stdio.h, and decided to use FILE->_cnt, to
tell me if there are any items left in the buffer pool.

The questions I need help with, are:
  (1) Is it *totally* portable/POSIX compatible to use _cnt ?
  (2) if not, Have I missed something in stdio.h that will let me
      do what I'm after ?

*-------------------------------------------*----------------------------*
*  Subindrao Johal,                         *++++++++++++++++++++++++++++*
*  SARI Project,                            *  tel:   031 668 1550 x219  *
*  Department of Electrical Engineering,    *  fax:   031 662 4678       *
*  University of Edinburgh,                 *  email: ssj@sari.ed.ac.uk  *
*  The King's Buildings, Edinburgh EH9 3JL  *++++++++++++++++++++++++++++*
*-------------------------------------------*----------------------------*

chris@mimsy.umd.edu (Chris Torek) (02/03/90)

In article <1988@castle.ed.ac.uk> ssj@castle.ed.ac.uk (S Johal) writes:
>  (1) Is it *totally* portable/POSIX compatible to use _cnt ?

No: there is no guarantee that a `FILE *' can be followed to a `_cnt' field,
and in my stdio, there is no _cnt field.  (There are two called _r and _w
that, collectively, mean what _cnt used to.)

>  (2) if not, Have I missed something in stdio.h that will let me
>      do what I'm after ?

No.  stdio has no multiplexing feature analagous to select().  If you
need select(), you cannot use stdio; if you need stdio, you cannot use
select().

If absolutely necessary, you are probably best off by defining a small
system-dependent module to do what select does but on multiple FILE objects.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris

field@cs.pitt.edu (Gus) (08/07/90)

I using select () to detect data on a file descriptor.  Upon detecting
info, I perform a read ().  If I don't read all the data on the
descriptor, and then return to select (), select will only return
when _new_ data is delivered to the descriptor.  Is there a way to
have select () return whenever there is pending data to be read (whether 
or not new data has arrived).

Some specifics: I'm running on a Sun-4, 4.0.3.  The file I'm reading
from is a serial port (canonical off, c_cc[MIN] = 1, c_cc[TIME] = 0,
no echo). 

I would like to avoid performing a manual select (ioctl with FIONREAD)
since I may be listening to lots of serial ports.

Please respond via e-mail, I'll summarize if there is interest.

Brian
-----
field@cs.pitt.edu

dnb@meshugge.media.mit.edu (David N. Blank) (09/28/90)

>Has anyone out there ported this program to the SysV or Xenix
>environment?  ( it uses the BSD select() call)

Let me ask a more general question: what's the SysV version of/
replacement paradigm for select()?  Thanks.
           Peace,
              dNb

thomas@uppsala.telesoft.se (Thomas Tornblom) (10/01/90)

In article <DNB.90Sep28101809@meshugge.media.mit.edu> dnb@meshugge.media.mit.edu (David N. Blank) writes:



   >Has anyone out there ported this program to the SysV or Xenix
   >environment?  ( it uses the BSD select() call)

   Let me ask a more general question: what's the SysV version of/
   replacement paradigm for select()?  Thanks.
	      Peace,
		 dNb

poll(2) if sysV.x & x >= 3.

Thomas
 
-- 
Real life:      Thomas Tornblom             Email:  thomas@uppsala.telesoft.se
Snail mail:     Telesoft Uppsala AB         Phone:  +46 18 189406
                Box 1218                    Fax:    +46 18 132039
                S - 751 42 Uppsala, Sweden

hascall@cs.iastate.edu (10/28/90)

      after a:

	      select( ..., exceptfds, ...)

      how do I find out what kind of exception has occurred on
      the socket(s) indicated in exceptfds?   Heck, what *are*
      the possible exception conditions?  closed?  out-of-band data?
      urgent data?  others?

many thanks,
John Hascall  /  john@iastate.edu  /  hascall@atanasoff.cs.iastate.edu