DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

ev_open(S-osr5)


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-osr5)). 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-osr5), ev_close(S-osr5), ev_count(S-osr5), ev_flush(S-osr5), ev_getdev(S-osr5), ev_getemask(S-osr5), ev_gindev(S-osr5), ev_init(S-osr5), ev_pop(S-osr5), ev_read(S-osr5), ev_resume(S-osr5), ev_setemask(S-osr5), ev_suspend(S-osr5)

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.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005