[libdispatch-dev] Solaris portability - PATCH - getprogname shim support
Joakim Johansson
jocke at tbricks.com
Fri Jul 23 08:11:50 PDT 2010
Falling back to retrieving program name for libdispatch debug file using getexecname() for Solaris.
Also made the fallback getprogname function return a ‘const’ string to the program name to avoid warnings.
Cheers,
Joakim
octo.tbricks.com:gcd/gcd/trunk> svn up
At revision 188.
octo.tbricks.com:gcd/gcd/trunk> svn diff
Index: configure.ac
===================================================================
--- configure.ac (revision 188)
+++ configure.ac (working copy)
@@ -193,7 +193,7 @@
AC_CHECK_DECLS([SIGEMT], [], [], [[#include <signal.h>]])
AC_CHECK_DECLS([VQ_UPDATE, VQ_VERYLOWDISK], [], [], [[#include <sys/mount.h>]])
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
-AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf getprogname])
+AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf getprogname getexecname])
AC_CHECK_DECLS([POSIX_SPAWN_START_SUSPENDED],
[have_posix_spawn_start_suspended=true],
Index: src/shims/getprogname.h
===================================================================
--- src/shims/getprogname.h (revision 188)
+++ src/shims/getprogname.h (working copy)
@@ -23,15 +23,19 @@
#define __DISPATCH_SHIMS_GETPROGNAME__
#ifndef HAVE_GETPROGNAME
-static inline char *
+
+static inline const char *
getprogname(void)
{
# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
return program_invocation_short_name;
+#elif HAVE_GETEXECNAME
+ return getexecname();
# else
# error getprogname(3) is not available on this platform
# endif
}
+
#endif /* HAVE_GETPROGNAME */
#endif /* __DISPATCH_SHIMS_GETPROGNAME__ */
octo.tbricks.com:gcd/gcd/trunk>
More information about the libdispatch-dev
mailing list