diff --git a/codecs/ilbc/Makefile b/codecs/ilbc/Makefile
index ba7466ee076092ea4d7eaa3999181e57aaacc0d9..58d35798896c785969d750e0d3c97534db05bd67 100755
--- a/codecs/ilbc/Makefile
+++ b/codecs/ilbc/Makefile
@@ -11,6 +11,7 @@ all: $(LIB)
 
 $(LIB): $(OBJS)
 	ar cr $(LIB) $(OBJS)
+	ranlib $(LIB)
 
 clean:
 	rm -f $(LIB) *.o
diff --git a/codecs/lpc10/lpc10.h b/codecs/lpc10/lpc10.h
index 314e2e35f1117452433dcc2f81dcc3f296ef2a2e..02c59b1e492697afffdad52a7f90c116e6c99126 100755
--- a/codecs/lpc10/lpc10.h
+++ b/codecs/lpc10/lpc10.h
@@ -1,8 +1,11 @@
 /*
 
 $Log$
-Revision 1.15  2003/03/16 22:37:30  matteo
-dom mar 16 23:37:23 CET 2003
+Revision 1.16  2003/04/23 19:13:35  markster
+More OpenBSD patches
+
+Revision 1.2  2003/04/23 19:13:35  markster
+More OpenBSD patches
 
 Revision 1.1.1.2  2003/03/16 22:37:30  matteo
 dom mar 16 23:37:23 CET 2003
@@ -35,7 +38,7 @@ Add broken lpc10 code...  It's not too far from working I don't think...
 
  */
 
-#if defined(unix)
+#if defined(unix) || defined(__unix__)
 typedef short		INT16;
 typedef int		INT32;
 #endif
diff --git a/loader.c b/loader.c
index cd18b353e5b36694aeefc6b3a67efcc784b425f7..b47077a77227d7b5647a154d9e7644511307d072 100755
--- a/loader.c
+++ b/loader.c
@@ -30,6 +30,10 @@
 #include "asterisk.h"
 #include "astconf.h"
 
+#ifndef RTLD_NOW
+#define RTLD_NOW 0
+#endif
+
 static char expected_key[] =
 { 0x8e, 0x93, 0x22, 0x83, 0xf5, 0xc3, 0xc0, 0x75,
   0xff, 0x8b, 0xa9, 0xbe, 0x7c, 0x43, 0x74, 0x63 };
@@ -174,14 +178,20 @@ int ast_load_resource(char *resource_name)
 		cfg = ast_load(AST_MODULE_CONFIG);
 		option_verbose = o;
 		if (cfg) {
+#ifdef RTLD_GLOBAL
 			if ((val = ast_variable_retrieve(cfg, "global", resource_name))
 					&& ast_true(val))
 				flags |= RTLD_GLOBAL;
+#endif
 			ast_destroy(cfg);
 		}
 	} else {
 		/* Resource modules are always loaded global and lazy */
+#ifdef RTLD_GLOBAL
 		flags = (RTLD_GLOBAL | RTLD_LAZY);
+#else
+		flags = RTLD_LAZY;
+#endif
 	}
 	
 	if (ast_pthread_mutex_lock(&modlock))
@@ -215,31 +225,43 @@ int ast_load_resource(char *resource_name)
 		return -1;
 	}
 	m->load_module = dlsym(m->lib, "load_module");
+	if (m->load_module == NULL)
+		m->load_module = dlsym(m->lib, "_load_module");
 	if (!m->load_module) {
 		ast_log(LOG_WARNING, "No load_module in module %s\n", fn);
 		errors++;
 	}
 	m->unload_module = dlsym(m->lib, "unload_module");
+	if (m->unload_module == NULL)
+		m->unload_module = dlsym(m->lib, "_unload_module");
 	if (!m->unload_module) {
 		ast_log(LOG_WARNING, "No unload_module in module %s\n", fn);
 		errors++;
 	}
 	m->usecount = dlsym(m->lib, "usecount");
+	if (m->usecount == NULL)
+		m->usecount = dlsym(m->lib, "_usecount");
 	if (!m->usecount) {
 		ast_log(LOG_WARNING, "No usecount in module %s\n", fn);
 		errors++;
 	}
 	m->description = dlsym(m->lib, "description");
+	if (m->description == NULL)
+		m->description = dlsym(m->lib, "_description");
 	if (!m->description) {
 		ast_log(LOG_WARNING, "No description in module %s\n", fn);
 		errors++;
 	}
 	m->key = dlsym(m->lib, "key");
+	if (m->key == NULL)
+		m->key = dlsym(m->lib, "_key");
 	if (!m->key) {
 		ast_log(LOG_WARNING, "No key routine in module %s\n", fn);
 		errors++;
 	}
 	m->reload = dlsym(m->lib, "reload");
