-
Notifications
You must be signed in to change notification settings - Fork 0
/
stack.h
33 lines (25 loc) · 853 Bytes
/
stack.h
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
// SPDX-License-Identifier: MIT
#ifndef IOUCONTEXT_STACK_H
#define IOUCONTEXT_STACK_H
#include <signal.h>
#include <stdalign.h>
#ifdef __cplusplus
extern "C" {
#endif
stack_t stack_get(size_t size);
stack_t stack_get_rlimit();
stack_t stack_get_signal();
stack_t stack_clear(stack_t);
stack_t stack_nofork(stack_t);
stack_t stack_dofork(stack_t);
void * stack_alloca(stack_t *, size_t, size_t);
#define stack_push(STACK, TYPE) ({ (TYPE*) stack_alloca((STACK), sizeof(TYPE), alignof(TYPE)); })
#define stack_array(STACK, TYPE, COUNT) ({ (TYPE*) stack_alloca((STACK), (COUNT) * sizeof(TYPE), alignof(TYPE)); })
void * stack_memcpy(stack_t *, const void *, size_t, size_t);
char * stack_strcpy(stack_t *, const char *);
stack_t stack_split(stack_t *, size_t, size_t);
void stack_put(stack_t);
#ifdef __cplusplus
}
#endif
#endif//IOUCONTEXT_STACK_H