DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

ev_open(S)


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

ev_open opens an event queue for input. The argument points to a bitmask of device types. ev_open attaches available devices whose class is masked in. ev_open 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 D_STRING, D_REL, D_ABS, or D_OTHER. D_STRING refers to character stream devices like the keyboard. D_REL refers to relative locator devices like mice. D_ABS refers to absolute locator devices like bitpads. These values are defined in <mouse.h>.

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

If ev_open 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 ev_init(S)). ev_open returns -2 if it does not find any devices 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

ev_block(S), ev_close(S), ev_count(S), ev_flush(S), ev_getdev(S), ev_getemask(S), ev_gindev(S), ev_init(S), ev_pop(S), ev_read(S), ev_resume(S), ev_setemask(S), ev_suspend(S)

Standards conformance

ev_open is not part of any currently supported standard; it is an extension of AT&T System V provided by the Santa Cruz Operation.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003