]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libbsd/lib/contrib/include/bsd/stdlib.h
update
[l4.git] / l4 / pkg / libbsd / lib / contrib / include / bsd / stdlib.h
1 /*
2  * Copyright © 2005 Aurelien Jarno
3  * Copyright © 2006 Robert Millan
4  * Copyright © 2008-2011 Guillem Jover <guillem@hadrons.org>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
20  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 #ifdef LIBBSD_OVERLAY
30 #include_next <stdlib.h>
31 #else
32 #include <stdlib.h>
33 #endif
34
35 /* For compatibility with NetBSD, which defines humanize_number here. */
36 #ifdef LIBBSD_OVERLAY
37 #include <libutil.h>
38 #else
39 #include <bsd/libutil.h>
40 #endif
41
42 #ifndef LIBBSD_STDLIB_H
43 #define LIBBSD_STDLIB_H
44
45 #include <sys/cdefs.h>
46 #include <sys/stat.h>
47 #include <stdint.h>
48
49 __BEGIN_DECLS
50 u_int32_t arc4random();
51 void arc4random_stir();
52 void arc4random_addrandom(u_char *dat, int datlen);
53 void arc4random_buf(void *_buf, size_t n);
54 u_int32_t arc4random_uniform(u_int32_t upper_bound);
55
56 int dehumanize_number(const char *str, int64_t *size);
57
58 const char *getprogname(void);
59 void setprogname(const char *);
60
61 int heapsort (void *, size_t, size_t, int (*)(const void *, const void *));
62 int mergesort(void *base, size_t nmemb, size_t size,
63               int (*cmp)(const void *, const void *));
64 int radixsort(const unsigned char **base, int nmemb,
65               const unsigned char *table, unsigned endbyte);
66 int sradixsort(const unsigned char **base, int nmemb,
67                const unsigned char *table, unsigned endbyte);
68
69 void *reallocf(void *ptr, size_t size);
70 void *reallocarray(void *ptr, size_t nmemb, size_t size);
71
72 long long strtonum(const char *nptr, long long minval, long long maxval,
73                    const char **errstr);
74
75 char *getbsize(int *headerlenp, long *blocksizep);
76 __END_DECLS
77
78 #endif