Renamed functions to sys_* to not be confused with libc functions

This commit is contained in:
g1n 2021-12-09 14:37:23 +02:00
parent 1d03e0553c
commit 258b647cb7
4 changed files with 13 additions and 13 deletions

View File

@ -2,6 +2,6 @@
int main() {
char hellostr[] = "Hello, World!\n";
write(1, hellostr, sizeof(hellostr));
sys_write(1, hellostr, sizeof(hellostr));
return 0;
}

View File

@ -2,7 +2,7 @@
int main() {
char str[10];
read(2, str, 10);
write(1, str, sizeof(str));
sys_read(2, str, 10);
sys_write(1, str, sizeof(str));
return 0;
}

View File

@ -5,11 +5,11 @@
#include <stddef.h>
#include <sys/types.h>
void exit(int status); // FIXME: noreturn
int open(const char *pathname, int flags);
int close(int fd);
ssize_t write(int fd, const void *buf, size_t count);
ssize_t read(int fd, void *buf, size_t count);
void sys_exit(int status); // FIXME: noreturn
int sys_open(const char *pathname, int flags);
int sys_close(int fd);
ssize_t sys_write(int fd, const void *buf, size_t count);
ssize_t sys_read(int fd, void *buf, size_t count);
// TODO

View File

@ -1,22 +1,22 @@
#include <liblinux.h>
#include <liblinux/syscall.h>
void exit(int status) {
void sys_exit(int status) {
syscall(__NR_exit, status);
}
int open(const char *pathname, int flags) {
int sys_open(const char *pathname, int flags) {
return syscall(__NR_close, pathname, flags);
}
int close(int fd) {
int sys_close(int fd) {
return syscall(__NR_close, fd);
}
ssize_t write(int fd, const void *buf, size_t count) {
ssize_t sys_write(int fd, const void *buf, size_t count) {
return syscall(__NR_write, fd, buf, count);
}
ssize_t read(int fd, void *buf, size_t count) {
ssize_t sys_read(int fd, void *buf, size_t count) {
return syscall(__NR_read, fd, buf, count);
}