path: root/include/iconv.h
diff options
authorpeter <>2013-08-13 07:15:01 +0000
committerpeter <>2013-08-13 07:15:01 +0000
commit995e1f0063b0515ed5821ebab3aff02dbbe44719 (patch)
tree9bba3bf02dbd5d242b50c29cd7221d5ae286e560 /include/iconv.h
parentd9e76bbffc59d724ea0ffe9896012f4ac0859bc7 (diff)
The iconv in libc did two things - implement the standard APIs, the GNU
extensions and also tried to be link time compatible with ports libiconv. This splits that functionality and enables the parts that shouldn't interfere with the port by default. WITH_ICONV (now on by default) - adds iconv.h, iconv_open(3) etc. WITH_LIBICONV_COMPAT (off by default) adds the libiconv_open etc API, linker symbols and even a stub that are good enough to be able to 'pkg delete -f libiconv' on a running system and reasonably expect it to work. I have tortured many machines over the last few days to try and reduce the possibilities of foot-shooting as much as I can. I've successfully recompiled to enable and disable the libiconv_compat modes, ports that use libiconv alongside system iconv etc. If you don't enable the WITH_LIBICONV_COMPAT switch, they don't share symbol space. This is an extension of behavior on other system. iconv(3) is a standard libc interface and libiconv port expects to be able to run alongside it on systems that have it. Bumped osreldate.
Diffstat (limited to 'include/iconv.h')
1 files changed, 26 insertions, 15 deletions
diff --git a/include/iconv.h b/include/iconv.h
index 7b628af..3423a24 100644
--- a/include/iconv.h
+++ b/include/iconv.h
@@ -41,20 +41,23 @@
#include <sys/cdefs.h>
#include <sys/types.h>
-#define iconv_open libiconv_open
-#define iconv_close libiconv_close
-#define iconv libiconv
-#define iconv_t libiconv_t
+#include <_libiconv_compat.h>
+#define libiconv_open iconv_open
+#define libiconv_close iconv_close
+#define libiconv iconv
+#define libiconv_t iconv_t
struct __tag_iconv_t;
typedef struct __tag_iconv_t *iconv_t;
-iconv_t libiconv_open(const char *, const char *);
-size_t libiconv(iconv_t, const char ** __restrict,
- size_t * __restrict, char ** __restrict,
- size_t * __restrict);
-int libiconv_close(iconv_t);
+iconv_t iconv_open(const char *, const char *);
+size_t iconv(iconv_t, const char ** __restrict,
+ size_t * __restrict, char ** __restrict,
+ size_t * __restrict);
+int iconv_close(iconv_t);
* non-portable interfaces for iconv
@@ -67,20 +70,28 @@ size_t __iconv(iconv_t, const char **, size_t *, char **,
* GNU interfaces for iconv
-#define iconv_open_into libiconv_open_into
-#define iconvctl libiconvctl
-#define iconvlist libiconvlist
+#define libiconv_open_into iconv_open_into
+#define libiconvctl iconvctl
+#define libiconvlist iconvlist
+#define libiconv_set_relocation_prefix iconv_set_relocation_prefix
/* We have iconvctl() */
-#define _LIBICONV_VERSION 0x0108
-extern int _libiconv_version;
+#define _ICONV_VERSION 0x0108
+extern int _iconv_version;
+#define _libiconv_version _iconv_version
typedef struct {
void *spaceholder[64];
} iconv_allocation_t;
int iconv_open_into(const char *, const char *, iconv_allocation_t *);
-void libiconv_set_relocation_prefix (const char *orig_prefix,
+void iconv_set_relocation_prefix(const char *orig_prefix,
const char *curr_prefix);
OpenPOWER on IntegriCloud