aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/onexit.c
blob: 8c45e3b418fabf863d6f7228bf4f206799c242ee (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
/*
 * onexit.c
 */

#include <stdlib.h>
#include <unistd.h>
#include <sys/module.h>
#include "atexit.h"

int on_exit(void (*fctn) (int, void *), void *arg)
{
    struct atexit *as = malloc(sizeof(struct atexit));

    if (!as)
	return -1;

    as->fctn = fctn;
    as->arg = arg;

    as->next = __syslinux_current->u.x.atexit_list;
    __syslinux_current->u.x.atexit_list = as;

    return 0;
}