summaryrefslogtreecommitdiff
path: root/src/stdlib/_stdlib.h
blob: 82b7943d3035e73f2543e599e29ffa0051429642 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef ___STDLIB_H__
#define ___STDLIB_H__

#include <stdlib.h>
#include <limits.h>

#define _rand(_n) \
	(((_n) = (_n) * 1103515245 + 12345) ? (_n) / UINT_MAX % RAND_MAX : 0)

#include "errno/errno_t.h"
#include "constraint_handler_t.h"
#include "__constraint_info.h"
void abort_handler_s(const char * restrict msg, void * restrict ptr, errno_t error);

struct __stdlib {
	struct atexit {
        	int nfns;
        	void (*fns[32])(void);
        	struct atexit *next;
        	struct atexit *prev;
	} atexit;
	int exit_called;
	int quick_exit_called;
	unsigned int rand;
	char **environ;
	constraint_handler_t constraint_handler;
};

extern struct __stdlib __stdlib;

#ifdef _POSIX_SOURCE
extern char **environ;
#else
#define environ __stdlib.environ
#endif

#endif