1 1.12 skrll /* $NetBSD: rtldenv.h,v 1.12 2013/05/06 08:02:20 skrll Exp $ */ 2 1.1 cgd 3 1.1 cgd /* 4 1.1 cgd * Copyright 1996 Matt Thomas <matt (at) 3am-software.com> 5 1.1 cgd * All rights reserved. 6 1.1 cgd * 7 1.1 cgd * Redistribution and use in source and binary forms, with or without 8 1.1 cgd * modification, are permitted provided that the following conditions 9 1.1 cgd * are met: 10 1.1 cgd * 1. Redistributions of source code must retain the above copyright 11 1.1 cgd * notice, this list of conditions and the following disclaimer. 12 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 cgd * notice, this list of conditions and the following disclaimer in the 14 1.1 cgd * documentation and/or other materials provided with the distribution. 15 1.1 cgd * 3. The name of the author may not be used to endorse or promote products 16 1.1 cgd * derived from this software without specific prior written permission. 17 1.1 cgd * 18 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 1.1 cgd * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 1.1 cgd * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 1.1 cgd * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 1.1 cgd * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 1.1 cgd * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 1.1 cgd * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 1.1 cgd * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 1.1 cgd * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 1.1 cgd * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 1.1 cgd */ 29 1.1 cgd 30 1.1 cgd #ifndef _RTLDENV_H 31 1.1 cgd #define _RTLDENV_H 32 1.1 cgd 33 1.1 cgd #include <stddef.h> 34 1.1 cgd #include <stdarg.h> 35 1.1 cgd 36 1.6 skrll void *xcalloc(size_t); 37 1.6 skrll void *xmalloc(size_t); 38 1.8 christos void *xrealloc(void *, size_t); 39 1.6 skrll char *xstrdup(const char *); 40 1.9 ad void xfree(void *); 41 1.1 cgd 42 1.1 cgd #ifdef RTLD_LOADER 43 1.6 skrll void xprintf(const char *, ...) 44 1.3 christos __attribute__((__format__(__printf__, 1, 2))); 45 1.6 skrll void xvprintf(const char *, va_list) 46 1.3 christos __attribute__((__format__(__printf__, 1, 0))); 47 1.6 skrll void xsnprintf(char *, size_t, const char *, ...) 48 1.3 christos __attribute__((__format__(__printf__, 3, 4))); 49 1.6 skrll size_t xvsnprintf(char *, size_t, const char *, va_list) 50 1.3 christos __attribute__((__format__(__printf__, 3, 0))); 51 1.6 skrll void xwarn(const char *, ...) 52 1.3 christos __attribute__((__format__(__printf__, 1, 2))); 53 1.6 skrll void xwarnx(const char *, ...) 54 1.3 christos __attribute__((__format__(__printf__, 1, 2))); 55 1.6 skrll void xerr(int, const char *, ...) 56 1.7 drochner __attribute__((__noreturn__, __format__(__printf__, 2, 3))); 57 1.6 skrll void xerrx(int, const char *, ...) 58 1.7 drochner __attribute__((__noreturn__, __format__(__printf__, 2, 3))); 59 1.1 cgd 60 1.11 joerg void xassert(const char *, int, const char *) __dead; 61 1.6 skrll const char *xstrerror(int); 62 1.10 christos int xunsetenv(const char *); 63 1.3 christos 64 1.5 mycroft # ifdef DEBUG 65 1.5 mycroft # define assert(cond) ((cond) ? (void) 0 : xassert(__FILE__, __LINE__, #cond)) 66 1.5 mycroft # else 67 1.5 mycroft # define assert(cond) (void) 0 68 1.5 mycroft # endif 69 1.1 cgd #else 70 1.3 christos # include <assert.h> 71 1.3 christos # include <stdio.h> 72 1.3 christos # include <err.h> 73 1.12 skrll 74 1.3 christos # define xprintf printf 75 1.3 christos # define xvprintf vprintf 76 1.3 christos # define xsnprintf snprintf 77 1.3 christos # define xvsnprintf vsnprintf 78 1.3 christos # define xwarn warn 79 1.3 christos # define xwarnx warnx 80 1.3 christos # define xerr err 81 1.3 christos # define xerrx errx 82 1.3 christos # define xassert assert 83 1.3 christos # define xstrerror strerror 84 1.1 cgd #endif 85 1.1 cgd 86 1.1 cgd #endif /* _RTLDENV_H */ 87