gen_calls.c

Go to the documentation of this file.
00001 /*****************************************************************************************
00002  Copyright (c) 2002-2004 The UbixOS Project
00003  All rights reserved.
00004 
00005  Redistribution and use in source and binary forms, with or without modification, are
00006  permitted provided that the following conditions are met:
00007 
00008  Redistributions of source code must retain the above copyright notice, this list of
00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
00010  form must reproduce the above copyright notice, this list of conditions, the following
00011  disclaimer and the list of authors in the documentation and/or other materials provided
00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
00013  contributors may be used to endorse or promote products derived from this software
00014  without specific prior written permission.
00015 
00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 
00026  $Id$
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 /* return the process id */
00038 int getpid(struct thread *td, struct getpid_args *uap) {
00039   td->td_retval[0] = _current->id;
00040   return (0);
00041   }
00042 
00043 /* return the process user id */
00044 int getuid(struct thread *td, struct getuid_args *uap) {
00045   td->td_retval[0] = _current->uid;
00046   return (0);
00047   }
00048 
00049 /* return the process group id */
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   if (uap->fd == 2) {
00059     kprintf("stderr: %s",uap->buf);
00060     }
00061   if (uap->fd == 1) {
00062     in = uap->buf;
00063     buffer = kmalloc(1024);
00064     memcpy(buffer,uap->buf,uap->nbyte);
00065     kprintf("%s",buffer); 
00066     kfree(buffer);
00067     }
00068   else {
00069     kprintf("(%i) %s",uap->fd,uap->buf);
00070     }
00071   return(0x0);
00072   }
00073 
00074 int issetugid(register struct thread *td, struct issetugid_args *uap) {
00075   td->td_retval[0] = 0;
00076   return (0);
00077   }
00078 
00079 int readlink(struct thread *td,struct readlink_args *uap) {
00080   kprintf("readlink: [%s:%i]\n",uap->path,uap->count);
00081   td->td_retval[0] = -1;
00082   td->td_retval[1] = 0x0;
00083   return(0x0);
00084   }
00085 
00086 int gettimeofday_new(struct thread *td, struct gettimeofday_args *uap) {
00087   return(0x0);
00088   }
00089 
00090 /***
00091  END
00092  ***/

Generated on Sun Dec 3 02:38:04 2006 for UbixOS V2 by  doxygen 1.4.7