dir_register, dir_deregister, dir_lookup, dir_lookup_string - directory service routines
#include <sys.h>
These routines provide an interface to the directory service. The directory service provides a generic way of associating a name with a value. The registered value may also have a given type. A common use is to associate a pthread id with a name so that other threads can rendezvous with the thread.
A name can be associated with a value with a call to dir_register(). The value associated with name may then be retrieved with a call to dir_lookup() or dir_lookup_string(). The entry for name may be removed with a call to dir_deregister().
Several names may share the same value; however, each name must be unique.
The type is used to allow users to look up values by class. By associating a type with a name and a value, all instances of a given type may be retreived. This feature is used to retreive all servers for example. The structure for the single linked list is shown above.
dir_lookup_type() is used to lookup all names and values associated with a given type. This is very useful to lookup all system objects of a given type. The various pre-defined system types are defined in sys.h as follows.
The calls return a 1 if successful, and 0 on error except for dir_lookup_type(). dir_lookup_type() returns a count of the number of entries found or -1 with errno set if there is an error.
If dir_register() fails, it returns 0 and sets errno. dir_lookup_type() is the only function to return -1 on error and it sets errno using the same error codes.
For multiprocessor systems only, all calls can return:
In a multiprocessor system, the service is provided by the Directory thread.