Make setproctitle() available in 0.2 and 0.5 version nodes

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.
This commit is contained in:
Guillem Jover 2013-05-25 17:11:53 +02:00
parent c984dacd65
commit e9933255d4
3 changed files with 15 additions and 3 deletions

View 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

View 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;

View 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