Renamed functions to sys_* to not be confused with libc functions
This commit is contained in:
parent
1d03e0553c
commit
258b647cb7
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char hellostr[] = "Hello, World!\n";
|
char hellostr[] = "Hello, World!\n";
|
||||||
write(1, hellostr, sizeof(hellostr));
|
sys_write(1, hellostr, sizeof(hellostr));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char str[10];
|
char str[10];
|
||||||
read(2, str, 10);
|
sys_read(2, str, 10);
|
||||||
write(1, str, sizeof(str));
|
sys_write(1, str, sizeof(str));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
void exit(int status); // FIXME: noreturn
|
void sys_exit(int status); // FIXME: noreturn
|
||||||
int open(const char *pathname, int flags);
|
int sys_open(const char *pathname, int flags);
|
||||||
int close(int fd);
|
int sys_close(int fd);
|
||||||
ssize_t write(int fd, const void *buf, size_t count);
|
ssize_t sys_write(int fd, const void *buf, size_t count);
|
||||||
ssize_t read(int fd, void *buf, size_t count);
|
ssize_t sys_read(int fd, void *buf, size_t count);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
#include <liblinux.h>
|
#include <liblinux.h>
|
||||||
#include <liblinux/syscall.h>
|
#include <liblinux/syscall.h>
|
||||||
|
|
||||||
void exit(int status) {
|
void sys_exit(int status) {
|
||||||
syscall(__NR_exit, 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);
|
return syscall(__NR_close, pathname, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
int close(int fd) {
|
int sys_close(int fd) {
|
||||||
return syscall(__NR_close, 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);
|
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);
|
return syscall(__NR_read, fd, buf, count);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue