API for managing dynamically loaded libraries
More...
|
file | exports.h |
| Kernel exported symbols support.
|
|
file | library.h |
| Dynamically loadable library support.
|
|
API for managing dynamically loaded libraries
◆ LIBRARY_DEFAULTS
#define LIBRARY_DEFAULTS 0 |
◆ libid_t
◆ export_init()
void export_init |
( |
void | | ) |
|
Setup initial kernel exports.
◆ export_lookup()
Look up a symbol by name.
- Parameters
-
name | The symbol to look up |
- Returns
- The export structure, or NULL on failure
◆ library_by_libid()
Look up a library by ID.
This function looks up a library by its library ID.
- Parameters
-
libid | The library ID to look up |
- Returns
- The specified library, or NULL if not found
◆ library_close()
Close a previously opened library.
This function will close the specified library. This may involve simply decrementing its reference count, however, it may also involve actually closing and freeing the library. Thus, don't try to use the library after calling this without reopening it first.
- Parameters
-
- Return values
-
0 | On success |
-1 | On error, errno may be set to an appropriate code |
- Error Conditions:
- EINVAL - the library is not valid
◆ library_create()
Create a new library shell.
This function creates a new library, adding it to the list of libraries. You generally should not call this function directly, unless you have some good reason to do so.
- Parameters
-
flags | Flags to create the library with. |
- Returns
- The newly created library, or NULL on error
◆ library_destroy()
Destroy a library.
This function will take a loaded library and destroy it, unloading it completely. Generally, you should not call this function, but rather use library_close() to make sure that you're not closing something that is still in use.
- Parameters
-
- Return values
-
0 | Upon successfully destroying the library |
◆ library_get_libid()
Retrieve the specified library's runtime-assigned ID.
- Parameters
-
lib | The library to examine |
- Returns
- The library's ID, or -1 on error
- Error Conditions:
- EINVAL - the library is not valid
◆ library_get_name()
Retrieve the specified library's name.
- Parameters
-
lib | The library to examine |
- Returns
- The library's symbolic name, or NULL on error
- Error Conditions:
- EINVAL - the library is not valid
◆ library_get_refcnt()
Retrieve the specified library's reference count.
- Parameters
-
lib | The library to examine |
- Returns
- The library's reference count, or -1 on error
- Error Conditions:
- EINVAL - the library is not valid
◆ library_get_version()
Retrieve the specified library's version.
- Parameters
-
lib | The library to examine |
- Returns
- The library's version number, or 0 on error
- Error Conditions
- EINVAL - the library is not valid
◆ library_lookup()
Look up a library by name.
This function looks up a library by its symbolic name without trying to actually load or open it. This is useful if you want to open a library but not keep around a handle to it (which isn't necessarily encouraged).
- Parameters
-
name | The name of the library to search for |
- Returns
- The library, if found. NULL if not found, errno set as appropriate.
- Error Conditions:
- ENOENT - the library was not found
◆ library_open()
klibrary_t * library_open |
( |
const char * | name, |
|
|
const char * | fn ) |
Try to open a library by name.
This function attempts to open a library by its name. If it cannot be found by name, this function will attempt to load the library from the specified filename.
- Parameters
-
name | The symbolic name of the library |
fn | The filename to load the library from |
- Returns
- A handle to the library, or NULL on error with errno set as appropriate
- Error Conditions:
- EINVAL - the library was found or loaded, but invalid
ENOMEM - out of memory
ENOENT - library not found and no filename given