summaryrefslogtreecommitdiffstats
path: root/syscall/exit.c
blob: 307ea7a417226a0e8ddbd143e9f51a65105081e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "api/syscall.h"
#include "api/errno.h"
#include "umode_vma.h"
#include "arch/processor.h"
#include "handler.h"

int
_handler_exit(struct sc_exit *sc)
{
    int exit_code = 0;
    if(user_vma_read(&exit_code, &sc->exit_code, sizeof(int)) != 0)
        return -EFAIL;

    tcb_t *tcb = tcb_current();
    tcb_kill(tcb, exit_code);
    return 0;
}