diff --git a/src/sys/include/math.h b/src/sys/include/math.h index c69cd89..d793028 100644 --- a/src/sys/include/math.h +++ b/src/sys/include/math.h @@ -32,7 +32,7 @@ #include -typedef long long int quad_t; +//typedef long long int quad_t; typedef unsigned long long int u_quad_t; double atan(double x); @@ -44,6 +44,9 @@ /*** $Log$ + Revision 1.1.1.1 2006/06/01 12:46:13 reddawg + ubix2 + Revision 1.2 2005/10/12 00:13:36 reddawg Removed diff --git a/src/sys/include/sys/gen_calls.h b/src/sys/include/sys/gen_calls.h index d08519e..465af4e 100644 --- a/src/sys/include/sys/gen_calls.h +++ b/src/sys/include/sys/gen_calls.h @@ -36,6 +36,9 @@ int sys_write(struct thread *, struct write_args *); int getpid(struct thread *, struct getpid_args *); int issetugid(register struct thread *, struct issetugid_args *); +int readlink(struct thread *,struct readlink_args *); +int getuid(struct thread *, struct getuid_args *); +int getgid(struct thread *, struct getgid_args *); #endif diff --git a/src/sys/include/sys/kern_descrip.h b/src/sys/include/sys/kern_descrip.h index 631111f..e6168c1 100644 --- a/src/sys/include/sys/kern_descrip.h +++ b/src/sys/include/sys/kern_descrip.h @@ -33,7 +33,67 @@ #include #include +/* command values */ +#define F_DUPFD 0 /* duplicate file descriptor */ +#define F_GETFD 1 /* get file descriptor flags */ +#define F_SETFD 2 /* set file descriptor flags */ +#define F_GETFL 3 /* get file status flags */ +#define F_SETFL 4 /* set file status flags */ +#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ +#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ +#define F_GETLK 7 /* get record locking information */ +#define F_SETLK 8 /* set record locking information */ +#define F_SETLKW 9 /* F_SETLK; wait if blocked */ + +/* Flag Values */ +#define FREAD 0x0001 +#define FWRITE 0x0002 +#define O_NONBLOCK 0x0004 /* no delay */ +#define O_APPEND 0x0008 /* set append mode */ +#define O_SHLOCK 0x0010 /* open with shared file lock */ +#define O_EXLOCK 0x0020 /* open with exclusive file lock */ +#define O_ASYNC 0x0040 /* signal pgrp when data ready */ +#define O_FSYNC 0x0080 /* synchronous writes */ +#define O_SYNC 0x0080 /* POSIX synonym for O_FSYNC */ +#define O_NOFOLLOW 0x0100 /* don't follow symlinks */ +#define O_CREAT 0x0200 /* create if nonexistent */ +#define O_TRUNC 0x0400 /* truncate to zero length */ +#define O_EXCL 0x0800 /* error if already exists */ +#define O_DIRECT 0x00010000 +#define O_RDONLY 0x0000 /* open for reading only */ +#define O_WRONLY 0x0001 /* open for writing only */ +#define O_RDWR 0x0002 /* open for reading and writing */ +#define O_ACCMODE 0x0003 /* mask for above modes */ + + +#define FHASLOCK 0x4000 /* descriptor holds advisory lock */ + + +/* F MAPPERS */ +#define FAPPEND O_APPEND /* kernel/compat */ +#define FASYNC O_ASYNC /* kernel/compat */ +#define FFSYNC O_FSYNC /* kernel */ +#define FNONBLOCK O_NONBLOCK /* kernel */ +#define FNDELAY O_NONBLOCK /* compat */ +#define O_NDELAY O_NONBLOCK /* compat */ +#define FPOSIXSHM O_NOFOLLOW + + + +#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT) + +#define FFLAGS(oflags) ((oflags) + 1) +#define OFLAGS(fflags) ((fflags) - 1) + +struct file { + int f_flag; + }; + + int fcntl(struct thread *, struct fcntl_args *); +//int falloc(struct thread *,int **, int *); +int close(struct thread *,struct close_args *); +int falloc(struct thread *, struct file **, int *); #endif diff --git a/src/sys/include/sys/kernsysctl.h b/src/sys/include/sys/kernsysctl.h index b01708f..d434106 100644 --- a/src/sys/include/sys/kernsysctl.h +++ b/src/sys/include/sys/kernsysctl.h @@ -34,6 +34,18 @@ #include int __sysctl(struct thread *, struct sysctl_args *); +int sysctl_add(int *,int,char *,void *,int); +int sysctl_init(); + +struct sysctl_entry { + struct sysctl_entry *prev; + struct sysctl_entry *next; + struct sysctl_entry *children; + char name[32]; + int id; + void *value; + int val_len; + }; #endif diff --git a/src/sys/include/sys/pipe.h b/src/sys/include/sys/pipe.h new file mode 100644 index 0000000..fb9f7d6 --- /dev/null +++ b/src/sys/include/sys/pipe.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 _PIPE_H +#define _PIPE_H + +#include +#include + +int pipe(struct thread *, struct pipe_args *); + +#endif + +/*** + END + ***/ + diff --git a/src/sys/include/sys/sysproto.h b/src/sys/include/sys/sysproto.h index 67df3f8..0eb0c60 100644 --- a/src/sys/include/sys/sysproto.h +++ b/src/sys/include/sys/sysproto.h @@ -71,6 +71,39 @@ char arg_l_[PADL_(long)]; long arg; char arg_r_[PADR_(long)]; }; +struct pipe_args { + register_t dummy; + }; + +struct readlink_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)]; + char count_l_[PADL_(int)]; int count; char count_r_[PADR_(int)]; +}; + +struct getuid_args { + register_t dummy; +}; + +struct getgid_args { + register_t dummy; +}; +struct close_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; +}; + +struct mmap_args { + char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)]; + }; +struct obreak_args { + char nsize_l_[PADL_(char *)]; char * nsize; char nsize_r_[PADR_(char *)]; + }; diff --git a/src/sys/include/sys/thread.h b/src/sys/include/sys/thread.h index 291b3d1..089731b 100644 --- a/src/sys/include/sys/thread.h +++ b/src/sys/include/sys/thread.h @@ -30,10 +30,10 @@ #ifndef _THREAD_H #define _THREAD_H - struct thread { - int a; - int td_retval[2]; + int td_retval[2]; + uInt32 o_files[1024]; + uInt32 vm_daddr; }; #endif diff --git a/src/sys/include/ubixos/endtask.h b/src/sys/include/ubixos/endtask.h index 550d77c..fb3c8fc 100644 --- a/src/sys/include/ubixos/endtask.h +++ b/src/sys/include/ubixos/endtask.h @@ -31,6 +31,7 @@ #define _ENDTASK_H #include +#include void endTask(pidType); @@ -38,6 +39,9 @@ /*** $Log$ + Revision 1.1.1.1 2006/06/01 12:46:13 reddawg + ubix2 + Revision 1.2 2005/10/12 00:13:37 reddawg Removed diff --git a/src/sys/include/ubixos/syscalls_new.h b/src/sys/include/ubixos/syscalls_new.h index 31970a1..784bb22 100644 --- a/src/sys/include/ubixos/syscalls_new.h +++ b/src/sys/include/ubixos/syscalls_new.h @@ -36,9 +36,18 @@ void fcntl(); void issetugid(); void __sysctl(); +void pipe(); +void readlink(); +void getuid(); +void getgid(); +void close(); +void mmap(); +void obreak(); #define invalid_call 0x0 +typedef void (*functionPTR)(); + functionPTR systemCalls_new[] = { invalid_call, /** 0 **/ sysExit, /** 1 **/ @@ -46,7 +55,7 @@ invalid_call, /** 3 **/ sys_write, /** 4 **/ invalid_call, /** 5 **/ - invalid_call, /** 6 **/ + close, /** 6 **/ invalid_call, /** 7 **/ invalid_call, /** 8 **/ invalid_call, /** 9 **/ @@ -57,14 +66,14 @@ invalid_call, /** 14 **/ invalid_call, /** 15 **/ invalid_call, /** 16 **/ - invalid_call, /** 17 **/ + obreak, /** 17 **/ invalid_call, /** 18 **/ invalid_call, /** 19 **/ getpid, /** 20 **/ invalid_call, /** 21 **/ invalid_call, /** 22 **/ invalid_call, /** 23 **/ - invalid_call, /** 24 **/ + getuid, /** 24 **/ invalid_call, /** 25 **/ invalid_call, /** 26 **/ invalid_call, /** 27 **/ @@ -82,12 +91,12 @@ invalid_call, /** 39 **/ invalid_call, /** 40 **/ invalid_call, /** 41 **/ - invalid_call, /** 42 **/ + pipe, /** 42 **/ invalid_call, /** 43 **/ invalid_call, /** 44 **/ invalid_call, /** 45 **/ invalid_call, /** 46 **/ - invalid_call, /** 47 **/ + getgid, /** 47 **/ invalid_call, /** 48 **/ invalid_call, /** 49 **/ invalid_call, /** 50 **/ @@ -98,7 +107,7 @@ invalid_call, /** 55 **/ invalid_call, /** 56 **/ invalid_call, /** 57 **/ - invalid_call, /** 58 **/ + readlink, /** 58 **/ invalid_call, /** 59 **/ invalid_call, /** 60 **/ invalid_call, /** 61 **/ @@ -237,7 +246,7 @@ invalid_call, /** 194 **/ invalid_call, /** 195 **/ invalid_call, /** 196 **/ - invalid_call, /** 197 **/ + mmap, /** 197 **/ invalid_call, /** 198 **/ invalid_call, /** 199 **/ invalid_call, /** 200 **/ diff --git a/src/sys/include/ubixos/types.h b/src/sys/include/ubixos/types.h index 7a423d8..2fe3f61 100644 --- a/src/sys/include/ubixos/types.h +++ b/src/sys/include/ubixos/types.h @@ -48,6 +48,8 @@ typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; typedef __uint64_t u_int64_t; +//typedef long long int quad_t; +typedef __uint64_t quad_t; typedef unsigned char u_char; typedef unsigned short u_short; @@ -92,30 +94,12 @@ #endif typedef __ssize_t ssize_t; - +typedef char * caddr_t; +typedef __int64_t off_t; #endif /*** - $Log$ - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:57 reddawg - no message - - Revision 1.6 2004/09/08 22:04:10 apwillia - Added calling of static constructors, commented out tty_printf in kprintf (due to deadlock) - - Revision 1.5 2004/07/05 23:06:32 reddawg - Fixens - - Revision 1.4 2004/06/01 02:50:45 reddawg - Cleanup - - Revision 1.3 2004/05/21 15:20:00 reddawg - Cleaned up - - END ***/ + diff --git a/src/sys/include/vfs/file.h b/src/sys/include/vfs/file.h index 5d0245e..5680ac0 100644 --- a/src/sys/include/vfs/file.h +++ b/src/sys/include/vfs/file.h @@ -74,7 +74,6 @@ fileDescriptor *fopen(const char *,const char *); int fclose(fileDescriptor *); - /* UBU */ diff --git a/src/sys/include/vmm/paging.h b/src/sys/include/vmm/paging.h index 267f636..4ea31c5 100644 --- a/src/sys/include/vmm/paging.h +++ b/src/sys/include/vmm/paging.h @@ -31,6 +31,8 @@ #define _PAGING_H #include +#include +#include #define pageLength 0x00000400 #define pageSize 4096 @@ -64,43 +66,14 @@ void *vmm_getFreeMallocPage(uInt16 count); void vmm_pageFault(uInt32,uInt32,uInt32); void _vmm_pageFault(); +int mmap(struct thread *,struct mmap_args *); +int obreak(struct thread *,struct obreak_args *); extern uInt32 *kernelPageDirectory; #endif /*** - $Log$ - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:58 reddawg - no message - - Revision 1.8 2004/08/14 11:23:02 reddawg - Changes - - Revision 1.7 2004/07/28 15:05:43 reddawg - Major: - Pages now have strict security enforcement. - Many null dereferences have been resolved. - When apps loaded permissions set for pages rw and ro - - Revision 1.6 2004/07/26 19:15:49 reddawg - test code, fixes and the like - - Revision 1.5 2004/07/24 23:04:44 reddawg - Changes... mark let me know if you fault at pid 185 when you type stress - - Revision 1.4 2004/07/24 20:00:51 reddawg - Lots of changes to the vmm subsystem.... Page faults have been adjust to now be blocking on a per thread basis not system wide. This has resulted in no more deadlocks.. also the addition of per thread locking has removed segfaults as a result of COW in which two tasks fault the same COW page and try to modify it. - - Revision 1.3 2004/07/22 17:32:25 reddawg - I broke it hopefully - - Revision 1.2 2004/05/21 15:21:04 reddawg - Cleaned up - - END ***/ +