blob: c43de8d5d2f070f4ccdd7256608fa98227ce7333 (
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
|
#include <unistd.h>
#include "triton.h"
#include "fdtrash.h"
static void fdtrash_close(struct triton_context_t *ctx)
{
triton_context_unregister(ctx);
}
struct triton_context_t ctx = {
.close = fdtrash_close,
};
static void __close(void *arg)
{
close((long)arg);
}
void __export fdtrash_add(long fd)
{
triton_context_call(&ctx, (triton_event_func)__close, (void *)fd);
}
static void init()
{
triton_context_register(&ctx, NULL);
triton_context_wakeup(&ctx);
}
DEFINE_INIT(10, init);
|