rtldenv.h revision 1.3 1 1.3 christos /* $NetBSD: rtldenv.h,v 1.3 1999/03/01 16:40:07 christos 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.3 christos void *xcalloc __P((size_t));
37 1.3 christos void *xmalloc __P((size_t));
38 1.3 christos char *xstrdup __P((const char *));
39 1.1 cgd
40 1.1 cgd #ifdef RTLD_LOADER
41 1.3 christos void xprintf __P((const char *, ...))
42 1.3 christos __attribute__((__format__(__printf__, 1, 2)));
43 1.3 christos void xvprintf __P((const char *, va_list))
44 1.3 christos __attribute__((__format__(__printf__, 1, 0)));
45 1.3 christos void xsnprintf __P((char *, size_t, const char *, ...))
46 1.3 christos __attribute__((__format__(__printf__, 3, 4)));
47 1.3 christos size_t xvsnprintf __P((char *, size_t, const char *, va_list))
48 1.3 christos __attribute__((__format__(__printf__, 3, 0)));
49 1.3 christos void xwarn __P((const char *, ...))
50 1.3 christos __attribute__((__format__(__printf__, 1, 2)));
51 1.3 christos void xwarnx __P((const char *, ...))
52 1.3 christos __attribute__((__format__(__printf__, 1, 2)));
53 1.3 christos void xerr __P((int, const char *, ...))
54 1.3 christos __attribute__((__format__(__printf__, 2, 3)));
55 1.3 christos void xerrx __P((int, const char *, ...))
56 1.3 christos __attribute__((__format__(__printf__, 2, 3)));
57 1.1 cgd
58 1.3 christos void xassert __P((const char *, int, const char *));
59 1.3 christos const char *xstrerror __P((int));
60 1.3 christos
61 1.3 christos # define assert(cond) ((cond) \
62 1.1 cgd ? (void) 0 :\
63 1.1 cgd (xassert(__FILE__, __LINE__, #cond "\n"), abort()))
64 1.1 cgd #else
65 1.3 christos # include <assert.h>
66 1.3 christos # include <stdio.h>
67 1.3 christos # include <err.h>
68 1.3 christos
69 1.3 christos # define xprintf printf
70 1.3 christos # define xvprintf vprintf
71 1.3 christos # define xsnprintf snprintf
72 1.3 christos # define xvsnprintf vsnprintf
73 1.3 christos # define xwarn warn
74 1.3 christos # define xwarnx warnx
75 1.3 christos # define xerr err
76 1.3 christos # define xerrx errx
77 1.3 christos # define xassert assert
78 1.3 christos # define xstrerror strerror
79 1.1 cgd #endif
80 1.1 cgd
81 1.1 cgd #endif /* _RTLDENV_H */
82