summaryrefslogtreecommitdiffstats
path: root/include/dlfcn.h
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>2002-05-29 16:25:43 +0000
committerwollman <wollman@FreeBSD.org>2002-05-29 16:25:43 +0000
commit5bbebb88fb23509498ba2cbfc2a894bbaa78d31c (patch)
tree876b8b56f5abc5a10b03f80b310b2547dc76e4bc /include/dlfcn.h
parent929b4f74103ca2c710f7c4dd59c78d91fec585b4 (diff)
downloadFreeBSD-src-5bbebb88fb23509498ba2cbfc2a894bbaa78d31c.zip
FreeBSD-src-5bbebb88fb23509498ba2cbfc2a894bbaa78d31c.tar.gz
Reorganize dlfcn.h slightly to separate out XSI and BSD interfaces.
Add new dlfunc() interface, which is a version of dlsym() with a return type that can be cast to a function pointer without turning your computer into a frog. Reviewed by: freebsd-standards
Diffstat (limited to 'include/dlfcn.h')
-rw-r--r--include/dlfcn.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 13fd684..38a38be 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -63,10 +63,31 @@ typedef struct dl_info {
void *dli_saddr; /* Address of nearest symbol */
} Dl_info;
+/*
+ * The actual type declared by this typedef is immaterial, provided that
+ * it is a function pointer. Its purpose is to provide a return type for
+ * dlfunc() which can be cast to a function pointer type without depending
+ * on behavior undefined by the C standard, which might trigger a compiler
+ * diagnostic. We intentionally declare a unique type signature to force
+ * a diagnostic should the application not cast the return value of dlfunc()
+ * appropriately.
+ */
+struct __dlfunc_arg {
+ int __dlfunc_dummy;
+};
+
+typedef void (*__dlfunc_t)(struct __dlfunc_arg);
+
__BEGIN_DECLS
-int dladdr(const void *, Dl_info *);
+/* XSI functions first */
int dlclose(void *);
const char *dlerror(void);
+void *dlopen(const char *, int);
+void *dlsym(void * /* __restrict */, const char * /* __restrict */);
+
+#if __BSD_VISIBLE
+int dladdr(const void *, Dl_info *);
+__dlfunc_t dlfunc(void * /* __restrict */, const char * /* __restrict */);
void dllockinit(void *_context,
void *(*_lock_create)(void *_context),
void (*_rlock_acquire)(void *_lock),
@@ -74,8 +95,7 @@ void dllockinit(void *_context,
void (*_lock_release)(void *_lock),
void (*_lock_destroy)(void *_lock),
void (*_context_destroy)(void *_context));
-void *dlopen(const char *, int);
-void *dlsym(void *, const char *);
+#endif /* __BSD_VISIBLE */
__END_DECLS
#endif /* !_DLFCN_H_ */
OpenPOWER on IntegriCloud