Added oskittcp. As the name suggests, it was taken from OSKIT. ReactOS specific parts are interface.c and include/oskit*.h These define an abstract interface to this TCP component that could be used by anyone. In this way, oskittcp can be used in a variety of roles. Added: trunk/reactos/lib/network/ Added: trunk/reactos/lib/network/oskittcp/ Added: trunk/reactos/lib/network/oskittcp/README Added: trunk/reactos/lib/network/oskittcp/include/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/dev/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/dev/include/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/dev/include/vm/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/dev/include/vm/vm.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/dev/include/vm/vm_par am.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/net/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/net/include/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/net/include/arpa/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/net/include/arpa/inet .h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/net/include/imp.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/ansi. h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/cpufu nc.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/endia n.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/ipl.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/limit s.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/param .h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/proc. h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/signa l.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/spl.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/stdar g.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/trap. h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/types .h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/vmpar am.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/net/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/net/if.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/net/if_arp.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/net/netisr.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/net/radix.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/net/raw_cb.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/net/route.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/if_et her.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/igmp_ var.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/in.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/in_pc b.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/in_sy stm.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/in_va r.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/ip.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/ip_fw .h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/ip_ic mp.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/ip_va r.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/tcp.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/tcp_d ebug.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/tcp_f sm.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/tcp_s eq.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/tcp_t imer.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/tcp_v ar.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/tcpip .h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/udp.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/netinet/udp_v ar.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/ Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/buf.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/callout.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/cdefs.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/domain.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/errno.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/fcntl.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/file.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/filedesc. h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/filio.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/ioccom.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/ioctl.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/kernel.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/libkern.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/malloc.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/mbuf.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/param.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/proc.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/protosw.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/queue.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/resource. h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/resourcev ar.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/rtprio.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/select.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/signal.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/signalvar .h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/socket.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/socketvar .h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/sockio.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/stat.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/sysctl.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/syslimits .h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/syslog.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/systm.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/time.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/ttycom.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/types.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/ucred.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/uio.h Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/sys/unistd.h Added: trunk/reactos/lib/network/oskittcp/include/memtrack.h Added: trunk/reactos/lib/network/oskittcp/include/oskitdebug.h [truncated at 100 lines; 39 more skipped] _____
Added: trunk/reactos/lib/network/oskittcp/README --- trunk/reactos/lib/network/oskittcp/README 2006-01-28 20:14:38 UTC (rev 22) +++ trunk/reactos/lib/network/oskittcp/README 2006-01-28 20:22:17 UTC (rev 23) @@ -0,0 +1,5 @@
+These files are originally from the freebsd TCP stack contained on oskit. +Only files relevent to TCP are here, along with assorted interfaces that +are needed to make them useful. Overall, I intend this to implement a +generic, standalone TCP library that can be used with any IP machinery +required. _____
Added: trunk/reactos/lib/network/oskittcp/include/freebsd/dev/include/vm/vm.h --- trunk/reactos/lib/network/oskittcp/include/freebsd/dev/include/vm/vm.h 2006-01-28 20:14:38 UTC (rev 22) +++ trunk/reactos/lib/network/oskittcp/include/freebsd/dev/include/vm/vm.h 2006-01-28 20:22:17 UTC (rev 23) @@ -0,0 +1,42 @@
+/* + * Copyright (c) 1997-1998 University of Utah and the Flux Group. + * All rights reserved. + * + * This file is part of the Flux OSKit. The OSKit is free software, also known + * as "open source;" you can redistribute it and/or modify it under the terms + * of the GNU General Public License (GPL), version 2, as published by the Free + * Software Foundation (FSF). To explore alternate licensing terms, contact + * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. + * + * The OSKit is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GPL for more details. You should have + * received a copy of the GPL along with the OSKit; see the file COPYING. If + * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. + */ +/* + * here's vm.h's primary purpose in life: + * + * define `vm_map_t' for the first arg to kmem_alloc() + */ +#ifndef _FAKE_VM_H +#define _FAKE_VM_H + +typedef void *vm_map_t; + +#include <vm/vm_param.h> + +/* + * XXX This is used by syscons to compute the address of the video buffer. + * This definition means the driver will only work when kva == pa. + * The real solution would be to modify the driver to map the buffer explicitly. + */ +#define vtophys(va) va + +/* + * ip_icmp.c and possibly other files rely on vm/vm.h to get sys/proc ... + */ +#include <sys/proc.h> +#include <sys/queue.h> + +#endif /* _FAKE_VM_H */ _____
Added: trunk/reactos/lib/network/oskittcp/include/freebsd/dev/include/vm/vm_par am.h --- trunk/reactos/lib/network/oskittcp/include/freebsd/dev/include/vm/vm_par am.h 2006-01-28 20:14:38 UTC (rev 22) +++ trunk/reactos/lib/network/oskittcp/include/freebsd/dev/include/vm/vm_par am.h 2006-01-28 20:22:17 UTC (rev 23) @@ -0,0 +1,27 @@
+/* + * Copyright (c) 1997-1998 University of Utah and the Flux Group. + * All rights reserved. + * + * This file is part of the Flux OSKit. The OSKit is free software, also known + * as "open source;" you can redistribute it and/or modify it under the terms + * of the GNU General Public License (GPL), version 2, as published by the Free + * Software Foundation (FSF). To explore alternate licensing terms, contact + * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. + * + * The OSKit is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GPL for more details. You should have + * received a copy of the GPL along with the OSKit; see the file COPYING. If + * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. + */ +#ifndef _VM_PARAM_ +#define _VM_PARAM_ + +#include <machine/vmparam.h> + +typedef int boolean_t; + +#define TRUE 1 +#define FALSE 0 + +#endif /* _VM_PARAM_ */ _____
Added: trunk/reactos/lib/network/oskittcp/include/freebsd/net/include/arpa/inet .h --- trunk/reactos/lib/network/oskittcp/include/freebsd/net/include/arpa/inet .h 2006-01-28 20:14:38 UTC (rev 22) +++ trunk/reactos/lib/network/oskittcp/include/freebsd/net/include/arpa/inet .h 2006-01-28 20:22:17 UTC (rev 23) @@ -0,0 +1,57 @@
+/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)inet.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_INET_H_ +#define _ARPA_INET_H_ + +/* External definitions for functions in inet(3) */ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +#ifndef _WINSOCKAPI_ +unsigned long inet_addr __P((const char *)); +#endif//_WINSOCKAPI_ +int inet_aton __P((const char *, struct in_addr *)); +unsigned long inet_lnaof __P((struct in_addr)); +struct in_addr inet_makeaddr __P((u_long , u_long)); +unsigned long inet_netof __P((struct in_addr)); +unsigned long inet_network __P((const char *)); +#ifndef _WINSOCKAPI_ +char *inet_ntoa __P((struct in_addr)); +#endif//_WINSOCKAPI_ +__END_DECLS + +#endif /* !_INET_H_ */ _____
Added: trunk/reactos/lib/network/oskittcp/include/freebsd/net/include/imp.h --- trunk/reactos/lib/network/oskittcp/include/freebsd/net/include/imp.h 2006-01-28 20:14:38 UTC (rev 22) +++ trunk/reactos/lib/network/oskittcp/include/freebsd/net/include/imp.h 2006-01-28 20:22:17 UTC (rev 23) @@ -0,0 +1 @@
+#define NIMP 0 _____
Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/ansi. h --- trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/ansi. h 2006-01-28 20:14:38 UTC (rev 22) +++ trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/ansi. h 2006-01-28 20:22:17 UTC (rev 23) @@ -0,0 +1,96 @@
+/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + */ + +#ifndef _MACHINE_ANSI_H_ +#define _MACHINE_ANSI_H_ + +/* + * Types which are fundamental to the implementation and must be declared + * in more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ unsigned long /* clock() */ +#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ +#ifndef _BSD_SIZE_T_ +#define _BSD_SIZE_T_ unsigned int /* sizeof() */ +#endif +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_TIME_T_ long /* time() */ + +/* + * Types which are fundamental to the implementation and must be used + * in more than one standard header although they are only declared in + * one (perhaps nonstandard) header are defined here. Standard headers + * use _BSD_XXX_T_ without undef'ing it. + */ +#define _BSD_OFF_T_ long long /* file offset */ +#define _BSD_PID_T_ long /* process [group] */ +#define _BSD_VA_LIST_ char * /* va_list */ + +/* + * Runes (wchar_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 _RUNE_T_ instead of int. By changing it here, you + * lose a bit of ANSI conformance, but your programs will still work. + * + * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t + * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains + * defined for ctype.h. + */ +#define _BSD_WCHAR_T_ int /* wchar_t */ +#define _BSD_RUNE_T_ int /* rune_t */ + +/* + * Frequencies of the clock ticks reported by clock() and times(). They + * are the same as stathz for bogus historical reasons. They should be + * 1e6 because clock() and times() are implemented using getrusage() and + * there is no good reason why they should be less accurate. There is + * the bad reason that (broken) programs might not like clock_t or + * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough + * to hold the required 24 hours worth of ticks if the frequency is + * 1000000ul, and ``unsigned long long'' would be nonstandard). + */ +#define _BSD_CLK_TCK_ 128 +#define _BSD_CLOCKS_PER_SEC_ 128 + +#endif /* !_MACHINE_ANSI_H_ */ _____
Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/cpufu nc.h --- trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/cpufu nc.h 2006-01-28 20:14:38 UTC (rev 22) +++ trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/cpufu nc.h 2006-01-28 20:22:17 UTC (rev 23) @@ -0,0 +1,457 @@
+/*- + * Copyright (c) 1993 The Regents of the University of California. + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + */ + +/* + * Functions to provide access to special i386 instructions. + */ + +#ifndef _MACHINE_CPUFUNC_H_ +#define _MACHINE_CPUFUNC_H_ + +#include <sys/cdefs.h> +#include <sys/types.h> + +#include <machine/spl.h> /* XXX belongs elsewhere */ + +#ifdef __GNUC__ + +#ifdef BDE_DEBUGGER +extern int bdb_exists; + +static __inline int +bdb(void) +{ + if (!bdb_exists) + return (0); + __asm __volatile("int $3"); + return (1); +} +#endif /* BDE_DEBUGGER */ + +static __inline void +disable_intr(void) +{ +#ifdef OSKIT + osenv_intr_disable(); +#else + __asm __volatile("cli" : : : "memory"); +#endif +} + +static __inline void +enable_intr(void) +{ +#ifdef OSKIT + osenv_intr_enable(); +#else + __asm __volatile("sti"); +#endif +} + +#define HAVE_INLINE_FFS + +static __inline int +ffs(int mask) +{ + int result; + /* + * bsfl turns out to be not all that slow on 486's. It can beaten + * using a binary search to reduce to 4 bits and then a table lookup, + * but only if the code is inlined and in the cache, and the code + * is quite large so inlining it probably busts the cache. + * + * Note that gcc-2's builtin ffs would be used if we didn't declare + * this inline or turn off the builtin. The builtin is faster but + * broken in gcc-2.4.5 and slower but working in gcc-2.5 and 2.6. + */ + __asm __volatile("testl %0,%0; je 1f; bsfl %0,%0; incl %0; 1:" + : "=r" (result) : "0" (mask)); + return (result); +} + +#if __GNUC__ < 2 + +#define inb(port) inbv(port) +#define outb(port, data) outbv(port, data) + +#else /* __GNUC >= 2 */ + +/* + * The following complications are to get around gcc not having a + * constraint letter for the range 0..255. We still put "d" in the + * constraint because "i" isn't a valid constraint when the port + * isn't constant. This only matters for -O0 because otherwise + * the non-working version gets optimized away. + * + * Use an expression-statement instead of a conditional expression + * because gcc-2.6.0 would promote the operands of the conditional + * and produce poor code for "if ((inb(var) & const1) == const2)". + */ +#define inb(port) ({ \ + u_char _data; \ + if (__builtin_constant_p((int) (port)) && (port) < 256ul) \ + _data = inbc(port); \ + else \ + _data = inbv(port); \ + _data; }) + +#define outb(port, data) \ + (__builtin_constant_p((int) (port)) && (port) < 256ul \ + ? outbc(port, data) : outbv(port, data)) + +static __inline u_char +inbc(u_int port) +{ + u_char data; + + __asm __volatile("inb %1,%0" : "=a" (data) : "id" ((u_short)(port))); + return (data); +} + +static __inline void +outbc(u_int port, u_char data) +{ + __asm __volatile("outb %0,%1" : : "a" (data), "id" ((u_short)(port))); +} + +#endif /* __GNUC <= 2 */ + +static __inline u_char +inbv(u_int port) +{ + u_char data; + /* + * We use %%dx and not %1 here because i/o is done at %dx and not at + * %edx, while gcc generates inferior code (movw instead of movl) + * if we tell it to load (u_short) port. + */ + __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port)); + return (data); +} + +static __inline u_long +inl(u_int port) +{ + u_long data; + + __asm __volatile("inl %%dx,%0" : "=a" (data) : "d" (port)); + return (data); +} + +static __inline void +insb(u_int port, void *addr, size_t cnt) +{ + __asm __volatile("cld; rep; insb" + : : "d" (port), "D" (addr), "c" (cnt) + : "di", "cx", "memory"); +} + +static __inline void +insw(u_int port, void *addr, size_t cnt) +{ + __asm __volatile("cld; rep; insw" + : : "d" (port), "D" (addr), "c" (cnt) + : "di", "cx", "memory"); +} + +static __inline void +insl(u_int port, void *addr, size_t cnt) +{ + __asm __volatile("cld; rep; insl" + : : "d" (port), "D" (addr), "c" (cnt) + : "di", "cx", "memory"); +} + +static __inline u_short +inw(u_int port) +{ + u_short data; + + __asm __volatile("inw %%dx,%0" : "=a" (data) : "d" (port)); + return (data); +} + +static __inline unsigned +loadandclear(u_int *addr) +{ + u_int result; + + __asm __volatile("xorl %0,%0; xchgl %1,%0" + : "=&r" (result) : "m" (*addr)); + return (result); +} + +static __inline void +outbv(u_int port, u_char data) +{ + u_char al; + /* + * Use an unnecessary assignment to help gcc's register allocator. + * This make a large difference for gcc-1.40 and a tiny difference + * for gcc-2.6.0. For gcc-1.40, al had to be ``asm("ax")'' for + * best results. gcc-2.6.0 can't handle this. + */ + al = data; + __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port)); +} + +static __inline void +outl(u_int port, u_long data) +{ + /* + * outl() and outw() aren't used much so we haven't looked at + * possible micro-optimizations such as the unnecessary + * assignment for them. + */ + __asm __volatile("outl %0,%%dx" : : "a" (data), "d" (port)); +} + +static __inline void +outsb(u_int port, void *addr, size_t cnt) +{ + __asm __volatile("cld; rep; outsb" + : : "d" (port), "S" (addr), "c" (cnt) + : "si", "cx"); +} + +static __inline void +outsw(u_int port, void *addr, size_t cnt) +{ + __asm __volatile("cld; rep; outsw" + : : "d" (port), "S" (addr), "c" (cnt) + : "si", "cx"); +} + +static __inline void +outsl(u_int port, void *addr, size_t cnt) +{ + __asm __volatile("cld; rep; outsl" + : : "d" (port), "S" (addr), "c" (cnt) + : "si", "cx"); +} + +static __inline void +outw(u_int port, u_short data) +{ + __asm __volatile("outw %0,%%dx" : : "a" (data), "d" (port)); +} + +static __inline void +pmap_update(void) +{ + u_long temp; + /* + * This should be implemented as load_cr3(rcr3()) when load_cr3() + * is inlined. + */ + __asm __volatile("movl %%cr3, %0; movl %0, %%cr3" : "=r" (temp) + : : "memory"); +} + +static __inline u_long +rcr2(void) +{ + u_long data; + + __asm __volatile("movl %%cr2,%0" : "=r" (data)); + return (data); +} + +static __inline u_long +read_eflags(void) +{ + u_long ef; + + __asm __volatile("pushfl; popl %0" : "=r" (ef)); + return (ef); +} + +static __inline void +write_eflags(u_long ef) +{ + __asm __volatile("pushl %0; popfl" : : "r" (ef)); +} + +#else /* !__GNUC__ */ + +int bdb __P((void)); +void disable_intr __P((void)); +void enable_intr __P((void)); +u_char inb __P((u_int port)); +u_long inl __P((u_int port)); +void insb __P((u_int port, void *addr, size_t cnt)); +void insl __P((u_int port, void *addr, size_t cnt)); +void insw __P((u_int port, void *addr, size_t cnt)); +u_short inw __P((u_int port)); +u_int loadandclear __P((u_int *addr)); +void outb __P((u_int port, u_char data)); +void outl __P((u_int port, u_long data)); +void outsb __P((u_int port, void *addr, size_t cnt)); +void outsl __P((u_int port, void *addr, size_t cnt)); +void outsw __P((u_int port, void *addr, size_t cnt)); +void outw __P((u_int port, u_short data)); +void pmap_update __P((void)); +u_long read_eflags __P((void)); +u_long rcr2 __P((void)); +void write_eflags __P((u_long ef)); + +#endif /* __GNUC__ */ + +/* + * XXX queue stuff belongs elsewhere. + */ +struct quehead { + struct quehead *qh_link; + struct quehead *qh_rlink; +}; + +static __inline void +insque(void *a, void *b) +{ + struct quehead *element = (struct quehead *)a, + *head = (struct quehead *)b; + + element->qh_link = head->qh_link; + element->qh_rlink = head; + head->qh_link = element; + element->qh_link->qh_rlink = element; +} + +static __inline void +remque(void *a) +{ + struct quehead *element = (struct quehead *)a; + + element->qh_link->qh_rlink = element->qh_rlink; + element->qh_rlink->qh_link = element->qh_link; + element->qh_rlink = 0; +} + +/* + * XXX the following declarations document garbage in support.s. + * gcc hasn't needed _divsi* for years. + * bcopy[bwx]() was used by pccons but isn't used now. + */ +int __divsi3 __P((int factor1, int factor2)); +u_int __udivsi3 __P((u_int factor1, u_int factor2)); +void bcopyb __P((const void *from, void *to, size_t len)); +void bcopyw __P((const void *from, void *to, size_t len)); +void bcopyx __P((const void *from, void *to, size_t len, + int stride)); + +#if 0 +/* + * These functions in support.s are declared elsewhere. + */ +void bcopy __P((const void *from, void *to, size_t len)); +void blkclr __P((void *buf, size_t len)); +void bzero __P((void *buf, size_t len)); +int copyin __P((void *udaddr, void *kaddr, size_t len)); +int copyinstr __P((void *udaddr, void *kaddr, size_t len, + size_t *lencopied)); +int copyout __P((void *kaddr, void *udaddr, size_t len)); +int copystr __P((void *kfaddr, void *kdaddr, size_t len, + size_t *lencopied)); +int fubyte __P((void *base)); +int fuswintr __P((void *base)); +int fuibyte __P((void *base)); +int fuword __P((void *base)); +struct region_descriptor; +void lgdt __P((struct region_descriptor *rdp)); +void lidt __P((struct region_descriptor *rdp)); +void lldt __P((u_short sel)); +/* + * longjmp() and setjmp() are only used by ddb. They probably shouldn't + * shouldn't be supported in the kernel. + */ +#include <setjmp.h> +void longjmp __P((jmp_buf jb, int rv)); +void ovbcopy __P((const void *from, void *to, size_t len); +int setjmp __P((jmp_buf jb)); +struct soft_segment_descriptor; +union descriptor; +int ssdtosd __P((struct soft_segment_descriptor *ssdp, + union descriptor *sdp)); +int subyte __P((void *base, int byte)); +int suibyte __P((void *base, int byte)); +int suswintr __P((void *base, int word)); +int suword __P((void *base, int word)); + +/* + * These functions in support.s are declared elsewhere, but never used. + * A silly amount of effort went into copyoutstr(). It's not worth + * maintaining, since the string length is usually known so copyout + * works better, or is easy to find so copyout() can be used. + */ +int copyoutstr __P((void *kaddr, void *udaddr, size_t len, + size_t *lencopied)); +int fuiword __P((void *base)); +int suiword __P((void *base, int word)); + +/* + * These functions in support.s are also in libkern.a and are declared in + * libkern.h. + * ffs() is built in to gcc-2 and was buggy in gcc-2.4.5 so we may may the + * buggy version if we don't replace it by an inline. + */ +int bcmp __P((const void *b1, const void *b2, size_t length)); +int ffs __P((int mask)); +#endif /* 0 */ + +/* + * These variables and functions in support.s are used. + */ +extern u_int atdevbase; /* offset in virtual memory of ISA io mem */ + +void filli __P((int pat, void *base, size_t cnt)); +void fillw __P((int /*u_short*/ pat, void *base, size_t cnt)); +int fusword __P((void *base)); +void load_cr0 __P((u_long cr0)); +void load_cr3 __P((u_long cr3)); +void ltr __P((u_short sel)); +u_int rcr0 __P((void)); +u_long rcr3 __P((void)); +int rtcin __P((int val)); + +/* + * These functions are NOT in support.s and should be declared elsewhere. + */ +void Debugger __P((const char *msg)); +u_long kvtop __P((void *addr)); +typedef void alias_for_inthand_t __P((u_int cs, u_int ef, u_int esp, + u_int ss)); +void setidt __P((int idx, alias_for_inthand_t *func, int typ, + int dpl, int selec)); + +#endif /* !_MACHINE_CPUFUNC_H_ */ _____
Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/endia n.h --- trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/endia n.h 2006-01-28 20:14:38 UTC (rev 22) +++ trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/endia n.h 2006-01-28 20:22:17 UTC (rev 23) @@ -0,0 +1,141 @@
+/* + * Copyright (c) 1987, 1991 Regents of the University of California. + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 + */ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ 1 + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#define BYTE_ORDER LITTLE_ENDIAN + +#ifndef KERNEL +#include <sys/cdefs.h> +#endif + +#ifdef _MSC_VER +static inline unsigned long __byte_swap_long ( unsigned long i ) +{ + char dst[4]; + char* src = (char*)&i; + dst[0] = src[3]; + dst[1] = src[2]; + dst[2] = src[1]; + dst[3] = src[0]; + return *(unsigned long*)&dst[0]; +} + +static inline unsigned short __byte_swap_word ( unsigned short i ) +{ + char dst[2]; + char* src = (char*)&i; + dst[0] = src[1]; + dst[1] = src[0]; + return *(unsigned short*)&dst[0]; +} +#else/*_MSC_VER*/ +#define __word_swap_long(x) \ +({ register u_long __X = (x); \ + __asm ("rorl $16, %1" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) +#if __GNUC__ >= 2 +#define __byte_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("xchgb %h1, %b1\n\trorl $16, %1\n\txchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) +#define __byte_swap_word(x) \ +__extension__ ({ register u_short __X = (x); \ + __asm ("xchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) +#else /* __GNUC__ >= 2 */ +#define __byte_swap_long(x) \ +({ register u_long __X = (x); \ + __asm ("rorw $8, %w1\n\trorl $16, %1\n\trorw $8, %w1" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) +#define __byte_swap_word(x) \ +({ register u_short __X = (x); \ + __asm ("rorw $8, %w1" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) +#endif /* __GNUC__ >= 2 */ +#endif /* _MSC_VER */ + +/* + * Macros for network/external number representation conversion. + */ +#if BYTE_ORDER == BIG_ENDIAN && !defined(lint) +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#define NTOHL(x) (x) +#define NTOHS(x) (x) +#define HTONL(x) (x) +#define HTONS(x) (x) + +#else + +#define ntohl __byte_swap_long +#define ntohs __byte_swap_word +#define htonl __byte_swap_long +#define htons __byte_swap_word + +#define NTOHL(x) (x) = ntohl((u_long)x) +#define NTOHS(x) (x) = ntohs((u_short)x) +#define HTONL(x) (x) = htonl((u_long)x) +#define HTONS(x) (x) = htons((u_short)x) +#endif +#endif /* _MACHINE_ENDIAN_H_ */ _____
Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/ipl.h --- trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/ipl.h 2006-01-28 20:14:38 UTC (rev 22) +++ trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/ipl.h 2006-01-28 20:22:17 UTC (rev 23) @@ -0,0 +1,41 @@
+/*- + * Copyright (c) 1993 The Regents of the University of California. + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 _ISA_IPL_H_ +#define _ISA_IPL_H_ + +#define NHWI 16 /* number of h/w interrupts */ +#define HWI_MASK 0xffff /* bits corresponding to h/w interrupts */ + +#endif /* _ISA_IPL_H_ */ _____
Added: trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/limit s.h --- trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/limit s.h 2006-01-28 20:14:38 UTC (rev 22) +++ trunk/reactos/lib/network/oskittcp/include/freebsd/src/sys/machine/limit s.h 2006-01-28 20:22:17 UTC (rev 23) @@ -0,0 +1,98 @@
+/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)limits.h 8.3 (Berkeley) 1/4/94 + */ + +#ifndef _MACHINE_LIMITS_H_ +#define _MACHINE_LIMITS_H_ + +#define CHAR_BIT 8 /* number of bits in a char */ +#ifndef __REACTOS__ +#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ +#endif + +/* + * According to ANSI (section 2.2.4.2), the values below must be usable by + * #if preprocessing directives. Additionally, the expression must have the + * same type as would an expression that is an object of the corresponding + * type converted according to the integral promotions. The subtraction for + * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an + * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values + * are written as hex so that GCC will be quiet about large integer constants. + */ +#define SCHAR_MAX 127 /* min value for a signed char */ +#define SCHAR_MIN (-128) /* max value for a signed char */ + +#ifndef _MSC_VER +#define UCHAR_MAX 255 /* max value for an unsigned char */ +#endif//_MSC_VER +#ifndef __REACTOS__ +#define CHAR_MAX 127 /* max value for a char */ +#define CHAR_MIN (-128) /* min value for a char */ +#endif + +#ifndef SHRT_MAX +#define USHRT_MAX 65535 /* max value for an unsigned short */ +#define SHRT_MAX 32767 /* max value for a short */ +#define SHRT_MIN (-32768) /* min value for a short */ +#endif + +#ifndef INT_MAX +#define UINT_MAX 0xffffffff /* max value for an unsigned int */ +#define INT_MAX 2147483647 /* max value for an int */ +#define INT_MIN (-2147483647-1) /* min value for an int */ +#endif + +#ifndef LONG_MAX +#define ULONG_MAX 0xffffffff /* max value for an unsigned long */ +#define LONG_MAX 2147483647 /* max value for a long */ +#define LONG_MIN (-2147483647-1) /* min value for a long */ +#endif + +#if !defined(_ANSI_SOURCE) [truncated at 1000 lines; 28707 more skipped]