]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
Make setproctitle() available in 0.2 and 0.5 version nodes
authorGuillem Jover <guillem@hadrons.org>
Sat, 25 May 2013 15:11:53 +0000 (17:11 +0200)
committerGuillem Jover <guillem@hadrons.org>
Mon, 27 May 2013 01:24:22 +0000 (03:24 +0200)
Make the 0.5 version the default, so that code wanting the actual
implemented version can get a proper versioned depdendency. For code
linked against the old version, make it available as an alias.

configure.ac
src/libbsd.map
src/setproctitle.c

index 1644510c86889d9aaea2f99b50b456e384b6940a..2fcd5114c3e086e659abf4cb92e2d5f3476d9c21 100644 (file)
@@ -38,6 +38,7 @@ AC_CHECK_HEADERS([sys/ndir.h sys/dir.h dir.h dirent.h])
 # Checks for typedefs, structures, and compiler characteristics.
 AC_TYPE_UID_T
 AC_C_INLINE
+AC_C_TYPEOF
 AC_TYPE_INT64_T
 AC_TYPE_MODE_T
 AC_TYPE_OFF_T
index e900ee39ea4c26cc067eac6bfbdf505cebbdf0a7..4067e2c0e38ee6c328bf796b091281a5dd9c16ad 100644 (file)
@@ -73,8 +73,6 @@ LIBBSD_0.2 {
     pidfile_close;
     pidfile_remove;
 
-    setproctitle;
-
     arc4random_buf;
     arc4random_uniform;
 } LIBBSD_0.1;
@@ -99,6 +97,9 @@ LIBBSD_0.5 {
     fgetwln;
     fparseln;
 
+    /* Introduced in 0.2 as a stub, implemented in 0.5. */
+    setproctitle;
+
     strnstr;
 
     wcslcat;
index 969f2665ebb8f6e3ecce351b83f1253dc64c54ab..60b64843005a72fe36ad421b6220be1ea6086dcb 100644 (file)
@@ -191,7 +191,7 @@ spt_init(int argc, char *argv[], char *envp[])
 #endif
 
 void
-setproctitle(const char *fmt, ...)
+setproctitle_impl(const char *fmt, ...)
 {
        /* Use buffer in case argv[0] is passed. */
        char buf[SPT_MAXTITLE + 1];
@@ -243,3 +243,13 @@ setproctitle(const char *fmt, ...)
                *++nul = '\0';
        }
 }
+__asm__(".symver setproctitle_impl,setproctitle@@LIBBSD_0.5");
+
+#ifdef HAVE_TYPEOF
+/* The original function introduced in 0.2 was a stub, it only got implemented
+ * in 0.5, make the implementation available in the old version as an alias
+ * for code linking against that version, and change the default to use the
+ * new version, so that new code depends on the implemented version. */
+extern typeof(setproctitle_impl) setproctitle_stub __attribute__((alias("setproctitle_impl")));
+__asm__(".symver setproctitle_stub,setproctitle@LIBBSD_0.2");
+#endif