+	if (m->reload == NULL)
+		m->reload = dlsym(m->lib, "_reload");
 	if (m->key && !(key = m->key())) {
 		ast_log(LOG_WARNING, "Key routine returned NULL in module %s\n", fn);
 		errors++;
diff --git a/pbx.c b/pbx.c
index 18e6eb41de8ff73072e276f6f83581887cd351fd..c8abb1ea87094d8a078e18ee5deb69b90c91e7dd 100755
--- a/pbx.c
+++ b/pbx.c
@@ -2684,7 +2684,7 @@ struct ast_context *ast_context_create(char *name, char *registrar)
 /*
  * errno values
  *  EBUSY  - can't lock
- *  ENODATA - no existence of context
+ *  ENOENT - no existence of context
  */
 int ast_context_add_include(char *context, char *include, char *registrar)
 {
@@ -2710,7 +2710,7 @@ int ast_context_add_include(char *context, char *include, char *registrar)
 
 	/* we can't find the right context */
 	ast_unlock_contexts();
-	errno = ENODATA;
+	errno = ENOENT;
 	return -1;
 }
 
@@ -3035,7 +3035,7 @@ int ast_context_add_include2(struct ast_context *con, char *value,
 /*
  * errno values
  *  EBUSY  - can't lock
- *  ENODATA - no existence of context
+ *  ENOENT - no existence of context
  */
 int ast_context_add_switch(char *context, char *sw, char *data, char *registrar)
 {
@@ -3061,7 +3061,7 @@ int ast_context_add_switch(char *context, char *sw, char *data, char *registrar)
 
 	/* we can't find the right context */
 	ast_unlock_contexts();
-	errno = ENODATA;
+	errno = ENOENT;
 	return -1;
 }
 
@@ -3129,7 +3129,7 @@ int ast_context_add_switch2(struct ast_context *con, char *value,
 
 /*
  * EBUSY  - can't lock
- * ENODATA - there is not context existence
+ * ENOENT - there is not context existence
  */
 int ast_context_remove_ignorepat(char *context, char *ignorepat, char *registrar)
 {
@@ -3151,7 +3151,7 @@ int ast_context_remove_ignorepat(char *context, char *ignorepat, char *registrar
 	}
 
 	ast_unlock_contexts();
-	errno = ENODATA;
+	errno = ENOENT;
 	return -1;
 }
 
@@ -3188,7 +3188,7 @@ int ast_context_remove_ignorepat2(struct ast_context *con, char *ignorepat, char
 
 /*
  * EBUSY - can't lock
- * ENODATA - there is no existence of context
+ * ENOENT - there is no existence of context
  */
 int ast_context_add_ignorepat(char *con, char *value, char *registrar)
 {
@@ -3210,7 +3210,7 @@ int ast_context_add_ignorepat(char *con, char *value, char *registrar)
 	}
 
 	ast_unlock_contexts();
-	errno = ENODATA;
+	errno = ENOENT;
 	return -1;
 }
 
@@ -3266,7 +3266,7 @@ int ast_ignore_pattern(char *context, char *pattern)
 
 /*
  * EBUSY   - can't lock
- * ENODATA  - no existence of context
+ * ENOENT  - no existence of context
  *
  */
 int ast_add_extension(char *context, int replace, char *extension, int priority, char *callerid,
@@ -3291,7 +3291,7 @@ int ast_add_extension(char *context, int replace, char *extension, int priority,
 	}
 
 	ast_unlock_contexts();
-	errno = ENODATA;
+	errno = ENOENT;
 	return -1;
 }
 
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 7e8c11c9c46ae7da849d248314be2ae1d5dac2ec..45359fcdda287b7cc1e3dbe87c7dab91df84105b 100755
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -689,10 +689,10 @@ static int handle_context_add_include(int fd, int argc, char *argv[])
 				ast_cli(fd, "Context '%s' already included in '%s' context\n",
 					argv[1], argv[3]); break;
 
-			case ENODATA:
+			case ENOENT:
 			case EINVAL:
 				ast_cli(fd, "There is no existence of context '%s'\n",
-					errno == ENODATA ? argv[3] : argv[1]); break;
+					errno == ENOENT ? argv[3] : argv[1]); break;
 
 			default:
 				ast_cli(fd, "Failed to include '%s' in '%s' context\n",
@@ -1115,7 +1115,7 @@ static int handle_context_add_extension(int fd, int argc, char *argv[])
 			case EBUSY:
 				ast_cli(fd, "Failed to lock context(s) list, please try again later\n"); break;
 
-			case ENODATA:
+			case ENOENT:
 				ast_cli(fd, "No existence of '%s' context\n", argv[4]); break;
 
 			case EEXIST:
@@ -1197,7 +1197,7 @@ static int handle_context_add_ignorepat(int fd, int argc, char *argv[])
 			case ENOMEM:
 				ast_cli(fd, "Out of free memory\n"); break;
 
-			case ENODATA:
+			case ENOENT:
 				ast_cli(fd, "There is no existence of '%s' context\n", argv[4]);
 				break;
 
@@ -1294,7 +1294,7 @@ static int handle_context_remove_ignorepat(int fd, int argc, char *argv[])
 				ast_cli(fd, "Failed to lock context(s) list, please try again later\n");
 				break;
 
-			case ENODATA:
+			case ENOENT:
 				ast_cli(fd, "There is no existence of '%s' context\n", argv[4]);
 				break;