1 // ucode.c file : Interface to MTX kernel: syscall functions
5 #include "uio.c" // YOUR prints, printi, printx, printf functions
25 return syscall(0,0,0);
30 return syscall(5, 0, 0);
33 int exec(file
) char *file
;
35 return syscall(6, file
, 0);
39 int wait(status
) int *status
;
41 return syscall(20, status
, 0);
44 int mkdir(name
) char *name
;
46 return syscall(21, name
, 0);
49 int rmdir(name
) char *name
;
51 return syscall(22, name
, 0);
54 int creat(name
) char *name
;
56 return syscall(23, name
, 0);
59 int rm(name
) char *name
;
61 return syscall(24, name
[1], 0);
65 int chdir(name
) char *name
;
67 return syscall(26, name
, 0);
70 int open(file
, mode
) char *file
; int mode
;
72 return syscall(28, file
, mode
);
77 return syscall(29, fd
);
80 long lseek(fd
, offset
, ww
) int fd
; ulong offset
82 return syscall(30, fd
, (ulong
)offset
);
85 int chmod(mode
, filename
) int mode
; char *filename
// mode=0xxx in Octal form
87 return syscall(33, mode
, filename
);
90 int chown(uid
, filename
) int uid
; char *filename
;
92 return syscall(34, uid
, filename
);
95 int read(fd
, buf
, nbytes
) int fd
, nbytes
; char *buf
;
97 return syscall(35, fd
, buf
, nbytes
);
100 int write(fd
, buf
, nbytes
) int fd
, nbytes
; char *buf
;
102 return syscall(36, fd
, buf
, nbytes
);
105 int stat(filename
, sPtr
) char *filename
; struct stat
*sPtr
;
107 return syscall(38, filename
, sPtr
);
110 int getcwd(cwdname
) char *cwdname
;
112 syscall(39, cwdname
, 0);
115 int pipe(pd
) int *pd
;
117 return syscall(40, pd
, 0);
122 return syscall(41, fd
, 0);
125 int dup2(fd
,gd
) int fd
, gd
;
127 return syscall(42, fd
, gd
);
132 return syscall(43,0,0);
137 return syscall(44, 0);
140 int setuid(uid
) int uid
;
142 return syscall(45, uid
);
145 int gettty(s
) char *s
;
147 return syscall(46, s
, 0,0);
150 int settty(s
) char *s
;
152 return syscall(47, s
, 0,0);
155 int fstat(fd
, sPtr
) int fd
; struct stat
*sPtr
;
157 return syscall(48, fd
, sPtr
);
161 int kill(sig
, pid
) int sig
, pid
;
163 return syscall(50, sig
, pid
);
166 int signal(sig
, catcher
) ushort sig
, catcher
;
168 return syscall(51, sig
, catcher
);
171 int sleep(t
) ushort t
;
173 return syscall(52, t
);
176 int settimer(t
) ushort t
;
178 return syscall(53, t
);
182 int exit(ecode
) ushort ecode
;
184 syscall(99, ecode
, 0);