diff --git a/src/sys/include/sys/gen_calls.h b/src/sys/include/sys/gen_calls.h index 0dc7a7e..d08519e 100644 --- a/src/sys/include/sys/gen_calls.h +++ b/src/sys/include/sys/gen_calls.h @@ -35,6 +35,7 @@ int sys_write(struct thread *, struct write_args *); int getpid(struct thread *, struct getpid_args *); +int issetugid(register struct thread *, struct issetugid_args *); #endif diff --git a/src/sys/include/sys/kern_descrip.h b/src/sys/include/sys/kern_descrip.h new file mode 100644 index 0000000..631111f --- /dev/null +++ b/src/sys/include/sys/kern_descrip.h @@ -0,0 +1,43 @@ +/***************************************************************************************** + Copyright (c) 2002-2004 The UbixOS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id$ + +*****************************************************************************************/ + +#ifndef _KERN_DESCRIP_H +#define _KERN_DESCRIP_H + +#include +#include + +int fcntl(struct thread *, struct fcntl_args *); + +#endif + +/*** + END + ***/ + diff --git a/src/sys/include/sys/sysproto.h b/src/sys/include/sys/sysproto.h index abb36b4..67df3f8 100644 --- a/src/sys/include/sys/sysproto.h +++ b/src/sys/include/sys/sysproto.h @@ -62,6 +62,15 @@ struct getpid_args { register_t dummy; }; +struct issetugid_args { + register_t dummy; +}; +struct fcntl_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char arg_l_[PADL_(long)]; long arg; char arg_r_[PADR_(long)]; +}; + diff --git a/src/sys/include/ubixos/syscalls_new.h b/src/sys/include/ubixos/syscalls_new.h index 569b446..31970a1 100644 --- a/src/sys/include/ubixos/syscalls_new.h +++ b/src/sys/include/ubixos/syscalls_new.h @@ -30,7 +30,12 @@ #ifndef _SYSCALLS_NEW_H #define _SYSCALLS_NEW_H -#include +void sysExit(); +void sys_write(); +void getpid(); +void fcntl(); +void issetugid(); +void __sysctl(); #define invalid_call 0x0 @@ -127,7 +132,7 @@ invalid_call, /** 89 **/ invalid_call, /** 90 **/ invalid_call, /** 91 **/ - invalid_call, /** 92 **/ + fcntl, /** 92 **/ invalid_call, /** 93 **/ invalid_call, /** 94 **/ invalid_call, /** 95 **/ @@ -288,7 +293,7 @@ invalid_call, /** 250 **/ invalid_call, /** 251 **/ invalid_call, /** 252 **/ - invalid_call, /** 253 **/ + issetugid, /** 253 **/ invalid_call, /** 254 **/ invalid_call, /** 255 **/ invalid_call, /** 256 **/ diff --git a/src/sys/kernel/Makefile b/src/sys/kernel/Makefile index aa6e2cc..b025135 100644 --- a/src/sys/kernel/Makefile +++ b/src/sys/kernel/Makefile @@ -6,7 +6,7 @@ include ../Makefile.inc # Objects -OBJS = kernsysctl.o gen_calls.o schedyield.o tty.o sys_call_new.o sys_call.o endtask.o spinlock.o bioscall.o ld.o time.o fork.o syscall.o elf.o systemtask.o exec.o sched.o kpanic.o vitals.o ubthread.o timer.o +OBJS = kern_descrip.o kernsysctl.o gen_calls.o schedyield.o tty.o sys_call_new.o sys_call.o endtask.o spinlock.o bioscall.o ld.o time.o fork.o syscall.o elf.o systemtask.o exec.o sched.o kpanic.o vitals.o ubthread.o timer.o # ap-boot.o smp.o all: $(OBJS) diff --git a/src/sys/kernel/gen_calls.c b/src/sys/kernel/gen_calls.c index cc74fae..bed91b9 100644 --- a/src/sys/kernel/gen_calls.c +++ b/src/sys/kernel/gen_calls.c @@ -39,7 +39,6 @@ return (0); } - int sys_write(struct thread *td, struct write_args *uap) { if (uap->fd == 2) { kprintf("stderr: %s",uap->buf); @@ -50,6 +49,12 @@ return(0x0); } +int issetugid(register struct thread *td, struct issetugid_args *uap) { + td->td_retval[0] = 0; + return (0); + } + + /*** END ***/ diff --git a/src/sys/kernel/kern_descrip.c b/src/sys/kernel/kern_descrip.c new file mode 100644 index 0000000..d0eb1af --- /dev/null +++ b/src/sys/kernel/kern_descrip.c @@ -0,0 +1,58 @@ +/***************************************************************************************** + Copyright (c) 2002-2004 The UbixOS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id$ + +*****************************************************************************************/ + +#include +#include +#include +#include +#include +#include + +int fcntl(struct thread *td, struct fcntl_args *uap) { + kprintf("fcntl: [%i:%i]\n",uap->cmd,uap->fd); + if (uap->fd == 0) { + td->td_retval[0] = 0x2; + } + else if (uap->fd == 1) { + td->td_retval[0] = 0x1; + } + else if (uap->fd == 2) { + td->td_retval[0] = 0x2; + } + else { + td->td_retval[0] = -1; + } + return(0x0); + } + + +/*** + END + ***/ + diff --git a/src/sys/kernel/kernsysctl.c b/src/sys/kernel/kernsysctl.c index 257eecd..999145d 100644 --- a/src/sys/kernel/kernsysctl.c +++ b/src/sys/kernel/kernsysctl.c @@ -37,6 +37,7 @@ int __sysctl(struct thread *td, struct sysctl_args *uap) { //kprintf("Name: [%s][%i][%i:%i]\n",uap->name,uap->namelen,uap->oldlenp,uap->newlen); kprintf("__sysctl: Just a place holder\n"); + td->td_retval[0] = -1; return(0x0); } diff --git a/src/sys/kernel/syscall.c b/src/sys/kernel/syscall.c index 2c34089..dc7b17a 100644 --- a/src/sys/kernel/syscall.c +++ b/src/sys/kernel/syscall.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -260,7 +259,8 @@ } else if ((uInt32)systemCalls_new[frame.tf_eax] == 0x0) { kprintf("Invalid Call: [%i][0x%X]\n",frame.tf_eax,(uInt32)systemCalls_new[frame.tf_eax]); - td->td_retval[0] = -1; + frame.tf_eax = -1; + frame.tf_edx = 0x0; } else { params = (caddr_t)frame.tf_esp + sizeof(int);