From owner-p4-projects@FreeBSD.ORG Tue Aug 15 02:26:42 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 12E7B16A4E0; Tue, 15 Aug 2006 02:26:42 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E592916A4DA for ; Tue, 15 Aug 2006 02:26:41 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 95AB543D46 for ; Tue, 15 Aug 2006 02:26:41 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7F2Qfu4083673 for ; Tue, 15 Aug 2006 02:26:41 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7F2Qfrn083657 for perforce@freebsd.org; Tue, 15 Aug 2006 02:26:41 GMT (envelope-from jb@freebsd.org) Date: Tue, 15 Aug 2006 02:26:41 GMT Message-Id: <200608150226.k7F2Qfrn083657@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 103948 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2006 02:26:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=103948 Change 103948 by jb@jb_freebsd2 on 2006/08/15 02:25:45 Declare the constructor. Fix compiler warnings. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libctf/common/ctf_lib.c#5 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libctf/common/ctf_lib.c#5 (text) ==== @@ -29,6 +29,7 @@ #include #include #include +#include #if !defined(sun) #include #endif @@ -58,7 +59,11 @@ static size_t _PAGESIZE; static size_t _PAGEMASK; +#if defined(sun) #pragma init(_libctf_init) +#else +void _libctf_init(void) __attribute__ ((constructor)); +#endif void _libctf_init(void) { @@ -92,8 +97,8 @@ if ((zlib.z_dlp = dlopen(_libctf_zlib, RTLD_LAZY | RTLD_LOCAL)) == NULL) return (ctf_set_open_errno(errp, ECTF_ZINIT)); - zlib.z_uncompress = (int (*)()) dlsym(zlib.z_dlp, "uncompress"); - zlib.z_error = (const char *(*)()) dlsym(zlib.z_dlp, "zError"); + zlib.z_uncompress = (int (*)(uchar_t *, ulong_t *, const uchar_t *, ulong_t)) dlsym(zlib.z_dlp, "uncompress"); + zlib.z_error = (const char *(*)(int)) dlsym(zlib.z_dlp, "zError"); if (zlib.z_uncompress == NULL || zlib.z_error == NULL) { (void) dlclose(zlib.z_dlp); @@ -227,7 +232,7 @@ * If we have read enough bytes to form a CTF header and the magic * string matches, attempt to interpret the file as raw CTF. */ - if (nbytes >= sizeof (ctf_preamble_t) && + if (nbytes >= (ssize_t) sizeof (ctf_preamble_t) && hdr.ctf.ctp_magic == CTF_MAGIC) { if (hdr.ctf.ctp_version > CTF_VERSION) return (ctf_set_open_errno(errp, ECTF_CTFVERS)); @@ -257,7 +262,7 @@ * do our own largefile ELF processing, and convert everything to * GElf structures so that clients can operate on any data model. */ - if (nbytes >= sizeof (Elf32_Ehdr) && + if (nbytes >= (ssize_t) sizeof (Elf32_Ehdr) && bcmp(&hdr.e32.e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) { #ifdef _BIG_ENDIAN uchar_t order = ELFDATA2MSB; @@ -269,7 +274,7 @@ void *strs_map; size_t strs_mapsz; - const char *strs; + char *strs; if (hdr.e32.e_ident[EI_DATA] != order) return (ctf_set_open_errno(errp, ECTF_ENDIAN)); @@ -277,7 +282,7 @@ return (ctf_set_open_errno(errp, ECTF_ELFVERS)); if (hdr.e32.e_ident[EI_CLASS] == ELFCLASS64) { - if (nbytes < sizeof (GElf_Ehdr)) + if (nbytes < (ssize_t) sizeof (GElf_Ehdr)) return (ctf_set_open_errno(errp, ECTF_FMT)); } else { Elf32_Ehdr e32 = hdr.e32; @@ -328,7 +333,7 @@ strs_map = mmap64(NULL, strs_mapsz, PROT_READ, MAP_PRIVATE, fd, sp[hdr.e64.e_shstrndx].sh_offset & _PAGEMASK); - strs = (const char *)strs_map + + strs = (char *)strs_map + (sp[hdr.e64.e_shstrndx].sh_offset & ~_PAGEMASK); if (strs_map == MAP_FAILED) {