00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <ubixos/types.h>
00031 #include <sys/thread.h>
00032 #include <sys/gen_calls.h>
00033 #include <ubixos/sched.h>
00034 #include <lib/kprintf.h>
00035 #include <assert.h>
00036
00037
00038 int getpid(struct thread *td, struct getpid_args *uap) {
00039 td->td_retval[0] = _current->id;
00040 return (0);
00041 }
00042
00043
00044 int getuid(struct thread *td, struct getuid_args *uap) {
00045 td->td_retval[0] = _current->uid;
00046 return (0);
00047 }
00048
00049
00050 int getgid(struct thread *td, struct getgid_args *uap) {
00051 td->td_retval[0] = _current->gid;
00052 return (0);
00053 }
00054
00055 int sys_write(struct thread *td, struct write_args *uap) {
00056 char *buffer = 0x0;
00057 char *in = 0x0;
00058
00059 if (uap->fd == 2) {
00060 kprintf("stderr: %s",uap->buf);
00061 }
00062
00063 if (uap->fd == 1) {
00064 in = uap->buf;
00065 buffer = kmalloc(1024);
00066 memcpy(buffer,uap->buf,uap->nbyte);
00067 kprintf("%s",buffer);
00068 kfree(buffer);
00069 }
00070 else {
00071 kprintf("(%i) %s",uap->fd,uap->buf);
00072 }
00073 return(0x0);
00074 }
00075
00076 int issetugid(register struct thread *td, struct issetugid_args *uap) {
00077 td->td_retval[0] = 0;
00078 return (0);
00079 }
00080
00081 int readlink(struct thread *td,struct readlink_args *uap) {
00082 kprintf("readlink: [%s:%i]\n",uap->path,uap->count);
00083 td->td_retval[0] = -1;
00084 td->td_retval[1] = 0x0;
00085 return(0x0);
00086 }
00087
00088 int gettimeofday_new(struct thread *td, struct gettimeofday_args *uap) {
00089 return(0x0);
00090 }
00091
00092 int read(struct thread *td,struct read_args *uap) {
00093 int error = 0x0;
00094 int i = 0x0;
00095
00096 for (i = 0x0;i < 20;i++) {
00097 ((char *)uap->buf)[i] = 'a';
00098 }
00099 ((char *)uap->buf)[i] = '\0';
00100 td->td_retval[0] = 20;
00101 return(error);
00102 }
00103
00104
00105
00106
00107