Revision
177
Author
robert@fledge.watson.org
Date
2009-12-28 03:44:37 -0800 (Mon, 28 Dec 2009)

Log Message

Test for getprogname() -- if not present, but there is a
program_invocation_short_name (as in Linux), use a wrapper around that.

Submitted by:	Mark Heily <mark@heily.com>

Modified Paths

Added Paths

Diff

Modified: trunk/configure.ac (176 => 177)


--- trunk/configure.ac	2009-12-28 11:28:23 UTC (rev 176)
+++ trunk/configure.ac	2009-12-28 11:44:37 UTC (rev 177)
@@ -192,7 +192,7 @@
 AC_CHECK_DECLS([FD_COPY], [], [], [[#include <sys/select.h>]])
 AC_CHECK_DECLS([SIGEMT], [], [], [[#include <signal.h>]])
 AC_CHECK_DECLS([VQ_UPDATE, VQ_VERYLOWDISK], [], [], [[#include <sys/mount.h>]])
-AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf])
+AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf getprogname program_invocation_short_name])
 
 AC_CHECK_DECLS([POSIX_SPAWN_START_SUSPENDED],
   [have_posix_spawn_start_suspended=true],

Modified: trunk/src/os_shims.h (176 => 177)


--- trunk/src/os_shims.h	2009-12-28 11:28:23 UTC (rev 176)
+++ trunk/src/os_shims.h	2009-12-28 11:44:37 UTC (rev 177)
@@ -46,6 +46,7 @@
 #define	FD_COPY(f, t)	(void)(*(t) = *(f))
 #endif
 
+#include "shims/getprogname.h"
 #include "shims/malloc_zone.h"
 #include "shims/tsd.h"
 #include "shims/perfmon.h"

Added: trunk/src/shims/getprogname.h (0 => 177)


--- trunk/src/shims/getprogname.h	                        (rev 0)
+++ trunk/src/shims/getprogname.h	2009-12-28 11:44:37 UTC (rev 177)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2009 Apple Inc. All rights reserved.
+ *
+ * @APPLE_APACHE_LICENSE_HEADER_START@
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @APPLE_APACHE_LICENSE_HEADER_END@
+ */
+
+#ifndef __DISPATCH_SHIMS_GETPROGNAME__
+#define __DISPATCH_SHIMS_GETPROGNAME__
+
+#ifndef HAVE_GETPROGNAME
+static inline char *
+getprogname(void)
+{
+# if HAVE_PROGRAM_INVOCATION_SHORT_NAME
+    return program_invocation_short_name;
+# else
+#   error getprogname(3) is not available on this platform
+# endif
+}
+#endif /* HAVE_GETPROGNAME */
+
+#endif /* __DISPATCH_SHIMS_GETPROGNAME__ */
Property changes on: trunk/src/shims/getprogname.h
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style