diff --git a/.cproject b/.cproject index 0c17e32..edb5d25 100644 --- a/.cproject +++ b/.cproject @@ -44,8 +44,30 @@ + + + + + + + + + + + + + + + + + - + diff --git a/bin/shell/commands.c b/bin/shell/commands.c index 598af10..6994656 100644 --- a/bin/shell/commands.c +++ b/bin/shell/commands.c @@ -93,7 +93,8 @@ else { printf("Childs Pid: [%i]\n",cPid); } - } + } + sde } else if (memcmp(data->args->arg,"test3", 5) == 0) { for (i=0x0;i<50;i++) { @@ -108,7 +109,7 @@ printf("Childs Pid: [%i]\n",cPid); } } - } + } else if (memcmp(data->args->arg,"echo",4) == 0) { for (i=1;iargc;i++) { printf("%s ",argv[i]); @@ -117,7 +118,7 @@ } else if (memcmp(data->args->arg,"about",5) == 0) { printf("UbixOS Shell v0.99 (C) 2002\n"); - printf("Base Command Line Interface\n"); + printf("Base Command Line Interface\n"); } else if (memcmp(data->args->arg,"cd",2) == 0) { if (argv[1]) { diff --git a/bin/shell/input.c b/bin/shell/input.c index c3bc07d..64092b1 100644 --- a/bin/shell/input.c +++ b/bin/shell/input.c @@ -31,9 +31,11 @@ #include "shell.h" void parseInput( inputBuffer *buffer, char *data ) { + int i = 0x0; char *arg = 0x0; // char **argv = 0x0; + struct argsStruct *tmpArgs = 0x0; while ( data[0] == ' ' ) { @@ -52,13 +54,6 @@ arg = strtok( data, " " ); data = strtok( NULL, "\n" ); -/* -if (data != 0x0) - printf( "sh[%s:%s]", arg, data ); -else - printf( "sh[%s]", arg ); -*/ - if ( arg[0] == '&' ) { buffer->bg = 0x1; } @@ -74,28 +69,19 @@ /* Alloc memory for argv[] */ buffer->argv = (char **) malloc( sizeof(char *) * ( buffer->argc + 1 ) ); - //buffer->envp = (char **)malloc(sizeof(char)); - - //buffer->envp[0] = 0x1; tmpArgs = buffer->args; - //argv = buffer->argv; - //printf( "argc: [%i]\n", buffer->argc ); - //printf( "arg-1: [%i:%s]\n", buffer->args->arg, buffer->args->arg ); for ( i = 0x1; i <= buffer->argc ; i++ ) { buffer->argv[i] = tmpArgs->arg; - //printf( "argv[%i]: %s\n", i, argv[i] ); tmpArgs = tmpArgs->next; } + buffer->argv[0] = (char *)buffer->argc; - //argv[buffer->argc+1] = buffer->envp; - //printf( "arg-1: [%i:%i:%s]\n", argv[0], buffer->args->arg, buffer->args->arg ); } void freeArgs( inputBuffer *ptr ) { free( ptr->args ); - //free(tmpArgs->argv); } diff --git a/bin/shell/main.c b/bin/shell/main.c index c3e59b7..04c3c8b 100644 --- a/bin/shell/main.c +++ b/bin/shell/main.c @@ -41,39 +41,37 @@ int main(int argc, char **argv, char **env) { unsigned int *segbase = 0x0; - char *buffer = (char *) malloc( 512 ); - inputBuffer *inBuf = (inputBuffer *) malloc( sizeof(inputBuffer) ); + char *buffer = (char *) malloc(512); + inputBuffer *inBuf = (inputBuffer *) malloc(sizeof(inputBuffer)); - machine = (char *) malloc( 32 ); - cwd = (char *) malloc( 1024 ); - memset(cwd, 'A', 1024); - cwd[1022] = '\n'; - cwd[1023] = '\0'; + machine = (char *) malloc(32); + cwd = (char *) malloc(1024); + bzero(cwd, 1024); - sprintf( machine, "uBixCube" ); - getcwd( cwd, 1024 ); + sprintf(machine, "uBixCube"); + getcwd(cwd, 1024); - while ( 1 ) { + while (1) { aGain: - printf( "%s@%s# ", machine, cwd ); - gets( (char *) buffer ); + printf("%s@%s# ", machine, cwd); + gets((char *) buffer); - if ( buffer[0] == 0x0 ) + if (buffer[0] == 0x0) goto aGain; inBuf->argc = 0x0; inBuf->args = 0x0; inBuf->bg = 0x0; - parseInput( inBuf, buffer ); + parseInput(inBuf, buffer); - if ( inBuf->args->arg != 0x0 ) { + if (inBuf->args->arg != 0x0) { if (!commands(inBuf)) execProgram(inBuf); } - freeArgs( inBuf ); + freeArgs(inBuf); } - return ( 0x0 ); + return (0x0); } diff --git a/bin/shell/shell.h b/bin/shell/shell.h index 13edb0c..3281c97 100644 --- a/bin/shell/shell.h +++ b/bin/shell/shell.h @@ -31,20 +31,20 @@ extern char *cwd; struct argsStruct { - struct argsStruct *next; - char *arg; - }; - -typedef struct { - int argc; - char **argv; - char **envp; - uInt8 bg; - struct argsStruct *args; - } inputBuffer; + struct argsStruct *next; + char *arg; +}; -void parseInput(inputBuffer *,char *); +typedef struct { + int argc; + char **argv; + char **envp; + uint8_t bg; + struct argsStruct *args; +} inputBuffer; + +void parseInput(inputBuffer *, char *); int commands(inputBuffer *); void execProgram(inputBuffer *); void freeArgs(inputBuffer *ptr); -void error(int errorCode,const char *errorMsg); +void error(int errorCode, const char *errorMsg); diff --git a/include_old/sys/_types.h b/include_old/sys/_types.h index c5156c0..118bc20 100644 --- a/include_old/sys/_types.h +++ b/include_old/sys/_types.h @@ -1,104 +1,86 @@ /*- - * Copyright (c) 2002 Mike Barcroft + * Copyright (c) 2002-2018 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: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * This was developed by Christopher W. Olsen for the UbixOS Project. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: * - * $FreeBSD: src/sys/sys/_types.h,v 1.14 2003/03/28 15:27:30 mike Exp $ + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) 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. + * 3) 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 AUTHOR 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. */ #ifndef _SYS__TYPES_H_ #define _SYS__TYPES_H_ -#include -#include +typedef char __int8_t; +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; +typedef long long __int64_t; +typedef unsigned long long __uint64_t; -/* - * Standard type definitions. - */ -typedef __int32_t __clockid_t; /* clock_gettime()... */ -typedef __uint32_t __fflags_t; /* file flags */ -typedef __uint64_t __fsblkcnt_t; -typedef __uint64_t __fsfilcnt_t; -typedef __uint32_t __gid_t; -typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */ -typedef __uint32_t __ino_t; /* inode number */ -typedef long __key_t; /* IPC key (for Sys V IPC) */ -typedef __uint16_t __mode_t; /* permissions */ -typedef int __nl_item; -typedef __uint16_t __nlink_t; /* link count */ -typedef __int64_t __off_t; /* file offset */ -typedef __int32_t __pid_t; /* process [group] */ -typedef __int64_t __rlim_t; /* resource limit (XXX not unsigned) */ -typedef __uint8_t __sa_family_t; -typedef __uint32_t __socklen_t; -typedef long __suseconds_t; /* microseconds (signed) */ -typedef __int32_t __timer_t; /* timer_gettime()... */ -typedef __uint32_t __udev_t; /* device number */ -typedef __uint32_t __uid_t; -typedef unsigned int __useconds_t; /* microseconds (unsigned) */ +typedef unsigned long __clock_t; +typedef __uint32_t __ino_t; + typedef __int32_t __ssize_t;/* stat types */ +typedef __uint32_t __dev_t;/* device number */ +typedef __uint16_t __mode_t; + typedef __uint16_t __nlink_t;/* link count */ +typedef __uint32_t __uid_t; + typedef __uint32_t __gid_t; + typedef __int32_t __time_t; + typedef __int64_t __blkcnt_t;/* file block count */ +typedef __uint32_t __blksize_t;/* file block size */ +typedef __uint32_t __fflags_t;/* file flags */ +typedef __int8_t __int_fast8_t; + typedef __uint8_t __uint_fast8_t; + typedef __int16_t __int_fast16_t; + typedef __uint16_t __uint_fast16_t; + typedef __int32_t __int_fast32_t; + typedef __uint32_t __uint_fast32_t; + typedef __int64_t __int_fast64_t; + typedef __uint64_t __uint_fast64_t; + typedef __int32_t __intptr_t; + typedef __uint32_t __uintptr_t; +typedef __uint32_t __uintfptr_t; + typedef __uint32_t __size_t; + typedef __int64_t __intmax_t; + typedef __uint64_t __uintmax_t; +typedef __int32_t __ptrdiff_t; + typedef __uint8_t __uint_least8_t; + typedef __uint16_t __uint_least16_t; + typedef __uint32_t __uint_least32_t; + typedef __uint64_t __uint_least64_t; + typedef __int8_t __int_least8_t; + typedef __int16_t __int_least16_t; + typedef __int32_t __int_least32_t; + typedef __int64_t __int_least64_t; + typedef int ___wchar_t; -/* - * Unusual type definitions. - */ -/* - * rune_t is declared to be an ``int'' instead of the more natural - * ``unsigned long'' or ``long''. Two things are happening here. It is not - * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, - * it looks like 10646 will be a 31 bit standard. This means that if your - * ints cannot hold 32 bits, you will be in trouble. The reason an int was - * chosen over a long is that the is*() and to*() routines take ints (says - * ANSI C), but they use __ct_rune_t instead of int. - * - * NOTE: rune_t is not covered by ANSI nor other standards, and should not - * be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and - * rune_t must be the same type. Also, wint_t must be no narrower than - * wchar_t, and should be able to hold all members of the largest - * character set plus one extra value (WEOF), and must be at least 16 bits. - */ -typedef int __ct_rune_t; -#ifndef __HMM -typedef __ct_rune_t __wchar_t; -typedef __ct_rune_t __rune_t; -#endif -typedef __ct_rune_t __wint_t; +typedef long __suseconds_t; /* microseconds (signed) */ +typedef __int32_t __pid_t; /* process [group] */ -/* - * dev_t has differing meanings in userland and the kernel. - */ -#ifdef _KERNEL -struct cdev; -typedef struct cdev *__dev_t; -#else -typedef __udev_t __dev_t; /* device number */ +#if !defined(__clang__) || !defined(__cplusplus) +typedef __uint_least16_t __char16_t; + typedef __uint_least32_t __char32_t; #endif -/* - * mbstate_t is an opaque object to keep conversion state during multibyte - * stream conversions. - */ -typedef union { - char __mbstate8[128]; - __int64_t _mbstateL; /* for alignment */ -} __mbstate_t; - -#endif /* !_SYS__TYPES_H_ */ +#endif \ No newline at end of file diff --git a/include_old/sys/select.h b/include_old/sys/select.h new file mode 100644 index 0000000..ce0d6e9 --- /dev/null +++ b/include_old/sys/select.h @@ -0,0 +1,100 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) 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. + * 3) 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 AUTHOR 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. + */ + +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H + +#include +#include +#include +#include + +#include + +typedef unsigned long __fd_mask; +typedef __fd_mask fd_mask; + +#ifndef _SIGSET_T_DECLARED +#define _SIGSET_T_DECLARED +typedef __sigset_t sigset_t; +#endif + +/* + * Select uses bit masks of file descriptors in longs. These macros + * manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here should + * be enough for most uses. + */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 1024 +#endif + +#define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */ +#define NFDBITS _NFDBITS + +#ifndef _howmany +#define _howmany(x, y) (((x) + ((y) - 1)) / (y)) +#endif + +typedef struct fd_set { + __fd_mask __fds_bits [_howmany(FD_SETSIZE, _NFDBITS)]; +} fd_set; + +#define fds_bits __fds_bits + +#define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS)) +#define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n)) +#define FD_COPY(f, t) (void)(*(t) = *(f)) +#define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0) +#define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n)) +#define FD_ZERO(p) do { \ + fd_set *_p; \ + __size_t _n; \ + \ + _p = (p); \ + _n = _howmany(FD_SETSIZE, _NFDBITS); \ + while (_n > 0) \ + _p->__fds_bits[--_n] = 0; \ +} while (0) + +#ifndef _KERNEL + +__BEGIN_DECLS +int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict); + +#ifndef _SELECT_DECLARED +#define _SELECT_DECLARED +/* XXX missing restrict type-qualifier */ +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +#endif +__END_DECLS +#endif /* !_KERNEL */ + + + +#endif /* END _SYS_SELECT_H */ diff --git a/include_old/sys/types.h b/include_old/sys/types.h index 2451195..0e60064 100644 --- a/include_old/sys/types.h +++ b/include_old/sys/types.h @@ -1,91 +1,180 @@ -/************************************************************************************** - Copyright (c) 2002 The UbixOS Project - All rights reserved. +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) 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. + * 3) 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 AUTHOR 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. + */ -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +#ifndef _SYS_TYPES_H_ +#define _SYS_TYPES_H_ -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. +#include +#include -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: types.h 89 2016-01-12 00:20:40Z reddawg $ - -**************************************************************************************/ - -#ifndef TYPES_H -#define TYPES_H - -#include - - - -/**** NEW TYPEDEFS ****/ -#ifndef _INTPTR_T_DECLARED -typedef __intptr_t intptr_t; -typedef __uintptr_t uintptr_t; -#define _INTPTR_T_DECLARED -#endif - -#ifndef _OFF_T_DECLARED -typedef __off_t off_t; -#define _OFF_T_DECLARED -#endif - -#ifndef _SSIZE_T_DECLARED -typedef __ssize_t ssize_t; -#define _SSIZE_T_DECLARED -#endif - -#ifndef _UINT64_T_DECLARED -typedef __uint64_t uInt64; -#define _UINT64_T_DECLARED -#endif - -#ifndef _INT32_T_DECLARED -typedef __int32_t int32_t; -#define _INT32_T_DECLARED -#endif - -#ifndef _INT64_T_DECLARED -typedef __int64_t int64_t; -#define _INT64_T_DECLARED -#endif - - -/**** END ****/ - -typedef unsigned char u_char; -typedef unsigned int u_int; - -typedef unsigned short uShort; -typedef unsigned long uLong; -typedef unsigned char uChar; -typedef unsigned int uInt; - -typedef unsigned char uInt8; -typedef unsigned short uInt16; -typedef unsigned int uInt32; - -typedef long long int quad_t; -typedef unsigned long long int u_quad_t; - #ifndef NULL #define NULL 0x0 #endif +typedef __uintfptr_t uintfptr_t; + +typedef char *caddr_t; + +/* unsigned integrals */ +typedef __uint8_t uint8_t; +typedef __uint16_t uint16_t; +typedef __uint32_t uint32_t; +typedef __uint64_t uint64_t; +typedef __uint64_t uquad_t; + +/* unsigned integrals (deprecated) */ +typedef __uint8_t u_int8_t; +typedef __uint16_t u_int16_t; +typedef __uint32_t u_int32_t; +typedef __uint64_t u_int64_t; +typedef __uint64_t u_quad_t; + +typedef __int64_t quad_t; + +typedef __int64_t daddr_t; /* disk address */ +typedef __uint32_t u_daddr_t; /* unsigned disk address */ + +typedef unsigned char uInt8; +typedef unsigned short uInt16; +typedef unsigned int uInt32; +typedef unsigned int uInt; +typedef char Int8; +typedef short Int16; +typedef long Int32; + +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; + +typedef int pidType; + +typedef int pid_t; +typedef int size_t; /* standart */ + #ifndef NOBOOL -typedef enum { FALSE=0,TRUE=1 } bool; +#ifndef __cplusplus +typedef enum {FALSE=0,TRUE=1}bool; +#endif +#else +#ifndef __cplusplus +#define FALSE 0 +#define TRUE 1 +typedef int bool; +#endif #endif - - +#ifndef _INO_T_DECLARED +typedef __ino_t ino_t; /* inode number */ +#define _INO_T_DECLARED #endif + +#ifndef _INT8_T_DECLARED +typedef __int8_t int8_t; +#define _INT8_T_DECLARED +#endif + +#ifndef _INT16_T_DECLARED +typedef __int16_t int16_t; +#define _INT16_T_DECLARED +#endif + +#ifndef _INT32_T_DECLARED +typedef __int32_t int32_t; +#define _INT32_T_DECLARED +#endif + +#ifndef _INT64_T_DECLARED +typedef __int64_t int64_t; +#define _INT64_T_DECLARED +#endif + +typedef __ssize_t ssize_t; +typedef char * caddr_t; +typedef __int64_t off_t; +typedef __uint32_t vm_offset_t; + +typedef __uid_t uid_t; /* user id */ +typedef __gid_t gid_t; /* group id */ +typedef __blkcnt_t blkcnt_t; +typedef __blksize_t blksize_t; +typedef __fflags_t fflags_t; + +#ifndef _TIME_T_DECLARED +typedef __time_t time_t; +#define _TIME_T_DECLARED +#endif + +typedef uint32_t uintmax_t; +typedef int32_t intmax_t; +typedef int32_t ptrdiff_t; +typedef uint32_t uintptr_t; + +#define __ULONG_MAX 0xffffffffUL +#define __USHRT_MAX 0xffff /* max value for an unsigned short */ + +#define ULONG_MAX __ULONG_MAX +#define USHRT_MAX __USHRT_MAX + +/* select a type for digits in base B: use unsigned short if they fit */ +#if ULONG_MAX == 0xffffffff && USHRT_MAX >= 0xffff +typedef unsigned short digit; +#else +typedef u_long digit; +#endif + +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +#define H _QUAD_HIGHWORD +#define L _QUAD_LOWWORD + +#define __CHAR_BIT 8 +#define CHAR_BIT __CHAR_BIT + +#define QUAD_BITS (sizeof(quad_t) * CHAR_BIT) +#define LONG_BITS (sizeof(long) * CHAR_BIT) +#define HALF_BITS (sizeof(long) * CHAR_BIT / 2) +#define HHALF(x) ((x) >> HALF_BITS) +#define LHALF(x) ((x) & ((1 << HALF_BITS) - 1)) +#define LHUP(x) ((x) << HALF_BITS) + +typedef unsigned int qshift_t; + +#define B (1 << HALF_BITS) /* digit base */ + +/* Combine two `digits' to make a single two-digit number. */ +#define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b)) + + +#ifndef _MODE_T_DECLARED +typedef __mode_t mode_t; /* permissions */ +#define _MODE_T_DECLARED +#endif + +#endif /* END _SYS_TYPES_H */ diff --git a/sys/include/sys/_types.h b/sys/include/sys/_types.h index 1363079..c998ff6 100644 --- a/sys/include/sys/_types.h +++ b/sys/include/sys/_types.h @@ -39,48 +39,20 @@ typedef unsigned long long __uint64_t; typedef unsigned long __clock_t; -typedef __uint32_t __ino_t; - typedef __int32_t __ssize_t;/* stat types */ -typedef __uint32_t __dev_t;/* device number */ -typedef __uint16_t __mode_t; - typedef __uint16_t __nlink_t;/* link count */ -typedef __uint32_t __uid_t; - typedef __uint32_t __gid_t; - typedef __int32_t __time_t; - typedef __int64_t __blkcnt_t;/* file block count */ -typedef __uint32_t __blksize_t;/* file block size */ -typedef __uint32_t __fflags_t;/* file flags */ -typedef __int8_t __int_fast8_t; - typedef __uint8_t __uint_fast8_t; - typedef __int16_t __int_fast16_t; - typedef __uint16_t __uint_fast16_t; - typedef __int32_t __int_fast32_t; - typedef __uint32_t __uint_fast32_t; - typedef __int64_t __int_fast64_t; - typedef __uint64_t __uint_fast64_t; - typedef __int32_t __intptr_t; - typedef __uint32_t __uintptr_t; -typedef __uint32_t __uintfptr_t; - typedef __uint32_t __size_t; - typedef __int64_t __intmax_t; - typedef __uint64_t __uintmax_t; -typedef __int32_t __ptrdiff_t; - typedef __uint8_t __uint_least8_t; - typedef __uint16_t __uint_least16_t; - typedef __uint32_t __uint_least32_t; - typedef __uint64_t __uint_least64_t; - typedef __int8_t __int_least8_t; - typedef __int16_t __int_least16_t; - typedef __int32_t __int_least32_t; - typedef __int64_t __int_least64_t; - typedef int ___wchar_t; +typedef __uint32_t __ino_t; typedef __int32_t __ssize_t;/* stat types */ +typedef __uint32_t __dev_t;/* device number */ +typedef __uint16_t __mode_t; typedef __uint16_t __nlink_t;/* link count */ +typedef __uint32_t __uid_t; typedef __uint32_t __gid_t; typedef __int32_t __time_t; typedef __int64_t __blkcnt_t;/* file block count */ +typedef __uint32_t __blksize_t;/* file block size */ +typedef __uint32_t __fflags_t;/* file flags */ +typedef __int8_t __int_fast8_t; typedef __uint8_t __uint_fast8_t; typedef __int16_t __int_fast16_t; typedef __uint16_t __uint_fast16_t; typedef __int32_t __int_fast32_t; typedef __uint32_t __uint_fast32_t; typedef __int64_t __int_fast64_t; typedef __uint64_t __uint_fast64_t; typedef __int32_t __intptr_t; typedef __uint32_t __uintptr_t; typedef __uint32_t __uintfptr_t; typedef __uint32_t __size_t; typedef __int64_t __intmax_t; typedef __uint64_t __uintmax_t; typedef __int32_t __ptrdiff_t; typedef __uint8_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __int8_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; typedef +int ___wchar_t; -typedef long __suseconds_t; /* microseconds (signed) */ -typedef __int32_t __pid_t; /* process [group] */ +typedef long __suseconds_t; /* microseconds (signed) */ +typedef __int32_t __pid_t;/* process [group] */ #if !defined(__clang__) || !defined(__cplusplus) -typedef __uint_least16_t __char16_t; - typedef __uint_least32_t __char32_t; +typedef __uint_least16_t __char16_t; typedef __uint_least32_t __char32_t; #endif #endif diff --git a/sys/mpi/system.c b/sys/mpi/system.c index e11e0f7..f30ef09 100644 --- a/sys/mpi/system.c +++ b/sys/mpi/system.c @@ -142,7 +142,7 @@ Notes: *****************************************************************************************/ -int mpi_postMessage(char *name, uInt32 type, mpi_message_t *msg) { +int mpi_postMessage(char *name, uint32_t type, mpi_message_t *msg) { mpi_mbox_t *mbox = 0x0; mpi_message_t *message = 0x0;