summaryrefslogtreecommitdiff
path: root/kernel/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c58
1 files changed, 25 insertions, 33 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index b750072..f21e35a 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -11,8 +11,19 @@
#include <time.h>
#include <unistd.h>
-time_t sys_time(void) {
- return ticks / 100;
+int sys_alarm(unsigned int seconds) {
+ if(!seconds) {
+ ctask->alarm = 0;
+ return 0;
+ }
+
+ ctask->alarm = ticks + (seconds * 100);
+}
+
+int sys_ctty(int ctty) {
+ ctask->ctty = ctty;
+
+ return 0;
}
pid_t sys_getpid(void) {
@@ -27,26 +38,8 @@ void *sys_getpdir(void) {
return (void*) pdir;
}
-void *sys_signal(int sig, void (*func)(int)) {
- if(sig < 0 || sig >= NRSIG)
- return NULL;
-
- /* SIGKILL and SIGSTOP cannot be caught */
- if(sig == SIGKILL || sig == SIGSTOP)
- return NULL;
-
- ctask->sig_handlers[sig] = func;
-
- return func;
-}
-
-int sys_alarm(unsigned int seconds) {
- if(!seconds) {
- ctask->alarm = 0;
- return 0;
- }
-
- ctask->alarm = ticks + (seconds * 100);
+void sys_panic(void) {
+ panic();
}
int sys_pause(void) {
@@ -55,22 +48,21 @@ int sys_pause(void) {
return -1;
}
-int sys_ctty(int ctty) {
- ctask->ctty = ctty;
+void *sys_signal(int sig, void (*func)(int)) {
+ if(sig < 0 || sig >= NRSIG)
+ return NULL;
- return 0;
-}
+ /* SIGKILL and SIGSTOP cannot be caught */
+ if(sig == SIGKILL || sig == SIGSTOP)
+ return NULL;
-ssize_t sys_read(void *buf, size_t len) {
- return tty_read(ctask->ctty, buf, len);
-}
+ ctask->sig_handlers[sig] = func;
-ssize_t sys_write(void *buf, size_t len) {
- return tty_write(ctask->ctty, buf, len);
+ return func;
}
-void sys_panic(void) {
- panic();
+time_t sys_time(void) {
+ return ticks / 100;
}
int sys_dummy(void) {