aboutsummaryrefslogtreecommitdiff
path: root/lib/src/syscalls.c
blob: d6ac1a51d158aea2dda0f535f24f4e8b51a188cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (c) 2021 Johannes Stoelp

#include <asm/unistd.h>  // __NR_*
#include <syscall.h>
#include <syscalls.h>

int open(const char* path, int flags) {
    return syscall2(__NR_open, path, flags);
}

ssize_t read(int fd, void* buf, size_t count) {
    return syscall3(__NR_read, fd, buf, count);
}

off_t lseek(int fd, off_t offset, int whence) {
    return syscall3(__NR_lseek, fd, offset, whence);
}

void _exit(int status) {
    syscall1(__NR_exit, status);
    __builtin_unreachable();
}