Brooklyn/include/linux/delayed_call.h
Scare Crowe 2a709f28fa Auto exploit mitigation feature
* 0day explit mitigation
* Memory corruption prevention
* Privilege escalation prevention
* Buffer over flow prevention
* File System corruption defense
* Thread escape prevention

This may very well be the most intensive inclusion to BrooklynR. This will not be part of an x86 suite nor it will be released as tool kit. The security core toolkit will remain part of kernel base.
2021-11-13 09:26:51 +05:00

35 lines
670 B
C

#ifndef _DELAYED_CALL_H
#define _DELAYED_CALL_H
/*
* Poor man's closures; I wish we could've done them sanely polymorphic,
* but...
*/
struct delayed_call {
void (*fn)(void *);
void *arg;
};
#define DEFINE_DELAYED_CALL(name) struct delayed_call name = {NULL, NULL}
/* I really wish we had closures with sane typechecking... */
static inline void set_delayed_call(struct delayed_call *call,
void (*fn)(void *), void *arg)
{
call->fn = fn;
call->arg = arg;
}
static inline void do_delayed_call(struct delayed_call *call)
{
if (call->fn)
call->fn(call->arg);
}
static inline void clear_delayed_call(struct delayed_call *call)
{
call->fn = NULL;
}
#endif