PERFORCE change 133703 for review
John Birrell
jb at FreeBSD.org
Sat Jan 19 18:44:38 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=133703
Change 133703 by jb at jb_freebsd1 on 2008/01/20 02:43:40
On FreeBSD libz is always available. I don't understand why it is
optional on Solaris. We will just link it in and be done with it!
Affected files ...
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libctf/common/ctf_lib.c#9 edit
Differences ...
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libctf/common/ctf_lib.c#9 (text) ====
@@ -34,14 +34,20 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#if defined(sun)
#include <dlfcn.h>
+#else
+#include <zlib.h>
+#endif
#include <gelf.h>
+#if defined(sun)
#ifdef _LP64
static const char *_libctf_zlib = "/usr/lib/64/libz.so";
#else
static const char *_libctf_zlib = "/usr/lib/libz.so";
#endif
+#endif
static struct {
int (*z_uncompress)(uchar_t *, ulong_t *, const uchar_t *, ulong_t);
@@ -60,10 +66,12 @@
void
_libctf_init(void)
{
+#if defined(sun)
const char *p = getenv("LIBCTF_DECOMPRESSOR");
if (p != NULL)
_libctf_zlib = p; /* use alternate decompression library */
+#endif
_libctf_debug = getenv("LIBCTF_DEBUG") != NULL;
@@ -79,6 +87,7 @@
void *
ctf_zopen(int *errp)
{
+#if defined(sun)
ctf_dprintf("decompressing CTF data using %s\n", _libctf_zlib);
if (zlib.z_dlp != NULL)
@@ -98,6 +107,13 @@
bzero(&zlib, sizeof (zlib));
return (ctf_set_open_errno(errp, ECTF_ZINIT));
}
+#else
+ zlib.z_uncompress = uncompress;
+ zlib.z_error = zError;
+
+ /* Dummy return variable as 'no error' */
+ zlib.z_dlp = (void *) (uintptr_t) 1;
+#endif
return (zlib.z_dlp);
}
More information about the p4-projects
mailing list