Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* xxselect? Who did that already on OSF1? I think nobody...
@ 1996-08-11  4:00 Oleg Orel
  0 siblings, 0 replies; only message in thread
From: Oleg Orel @ 1996-08-11  4:00 UTC (permalink / raw)




I working for HIPPI device driver for OSF/1 3.2C (today). My problem
is that when xxselect called first time and device nothing have to
read in this case according to description in the OSF/1 books I should
call select_enqueue(...).  Afterwords, in my interrupt handler I can
call ether select_dequeue ether select_wakeup. In second case xxselect
will be called second time with revents=NULL (it's mean that I can't
set it to indicate that something aviable for read/write) and in all
cases user's level select interface returns -1. If timeout expired
select returns 0. But I should return 1 to user level for indicate
that whereis something for read. What is way for do that. Maybe you
have examples of another drivers which do same?

Here is C's explanation (it's of course extracted part of driver):

typedef struct {

  sel_queue_t queue;
  ihandler_id_t *ihandler;
  struct controller *_controller;

} HPI_KCONFIG;

hpi_select(dev_t dev, short *events, short *revents, int scanning)
{
  int unit=minor(dev);
  extern int hz;


  if (!scanning)
    {
      select_dequeue(&KCONFIG.queue);
      return(0);
    }


  /* Waiting for done in destionation */

  if ((*events & POLLNORM) && (ICONFIG.type==HPI_DESTINATION))
    {
      if ((!ICONFIG.transfer && !ICONFIG.done) || ICONFIG.error)
        return (-1);

      if (!ICONFIG.done)
        select_enqueue(&KCONFIG.queue);

      if (ICONFIG.done)
        *revents|= POLLNORM;
    }

  return (0);
}

hpi_intr(caddr_t _unit)
{
  int unit=(int)_unit;
  String s;

  ICONFIG.interrupt++;

  if (ICONFIG.debug) printf("HCSR(%d)=%X\n",unit,*(int*)HCSR);

  if (ICONFIG.type==HPI_SOURCE)
    {
      if (HCSR->canceled_by_destination)
        {
          ICONFIG.error=HPI_CBDST;
          ICONFIG.transfer=0;
          ICONFIG.done=0;

          call_handler(unit);
          hpi_wakeup(unit);
          return clear_intr(unit);
        }
    }
  else
    {
     if (HCSR->last_connection_end)
        {
          ICONFIG.transfer=0;
          ICONFIG.done=1;
          ICONFIG.error=0;


          hpi_wakeup(unit);
          call_handler(unit);
          clear_intr(unit);
          return;

        }
     }
}

hpi_wakeup(int unit)
{
  wakeup((caddr_t)&ICONFIG.sleep);
  select_wakeup(&KCONFIG.queue);
}


So... question is how to organize return value = 1 in user's level after
select_enqueue before timeout. Now it's return -1 



Thanks for you help,
Oleg Orel



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-08-11  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-08-11  4:00 xxselect? Who did that already on OSF1? I think nobody Oleg Orel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox