Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ev_open(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


 ev_open(S)                     6 January 1993                     ev_open(S)


 Name

    ev_open - opens an event queue for input

 Syntax


    cc  . . .  -levent


    #include  <sys/types.h>
    #include  <sys/param.h>
    #include  <sys/sysmacros.h>
    #include  <sys/page.h>
    #include  <sys/event.h>
    #include  <mouse.h>

    int ev_open (dmask)
    dmask_t *dmaskp;


 Description

    evopen opens an event queue for input. The argument points to a bitmask
    of device types. evopen attaches available devices whose class is masked
    in.  evopen fills in the mask to indicate what kinds of devices it
    finds.

    The bitmask is made of one or more of four classes of devices.  The four
    classes are DSTRING, DREL, DABS, or DOTHER.  DSTRING refers to char-
    acter stream devices like the keyboard. DREL refers to relative locator
    devices like mice. DABS refers to absolute locator devices like bitpads.
    These values are defined in <mouse.h>.

    evopen attempts to open devices of the types indicated in the argument
    and sets the mask to indicate the devices successfully opened. If no de-
    vices can be successfully opened, evopen returns -1 as an error condi-
    tion.

    If evopen succeeds in opening an event queue and devices, it returns a
    file descriptor for the event queue.  The file descriptor is for use with
    the select system call and should not be used for reading or writing.

    This is a program fragment that opens an event queue with a mouse and the
    keyboard attached:

       main()
       {
       dmask_t dmask;                  /* device mask */
       int qfd;                        /* event queue file descriptor */

       ev_init();                      /* initialize event manager */

       dmask = D_REL|D_STRING;         /* device mask for mouse & kbd */
       qfd = ev_open(&dmask);          /* try to open event queue */
       if ( qfd < 0 )
               exit(1);                /* error on open */

       if (dmask != (D_REL | D_STRING))
               exit(2);                /* could not attach both devices */
                                       /* event queue is open */
       }


 Diagnostics

    The routine returns a negative number if it fails.

    It returns -1 if there was a configuration error in the configuration
    files (see evinit(S)).  evopen returns -2 if it does not find any de-
    vices to attach. It returns -3 if it is unable to open devices it finds.
    It returns -4 if it is unable to open an event queue.

 See also

    evblock(S), evclose(S), evcount(S), evflush(S), evgetdev(S),
    evgetemask(S), evgindev(S), evinit(S), evpop(S), evread(S),
    evresume(S), evsetemask(S), evsuspend(S)

 Standards conformance

    evopen is not part of any currently supported standard; it is an exten-
    sion of AT&T System V provided by the Santa Cruz Operation.


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026