The "dm" Package

These routines are meant to provide a generic and simple to use descriptor management facility (ie. event processing on pipes, connections and terminals). NOTE: THIS PACKAGE IS WORK IN PROGRESS. THE INTERFACE MAY CHANGE IN THE NEXT RELEASE, POSSIBLY WITHOUT NOTICE.

Library: karma
Link With: -lkarma

Functions

dm_register_managersRegister the managers.
dm_manageManage a file descriptor for events.
dm_unmanageTerminate the management of a file descriptor for activity.
dm_native_setupSetup descriptor management using native implementation.
dm_native_pollPoll all managed descriptors for any activity.

Prototype Functions

dm_PROTO_input_funcInput event callback.
dm_PROTO_close_funcClose event callback.
dm_PROTO_output_funcOutput event callback.
dm_PROTO_exception_funcException event callback.


Functions


EXPERIMENTAL FUNCTION: subject to change without notice

void dm_register_managers ( KManagedDescriptor (*manage_func) (int fd, void *info, flag (*input_func) (), void (*close_func) (), flag (*output_func) (), flag (*exception_func) (), flag auto_close), void *(*unmanage_func) (int fd, KManagedDescriptor md) )

Register the managers.

Parameters:

Returns: Nothing. On failure the process aborts.
Multithreading Level: Unsafe


EXPERIMENTAL FUNCTION: subject to change without notice

KManagedDescriptor dm_manage (int fd, void *info, flag (*input_func) (), void (*close_func) (), flag (*output_func) (), flag (*exception_func) (), flag auto_close)

This routine will manage a file descriptor for activity by registering callback routines. Only one set of callbacks may be registered per file descriptor.

Parameters:

Returns: A KManagedDescriptor object on success, else NULL.
Multithreading Level: Unsafe


void * dm_unmanage (int fd, KManagedDescriptor md)

Terminate the management of a file descriptor for activity.

Parameters:

Returns: The arbitrary pointer passed when the descriptor was managed.
Multithreading Level: Unsafe
Note:


void dm_native_setup ()

Setup descriptor management using native implementation.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


void dm_native_poll (long timeout_ms)

Poll all managed descriptors for any activity.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


Prototype Functions


flag dm_PROTO_input_func (int fd, void **info)

This routine is called when new input occurs on a descriptor.

Parameters:

Returns: TRUE if the descriptor is to remain managed and open, else it returns FALSE (indicating that the descriptor is to be unmanaged and closed). This routine MUST NOT unmanage or close the descriptor.
Multithreading Level: Unsafe
Note:


void dm_PROTO_close_func (int fd, void *info)

This routine is called when a descriptor closes.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe
Note:


flag dm_PROTO_output_func (int fd, void **info)

This routine is called when a descriptor becomes ready for writing.

Parameters:

Returns: TRUE if the descriptor is to remain managed and open, else it returns FALSE (indicating that the descriptor is to be unmanaged and closed). This routine MUST NOT unmanage or close the descriptor.
Multithreading Level: Unsafe
Note:


flag dm_PROTO_exception_func (int fd, void **info)

This routine is called when an exception occurrs on a descriptor.

Parameters:

Returns: TRUE if the descriptor is to remain managed and open, else it returns FALSE (indicating that the descriptor is to be unmanaged and closed). This routine MUST NOT unmanage or close the descriptor.
Multithreading Level: Unsafe
Note:


Back to Karma Home Page
Contact: Richard Gooch
Web Development: Ariel Internet Services