ev_open(3event)


ev_open -- opens an event queue for input

Synopsis

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 classes of devices. The classes are D_STRING, D_REL, or D_OTHER. D_STRING refers to character stream devices like the keyboard. D_REL refers to relative locator devices like mice. 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 */ ... }

Return values

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(3event)). 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.

References

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

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.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004