Example #1
0
static void load_prlib(const char *path)
{
	struct oproto_library *lib;

	abort_unless(path != NULL);

	if (oprliblist == NULL)
		oprliblist = cl_new(NULL, 1);

	lib = ecalloc(sizeof(*lib), 1);

	lib->path = path;

	lib->handle = dlopen(path, RTLD_LAZY);
	if (lib->handle == NULL)
		err("%s\n", dlerror());

	lib->load = dlsym(lib->handle, "load");
	if (lib->load == NULL)
		err("%s\n", dlerror());

	lib->unload = dlsym(lib->handle, "unload");
	if (lib->unload == NULL)
		err("%s\n", dlerror());

	if ((*lib->load)() < 0)
		errsys("Error loading %s: ");

	cl_push(oprliblist, lib);
}
Example #2
0
void
cl_ins_after_pos(struct cl_que *pos, struct cl_que **new_pos, TYPE *data)
{
	if (cl_push(pos, data) < 0)
		return;
	if (new_pos != NULL)
		*new_pos = CL_NEXT(pos);
}