Initial revision
authorlothar <lothar>
Mon, 3 Nov 2008 11:39:03 +0000 (11:39 +0000)
committerlothar <lothar>
Mon, 3 Nov 2008 11:39:03 +0000 (11:39 +0000)
188 files changed:
packages/compat/linux/v2_0/ChangeLog [new file with mode: 0644]
packages/compat/linux/v2_0/cdl/linux.cdl [new file with mode: 0644]
packages/compat/linux/v2_0/include/asm/atomic.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/asm/bug.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/asm/page.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/asm/semaphore.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/TODO [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/compiler.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/completion.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/config.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/crc32.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/errno.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/fs.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/init.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/kernel.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/list.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/mtd/compatmac.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/mtd/mtd.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/pagemap.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/rbtree.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/rwsem.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/sched.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/slab.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/spinlock.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/stat.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/string.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/timer.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/types.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/version.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/vmalloc.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/wait.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/workqueue.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/zlib.h [new file with mode: 0644]
packages/compat/linux/v2_0/include/linux/zutil.h [new file with mode: 0644]
packages/compat/linux/v2_0/src/rbtree.c [new file with mode: 0644]
packages/compat/posix/v2_0/ChangeLog [new file with mode: 0644]
packages/compat/posix/v2_0/cdl/posix.cdl [new file with mode: 0644]
packages/compat/posix/v2_0/cdl/pthread.cdl [new file with mode: 0644]
packages/compat/posix/v2_0/doc/posix.sgml [new file with mode: 0644]
packages/compat/posix/v2_0/include/export.h [new file with mode: 0644]
packages/compat/posix/v2_0/include/limits.h [new file with mode: 0644]
packages/compat/posix/v2_0/include/mutex.h [new file with mode: 0644]
packages/compat/posix/v2_0/include/muttypes.h [new file with mode: 0644]
packages/compat/posix/v2_0/include/pthread.h [new file with mode: 0644]
packages/compat/posix/v2_0/include/semaphore.h [new file with mode: 0644]
packages/compat/posix/v2_0/include/signal.h [new file with mode: 0644]
packages/compat/posix/v2_0/include/sigsetjmp.h [new file with mode: 0644]
packages/compat/posix/v2_0/include/time.h [new file with mode: 0644]
packages/compat/posix/v2_0/include/types.h [new file with mode: 0644]
packages/compat/posix/v2_0/include/utsname.h [new file with mode: 0644]
packages/compat/posix/v2_0/src/except.cxx [new file with mode: 0644]
packages/compat/posix/v2_0/src/misc.cxx [new file with mode: 0644]
packages/compat/posix/v2_0/src/mqueue.cxx [new file with mode: 0644]
packages/compat/posix/v2_0/src/mutex.cxx [new file with mode: 0644]
packages/compat/posix/v2_0/src/pprivate.h [new file with mode: 0644]
packages/compat/posix/v2_0/src/pthread.cxx [new file with mode: 0644]
packages/compat/posix/v2_0/src/sched.cxx [new file with mode: 0644]
packages/compat/posix/v2_0/src/sem.cxx [new file with mode: 0644]
packages/compat/posix/v2_0/src/signal.cxx [new file with mode: 0644]
packages/compat/posix/v2_0/src/startup.cxx [new file with mode: 0644]
packages/compat/posix/v2_0/src/time.cxx [new file with mode: 0644]
packages/compat/posix/v2_0/tests/mqueue1.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/mqueue2.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/mutex3.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/pthread1.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/pthread2.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/pthread3.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/signal1.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/signal2.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/signal3.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/sigsetjmp.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/timer1.c [new file with mode: 0644]
packages/compat/posix/v2_0/tests/tm_basic.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/ChangeLog [new file with mode: 0644]
packages/compat/uitron/v2_0/cdl/flags.cdl [new file with mode: 0644]
packages/compat/uitron/v2_0/cdl/mboxes.cdl [new file with mode: 0644]
packages/compat/uitron/v2_0/cdl/mempoolfixed.cdl [new file with mode: 0644]
packages/compat/uitron/v2_0/cdl/mempoolvar.cdl [new file with mode: 0644]
packages/compat/uitron/v2_0/cdl/semas.cdl [new file with mode: 0644]
packages/compat/uitron/v2_0/cdl/tasks.cdl [new file with mode: 0644]
packages/compat/uitron/v2_0/cdl/uitron.cdl [new file with mode: 0644]
packages/compat/uitron/v2_0/cdl/version.cdl [new file with mode: 0644]
packages/compat/uitron/v2_0/doc/uitron.sgml [new file with mode: 0644]
packages/compat/uitron/v2_0/include/uit_func.h [new file with mode: 0644]
packages/compat/uitron/v2_0/include/uit_func.inl [new file with mode: 0644]
packages/compat/uitron/v2_0/include/uit_ifnc.h [new file with mode: 0644]
packages/compat/uitron/v2_0/include/uit_ifnc.inl [new file with mode: 0644]
packages/compat/uitron/v2_0/include/uit_objs.hxx [new file with mode: 0644]
packages/compat/uitron/v2_0/include/uit_type.h [new file with mode: 0644]
packages/compat/uitron/v2_0/src/uit_func.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/src/uit_ifnc.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/src/uit_objs.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/test1.c [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/test2.c [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/test3.c [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/test4.c [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/test5.c [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/test6.c [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/test7.c [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/test8.c [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/test9.c [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/testcx2.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/testcx3.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/testcx4.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/testcx5.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/testcx6.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/testcx7.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/testcx8.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/testcx9.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/testcxx.cxx [new file with mode: 0644]
packages/compat/uitron/v2_0/tests/testintr.cxx [new file with mode: 0644]
packages/cygmon/v2_0/ChangeLog [new file with mode: 0644]
packages/cygmon/v2_0/cdl/cygmon.cdl [new file with mode: 0644]
packages/cygmon/v2_0/misc/Notes_CygMon_PID [new file with mode: 0644]
packages/cygmon/v2_0/misc/arm/arm-mon.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/arm/board.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/arm/cpu.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/arm/cpu_info.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/board.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bplist-dynamic.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/breakpoints.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/arm/gdb-cpu.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/arm/gdb-cpu.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/arm/gdb.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/arm/insn.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/arm/singlestep.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/bsp.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/breakpoint.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/bsp.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/bsp_cache.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/bsp_if.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/bsp_if.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/console-io.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/debug-io.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/gdb-cpu.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/gdb-cpu.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/gdb.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/generic-mem.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/hex-utils.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/printf.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/shared-data.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/singlestep.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/sprintf.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/syscall.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/syscall.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/sysinfo.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/common/vprintf.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/cpu.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/dbg-threads-api.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/defs.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/gdb-data.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/hex-utils.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/mips/gdb-cpu.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/mips/gdb-cpu.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/mips/gdb.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/mips/insn.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/mips/singlestep.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/mn10300/gdb-cpu.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/mn10300/gdb-cpu.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/mn10300/gdb.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/mn10300/insn.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/bsp/mn10300/singlestep.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/cpu-mon.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/cpu_info.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/ecos_bsp.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/ecos_dummy.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/fmt_util.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/generic-stub.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/generic_fmt32.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/generic_mem.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/ledit.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/ledit.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/mips/board.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/mips/cpu.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/mips/cpu_info.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/mips/mips-mon.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/mn10300/board.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/mn10300/cpu.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/mn10300/cpu_info.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/mn10300/mn10300-mon.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/monitor.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/monitor.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/monitor_cmd.c [new file with mode: 0644]
packages/cygmon/v2_0/misc/monitor_cmd.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/stub-tservice.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/tservice.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/unistd.h [new file with mode: 0644]
packages/cygmon/v2_0/misc/utils.c [new file with mode: 0644]

diff --git a/packages/compat/linux/v2_0/ChangeLog b/packages/compat/linux/v2_0/ChangeLog
new file mode 100644 (file)
index 0000000..a7463da
--- /dev/null
@@ -0,0 +1,95 @@
+2005-03-27  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+       * include/linux/kernel.h (PTR_ERR): Should be an unsigned long,
+       not an intager, at least that is what Linux uses.
+
+2005-01-22  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+       * include/linux/spinlock.h (DEFINE_SPINLOCK): Added.
+       * include/linux/slab.h (vfree): Added vmalloc and vfree which map
+       to malloc and free.
+       * include/linux/rwsem.h: New file. eCos does not have read/write
+       semaphores so these are mapped to normal semaphores.
+       
+2004-08-12  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+       * include/linux/spinlock.h: Add CYG_UNUSED_PARAM() calls to avoid
+       compiler warnings.
+
+2004-08-04  Gary Thomas <gary@mlbassoc.com>
+
+       * include/linux/list.h (list_for_each_entry): New macro needed for
+       latest jffs2 code.
+
+2003-11-12  Thomas Koeller <thomas.koeller@baslerweb.com>
+
+        * cdl/linux.cdl:
+        * include/asm/page.h:
+        Make page size configurable via cdl.
+
+2003-10-18  Gary Thomas  <gary@mlbassoc.com>
+
+        * src/rbtree.c (rb_erase): Fix bug in red-black tree which caused
+        node corruption - merge from external sources, found by Scott 
+       Wilkerson.
+
+2003-10-18  Savin Zlobec <savin@elatec.si>
+
+        * include/linux/rbtree.h: 
+        Fixed 'pointer of type `void *' used in subtraction' compiler warrning.
+
+2003-07-27  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+       * include/linux/init.h: 
+       * include/linux/vmalloc.h: New dummy files so that jffs2 will
+       compile.
+
+2003-07-27  Michael Checky  <Michael_Checky@ThermoKing.com>
+            Andrew Lunn <andrew.lunn@ascom.ch>
+       
+       * include/linux/kernel.h: Changed the #define IS_ERR to work correctly
+       negative error values returned by the jffs2 code.
+
+2003-06-10  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+       * include/linux/stat.h: Removed #defines which has been added to 
+       the main eCos sys/stat.h. 
+
+2003-01-21  David Woodhouse  <dwmw2@infradead.org>
+
+       * New package.
+
+//===========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2003 Red Hat.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//===========================================================================
diff --git a/packages/compat/linux/v2_0/cdl/linux.cdl b/packages/compat/linux/v2_0/cdl/linux.cdl
new file mode 100644 (file)
index 0000000..d9b93aa
--- /dev/null
@@ -0,0 +1,76 @@
+# ====================================================================
+#
+#      linux.cdl
+#
+#      Linux compatibility layer data
+#
+# ====================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos 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 GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):      dwmw2
+# Contributors:   tkoeller
+# Date:           2003-01-08
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_LINUX_COMPAT {
+    display       "Linux compatibility layer"
+    include_dir   ""
+    description   "
+       eCos supports a basic Linux compatibility Layer providing various
+        functions, equivalents or stubs expected by Linux kernel code, for
+        assistance in porting drivers and file system code from Linux.
+        Note this does not provide Linux compatibility to applications."
+
+    compile      rbtree.c
+
+    cdl_option CYGNUM_LINUX_COMPAT_PAGE_SIZE_EXPONENT {
+        display         "Define page size"
+        flavor          data
+        legal_values    10 to 16
+        default_value   12
+        no_define
+        define          PAGE_SHIFT
+        description     "
+            Define the page size. The value entered here is used as an
+            exponent X in the expression 2^^X to ensure that the page
+            size is always an integer power of two."  
+     } 
+}
+
+# EOF linux.cdl
diff --git a/packages/compat/linux/v2_0/include/asm/atomic.h b/packages/compat/linux/v2_0/include/asm/atomic.h
new file mode 100644 (file)
index 0000000..5cb72ff
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __ASM_ATOMIC_H__
+#define __ASM_ATOMIC_H__
+
+#define atomic_t int
+#define atomic_inc(atom) (*atom)++
+#define atomic_dec(atom) (*atom)--
+#define atomic_read(atom) (*atom)
+
+
+#endif /* __ASM_ATOMIC_H__ */
diff --git a/packages/compat/linux/v2_0/include/asm/bug.h b/packages/compat/linux/v2_0/include/asm/bug.h
new file mode 100644 (file)
index 0000000..060eb27
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __ASM_BUG_H__
+#define __ASM_BUG_H__
+
+#define BUG() do { diag_printf("BUG() at %s %d\n", __FILE__, __LINE__); *(int *)0=0; } while (0)
+
+#endif /* __ASM_BUG_H__ */
diff --git a/packages/compat/linux/v2_0/include/asm/page.h b/packages/compat/linux/v2_0/include/asm/page.h
new file mode 100644 (file)
index 0000000..d77a39a
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef __ASM_PAGE_H__
+#define __ASM_PAGE_H__
+
+#include <pkgconf/linux_compat.h>
+
+/* These aren't used by much yet. If that changes, you might want
+   to make them actually correct :) */
+#define PAGE_SIZE  (0x1 << PAGE_SHIFT)
+
+
+#endif /* __ASM_PAGE_H__ */
diff --git a/packages/compat/linux/v2_0/include/asm/semaphore.h b/packages/compat/linux/v2_0/include/asm/semaphore.h
new file mode 100644 (file)
index 0000000..e816155
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef __ASM_SEMAPHORE_H__
+#define __ASM_SEMAPHORE_H__
+
+#include <cyg/hal/drv_api.h>
+
+struct semaphore {
+       cyg_drv_mutex_t x;
+};
+
+#define DECLARE_MUTEX(x) struct semaphore x = { { 0 } };
+#define DECLARE_MUTEX_LOCKED(x) struct semaphore x = { { 1 } };
+
+#define init_MUTEX(sem) cyg_drv_mutex_init((cyg_drv_mutex_t *)sem)
+#define init_MUTEX_LOCKED(sem) do { cyg_drv_mutex_init((cyg_drv_mutex_t *)sem); cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem); } while(0)
+#define down(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem)
+#define down_interruptible(sem) ({ cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem), 0; })
+#define down_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem)
+#define up(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem)
+
+#endif /* __ASM_SEMAPHORE_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/TODO b/packages/compat/linux/v2_0/include/linux/TODO
new file mode 100644 (file)
index 0000000..df8a6d1
--- /dev/null
@@ -0,0 +1,11 @@
+
+This contains a very limited set of Linux-compatibility headers, initially
+just for getting JFFS2 to build.
+
+Some things are simply stubs which don't _work_, to allow the JFFS2 code
+to compile. Note that you may need to implement these _properly_ in order
+to use these for making other Linux code work, or indeed for making the 
+JFFS2 NAND support work.
+
+The non-working parts include, but are not limited to: 
+       workqueue.h, wait.h, timer.h, spinlock.h, sched.h, compiler.h
diff --git a/packages/compat/linux/v2_0/include/linux/compiler.h b/packages/compat/linux/v2_0/include/linux/compiler.h
new file mode 100644 (file)
index 0000000..fb25365
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __LINUX_COMPILER_H__
+#define __LINUX_COMPILER_H__
+
+#define likely(x) (x)
+#define unlikely(x) (x)
+
+#endif /* __LINUX_COMPILER_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/completion.h b/packages/compat/linux/v2_0/include/linux/completion.h
new file mode 100644 (file)
index 0000000..f131af8
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __LINUX_COMPLETION_H__
+#define __LINUX_COMPLETION_H__
+
+struct completion { } ;
+
+#endif /* __LINUX_COMPLETION_H__ */
+
diff --git a/packages/compat/linux/v2_0/include/linux/config.h b/packages/compat/linux/v2_0/include/linux/config.h
new file mode 100644 (file)
index 0000000..986e10b
--- /dev/null
@@ -0,0 +1,5 @@
+#ifndef __LINUX_CONFIG_H__
+#define __LINUX_CONFIG_H__
+
+
+#endif /* __LINUX_CONFIG_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/crc32.h b/packages/compat/linux/v2_0/include/linux/crc32.h
new file mode 100644 (file)
index 0000000..8d19a1e
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef CRC32_H
+#define CRC32_H
+
+#include <cyg/crc/crc.h>
+
+#define crc32(val, s, len) cyg_crc32_accumulate(val, (unsigned char *)s, len)
+
+#endif
diff --git a/packages/compat/linux/v2_0/include/linux/errno.h b/packages/compat/linux/v2_0/include/linux/errno.h
new file mode 100644 (file)
index 0000000..339f4fc
--- /dev/null
@@ -0,0 +1 @@
+#include <errno.h>
diff --git a/packages/compat/linux/v2_0/include/linux/fs.h b/packages/compat/linux/v2_0/include/linux/fs.h
new file mode 100644 (file)
index 0000000..c2f173a
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __LINUX_FS_H__
+#define __LINUX_FS_H__
+
+#include <linux/stat.h>
+/*
+ * File types
+ */
+#define DT_UNKNOWN     0
+#define DT_DIR         4
+#define DT_REG         8
+
+
+#endif /* __LINUX_FS_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/init.h b/packages/compat/linux/v2_0/include/linux/init.h
new file mode 100644 (file)
index 0000000..e4c702f
--- /dev/null
@@ -0,0 +1,3 @@
+#ifndef __LINUX_INIT_H__
+#define __LINUX_INIT_H__
+#endif
diff --git a/packages/compat/linux/v2_0/include/linux/kernel.h b/packages/compat/linux/v2_0/include/linux/kernel.h
new file mode 100644 (file)
index 0000000..3eb52d0
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef __LINUX_KERNEL_H__
+#define __LINUX_KERNEL_H__
+#include <cyg/infra/diag.h>
+
+#define jiffies 100
+
+#define ERR_PTR(err) ((void*)(err))
+#define PTR_ERR(err) ((unsigned long)(err))
+#define IS_ERR(err) ((unsigned long)err > (unsigned long)-1000L)
+
+#define CURRENT_TIME cyg_timestamp()
+
+#define        KERN_EMERG              "<0>" // system is unusable
+#define        KERN_ALERT              "<1>" // action must be taken immediately
+#define        KERN_CRIT               "<2>" // critical conditions
+#define        KERN_ERR                "<3>" // error conditions
+#define        KERN_WARNING            "<4>" // warning conditions
+#define        KERN_NOTICE             "<5>" // normal but significant condition
+#define        KERN_INFO               "<6>" // informational
+#define        KERN_DEBUG              "<7>" // debug-level messages
+#define printk diag_printf
+
+#define min(x,y) (x<y?x:y)
+#define max(x,y) (x<y?y:x)
+#define min_t(t, x,y) ((t)x<(t)y?(t)x:(t)y)
+
+
+#endif /* __LINUX_KERNEL_H__ */
+
+
+
+
diff --git a/packages/compat/linux/v2_0/include/linux/list.h b/packages/compat/linux/v2_0/include/linux/list.h
new file mode 100644 (file)
index 0000000..a6b3f46
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * JFFS2 -- Journalling Flash File System, Version 2.
+ *
+ * Copyright (C) 2002 Red Hat, Inc.
+ *
+ * Created by Jonathan Larmour <jlarmour@redhat.com>
+ * 
+ *===========================================================================
+ *####ECOSGPLCOPYRIGHTBEGIN####
+ * -------------------------------------------
+ * This file is part of eCos, the Embedded Configurable Operating System.
+ * Copyright (C) 2003 Red Hat.
+ *
+ * eCos is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 or (at your option) any later version.
+ *
+ * eCos 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 GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with eCos; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * As a special exception, if other files instantiate templates or use macros
+ * or inline functions from this file, or you compile this file and link it
+ * with other works to produce a work based on this file, this file does not
+ * by itself cause the resulting work to be covered by the GNU General Public
+ * License. However the source code for this file must still be made available
+ * in accordance with section (3) of the GNU General Public License.
+ *
+ * This exception does not invalidate any other reasons why a work based on
+ * this file might be covered by the GNU General Public License.
+ *
+ * Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+ * at http://sources.redhat.com/ecos/ecos-license/
+ * -------------------------------------------
+ *####ECOSGPLCOPYRIGHTEND####
+ *===========================================================================
+ *
+ */
+
+#ifndef CYGONCE_FS_JFFS2_LIST_H
+#define CYGONCE_FS_JFFS2_LIST_H
+
+
+/* -----------------------------------------------------------------------*/
+
+/* Doubly linked list implementation to replace the GPL'd one used in
+   the Linux kernel. */
+
+#include <stddef.h>
+#include <cyg/infra/cyg_type.h>
+
+/* TYPES */
+
+struct list_head {
+    struct list_head *next;
+    struct list_head *prev;
+};
+
+/* MACROS */
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+        struct list_head name = LIST_HEAD_INIT(name)
+
+#define INIT_LIST_HEAD( _list_ )              \
+CYG_MACRO_START                               \
+(_list_)->next = (_list_)->prev = (_list_);   \
+CYG_MACRO_END
+
+/* FUNCTIONS */
+
+/* Insert an entry _after_ the specified entry */
+static __inline__ void
+list_add( struct list_head *newent, struct list_head *afterthisent )
+{
+    struct list_head *next = afterthisent->next;
+    newent->next = next;
+    newent->prev = afterthisent;
+    afterthisent->next = newent;
+    next->prev = newent;
+} /* list_add() */
+
+/* Insert an entry _before_ the specified entry */
+static __inline__ void
+list_add_tail( struct list_head *newent, struct list_head *beforethisent )
+{
+    struct list_head *prev = beforethisent->prev;
+    newent->prev = prev;
+    newent->next = beforethisent;
+    beforethisent->prev = newent;
+    prev->next = newent;
+} /* list_add_tail() */
+
+/* Delete the specified entry */
+static __inline__ void
+list_del( struct list_head *ent )
+{
+    ent->prev->next = ent->next;
+    ent->next->prev = ent->prev;
+} /* list_del() */
+
+/* Is this list empty? */
+static __inline__ int
+list_empty( struct list_head *list )
+{
+    return ( list->next == list );
+} /* list_empty() */
+
+/* list_entry - Assuming you have a struct of type _type_ that contains a
+   list which has the name _member_ in that struct type, then given the
+   address of that list in the struct, _list_, this returns the address
+   of the container structure */
+
+#define list_entry( _list_, _type_, _member_ ) \
+    ((_type_ *)((char *)(_list_)-(char *)(offsetof(_type_,_member_))))
+
+/* list_for_each - using _ent_, iterate through list _list_ */
+
+#define list_for_each( _ent_, _list_ )   \
+    for ( (_ent_) = (_list_)->next;      \
+    (_ent_) != (_list_);                 \
+    (_ent_) = (_ent_)->next )
+
+/*
+ * list_for_each_entry - this function can be use to iterate over all
+ * items in a list* _list_ with it's head at _head_ and link _item_
+ */
+#define list_for_each_entry(_list_, _head_, _item_)                     \
+for ((_list_) = list_entry((_head_)->next, typeof(*_list_), _item_); \
+     &((_list_)->_item_) != (_head_);                                 \
+     (_list_) = list_entry((_list_)->_item_.next, typeof(*_list_), _item_))
+
+/* -----------------------------------------------------------------------*/
+#endif /* #ifndef CYGONCE_FS_JFFS2_LIST_H */
+/* EOF list.h */
diff --git a/packages/compat/linux/v2_0/include/linux/mtd/compatmac.h b/packages/compat/linux/v2_0/include/linux/mtd/compatmac.h
new file mode 100644 (file)
index 0000000..cee3749
--- /dev/null
@@ -0,0 +1,5 @@
+#ifndef __LINUX_MTD_COMPATMAC_H__
+#define __LINUX_MTD_COMPATMAC_H__
+
+
+#endif /* __LINUX_MTD_COMPATMAC_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/mtd/mtd.h b/packages/compat/linux/v2_0/include/linux/mtd/mtd.h
new file mode 100644 (file)
index 0000000..817d31c
--- /dev/null
@@ -0,0 +1,5 @@
+#ifndef __LINUX_MTD_MTD_H__
+#define __LINUX_MTD_MTD_H__
+
+
+#endif /* __LINUX_MTD_MTD_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/pagemap.h b/packages/compat/linux/v2_0/include/linux/pagemap.h
new file mode 100644 (file)
index 0000000..fccf9c4
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef __LINUX_PAGEMAP_H__
+#define __LINUX_PAGEMAP_H__
+
+#include <asm/bug.h>
+#include <asm/page.h>
+
+#define PAGE_CACHE_SHIFT        PAGE_SHIFT
+#define PAGE_CACHE_SIZE         PAGE_SIZE
+
+#define PageLocked(pg) 1
+#define Page_Uptodate(pg) 0
+#define UnlockPage(pg) 
+#define PAGE_BUG(pg) BUG()
+#define ClearPageUptodate(pg)
+#define SetPageError(pg)
+#define ClearPageError(pg)
+#define SetPageUptodate(pg)
+
+#endif /* __LINUX_PAGEMAP_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/rbtree.h b/packages/compat/linux/v2_0/include/linux/rbtree.h
new file mode 100644 (file)
index 0000000..fef5f71
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef        _LINUX_RBTREE_H
+#define        _LINUX_RBTREE_H
+
+
+struct rb_node {
+       struct rb_node *rb_left;        /* left element */
+       struct rb_node *rb_right;       /* right element */
+       struct rb_node *rb_parent;      /* parent element */
+       int rb_color;                   /* node color */
+};
+
+struct rb_root {
+       struct rb_node *rb_node; /* root of the tree */
+};
+#define NULL ((void *)0)
+#define RB_ROOT ((struct rb_root){NULL})
+#define rb_entry(p, container, field)          \
+       ((container *) ((char *)p - ((char *)&(((container *)0)->field))))
+
+#define RB_BLACK       0
+#define RB_RED         1
+
+
+extern void rb_insert_color(struct rb_node *, struct rb_root *);
+extern void rb_erase(struct rb_node *, struct rb_root *);
+
+/* Find logical next and previous nodes in a tree */
+extern struct rb_node *rb_next(struct rb_node *);
+extern struct rb_node *rb_prev(struct rb_node *);
+extern struct rb_node *rb_first(struct rb_root *);
+
+/* Fast replacement of a single node without remove/rebalance/add/rebalance */
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 
+                           struct rb_root *root);
+
+static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
+                               struct rb_node ** rb_link)
+{
+       node->rb_parent = parent;
+       node->rb_color = RB_RED;
+       node->rb_left = node->rb_right = NULL;
+
+       *rb_link = node;
+}
+
+#endif /* _LINUX_RBTREE_H */
diff --git a/packages/compat/linux/v2_0/include/linux/rwsem.h b/packages/compat/linux/v2_0/include/linux/rwsem.h
new file mode 100644 (file)
index 0000000..d648a15
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef __LINUX_RWSEM_H__
+#define __LINUX_RWSEM_H__
+
+// eCos does not have the concept of a read/write semaphore. So just
+// map them onto normal semaphores and hope we don't deadlock
+// somewhere.
+
+#include <asm/semaphore.h>
+
+struct rw_semaphore;
+
+#define down_read(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem)
+#define down_read_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem)
+#define down_write(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem)
+#define down_write_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem)
+#define up_read(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem)
+#define up_write(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem)
+#define downgrade_write(sem) 
+
+#endif // __LINUX_RWSEM_H__ 
diff --git a/packages/compat/linux/v2_0/include/linux/sched.h b/packages/compat/linux/v2_0/include/linux/sched.h
new file mode 100644 (file)
index 0000000..14a7359
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef __LINUX_SCHED_H__
+#define __LINUX_SCHED_H__
+
+#define cond_resched() do { } while(0)
+#define signal_pending(x) (0)
+
+#endif /* __LINUX_SCHED_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/slab.h b/packages/compat/linux/v2_0/include/linux/slab.h
new file mode 100644 (file)
index 0000000..fff3949
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef __LINUX_SLAB_H__
+#define __LINUX_SLAB_H__
+
+#include <stdlib.h>
+
+#include <asm/page.h> /* Don't ask. Linux headers are a mess. */
+
+#define kmalloc(x, y) malloc(x)
+#define kfree(x) free(x)
+#define vmalloc(x) malloc(x)
+#define vfree(x) free(x)
+
+#endif /* __LINUX_SLAB_H__ */
+
diff --git a/packages/compat/linux/v2_0/include/linux/spinlock.h b/packages/compat/linux/v2_0/include/linux/spinlock.h
new file mode 100644 (file)
index 0000000..22eba0b
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef __LINUX_SPINLOCK_H__
+#define __LINUX_SPINLOCK_H__
+
+
+typedef struct { } spinlock_t;
+#define SPIN_LOCK_UNLOCKED (spinlock_t) { }
+#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
+
+#define spin_lock_init(lock)             \
+CYG_MACRO_START;                         \
+CYG_UNUSED_PARAM(spinlock_t *, lock);    \
+CYG_MACRO_END
+
+#define spin_lock(lock)                  \
+CYG_MACRO_START;                         \
+CYG_UNUSED_PARAM(spinlock_t *, lock);    \
+CYG_MACRO_END
+
+#define spin_unlock(lock)                \
+CYG_MACRO_START;                         \
+CYG_UNUSED_PARAM(spinlock_t *, lock);    \
+CYG_MACRO_END
+
+#define spin_lock_bh(lock)               \
+CYG_MACRO_START;                         \
+CYG_UNUSED_PARAM(spinlock_t *, lock);    \
+CYG_MACRO_END
+
+#define spin_unlock_bh(lock)             \
+CYG_MACRO_START;                         \
+CYG_UNUSED_PARAM(spinlock_t *, lock);    \
+CYG_MACRO_END
+
+#endif /* __LINUX_SPINLOCK_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/stat.h b/packages/compat/linux/v2_0/include/linux/stat.h
new file mode 100644 (file)
index 0000000..a3efd61
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __LINUX_STAT_H__
+#define __LINUX_STAT_H__
+
+
+#include <sys/stat.h>
+
+#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
+#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
+#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
+#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
+
+#endif /* __LINUX_STAT_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/string.h b/packages/compat/linux/v2_0/include/linux/string.h
new file mode 100644 (file)
index 0000000..fc14ba6
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __LINUX_STRING_H__
+#define __LINUX_STRING_H__
+
+#include <string.h>
+
+#endif /* __LINUX_STRING_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/timer.h b/packages/compat/linux/v2_0/include/linux/timer.h
new file mode 100644 (file)
index 0000000..80e9ef5
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __LINUX_TIMER_H__
+#define __LINUX_TIMER_H__
+
+/* Not yet */
+
+struct timer_list { } ;
+
+
+#endif /* __LINUX_TIMER_H__ */
+
diff --git a/packages/compat/linux/v2_0/include/linux/types.h b/packages/compat/linux/v2_0/include/linux/types.h
new file mode 100644 (file)
index 0000000..e58fc25
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __LINUX_TYPES_H__
+#define __LINUX_TYPES_H__
+
+#include "cyg/infra/cyg_type.h"
+
+#define uint8_t cyg_uint8
+#define uint16_t cyg_uint16
+#define uint32_t cyg_uint32
+#define loff_t off_t
+
+#define kvec iovec
+#endif /* __LINUX_TYPES_H__ */
+
diff --git a/packages/compat/linux/v2_0/include/linux/version.h b/packages/compat/linux/v2_0/include/linux/version.h
new file mode 100644 (file)
index 0000000..cca2d73
--- /dev/null
@@ -0,0 +1,5 @@
+#ifndef __LINUX_VERSION_H__
+#define __LINUX_VERSION_H__
+
+
+#endif /* __LINUX_VERSION_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/vmalloc.h b/packages/compat/linux/v2_0/include/linux/vmalloc.h
new file mode 100644 (file)
index 0000000..6f18ab2
--- /dev/null
@@ -0,0 +1,3 @@
+#ifndef __LINUX_VMALLOC_H__
+#define __LINUX_VMALLOC_H__
+#endif
diff --git a/packages/compat/linux/v2_0/include/linux/wait.h b/packages/compat/linux/v2_0/include/linux/wait.h
new file mode 100644 (file)
index 0000000..2b422e3
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __LINUX_WAIT_H__
+#define __LINUX_WAIT_H__
+
+
+typedef struct { } wait_queue_head_t;
+
+#define init_waitqueue_head(wait) do{} while (0)
+#define add_wait_queue(wait,new_wait) do{} while (0)
+#define remove_wait_queue(wait,old_wait) do{} while (0)
+#define DECLARE_WAITQUEUE(wait,current) do{} while (0)
+
+static inline void wake_up(wait_queue_head_t *erase_wait)
+{ /* Only used for waking up threads blocks on erases. Not used in eCos */ }
+
+#endif /* __LINUX_WAIT_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/workqueue.h b/packages/compat/linux/v2_0/include/linux/workqueue.h
new file mode 100644 (file)
index 0000000..8c900a4
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef __LINUX_WORKQUEUE_H__
+#define __LINUX_WORKQUEUE_H__
+
+/* We don't do this yet */
+struct work_struct { } ;
+
+#define INIT_WORK(x,y,z) /* */
+#define schedule_work(x) do { } while(0)
+#define flush_scheduled_work() do { } while(0)
+
+#endif /* __LINUX_WORKQUEUE_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/zlib.h b/packages/compat/linux/v2_0/include/linux/zlib.h
new file mode 100644 (file)
index 0000000..9de691e
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef __LINUX_ZLIB_H__
+#define __LINUX_ZLIB_H__
+
+#include <cyg/compress/zlib.h>
+
+#define zlib_deflateInit(x,y) deflateInit(x,y)
+#define zlib_deflate(x,y) deflate(x,y)
+#define zlib_deflateEnd(x) deflateEnd(x)
+#define zlib_inflateInit(x) inflateInit(x)
+#define zlib_inflateInit2(x,y) inflateInit2(x,y)
+#define zlib_inflate(x,y) inflate(x,y)
+#define zlib_inflateEnd(x) inflateEnd(x)
+
+#endif /* __LINUX_ZLIB_H__ */
diff --git a/packages/compat/linux/v2_0/include/linux/zutil.h b/packages/compat/linux/v2_0/include/linux/zutil.h
new file mode 100644 (file)
index 0000000..c3774ba
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __LINUX_ZUTIL_H__
+#define __LINUX_ZUTIL_H__
+
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+
+#endif /* __LINUX_ZUTIL_H__ */
diff --git a/packages/compat/linux/v2_0/src/rbtree.c b/packages/compat/linux/v2_0/src/rbtree.c
new file mode 100644 (file)
index 0000000..1ad19c8
--- /dev/null
@@ -0,0 +1,409 @@
+/*========================================================================
+//
+//      rbtree.c
+//
+//      Red Black tree implementation
+//
+//========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     Niels Provos/OpenBSD
+// Contributors:  dwmw2
+// Date:          2003-01-21
+// Purpose:       This file provides an implementation of red-black trees.
+// Description:   Derived from OpenBSD src/sys/sys/tree.h
+// Usage:         
+//
+//####DESCRIPTIONEND####
+//
+//======================================================================
+*/
+
+/*     $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $    */
+/*
+ * Copyright 2002 Niels Provos <provos@citi.umich.edu>
+ * 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 SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
+ */
+
+/* Fields renamed to match Linux ones. */
+#include <linux/rbtree.h>
+
+
+#define RB_HEAD(head)          (head)->rb_node
+#define RB_LEFT(elm)           (elm)->rb_left
+#define RB_RIGHT(elm)          (elm)->rb_right
+#define RB_PARENT(elm)         (elm)->rb_parent
+#define RB_COLOR(elm)          (elm)->rb_color
+
+
+#define RB_SET(elm, parent) do {                               \
+       RB_PARENT(elm) = parent;                                \
+       RB_LEFT(elm) = RB_RIGHT(elm) = NULL;    \
+       RB_COLOR(elm) = RB_RED;                         \
+} while (0)
+
+#define RB_SET_BLACKRED(black, red) do {                       \
+       RB_COLOR(black) = RB_BLACK;                             \
+       RB_COLOR(red) = RB_RED;                                 \
+} while (0)
+
+#ifndef RB_AUGMENT
+#define RB_AUGMENT(x)
+#endif
+
+#define RB_ROTATE_LEFT(head, elm, tmp) do {                    \
+       (tmp) = RB_RIGHT(elm);                                  \
+       if ((RB_RIGHT(elm) = RB_LEFT(tmp))) {                   \
+               RB_PARENT(RB_LEFT(tmp)) = (elm);                \
+       }                                                       \
+       RB_AUGMENT(elm);                                        \
+       if ((RB_PARENT(tmp) = RB_PARENT(elm))) {                \
+               if ((elm) == RB_LEFT(RB_PARENT(elm)))           \
+                       RB_LEFT(RB_PARENT(elm)) = (tmp);        \
+               else                                            \
+                       RB_RIGHT(RB_PARENT(elm)) = (tmp);       \
+       } else                                                  \
+               (head)->rb_node = (tmp);                        \
+       RB_LEFT(tmp) = (elm);                                   \
+       RB_PARENT(elm) = (tmp);                                 \
+       RB_AUGMENT(tmp);                                        \
+       if ((RB_PARENT(tmp)))                                   \
+               RB_AUGMENT(RB_PARENT(tmp));                     \
+} while (0)
+
+#define RB_ROTATE_RIGHT(head, elm, tmp) do {                   \
+       (tmp) = RB_LEFT(elm);                                   \
+       if ((RB_LEFT(elm) = RB_RIGHT(tmp))) {                   \
+               RB_PARENT(RB_RIGHT(tmp)) = (elm);               \
+       }                                                       \
+       RB_AUGMENT(elm);                                        \
+       if ((RB_PARENT(tmp) = RB_PARENT(elm))) {                \
+               if ((elm) == RB_LEFT(RB_PARENT(elm)))           \
+                       RB_LEFT(RB_PARENT(elm)) = (tmp);        \
+               else                                            \
+                       RB_RIGHT(RB_PARENT(elm)) = (tmp);       \
+       } else                                                  \
+               (head)->rb_node = (tmp);                        \
+       RB_RIGHT(tmp) = (elm);                                  \
+       RB_PARENT(elm) = (tmp);                                 \
+       RB_AUGMENT(tmp);                                        \
+       if ((RB_PARENT(tmp)))                                   \
+               RB_AUGMENT(RB_PARENT(tmp));                     \
+} while(0)
+
+/* Note args swapped to match Linux */
+void rb_insert_color(struct rb_node *elm, struct rb_root *head)
+{
+       struct rb_node *parent, *gparent, *tmp;
+       while ((parent = RB_PARENT(elm)) &&
+           RB_COLOR(parent) == RB_RED) {
+               gparent = RB_PARENT(parent);
+               if (parent == RB_LEFT(gparent)) {
+                       tmp = RB_RIGHT(gparent);
+                       if (tmp && RB_COLOR(tmp) == RB_RED) {
+                               RB_COLOR(tmp) = RB_BLACK;
+                               RB_SET_BLACKRED(parent, gparent);
+                               elm = gparent;
+                               continue;
+                       }
+                       if (RB_RIGHT(parent) == elm) {
+                               RB_ROTATE_LEFT(head, parent, tmp);
+                               tmp = parent;
+                               parent = elm;
+                               elm = tmp;
+                       }
+                       RB_SET_BLACKRED(parent, gparent);
+                       RB_ROTATE_RIGHT(head, gparent, tmp);
+               } else {
+                       tmp = RB_LEFT(gparent);
+                       if (tmp && RB_COLOR(tmp) == RB_RED) {
+                               RB_COLOR(tmp) = RB_BLACK;
+                               RB_SET_BLACKRED(parent, gparent);
+                               elm = gparent;
+                               continue;
+                       }
+                       if (RB_LEFT(parent) == elm) {
+                               RB_ROTATE_RIGHT(head, parent, tmp);
+                               tmp = parent;
+                               parent = elm;
+                               elm = tmp;
+                       }
+                       RB_SET_BLACKRED(parent, gparent);
+                       RB_ROTATE_LEFT(head, gparent, tmp);
+               }
+       }
+       RB_COLOR(head->rb_node) = RB_BLACK;
+}
+
+
+static void rb_remove_color(struct rb_root *head, struct rb_node *parent,
+                           struct rb_node *elm)
+{
+       struct rb_node *tmp;
+       while ((elm == NULL || RB_COLOR(elm) == RB_BLACK) &&
+           elm != RB_HEAD(head)) {
+               if (RB_LEFT(parent) == elm) {
+                       tmp = RB_RIGHT(parent);
+                       if (RB_COLOR(tmp) == RB_RED) {
+                               RB_SET_BLACKRED(tmp, parent);
+                               RB_ROTATE_LEFT(head, parent, tmp);
+                               tmp = RB_RIGHT(parent);
+                       }
+                       if ((RB_LEFT(tmp) == NULL ||
+                           RB_COLOR(RB_LEFT(tmp)) == RB_BLACK) &&
+                           (RB_RIGHT(tmp) == NULL ||
+                           RB_COLOR(RB_RIGHT(tmp)) == RB_BLACK)) {
+                               RB_COLOR(tmp) = RB_RED;
+                               elm = parent;
+                               parent = RB_PARENT(elm);
+                       } else {
+                               if (RB_RIGHT(tmp) == NULL ||
+                                   RB_COLOR(RB_RIGHT(tmp)) == RB_BLACK) {
+                                       struct rb_node *oleft;
+                                       if ((oleft = RB_LEFT(tmp)))
+                                               RB_COLOR(oleft) = RB_BLACK;
+                                       RB_COLOR(tmp) = RB_RED;
+                                       RB_ROTATE_RIGHT(head, tmp, oleft);
+                                       tmp = RB_RIGHT(parent);
+                               }
+                               RB_COLOR(tmp) = RB_COLOR(parent);
+                               RB_COLOR(parent) = RB_BLACK;
+                               if (RB_RIGHT(tmp))
+                                       RB_COLOR(RB_RIGHT(tmp)) = RB_BLACK;
+                               RB_ROTATE_LEFT(head, parent, tmp);
+                               elm = RB_HEAD(head);
+                               break;
+                       }
+               } else {
+                       tmp = RB_LEFT(parent);
+                       if (RB_COLOR(tmp) == RB_RED) {
+                               RB_SET_BLACKRED(tmp, parent);
+                               RB_ROTATE_RIGHT(head, parent, tmp);
+                               tmp = RB_LEFT(parent);
+                       }
+                       if ((RB_LEFT(tmp) == NULL ||
+                           RB_COLOR(RB_LEFT(tmp)) == RB_BLACK) &&
+                           (RB_RIGHT(tmp) == NULL ||
+                           RB_COLOR(RB_RIGHT(tmp)) == RB_BLACK)) {
+                               RB_COLOR(tmp) = RB_RED;
+                               elm = parent;
+                               parent = RB_PARENT(elm);
+                       } else {
+                               if (RB_LEFT(tmp) == NULL ||
+                                   RB_COLOR(RB_LEFT(tmp)) == RB_BLACK) {
+                                       struct rb_node *oright;
+                                       if ((oright = RB_RIGHT(tmp)))
+                                               RB_COLOR(oright) = RB_BLACK;
+                                       RB_COLOR(tmp) = RB_RED;
+                                       RB_ROTATE_LEFT(head, tmp, oright);
+                                       tmp = RB_LEFT(parent);
+                               }
+                               RB_COLOR(tmp) = RB_COLOR(parent);
+                               RB_COLOR(parent) = RB_BLACK;
+                               if (RB_LEFT(tmp))
+                                       RB_COLOR(RB_LEFT(tmp)) = RB_BLACK;
+                               RB_ROTATE_RIGHT(head, parent, tmp);
+                               elm = RB_HEAD(head);
+                               break;
+                       }
+               }
+       }
+       if (elm)
+               RB_COLOR(elm) = RB_BLACK;
+}
+
+/* Note name changed. Guess why :) */
+void rb_erase(struct rb_node *elm, struct rb_root *head)
+{
+       struct rb_node *child, *parent, *old = elm;
+       int color;
+       if (RB_LEFT(elm) == NULL)
+               child = RB_RIGHT(elm);
+       else if (RB_RIGHT(elm) == NULL)
+               child = RB_LEFT(elm);
+       else {
+               struct rb_node *left;
+               elm = RB_RIGHT(elm);
+               while ((left = RB_LEFT(elm)))
+                       elm = left;
+               child = RB_RIGHT(elm);
+               parent = RB_PARENT(elm);
+               color = RB_COLOR(elm);
+               if (child)
+                       RB_PARENT(child) = parent;
+               if (parent) {
+                       if (RB_LEFT(parent) == elm)
+                               RB_LEFT(parent) = child;
+                       else
+                               RB_RIGHT(parent) = child;
+                       RB_AUGMENT(parent);
+               } else
+                       RB_HEAD(head) = child;
+               if (RB_PARENT(elm) == old)
+                       parent = elm;
+               *(elm) = *(old);
+               if (RB_PARENT(old)) {
+                       if (RB_LEFT(RB_PARENT(old)) == old)
+                               RB_LEFT(RB_PARENT(old)) = elm;
+                       else
+                               RB_RIGHT(RB_PARENT(old)) = elm;
+                       RB_AUGMENT(RB_PARENT(old));
+               } else
+                       RB_HEAD(head) = elm;
+               RB_PARENT(RB_LEFT(old)) = elm;
+               if (RB_RIGHT(old))
+                       RB_PARENT(RB_RIGHT(old)) = elm;
+               if (parent) {
+                       left = parent;
+                       do {
+                               RB_AUGMENT(left);
+                       } while ((left = RB_PARENT(left)));
+               }
+               goto color;
+       }
+       parent = RB_PARENT(elm);
+       color = RB_COLOR(elm);
+       if (child)
+               RB_PARENT(child) = parent;
+       if (parent) {
+               if (RB_LEFT(parent) == elm)
+                       RB_LEFT(parent) = child;
+               else
+                       RB_RIGHT(parent) = child;
+               RB_AUGMENT(parent);
+       } else
+               RB_HEAD(head) = child;
+color:
+       if (color == RB_BLACK)
+               rb_remove_color(head, parent, child);
+}
+
+struct rb_node *rb_next(struct rb_node *elm)
+{
+       if (RB_RIGHT(elm)) {
+               elm = RB_RIGHT(elm);
+               while (RB_LEFT(elm))
+                       elm = RB_LEFT(elm);
+       } else {
+               if (RB_PARENT(elm) &&
+                   (elm == RB_LEFT(RB_PARENT(elm))))
+                       elm = RB_PARENT(elm);
+               else {
+                       while (RB_PARENT(elm) &&
+                           (elm == RB_RIGHT(RB_PARENT(elm))))
+                               elm = RB_PARENT(elm);
+                       elm = RB_PARENT(elm);
+               }
+       }
+       return (elm);
+}
+
+struct rb_node *rb_prev(struct rb_node *elm)
+{
+       if (RB_LEFT(elm)) {
+               elm = RB_LEFT(elm);
+               while (RB_RIGHT(elm))
+                       elm = RB_RIGHT(elm);
+       } else {
+               if (RB_PARENT(elm) &&
+                   (elm == RB_RIGHT(RB_PARENT(elm))))
+                       elm = RB_PARENT(elm);
+               else {
+                       while (RB_PARENT(elm) &&
+                           (elm == RB_LEFT(RB_PARENT(elm))))
+                               elm = RB_PARENT(elm);
+                       elm = RB_PARENT(elm);
+               }
+       }
+       return (elm);
+}
+
+/* These ones are lifted from Linux -- but that's OK because I
+   wrote them. dwmw2. */
+struct rb_node *rb_first(struct rb_root *root)
+{
+        struct rb_node  *n;
+
+        n = root->rb_node;
+        if (!n)
+                return 0;
+        while (n->rb_left)
+                n = n->rb_left;
+        return n;
+}
+
+void rb_replace_node(struct rb_node *victim, struct rb_node *new,
+                     struct rb_root *root)
+{
+        struct rb_node *parent = victim->rb_parent;
+
+        /* Set the surrounding nodes to point to the replacement */
+        if (parent) {
+                if (victim == parent->rb_left)
+                        parent->rb_left = new;
+                else
+                        parent->rb_right = new;
+        } else {
+                root->rb_node = new;
+        }
+        if (victim->rb_left)
+                victim->rb_left->rb_parent = new;
+        if (victim->rb_right)
+                victim->rb_right->rb_parent = new;
+
+        /* Copy the pointers/colour from the victim to the replacement */
+        *new = *victim;
+}
diff --git a/packages/compat/posix/v2_0/ChangeLog b/packages/compat/posix/v2_0/ChangeLog
new file mode 100644 (file)
index 0000000..4eed209
--- /dev/null
@@ -0,0 +1,1094 @@
+2004-10-01  Oyvind Harboe  <oyvind.harboe@zylin.com>
+
+       * src/signal.cxx:  place the CYGBLD_ATTRIB_INIT_PRI such that it
+       compiles for gcc 3.4.2 which is more picky about its placement.
+
+2003-12-02  Sandeep  <sandeep@codito.com>
+
+       * src/mqueue.cxx (new): define a placement new instead of using <new>
+
+2003-11-19  Rickard Westman <rickard.westman@27m.se>
+       
+       * src/mqueue.cxx: Fix problem with mq_timedsend() and
+       mq_timedreceive() timing out with zero timeouts even when there is
+       room in the queue.
+
+2003-11-17  Dan Jakubiec <djakubiec@yahoo.com>
+
+       * src/pthread.cxx (pthread_exit): Added code to disable cancellation
+       requests during thread exit.  This allows thread cleanup handlers
+       to issue system calls when cleaning up thread resources.
+
+2003-06-18  Jonathan Larmour  <jifl@eCosCentric.com>
+
+       * src/pthread.cxx (pthread_self_info): Just add some comments so
+       no-one's tempted to uncomment assert.
+       (pthread_create): Verify that self is a valid POSIX thread when
+       needed.
+
+2003-03-20  Mark Salter  <msalter@redhat.com>
+
+       * include/pthread.h: Avoid conflict with recently introduced gcc
+       __thread keyword.
+
+2003-03-13  Bart Veer  <bartv@ecoscentric.com>
+
+       * include/export.h: Only export signal-related functions if
+       CYGPKG_POSIX_SIGNALS is enabled.
+
+2003-03-04  Gary Thomas  <gary@mlbassoc.com>
+
+       * include/pthread.h: Rework prototypes to minimize namespace problems.
+
+2003-03-03  Jonathan Larmour  <jifl@eCosCentric.com>
+
+       * tests/signal2.c (cause_illegal_access): PowerPC only generates
+       alignment exceptions in little-endian mode, so make that a special
+       case.
+
+       * tests/mutex3.c: Include POSIX headers before feature tests to
+       prevent spurious CYG_TEST_NA.
+
+2003-02-24  Jonathan Larmour  <jifl@eCosCentric.com>
+
+       * doc/posix.sgml: Expunge EL/IX. Dead standard.
+       * cdl/posix.cdl: Add doc link.
+
+2003-02-13  Jonathan Larmour  <jifl@eCosCentric.com>
+
+       * src/mutex.cxx: Include sched.hxx for scheduler lock/unlock primitives.
+       Reported by Jani Monoses.
+
+2003-02-10  Gary Thomas  <gary@mlbassoc.com>
+
+       * tests/signal3.c (main): Reorg code so it builds with older GCC.
+
+2003-01-31  Nick Garnett  <nickg@calivar.com>
+
+       * src/time.cxx (alarm_action): Added call to
+       cyg_posix_signal_sigwait() to wake up any sigwait()ing threads.
+
+       * src/signal.cxx (cyg_posix_signal_sigwait): Added this function
+       to export access to signal_sigwait conditional variable.
+       (sigtimedwait): Added call to cyg_posix_timer_asr() to allow timer
+       signals to be delivered here.
+
+       * src/pprivate.h: Added prototype for cyg_posix_signal_sigwait().
+
+       * cdl/posix.cdl:
+       * tests/signal3.c: Added this program to test interaction of
+       timers and signals, particularly sigwait(). Based on a test
+       program from N.Suresh <nsuresh@cdotb.ernet.in>.
+
+2003-01-20  Jonathan Larmour  <jifl@eCosCentric.com>
+
+       * src/signal.cxx (cyg_posix_deliver_signals): silence warning.
+
+       * src/time.cxx (cyg_timespec_to_ticks): Remove use of default arg in
+       definition.
+
+2003-01-18  Jonathan Larmour  <jifl@eCosCentric.com>
+
+       * src/mqueue.cxx: Fix multi-line string literal warning.
+
+2003-01-13  Jonathan Larmour  <jifl@eCosCentric.com>
+
+       * doc/posix.sgml: Document them.
+
+       * src/mqueue.cxx (mq_timedreceive): Make fully compliant by dealing
+       with bogus timeouts.
+       (mq_timedsend): Ditto.
+
+2003-01-13  Dmitriy Korovkin  <dkorovkin@rambler.ru>
+
+       * src/mqueue.cxx (mq_timedsend): New function. Implementing POSIX
+       1003.1d draft definition.
+       (mq_timedreceive): Ditto.
+
+2002-12-10  Wade Jensen  <waj4news@cox.net>
+2002-12-10  Jonathan Larmour  <jifl@eCosCentric.com>
+
+       * src/mutex.cxx (pthread_cond_timedwait): Initialize clock converters
+       only once ever.
+
+2002-11-26  Nick Garnett  <nickg@ecoscentric.com>
+
+       * src/signal.cxx: Changed the three routines added in the last
+       change so that they can be called safely from non-POSIX threads.
+
+2002-11-10  Nick Garnett  <nickg@ecoscentric.com>
+
+       * src/signal.cxx: Added three exportable routines that may be used
+       by other packages to manipulate the signal mask, test for
+       deliverable signals, and have signals delivered at controlled
+       points.
+
+       * include/export.h: Added macros to export signal mask management,
+       detection and delivery to other packages.
+
+2002-11-05  Jonathan Larmour  <jifl@eCosCentric.com>
+
+       * tests/tm_basic.cxx: Use <cyg/infra/diag.h> for diag_printf
+       prototype.
+
+2002-05-23  Jesper Skov  <jskov@redhat.com>
+
+       * cdl/posix.cdl: Don't build tests using signals when posix
+       signals are disabled.
+
+2002-05-21  Jesper Skov  <jskov@redhat.com>
+
+       * tests/mutex3.c: Added an NA check.
+
+2002-04-09  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/signal.cxx (cyg_deliver_signals): Don't assert here for an
+       unhandled signal (unless there's no _exit). Trace it though.
+
+2002-04-08  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/sem.cxx (sem_getvalue): return 0, and put value in *sval.
+
+2002-04-03  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * cdl/posix.cdl: Allow clocks to be configured again.
+
+2002-03-05  Jesper Skov  <jskov@redhat.com>
+
+       * src/pprivate.h: Correct conditional declaration of timespec
+       functions.
+
+       * src/sched.cxx (sched_rr_get_interval): Return ENOSYS when
+       CYGPKG_POSIX_CLOCKS disabled.
+
+2002-02-27  Robin Farine  <robin.farine@terminus.org>
+
+       * src/pthread.cxx (pthread_exit): While running thread static
+       storage destructors, set the thread's value associated with the
+       current key to NULL before invoking the destructor.
+
+2002-02-14  Nick Garnett  <nickg@redhat.com>
+
+       * doc/posix.sgml: Generally fixed up and reformatted to make this
+       file readable by mere humans. Some omissions and outdated
+       information fixed, but not substantially changed from the
+       original.
+
+       * cdl/posix.cdl: Changed some definitions and dependencies so that
+       disabling the timers does not disable threads too. This was
+       largely a consequence of trying to document the behaviour of these
+       options.
+       
+2002-02-14  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * doc/posix.sgml: New file, originally accompanied by this ChangeLog:
+       2001-12-22  Jonathan Larmour  <jlarmour@redhat.com>
+       
+               * ecos-elix.sgml: Do a minor cleanup of the function prototype
+               layouts.
+               Should be done better than this, but this is at least not
+               _completely_ wrong any more.
+               Also several more layout problems due to incorrect tags fixed.
+       
+       2001-12-07  Jonathan Larmour  <jlarmour@redhat.com>
+       
+               * ecos-elix.sgml: Add getcwd as supported now.
+       
+       2001-12-06  Jonathan Larmour  <jlarmour@redhat.com>
+       
+               * ecos-elix.sgml: Created from old framemaker version.
+       
+2002-01-21  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/sched.cxx (sched_get_priority_min): Don't allow idle thread
+       priority as a valid priority.
+       Case #106952.
+
+2001-12-11  Nick Garnett  <nickg@redhat.com>
+
+       * tests/mqueue2.c (cyg_user_start): Added CYG_TEST_INIT() to
+       NOTAPPLICABLE variant, otherwise the order of breakpoints are all
+       wrong and the testfarm registers a failure.
+
+2001-11-06  Gary Thomas  <gthomas@redhat.com>
+
+       * include/muttypes.h: Need <pkgconf/kernel.h> configuration info,
+       otherwise structures defined here could have the wrong size.
+
+2001-10-25  I-Jui Sung <ijsung@csie.nctu.edu.tw>
+
+       * src/mqueue.cxx (do_mq_unlink): Nullify table entries' mq as this
+       is used by mq_open to see if the entry is used.
+
+2001-10-11  Jesper Skov  <jskov@redhat.com>
+
+       * tests/mutex3.c: Fixed warning. 
+       (new_thread): Fixed allocation: increase counter
+       before starting threads which have been allocated resources.
+
+       * tests/signal2.c (cause_illegal_access): Fix warning.
+
+2001-10-10  Jesper Skov  <jskov@redhat.com>
+
+       * cdl/posix.cdl: Only build sem.cxx when the semaphores component
+       is enabled.
+
+2001-10-09  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/pprivate.h (pthread_info): Conditionalize signal specific
+       members. Conditionalize declaration of 
+       cyg_posix_pthread_release_thread().     
+
+       * cdl/posix.cdl (CYGPKG_POSIX_CLOCKS): new option to separately
+       configure posix clocks from timers.
+       (CYGPKG_POSIX_TIMERS): require clocks and signals.
+
+       * include/time.h: Make proper ISO C. Conditionalize on
+       CYGPKG_POSIX_TIMERS correctly wrt the above change.
+
+       * src/pthread.cxx (posix_asr): Call signal and timer subsystems
+       conditionally.
+
+       * src/pthread.cxx (pthread_reap): Don't destroy signal handling
+       fields if there is no signal handling subsystem.
+       (cyg_posix_pthread_release_thread): Conditionalize on signals.
+       (pthread_create): Init signal subsys conditionally.
+
+       * src/signal.cxx (sleep): Move to...
+
+       * src/time.cxx: ...here.
+       Conditionalize throughout depending on whether it's POSIX clocks
+       or more specifically POSIX timers.
+       (nanosleep): Use PTHREAD_TESTCANCEL() not pthread_testcancel().
+       Get current thread from kernel not pthreads to remove pthread
+       dependency.
+
+2001-10-09  Jesper Skov  <jskov@redhat.com>
+
+       * tests/signal2.c: Also do NA check for signals.
+
+2001-10-01  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/mqueue.cxx (mq_open): Conditionalize use of sigev correctly.
+       (mq_close): Similarly.
+
+2001-09-28  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * cdl/pthread.cdl (CYGNUM_POSIX_MAIN_DEFAULT_PRIORITY): Clarify
+       POSIX thread priority description.
+
+2001-09-28  Jesper Skov  <jskov@redhat.com>
+
+       * cdl/pthread.cdl: Changed default priority of POSIX main to
+       16. This allows service threads (such as DHCP thread) to run when
+       started from main().
+
+2001-09-10  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * include/pthread.h: Separate mutex and condvar API into separate
+       header file to fix configury problems.
+       * include/mutex.h: New file for the above.
+       * cdl/posix.cdl: provide the correct configury for the isoinfra
+       package to include the above file.
+       * cdl/pthread.cdl: Move _POSIX_PTHREAD_PRIO_INHERIT and
+       _POSIX_THREAD_PRIO_PROTECT to cdl/posix.cdl.
+       
+2001-09-07  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/sem.cxx (sem_trywait): Actually use the return value.
+
+       * src/sched.cxx (sched_get_priority_max): Use MAX not MIN
+       (sched_get_priority_min): Use MIN not MAX.
+
+2001-09-06  Jesper Skov  <jskov@redhat.com>
+
+       * cdl/posix.cdl: Moved signal implements statements to the
+       CYGPKG_POSIX_SIGNALS component.
+
+2001-08-06  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * cdl/posix.cdl: Reorganize dependencies so that signals, timers
+       and pthreads really can be disabled, and the relevant files don't
+       get built.
+       Build new mutex.cxx file.
+       Remove duplicate CYGPKG_POSIX_SCHED dependency for pthreads.
+
+       * include/limits.h: Don't include irrelevant header dependencies.
+
+       * include/muttypes.h: New type defining mutex/cond var types separately
+       from other pthread types.
+
+       * include/types.h: Remove mutex/cond var types.
+
+       * include/signal.h: Conditionalize on CYGPKG_POSIX_SIGNALS
+
+       * include/sigsetjmp.h: Don't include irrelevant header dependencies.
+       Rewrite sigsetjmp in a much more compiler friendly (and readable)
+       way with less type punning.
+
+       * src/misc.cxx: Don't include sysconf cases when pthreads or
+       CYGPKG_POSIX_TIMERS not enabled.
+
+       * src/mutex.cxx: New file, broken out of pthreads.cxx, as most
+       of it is not fixed to the pthreads implementation, and I've fixed
+       the bits that were too tied to it.
+
+       * src/pprivate.h: Conditionalize definitions that are specific
+       to CYGPKG_POSIX_PTHREAD. Ditto for prototypes for CYGPKG_POSIX_SIGNALS
+       and CYGPKG_POSIX_TIMERS. Move PTHREAD_ENTRY/RETURN etc. macros
+       here so they can be used throughout the package.
+
+       * src/pthread.cxx: Remove mutex/cond var implementation, and
+       entry/return macros, as per above.
+
+       * src/signal.cxx (cyg_sigqueue): Don't just set non-queueable signals 
+       pending - also forcibly wake up any blocked threads.
+       (siglongjmp): Use new layout of sigjmp_buf.
+
+       * tests/mutex3.c:
+       * tests/pthread1.c:
+       * tests/pthread2.c:
+       * tests/pthread3.c:
+       * tests/signal1.c:
+       * tests/sigsetjmp.c:
+       * tests/timer1.c:
+       * tests/tm_basic.cxx:
+       Correct configuration dependencies, and do NA appropriately.
+       
+2001-08-03  Nick Garnett  <nickg@cygnus.co.uk>
+
+       Imported from a development branch:
+       
+       2001-06-27  Nick Garnett  <nickg@cygnus.co.uk>
+
+               * tests/pthread3.c:
+               Modified the loop that waits for the threads to get going so that
+               it will function correctly in an SMP system, where the threads
+               will run in parallel.
+
+               * tests/mutex3.c: Disabled this test for SMP systems. It depends
+               too much on predicting the priority-driven execution order of the
+               threads. In an SMP system, some threads will run in parallel and
+               falsify the assumptions.
+
+       2001-05-25  Nick Garnett  <nickg@cygnus.co.uk>
+
+               * src/signal.cxx (siglongjmp): Minor change to satisfy latest C++
+               compiler.
+
+2001-06-14  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/pthread.cxx (pthread_attr_setstacksize): Correct stack
+       size assertion.
+
+2001-06-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/pthread.cxx (MAIN_DEFAULT_STACK_SIZE): Define to use at
+       least PTHREAD_STACK_MIN for main_stack.
+
+2001-05-01  Nick Garnett  <nickg@cygnus.co.uk>
+
+       [x86 branch]
+       * tests/signal2.c (cause_illegal_access): Added code for I386
+       architecture to provoke General Protection Fault. 
+
+       * src/except.cxx: Removed some extraneous diag_printf()s.
+
+2001-04-25  Bart Veer  <bartv@redhat.com>
+
+       * tests/tm_basic.cxx:
+       This test is now functional on the synthetic target.
+
+2001-04-20  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/time.cxx (cyg_ticks_to_timespec): Actually don't bother
+       with working out seconds using convertors. Instead just divide
+       down ns from a long long.
+
+2001-04-19  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/time.cxx (cyg_ticks_to_timespec): Clock convertors round off,
+       so adjust timespec accordingly.
+
+2001-02-14  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * include/pthread.h: Remove pthread_canceled() and
+       pthread_testcancel_unlock().
+       
+       * src/pthread.cxx: Ditto.
+       (pthread_join): Restructure to have function exit only at function end
+       (pthread_cond_timedwait): Check for timeouts and return ETIMEDOUT
+
+       * src/signal.cxx (sigtimedwait): Restructure cancellation testing
+
+       * src/time.cxx (nanosleep): test for cancellation at the end of the
+       function to keep Nick happy ;).
+
+2001-02-11  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * include/pthread.h: Add new pthread_testcancel_unlock and
+       pthread_canceled functions as eCos extensions.
+       Rename existing pthread_canceled variable to pthread_cancelled_dummy_var
+       
+       * src/pthread.cxx (pthread_canceled): New function to interrogate if
+       current thread has deferred cancel pending
+       (pthread_testcancel_unlock): New function. Like testcancel, but unlocks
+       a mutex before exitting the thread.
+       (checkforcancel): New internal function
+       (pthread_join): Add thread cancellation checks.
+       (pthread_cond_wait): Ditto.
+       (pthread_cond_timedwait): Ditto.
+       (pthread_testcancel): Use checkforcancel()
+       
+       * src/sem.cxx (sem_wait): Add thread cancellation checks
+       * src/signal.cxx (sigtimedwait): Ditto.
+       Also make compilation of this file conditional on CYGPKG_POSIX_SIGNALS
+       * src/time.cxx (nanosleep): Ditto.
+       Also make compilation of this file conditional on CYGPKG_POSIX_TIMERS
+
+       * cdl/posix.cdl (CYGPKG_POSIX_TIMERS): Implements POSIX timer ops.
+       Add explicit kernel and pthread dependencies.
+
+       * tests/sigsetjmp.c (pthread_entry1): Fix incorrect thread no. output
+
+       * tests/pthread3.c: Add deferred cancellation test.
+
+2001-01-11  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/pthread.cxx (pthread_testcancel): Added test for self !=
+       NULL in case this gets called from a non-pthread.
+
+2000-12-22  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/pthread.cxx (pthread_measure_stack_usage): New function
+       to measure stack usage.
+
+       * include/pthread.h: Prototype it.
+
+       * cdl/pthread.cdl: remove CYGNUM_POSIX_MAIN_DEFAULT_STACK_SIZE and
+       instead implement CYGINT_LIBC_STARTUP_EXTERNAL_INVOKE_MAIN_POSSIBLE
+
+       * src/pthread.cxx: Use stack size for main from libc_startup package
+       to prevent confusion
+       (cyg_posix_pthread_start): Likewise
+
+2000-12-06  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/signal.cxx: include unistd.h for _exit
+
+2000-11-20  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/signal.cxx (cyg_deliver_signals): Added else in code to
+       handle SIG_DFL. Otherwise if the SA_SIGINFO bit is set we call the
+       signal handler twice!
+
+2000-11-07  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/signal.cxx (cyg_posix_thread_siginit): Add extra thread
+       argument so that threads can inherit parent's sigmask.
+
+       * src/pthread.cxx (pthread_create): Call with parent thread
+
+       * src/pprivate.h: Change cyg_posix_thread_siginit prototype to take
+       parent thread argument
+
+       * tests/signal1.c: Add more checking of sigwaits, and fix so that it's
+       only called when the signal is masked. Check errno values too
+       sometimes.
+
+2000-11-02  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/signal.cxx (sigtimedwait): return signal number on success,
+       not 0
+       (SIGNAL_RETURN_VALUE): New macro for returning from functions with
+       valid non-zero returns
+       (sigwaitinfo): Pass on sigtimedwait result with SIGNAL_RETURN_VALUE
+       macro as it may return the signal number.
+
+2000-11-01  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * src/signal.cxx (sigtimedwait): Check for SIGALRMs as a special
+       case when looping as it won't have been set pending if it was
+       masked.
+       (check_sigalarm): New function extracted from the posix signal ASR
+       (sigalrm_action): Unconditionally wake up threads waiting in sigwait
+       so that they can check for pending SIGALRMs even if they were
+       masked.
+       (cyg_deliver_signals): Handle SIG_DFL signals properly, and check
+       for bad signal handlers.
+       (cyg_posix_signal_start): Initialize default signal actions to SIG_DFL
+
+2000-10-27  Jesper Skov  <jskov@redhat.com>
+
+       * tests/signal2.c (cause_illegal_access): Don't loop forever.
+
+2000-10-16  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * include/sigsetjmp.h (sigsetjmp): Various fixes to make portable
+       across all HALs (by avoiding CYGARC_JMP_BUF_SIZE) and remove warnings.
+       * src/signal.cxx (siglongjmp): Likewise
+
+2000-10-12  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * include/sigsetjmp.h: Added this header to define
+       sigjmp_buf,sigsetjmp() and siglongjmp().
+
+       * cdl/posix.cdl:
+       Added support for providing sigsetjmp implementation and header.
+       Added sigsetjmp test.
+
+       * src/signal.cxx: Added siglongjmp().
+
+       * tests/sigsetjmp.c: Added this test for sigsetjmp(), siglongjmp()
+       functionality. This is also a test for longjmping out of signal
+       handlers.
+
+       * tests/signal2.c:
+       Ifdeffed around cause_* functions to avoid compiler warnings when
+       they are not needed.
+       Changed CYG_TEST_NA() calls to CYG_TEST_INFO() and changed
+       CYG_TEST_FINISH() to CYG_TEST_PASS_FINISH(). With the _NA's there,
+       the first unsupported exception just terminates the program, and
+       does not give any subsequent supported ones a chance to run.
+
+2000-10-12  Jesper Skov  <jskov@redhat.com>
+
+       * tests/timer1.c (main): Fix exit check.
+
+2000-10-11  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/pthread.cxx: Fixed cyg_posix_pthread_release_thread() to
+       work for _DETACHED threads as well as for _RUNNING ones. Also
+       fixed a bug in test to decrement counter in this routine.
+
+       * src/pprivate.h: Added note about retaining numerical order of
+       PTHREAD_STATE_* defines.
+
+       * tests/timer1.c: Fixed some bugs of the how-did-it-ever-work
+       variety.
+
+2000-10-05  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/misc.cxx:
+       Added a set of compatibility functions to aid portability and
+       improve standards compliance.
+       Added cyg_posix_function_[start|finish] to set up and terminate
+       POSIX API functionality wrt signal and cancellation behaviour.
+       (Lots more to do here).
+
+       * include/export.h:
+       Added this file to contain definitions that can be exported from
+       the POSIX package to others.
+
+       * src/pprivate.h: Added include of export.h
+       
+2000-09-11  Jonathan Larmour  <jlarmour@redhat.com>
+
+       * include/limits.h (OPEN_MAX): Don't define here - let FS infra do
+       that.
+       (LINK_MAX): Ditto
+       (NAME_MAX): Ditto
+       (PATH_MAX): Ditto
+
+2000-09-04  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * tests/pthread2.c: 
+       * tests/pthread3.c:
+       Fixed bug in calculation of thread stack addresses.
+
+       * src/misc.cxx (sysconf): Change zero returns to -1 when a feature
+       is not supported.
+
+2000-08-08  Jonathan Larmour  <jlarmour@redhat.co.uk>
+
+       * include/limits.h: Don't define SSIZE_MAX here, leave it to the
+       isoinfra default.
+
+2000-07-27  Jonathan Larmour  <jlarmour@redhat.co.uk>
+
+       * tests/signal2.c: NA if no setjmp/longjmp
+
+2000-07-26  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * include/pthread.h:
+       * src/pthread.cxx (pthread_testcancel): Reversed addition of cyg_
+       to this symbol.
+
+2000-07-25  Jonathan Larmour  <jlarmour@redhat.co.uk>
+
+       * src/pthread.cxx: Define main_stack and main_thread as static
+       Rename pthread_canceled -> cyg_pthread_canceled - pthread_ may be
+       a reserved name space but this makes explicit it is implementation-
+       and not standard-defined
+       (PTHREAD_ENTRY_VOID): Define for funcs that take no args
+       (pthread_testcancel): Call PTHREAD_ENTRY_VOID()
+
+       * include/pthread.h: Rename pthread_canceled -> cyg_pthread_canceled
+
+2000-07-20  Jonathan Larmour  <jlarmour@redhat.co.uk>
+
+       * src/pthread.cxx: Use isoinfra to determine presence of malloc()
+       Define pthread_malloc() and pthread_free() as inlines
+
+       * cdl/posix.cdl: Shouldn't define _POSIX_MESSAGE_PASSING at all - that
+       happens in isoinfra.
+
+2000-07-20  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * cdl/posix.cdl: Added misc.cxx to compile list. Added option to
+       define _POSIX_MESSAGE_PASSING. Added configury for utsname
+       structure.
+
+       * include/utsname.h: Added this file to define struct utsname and
+       uname() function prototype.
+
+       * include/mqueue.h: Moved definition of _POSIX_MESSAGE_PASSING to
+       CDL.
+
+       * include/limits.h: Added NGROUPS_MAX definition.
+
+       * src/pthread.cxx:
+       Added support for malloced() thread stacks.
+       Added implementations of pthread_mutex_setprioceiling() and
+       pthread_mutex_getprioceiling().
+       Changed implementations of pthread_mutex_destroy(),
+       pthread_mutex_lock() and pthread_mutex_trylock() to conform more
+       closely to the standard.
+       Changed pthread_key_create() to assign NULL to all valid thread
+       slots that correspond to a newly allocated key.
+
+       * src/pprivate.h: Added freestack and stackmem members to manage
+       malloced thread stacks.
+
+       * src/misc.cxx: Added this file to contain functions that do not
+       belong in any other files. Currently contains uname() and
+       sysconf().
+
+2000-07-19  Jonathan Larmour  <jlarmour@redhat.co.uk>
+
+       * src/startup.cxx: Remove unnecessary includes
+       Use dummy object constructor to do initialization
+
+       * cdl/posix.cdl: 
+       Don't need main.cxx any more
+       Build startup.cxx into extras.o (via libextras.a)
+
+       * cdl/pthread.cdl (CYGPKG_POSIX_MAIN_THREAD):
+       Integrate with CYGPKG_LIBC_STARTUP - tell CYGPKG_LIBC_STARTUP to
+       let pthreads set up main thread
+
+       * src/pthread.cxx: Integrate with CYGPKG_LIBC_STARTUP rather than
+       calling main() directly.
+       Track number of threads waiting to be joined, so we can tell in
+       pthread_exit() if this is the last thread, and therefore whether
+       to call exit()
+
+       * src/main.cxx: obsolete, removed
+
+2000-07-13  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/signal.cxx: Added ISO C compatibility functions signal() and
+       raise().
+
+2000-06-21  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/pthread.cxx: Added for(;;) loop to end of pthread_exit().
+       pthread_exit() is marked with the noreturn attribute, and without
+       this some compilers generate a call to abort() here in case
+       Cyg_Thread::exit() returns. The loop avoids this.
+
+2000-06-06  Jonathan Larmour  <jlarmour@redhat.co.uk>
+
+       * src/mqueue.cxx (mq_receive): Fix non-portable treatment of mode flags
+       (mq_send):  Ditto
+       * tests/mqueue2.c (main): Ditto
+
+2000-05-24  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * tests/pthread2.c: Added this program to test per-thread data
+       handling.
+
+       * tests/pthread3.c: Added this program to test execution of
+       cancellation handler.
+
+       * src/pthread.cxx: Fixed some bugs revealed by new test programs.
+
+       * cdl/posix.cdl: Added two new pthread tests.
+
+2000-05-22  Jonathan Larmour  <jlarmour@redhat.co.uk>
+
+       * cdl/posix.cdl (CYGPKG_POSIX): Require
+       CYGIMP_KERNEL_SCHED_SORTED_QUEUES
+
+2000-05-20  Jonathan Larmour  <jlarmour@redhat.co.uk>
+
+       * tests/mqueue1.c (cyg_user_start): Define correctly
+       * tests/mqueue2.c (cyg_user_start): Likewise
+
+       * src/pprivate.h (cyg_sigqueue): Make struct sigevent * arg const since
+       it is, and it prevents warnings elsewhere
+       * src/signal.cxx (cyg_sigqueue): ditto
+
+       * tests/signal2.c: Use CYG_TEST_NA, not CYG_TEST_INFO (otherwise
+       the test farm may fail the tests because there are no PASSes or NAs)
+
+       * cdl/posix.cdl (CYGPKG_POSIX): We need errno and error codes, so
+       require them
+       Move some of the package implements into the components
+       Add message queue configuration, build mqueue.cxx and the mqueue1 and
+       mqueue2 tests
+       Move some calculated options into isoinfra, implemented as interfaces
+       so that unistd.h and limits.h can get the values
+
+       * include/limits.h: Move _POSIX_* macros into isoinfra limits.h
+       since they are implementation independent
+
+       * src/mqueue.cxx: Add POSIX message queue implementation
+       * tests/mqueue1.c, tests/mqueue2.c: and tests
+
+2000-05-18  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/pprivate.h:
+       * src/pthread.cxx:
+       * src/signal.cxx:
+       * src/time.cxx:
+       Added prioritization of static kernel objects.
+
+2000-05-17  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/pthread.cxx:
+       To reduce the static memory required by this code, the
+       pthread_info structure for a pthread is now allocated in the stack
+       memory for that thread, and not in a static table. The table is
+       now just an array of pointers. The per-thread data array is now
+       also allocated onto the stack only when first required.
+
+       * include/pthread.h: Removed some redundant code.
+
+       * include/limits.h: Added PTHREAD_STACK_OVERHEAD to record
+       management overhead imposed on POSIX threads stacks. This is added
+       to the HAL minimum requirement to generate PTHREAD_STACK_MIN.
+
+       * src/pprivate.h (pthread_info):
+       * include/types.h (pthread_attr_t): Converted a number of integer
+       state and boolean fields to bitfields.
+
+       * cdl/pthread.cdl:
+       Added requirement for CYGFUN_KERNEL_THREADS_STACK_LIMIT.
+
+2000-05-16  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * include/types.h: Added stacksize_valid to pthread_attr_t
+       structure.
+
+       * include/signal.h:
+       Added SI_EXCEPT to mark any signals that were caused by an
+       exception. Removed conditions around SIGBUS.
+
+       * src/startup.cxx (cyg_posix_start):
+       Added call to cyg_posix_exception_start(). 
+
+       * src/signal.cxx:
+       Rearranged cyg_deliver_signals() so that it is possible to
+       longjmp() out of a signal handler without leaving signal handling
+       code in an inconsistent state.
+       Added handling of SIG_IGN in sigaction().
+
+       * src/pthread.cxx: Added setting and checking of stacksize_valid.
+
+       * src/pprivate.h: Added cyg_deliver_signals() as an export of
+       signal system. Added exports from except.cxx.
+
+       * src/except.cxx: Added this file to handle delivery of exceptions
+       into the POSIX signal mechanism.
+
+       * cdl/posix.cdl: Added except.cxx to compile list, added signal2
+       to tests. Added requirement on kernel exception processing.
+
+       * tests/tm_basic.cxx: Tidied up a compilation warning.
+
+       * tests/signal2.c: Added this test for exception signal generation.
+
+       * tests/mutex3.c: Fixed stupid bug.
+       
+2000-05-10  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/pprivate.h: Added cyg_posix_clock_start() prototype.
+
+       * src/startup.cxx: Added call to cyg_posix_clock_start().
+
+       * src/time.cxx: Added startup routine to initialize
+       converters. Fixed error result bug in timer_delete().
+
+       * include/signal.h: Removed some configuration tests which are now
+       done in CDL.
+
+       * cdl/posix.cdl: Added configury for the signals component. Added
+       tm_basic to tests.
+
+       * tests/tm_basic.cxx:
+       Added this POSIXized version of the tm_basic test. Note that this
+       has not been entirely converted. While the code being tested is
+       POSIX, the timing infrastructure remains a mish-mash of kernel,
+       KAPI and HAL code.
+
+2000-05-04  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/time.cxx:
+       Many changes to implement the delivery of signals on timer expiry.
+       Also added timer_delete().
+
+       * src/signal.cxx:
+       cyg_sigqueue() and cyg_deliver_signals() may now only be called
+       from within the context of a POSIX thread, either from an API call
+       or an ASR.
+       cyg_deliver_signals() can now cope with a signal that has
+       SA_SIGINFO set but no signals queued. It also determines
+       dynamically whether to lock the signal_mutex.
+       cyg_deliver_signals() is no longer called implicitly from
+       cyg_sigqueue() - so a number of expicit calls have been added.
+       
+       * src/sched.cxx:
+       Added this file to implement scheduling API.
+
+       * src/pthread.cxx:
+       Moved priority translation macros to pprivate.h.
+       Removed errno handling, now done in isoinfra package.
+       Added iterative calls to per-thread data destructors.
+
+       * src/pprivate.h:
+       Removed error field from pthread_info structure.
+       Moved priority translation macros here.
+       Removed prototype for cyg_deliver_signals().
+       Added prototype for cyg_posix_timer_asr().
+
+       * include/time.h: Added timer_delete() which was mysteriously
+       omitted.
+
+       * cdl/posix.cdl: Added sched.cxx to compile list and timer1.c to
+       tests.
+
+       * tests/signal1.c: 
+       * tests/pthread1.c:
+       Fixed bug in use of stack sizes.
+
+       * tests/timer1.c: 
+       Added test for use of timers.
+               
+2000-05-02  Jonathan Larmour  <jlarmour@redhat.co.uk>
+
+       * include/sched.h: No longer needed - just use the default definition
+       in isoinfra
+
+       * include/errno.h: No longer needed - errno provision now comes from
+       CYGPKG_ERROR
+       
+       * include/sys/types.h: Moved to include/types.h
+       
+       * cdl/posix.cdl, cdl/pthread.cdl: Put include files in cyg/posix, and
+       configure CYGPKG_ISOINFRA to include the appropriate headers
+       
+       * include/semaphore.h: Don't need to check kernel - including
+       pkgconf/kernel.h would already fail
+       Give SEM_FAILED a type so casting behaves in C++
+       
+       * include/signal.h: This uses pid_t etc., so include <sys/types.h>
+       Add signal() and raise() prototypes (to allow libc compilation, even
+       though they aren't implemented yet)
+       
+       * include/time.h: Remove unnecessary includes. Move clockid_t and
+       timer_t definitions here from sys/types.h since this is where the
+       standard says they must live. 
+       
+       * src/pprivate.h: Include signal.h and limits.h since their contents
+       are used later in the file.     
+
+2000-04-28  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/signal.cxx:
+       Added implementations of alarm(), pause() and sleep().
+       Modified cyg_sigqueue() so that it could be called from an ASR.
+       Added cyg_posix_signal_asr() to do signal processing in ASRs.
+       Miscellaneous bug fixes.
+
+       * src/pthread.cxx:
+       Added pthread_count to count number of threads created.
+       Added call to signal ASR function in main ASR.
+       Added cyg_posix_pthread_release_thread() to seek out and kick a
+       thread to which a given set of signals may be delivered.
+
+       * src/pprivate.h:
+       Added some more functions that are shared between POSIX
+       subsystems.
+
+       * include/signal.h:
+       Added alarm(), pause() and sleep() prototypes. 
+
+       * tests/signal1.c: Added this test for various aspects of signal
+       handling.
+
+       * cdl/posix.cdl: Added signal1 test.
+
+2000-04-20  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/signal.cxx: Added this file to contain signal handling code.
+
+       * src/time.cxx: Made tick<->timespec converters exported to
+       rest of POSIX subsystem. Enabled interface to signal mechanism for
+       notifying timer expiration.
+
+       * src/pthread.cxx:
+       Made pthread_mutex exported to rest of POSIX subsystem.
+       Exported pthread_info_id().
+       Added thread init and destroy functions for signal subsystem.
+
+       * src/startup.cxx: Added call to cyg_posix_signal_start().
+
+       * src/pprivate.h: Added signal handling fields support to
+       pthread_info structure. Added extra internal interfaces to support
+       signal handling code.
+
+       * include/signal.h: Added _how_ argument values for the sigmask
+       functions.
+
+       * cdl/posix.cdl: Added signal.cxx to compile list.
+
+2000-04-13  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * include/time.h: 
+       * src/time.cxx:
+       Added implementation of clock and timer functions. These are
+       currently untested since they need working signals.
+
+2000-04-12  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/pprivate.h: Added cancellation support fields to
+       pthread_info structure. Made pthread_self_info() exported.
+
+       * include/semaphore.h: Added SEM_FAILED plus misc. tidies.
+
+       * include/pthread.h: Added PTHREAD_CANCELED.
+
+       * include/errno.h: Fixed cyg_pthread_errno_p() return type.
+
+       * src/pthread.cxx:
+       Added pthread_reap() to clean up exited threads.
+       Added support for cancellation.
+       Added cyg_posix_errno_p().
+
+       * src/time.cxx:
+       Added this file to implement time functionality. At present only
+       nanosleep() is actually implemented.
+
+       * src/sem.cxx:
+       Added this file to implement semaphore functionality.
+
+       * cdl/pthread.cdl:
+       Added some extra configuration requirements.
+
+       * cdl/posix.cdl:
+       Added some more files to compile.
+       Added semaphore configuration.
+
+       * tests/mutex3.c:
+       Added this test program. This is actually a POSIXized version of
+       Hugo's splendid kernel test of the same name. It exercises quite a
+       lot of the pthread infrastructure and is thus a good test to run.
+
+       * tests/pthread1.c:
+       Added proper comment headers and added full testing stuff.
+       
+2000-04-10  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/pprivate.h: 
+       * src/pthread.cxx:
+       Added per-thread data support.
+
+2000-04-06  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * src/pthread.cxx:
+       Filled in implementations of lots of functions.
+
+       * src/main.cxx:
+       Added this file to contain a default main. This is currenly just a
+       duplicate of the same file from the C library. Work is needed to
+       combine these.
+
+       * include/sys/types.h:
+       Modified pthread_mutex_t to conform to kernel structure.
+
+       * cdl/pthread.cdl:
+       Added support for main thread.
+
+       * cdl/posix.cdl:
+       Added main.cxx to compile list.
+
+2000-03-31  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * cdl/pthread.cdl: 
+       * cdl/posix.cdl:
+       Added CDL files to configure POSIX subsystem.
+
+       * src/pprivate.h: 
+       * src/pthread.cxx: 
+       * src/startup.cxx: 
+       Added these files to begin implementation of POSIX package.
+       
+       * include/pthread.h: 
+       * include/sched.h: 
+       * include/signal.h: 
+       * include/time.h: 
+       * include/sys/types.h: 
+       Many changes needed by implementation work.
+       
+       * include/limits.h: 
+       * include/errno.h: 
+       Added these header files.
+       
+2000-03-24  Nick Garnett  <nickg@cygnus.co.uk>
+
+       * include/sys/types.h: 
+       * include/time.h: 
+       * include/sched.h: 
+       * include/pthread.h: 
+       * include/signal.h:
+       * include/semaphore.h: 
+       * include/mqueue.h: 
+       Roughed out (most of) the set of POSIX headers for the
+       functionality we are currently going to support. These files are
+       currently neither fully standard conformant nor implementation
+       ready. Much work is still needed to make them so. Watch this
+       space.
+
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos 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 GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
diff --git a/packages/compat/posix/v2_0/cdl/posix.cdl b/packages/compat/posix/v2_0/cdl/posix.cdl
new file mode 100644 (file)
index 0000000..86b3aa2
--- /dev/null
@@ -0,0 +1,317 @@
+# ====================================================================
+#
+#      posix.cdl
+#
+#      POSIX layer configuration data
+#
+# ====================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos 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 GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):      nickg
+# Contributors:
+# Date:           2000-3-28
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_POSIX {
+    display        "POSIX compatibility layer"
+    description    "This package enables the POSIX compatibility
+                    layer that implements IEEE 1003.1."
+    doc            ref/posix-compatibility.html
+    include_dir    cyg/posix
+    
+    requires       CYGPKG_KERNEL
+    requires       CYGPKG_ISOINFRA
+    requires       CYGPKG_ERROR
+    requires       CYGINT_ISO_ERRNO
+    requires       CYGINT_ISO_ERRNO_CODES
+    requires       CYGIMP_KERNEL_SCHED_SORTED_QUEUES
+
+    implements     CYGINT_ISO_SCHED_IMPL
+    implements     CYGINT_ISO_POSIX_LIMITS
+    implements     CYGINT_ISO_PMUTEXTYPES
+    implements     CYGINT_ISO_PTHREAD_MUTEX
+    requires       { CYGBLD_ISO_POSIX_LIMITS_HEADER == \
+                         "<cyg/posix/limits.h>" }
+    requires       { CYGBLD_ISO_PMUTEXTYPES_HEADER == \
+                         "<cyg/posix/muttypes.h>" }
+    requires       { CYGBLD_ISO_PTHREAD_MUTEX_HEADER == \
+                         "<cyg/posix/mutex.h>" }
+    
+    compile        mqueue.cxx mutex.cxx misc.cxx
+    compile       -library=libextras.a startup.cxx
+
+    cdl_option _POSIX_THREAD_PRIO_INHERIT {
+        display                "POSIX mutex priority inheritance feature test macro"
+        flavor         bool
+        default_value  1
+        requires       CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_INHERIT
+        description    "This option defines the POSIX feature test macro
+                         for supporting priority inheritance protocol in
+                         mutexes."
+    }
+    
+    cdl_option _POSIX_THREAD_PRIO_PROTECT {
+        display                "POSIX mutex priority ceiling feature test macro"
+        flavor         bool
+        default_value  1
+        requires       CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
+        description    "This option defines the POSIX feature test macro
+                         for supporting priority ceiling protocol in mutexes."
+    }
+    
+    # ----------------------------------------------------------------
+    # Scheduling component
+    
+    cdl_component CYGPKG_POSIX_SCHED {
+       display          "POSIX scheduling configuration"
+       flavor           bool
+       default_value    1
+       description      "This component provides controls over scheduling
+                         in POSIX."
+        requires         CYGPKG_POSIX_CLOCKS
+        compile          sched.cxx
+
+       cdl_option _POSIX_PRIORITY_SCHEDULING {
+           display       "POSIX priority scheduling feature test macro"
+           flavor        bool
+           calculated    1
+           requires      CYGSEM_KERNEL_SCHED_MLQUEUE
+           description   "This option defines the POSIX feature test macro
+                          that indicates that priority scheduling is present.
+                          This should not be undefined."
+       }
+    }
+
+    # ----------------------------------------------------------------
+    # Pthreads component
+
+    cdl_component CYGPKG_POSIX_PTHREAD {
+       display          "POSIX pthread configuration"
+       flavor           bool
+       default_value    1
+       description      "This component provides configuration controls for
+                         the POSIX pthreads package."
+        compile          pthread.cxx
+       script           pthread.cdl
+    }
+
+    # ----------------------------------------------------------------
+    # Timers component
+
+    cdl_option CYGPKG_POSIX_CLOCKS {
+       display          "POSIX clocks"
+       flavor           bool
+        default_value    1
+        implements       CYGINT_ISO_POSIX_CLOCK_TYPES
+        implements       CYGINT_ISO_POSIX_CLOCKS
+        implements       CYGINT_ISO_POSIX_SLEEP
+        requires         { CYGBLD_ISO_POSIX_CLOCK_TYPES_HEADER == \
+                             "<cyg/posix/time.h>" }
+        requires         { CYGBLD_ISO_POSIX_CLOCKS_HEADER == \
+                             "<cyg/posix/time.h>" }
+        requires         CYGPKG_KERNEL
+        requires         CYGVAR_KERNEL_COUNTERS_CLOCK
+        compile          time.cxx
+       description      "This component provides configuration controls for
+                         the POSIX clocks."
+    }
+
+    # ----------------------------------------------------------------
+    # Timers component
+
+    cdl_option CYGPKG_POSIX_TIMERS {
+       display          "POSIX timers"
+       flavor           bool
+       default_value    1
+        implements       CYGINT_ISO_POSIX_TIMER_TYPES
+        implements       CYGINT_ISO_POSIX_TIMERS
+        implements       CYGINT_ISO_POSIX_TIMER_OPS
+        requires         { CYGBLD_ISO_POSIX_TIMER_TYPES_HEADER == \
+                             "<cyg/posix/time.h>" }
+        requires         { CYGBLD_ISO_POSIX_TIMERS_HEADER == \
+                             "<cyg/posix/time.h>" }
+        requires         CYGPKG_KERNEL
+        requires         CYGVAR_KERNEL_COUNTERS_CLOCK
+        requires         CYGPKG_POSIX_PTHREAD
+        requires         CYGPKG_POSIX_CLOCKS
+        requires         CYGPKG_POSIX_SIGNALS
+       description      "This component provides configuration controls for
+                         the POSIX timers."
+    }
+
+    # ----------------------------------------------------------------
+    # Semaphores component
+
+    cdl_option CYGPKG_POSIX_SEMAPHORES {
+       display          "POSIX semaphores"
+       flavor           bool
+       default_value    1
+        implements       CYGINT_ISO_SEMAPHORES
+        requires         { CYGBLD_ISO_SEMAPHORES_HEADER == \
+                             "<cyg/posix/semaphore.h>" }
+       description      "This component provides configuration controls for
+                         POSIX semaphores."
+
+        compile          sem.cxx
+    }
+
+    # ----------------------------------------------------------------
+    # Message queues component
+
+    cdl_component CYGPKG_POSIX_MQUEUES {
+       display          "POSIX message queues"
+       flavor           bool
+       default_value    1
+        implements       CYGINT_ISO_MQUEUE
+        requires         CYGPKG_KERNEL
+        requires         CYGINT_ISO_MALLOC
+        requires         CYGINT_ISO_ERRNO
+        requires         CYGINT_ISO_STRING_STRFUNCS
+       description      "This component provides configuration controls for
+                         POSIX message queues."
+
+        cdl_option CYGNUM_POSIX_MQUEUE_OPEN_MAX {
+            display          "Maximum number of message queues"
+            flavor           data
+            default_value    8
+            legal_values     1 to 999999
+        }
+
+        cdl_option CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR {
+            display          "Validate queue descriptors"
+            flavor           bool
+            default_value    1
+            description      "
+                This option turns on checking that message queue descriptors
+                (of type mqd_t) passed into mq_* functions are valid. If so,
+                the functions will fail with EBADF, as POSIX 1003.1 mandates.
+                If this option is disabled, if an invalid descriptor is used,
+                random corruption may occur, or the system may crash. If
+                you are confident invalid descriptors will not be used,
+                you may wish to be disable this to save some per-instance
+                memory and execution time."
+        }
+
+        cdl_option CYGFUN_POSIX_MQUEUE_NOTIFY {
+            display          "Allow empty queue notification"
+            flavor           bool
+            requires         CYGPKG_POSIX_SIGNALS
+            default_value    CYGPKG_POSIX_SIGNALS
+            description      "
+                Enabling this option adds the function mq_notify() to the
+                API. Without it, some code and per-message queue descriptor
+                space is saved, as well as no longer requiring POSIX realtime
+                signal support."
+        }
+    }
+
+    # ----------------------------------------------------------------
+    # Signals component
+
+    cdl_component CYGPKG_POSIX_SIGNALS {
+       display          "POSIX signals configuration"
+       flavor           bool
+       default_value    1
+       requires         CYGPKG_KERNEL_EXCEPTIONS
+        requires         CYGPKG_POSIX_PTHREAD
+        requires         CYGPKG_POSIX_TIMERS
+        implements       CYGINT_POSIX_REALTIME_SIGNALS
+        implements       CYGINT_ISO_SIGSETJMP
+        requires         { CYGBLD_ISO_SIGSETJMP_HEADER == \
+                             "<cyg/posix/sigsetjmp.h>" }
+        implements       CYGINT_ISO_SIGNAL_NUMBERS
+        implements       CYGINT_ISO_SIGNAL_IMPL
+        requires         { CYGBLD_ISO_SIGNAL_NUMBERS_HEADER == \
+                             "<cyg/posix/signal.h>" }
+        requires         { CYGBLD_ISO_SIGNAL_IMPL_HEADER == \
+                             "<cyg/posix/signal.h>" }
+       description      "This component provides configuration controls for
+                         the POSIX signals."
+        compile          signal.cxx except.cxx 
+    }
+
+    # ----------------------------------------------------------------
+    # uname structure component
+
+    cdl_component CYGPKG_POSIX_UTSNAME {
+       display           "POSIX utsname configuration"
+       flavor            bool
+       default_value     1
+       requires          { CYGBLD_ISO_UTSNAME_HEADER == \
+                            "<cyg/posix/utsname.h>" }
+       description       "This component provides configuration controls for
+                          the POSIX utsname structure and the uname() function."
+
+       cdl_option CYG_POSIX_UTSNAME_LENGTH {
+           display          "Length of name strings in utsname structure"
+           flavor           data
+           default_value    65
+           legal_values     1 to 99999999
+       }
+
+       cdl_option CYG_POSIX_UTSNAME_NODENAME_LENGTH {
+           display          "Length of nodename string in utsname structure"
+           flavor           data
+           default_value    { CYG_POSIX_UTSNAME_LENGTH }
+           legal_values     1 to 99999999          
+       }
+
+    }
+
+    # ----------------------------------------------------------------
+    # Tests
+
+        cdl_option CYGPKG_POSIX_TESTS {
+            display "POSIX tests"
+            flavor  data
+            no_define
+            calculated { 
+                "tests/pthread1 tests/pthread2 tests/pthread3 tests/mutex3 tests/mqueue2"
+                . ((CYGPKG_POSIX_SIGNALS) ? " tests/mqueue1 tests/signal1 tests/signal2 tests/signal3 tests/sigsetjmp tests/timer1 tests/tm_basic" : "")
+            }
+            description   "
+                This option specifies the set of tests for the POSIX package."
+        }
+
+}
+
+# ====================================================================
+# End of posix.cdl
+
+
diff --git a/packages/compat/posix/v2_0/cdl/pthread.cdl b/packages/compat/posix/v2_0/cdl/pthread.cdl
new file mode 100644 (file)
index 0000000..d170356
--- /dev/null
@@ -0,0 +1,197 @@
+# ====================================================================
+#
+#      pthread.cdl
+#
+#      POSIX pthread configuration data
+#
+# ====================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos 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 GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):      nickg
+# Contributors:   jlarmour
+# Date:           2000-3-28
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_option CYGPKG_POSIX_PTHREAD_REQUIREMENTS {
+       display         "Generic requirements of pthread package"
+       flavor          bool
+       calculated      1
+        implements      CYGINT_ISO_PTHREADTYPES
+        implements      CYGINT_ISO_PTHREAD_IMPL
+       requires        CYGPKG_POSIX_SCHED
+       requires        CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE
+       requires        CYGSEM_KERNEL_SCHED_ASR_SUPPORT
+       requires        CYGSEM_KERNEL_SCHED_ASR_GLOBAL
+       requires        !CYGSEM_KERNEL_SCHED_ASR_DATA_GLOBAL
+       requires        CYGFUN_KERNEL_THREADS_STACK_LIMIT
+        requires        { CYGBLD_ISO_PTHREADTYPES_HEADER == \
+                          "<cyg/posix/types.h>" }
+        requires        { CYGBLD_ISO_PTHREAD_IMPL_HEADER == \
+                          "<cyg/posix/pthread.h>" }
+       description     "This option exists merely to carry the pthread
+                         package requirements."
+
+}
+
+# ====================================================================
+
+cdl_component CYGPKG_POSIX_PTHREAD_VALUES {
+    display          "Constant values used in pthread package"
+    flavor           bool
+    calculated              1
+    description      "These are values that are either configurable, or derived
+                     from system parameters."
+
+    cdl_option CYGNUM_POSIX_PTHREAD_DESTRUCTOR_ITERATIONS {
+       display          "Maximum number of iterations of key destructors"
+       flavor           data
+       legal_values     4 to 100
+       default_value    4
+       description      "Maximum number of iterations of key destructors allowed."
+    }
+
+    cdl_option CYGNUM_POSIX_PTHREAD_KEYS_MAX {
+       display          "Maximum number of per-thread data keys allowed"
+       flavor           data
+       legal_values     128 to 65535
+       default_value    128
+       description      "Number of per-thread data keys supported."
+    }
+
+        cdl_option CYGNUM_POSIX_PTHREAD_THREADS_MAX {
+       display          "Maximum number of threads allowed"
+       flavor           data
+       legal_values     64 to 1024
+       default_value    64
+       description      "Maximum number of threads supported."
+    }
+
+}
+
+# ====================================================================
+
+cdl_component CYGPKG_POSIX_PTHREAD_FEATURES {
+       display         "Fixed Feature test macros for POSIX"
+       flavor          bool
+       calculated      1
+       description     "These options define POSIX feature test macros that
+                        describe the eCos implementation of pthreads. These
+                        are not changeable configuration options."
+
+    cdl_option _POSIX_THREADS {
+       display         "POSIX thread support feature test macro"
+       flavor          bool
+       calculated      1
+       requires        CYGSEM_KERNEL_SCHED_TIMESLICE
+       requires        CYGVAR_KERNEL_THREADS_DATA
+       description     "This option defines the POSIX feature test macro
+                       for thread support."
+    }
+
+    cdl_option _POSIX_THREAD_PRIORITY_SCHEDULING {
+       display         "POSIX thread priority scheduling feature test macro"
+       flavor          bool
+       calculated      1
+       requires        CYGSEM_KERNEL_SCHED_MLQUEUE
+        requires      _POSIX_THREADS
+       description     "This option defines the POSIX feature test macro
+                       for thread priority scheduling support."
+    }
+
+    cdl_option _POSIX_THREAD_ATTR_STACKADDR {
+       display         "POSIX stack address attribute feature test macro"
+       flavor          bool
+       calculated      1
+       description     "This option defines the POSIX feature test macro
+                       for supporting the thread stack address in the thread
+                       attribute object."
+    }
+
+    cdl_option _POSIX_THREAD_ATTR_STACKSIZE {
+       display         "POSIX stack size attribute feature test macro"
+       flavor          bool
+       calculated      1
+       description     "This option defines the POSIX feature test macro
+                       for supporting the thread stack size in the thread
+                       attribute object."
+    }
+
+    cdl_option _POSIX_THREAD_PROCESS_SHARED {
+       display         "POSIX process shared attribute feature test macro"
+       flavor          bool
+       calculated      0
+       description     "This option defines the POSIX feature test macro
+                       for supporting process shared mutexes. Since eCos
+                       does not have processes, this attribute is undefined."
+    }
+
+}
+
+# ====================================================================
+
+cdl_component CYGPKG_POSIX_MAIN_THREAD {
+       display         "Main thread configuration"
+       flavor          bool
+       calculated      1
+       requires        { 0 != CYGPKG_LIBC_STARTUP }
+       requires        CYGSEM_LIBC_STARTUP_MAIN_OTHER
+        implements      CYGINT_LIBC_STARTUP_EXTERNAL_INVOKE_MAIN_POSSIBLE
+       description     "These options control the thread used to
+                         run the main() application entry routine."
+                        
+       cdl_option CYGNUM_POSIX_MAIN_DEFAULT_PRIORITY {
+            display        "main()'s default thread priority"
+            flavor         data
+            legal_values   0 to 31
+            default_value  16
+            description    "
+                POSIX compatibility requires that the application's
+                main() function be invoked in a thread.
+               This option controls the priority of that thread. This
+                priority is the POSIX priority and is NOT the same as
+                an eCos thread priority. With POSIX thread priorities,
+                lower numbers are lower priority, and higher numbers are
+                higher priority."
+       }
+}
+
+# ====================================================================
+# End of pthread.cdl
+
+
diff --git a/packages/compat/posix/v2_0/doc/posix.sgml b/packages/compat/posix/v2_0/doc/posix.sgml
new file mode 100644 (file)
index 0000000..3434a81
--- /dev/null
@@ -0,0 +1,1568 @@
+<!-- {{{ Banner                         -->
+
+<!-- =============================================================== -->
+<!--                                                                 -->
+<!--     posix.sgml                                                  -->
+<!--                                                                 -->
+<!--     POSIX Compatibility                                         -->
+<!--                                                                 -->
+<!-- =============================================================== -->
+<!-- ####COPYRIGHTBEGIN####                                          -->
+<!--                                                                 -->
+<!-- =============================================================== -->
+<!-- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.  -->
+<!-- This material may be distributed only subject to the terms      -->
+<!-- and conditions set forth in the Open Publication License, v1.0  -->
+<!-- or later (the latest version is presently available at          -->
+<!-- http://www.opencontent.org/openpub/)                            -->
+<!-- Distribution of the work or derivative of the work in any       -->
+<!-- standard (paper) book form is prohibited unless prior           -->
+<!-- permission obtained from the copyright holder                   -->
+<!-- =============================================================== -->
+<!--                                                                 -->      
+<!-- ####COPYRIGHTEND####                                            -->
+<!-- =============================================================== -->
+<!-- #####DESCRIPTIONBEGIN####                                       -->
+<!--                                                                 -->
+<!-- ####DESCRIPTIONEND####                                          -->
+<!-- =============================================================== -->
+
+<!-- }}} -->
+
+<part id="posix-compatibility">
+<title>eCos POSIX compatibility layer</title>
+
+<chapter id="posix-standard-support">
+<title>POSIX Standard Support</title>
+
+<!-- {{{ Intro  -->
+
+    <para>
+      eCos contains support for the POSIX Specification (ISO&sol;IEC
+      9945-1)&lsqb;POSIX&rsqb;.
+    </para>
+    <para>
+      POSIX support is divided between the POSIX and the FILEIO
+      packages. The POSIX package provides support for threads,
+      signals, synchronization, timers and message queues. The FILEIO
+      package provides support for file and device I&sol;O. The two
+      packages may be used together or separately, depending on
+      configuration.
+    </para>
+    <para>
+      This document takes a functional approach to the POSIX
+      library. Support for a function implies that the data types and
+      definitions necessary to support that function, and the objects
+      it manipulates, are also defined. Any exceptions to this are
+      noted, and unless otherwise noted, implemented functions behave
+      as specified in the POSIX standard.
+    </para>
+    <para>
+      This document only covers the differences between the eCos
+      implementation and the standard; it does not provide complete
+      documentation. For full information, see the POSIX standard
+      &lsqb;POSIX&rsqb;. Online, the Open Group Single Unix
+      Specification &lsqb;SUS2&rsqb; provides complete documentation
+      of a superset of POSIX. If you have access to a Unix system with
+      POSIX compatibility, then the manual pages for this will be of
+      use.  There are also a number of books available.
+      &lsqb;Lewine&rsqb; covers the process, signal, file and I&sol;O
+      functions, while &lsqb;Lewis1&rsqb;, &lsqb;Lewis2&rsqb;,
+      &lsqb;Nichols&rsqb; and &lsqb;Norton&rsqb; cover Pthreads and
+      related topics (see Bibliography, xref). However, many of these
+      books are oriented toward using POSIX in non-embedded systems,
+      so care should be taken in applying them to programming under
+      eCos.
+    </para>
+    <para>
+      The remainder of this chapter broadly follows the structure
+      of the POSIX Specification. References to the appropriate
+      section of the Standard are included.
+    </para>
+    <para>
+      Omitted functions marked with &ldquo;&sol;&sol; TBA&rdquo;
+      are potential candidates for later implementation.
+    </para>
+
+<!-- }}} -->
+<!-- {{{ Process Primitives -->
+
+<sect1 id="posix-process-primitives">
+<title>Process Primitives &lsqb;POSIX Section 3&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+int kill(pid&lowbar;t pid, int sig); 
+int pthread&lowbar;kill(pthread&lowbar;t thread, int sig); 
+int sigaction(int sig, const struct sigaction &ast;act,
+              struct sigaction &ast;oact); 
+int sigqueue(pid&lowbar;t pid, int sig, const union sigval value); 
+int sigprocmask(int how, const sigset&lowbar;t &ast;set,
+                sigset&lowbar;t &ast;oset); 
+int pthread&lowbar;sigmask(int how, const sigset&lowbar;t &ast;set,
+                    sigset&lowbar;t &ast;oset); 
+int sigpending(sigset&lowbar;t &ast;set);
+int sigsuspend(const sigset&lowbar;t &ast;set); 
+int sigwait(const sigset&lowbar;t &ast;set, int &ast;sig); 
+int sigwaitinfo(const sigset&lowbar;t &ast;set, siginfo&lowbar;t &ast;info); 
+int sigtimedwait(const sigset&lowbar;t &ast;set, siginfo&lowbar;t &ast;info,
+                 const struct timespec &ast;timeout); 
+int sigemptyset(sigset&lowbar;t &ast;set); 
+int sigfillset(sigset&lowbar;t &ast;set); 
+int sigaddset(sigset&lowbar;t &ast;set, int signo); 
+int sigdelset(sigset&lowbar;t &ast;set, int signo); 
+int sigismember(const sigset&lowbar;t &ast;set, int signo);
+unsigned int alarm( unsigned int seconds );
+int pause( void ); 
+unsigned int sleep( unsigned int seconds );
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+
+<screen>
+pid&lowbar;t fork(void); 
+int execl( const char &ast;path, const char &ast;arg, ... ); 
+int execv( const char &ast;path, char &ast;const argv&lsqb;&rsqb; ); 
+int execle( const char &ast;path, const char &ast;arg, ... ); 
+int execve( const char &ast;path, char &ast;const argv&lsqb;&rsqb;,
+            char &ast;const envp&lsqb;&rsqb; ); 
+int execlp( const char &ast;path, const char &ast;arg, ... ); 
+int execvp( const char &ast;path, char &ast;const argv&lsqb;&rsqb; ); 
+int pthread&lowbar;atfork( void(&ast;prepare)(void),
+                    void (&ast;parent)(void),
+                    void (&ast;child)() );
+pid&lowbar;t wait( int &ast;stat&lowbar;loc );             
+pid&lowbar;t waitpid( pid&lowbar;t pid, int &ast;stat&lowbar;loc,
+               int options ); 
+void &lowbar;exit( int status );
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+<itemizedlist>
+  <listitem>
+    <para>
+    Signal handling may be enabled or disabled with the
+    CYGPKG&lowbar;POSIX&lowbar;SIGNALS option. Since signals are used
+    by other POSIX components, such as timers, disabling signals will
+    disable those components too.
+    </para>
+  </listitem>
+  
+  <listitem>
+    <para>
+    <emphasis>kill()</emphasis> and
+    <emphasis>sigqueue()</emphasis> may only take a 
+    <emphasis role="strong">pid</emphasis> argument of zero,
+    which maps to the current process.
+    </para>
+  </listitem>
+  
+  <listitem>
+    <para>
+    The <emphasis>SIGEV&lowbar;THREAD</emphasis> notification type is
+           not currently implemented.
+    </para>
+  </listitem>
+  
+  <listitem>
+    <para>
+    Job Control and Memory Protection signals are
+           not supported.
+    </para>
+  </listitem>
+
+  <listitem>
+    <para>
+    An extra implementation defined
+    <emphasis>si&lowbar;code</emphasis> value,
+    <emphasis>SI&lowbar;EXCEPT</emphasis>, is defined to
+    distinguish hardware generated exceptions from
+    others.
+    </para>
+  </listitem>
+
+  <listitem>
+    <para>
+    Extra signals are defined:
+    &lowbar;SIGTRAP&lowbar;,&lowbar;SIGIOT&lowbar;,
+    &lowbar;SIGEMT&lowbar;, and &lowbar;SIGSYS&lowbar;. These are
+    largely to maintain compatibility with the signal numbers used by
+    GDB.
+    </para>
+  </listitem>
+
+  <listitem>
+    <para>
+    Signal delivery may currently occur at unexpected places in some
+    API functions. Using <emphasis>longjmp()</emphasis> to transfer
+    control out of a signal handler may result in the interrupted
+    function not being able to complete properly. This may result in
+    later function calls failing or deadlocking.
+    </para>
+  </listitem>
+</itemizedlist>
+</sect2>
+
+
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Process Environment -->
+
+<sect1 id="posix-process-environment">
+<title>Process Environment &lsqb;POSIX Section 4&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+int uname( struct utsname &ast;name ); 
+time&lowbar;t time( time&lowbar;t &ast;tloc ); 
+char &ast;getenv( const char &ast;name ); 
+int isatty( int fd );
+long sysconf( int name );
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+<screen>
+pid&lowbar;t getpid( void ); 
+pid&lowbar;t getppid( void ); 
+uid&lowbar;t getuid( void ); 
+uid&lowbar;t geteuid( void ); 
+gid&lowbar;t getgid( void ); 
+gid&lowbar;t getegid( void ); 
+int setuid( uid&lowbar;t uid ); 
+int setgid( gid&lowbar;t gid ); 
+int getgroups( int gidsetsize, gid&lowbar;t grouplist&lsqb;&rsqb; ); 
+char &ast;getlogin( void ); 
+int getlogin&lowbar;r( char &ast;name, size&lowbar;t namesize ); 
+pid&lowbar;t getpgrp( void ); 
+pid&lowbar;t setsid( void );
+int setpgid( pid&lowbar;t pid, pid&lowbar;t pgid ); 
+char &ast;ctermid( char &ast;s); 
+char &ast;ttyname( int fd );                             &sol;&sol; TBA 
+int ttyname&lowbar;r( int fd, char &ast;name, size&lowbar;t namesize); &sol;&sol; TBA 
+clock&lowbar;t times( struct tms &ast;buffer );                 &sol;&sol; TBA
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+       <itemizedlist>
+         <listitem>
+           <para>The fields of the <emphasis>utsname</emphasis>
+           structure are initialized as follows:
+            <screen>
+           sysname     &ldquo;eCos&rdquo; 
+           nodename    &ldquo;&rdquo;  (gethostname() is currently not available)
+           
+           release             Major version number of the kernel 
+           version             Minor version number of the kernel 
+           machine     &ldquo;&rdquo;  (Requires some config tool changes)
+            </screen>
+           </para>
+           <para>
+           The sizes of these strings are defined by
+           CYG&lowbar;POSIX&lowbar;UTSNAME&lowbar;LENGTH and
+           CYG&lowbar;POSIX&lowbar;UTSNAME&lowbar;NODENAME&lowbar;LENGTH. The
+           latter defaults to the value of the former, but may also
+           be set independently to accommodate a longer node name.
+           </para>
+         </listitem>
+         
+         <listitem>
+           <para>
+           The <emphasis>time()</emphasis> function is currently
+           implemented in the C library.
+           </para>
+         </listitem>
+         
+         <listitem>
+           <para>A set of environment strings may be defined at configuration
+           time with the CYGDAT&lowbar;LIBC&lowbar;DEFAULT&lowbar;ENVIRONMENT
+           option. The application may also define an environment by direct
+           assignment to the <emphasis role="strong">environ</emphasis>
+           variable.
+           </para>
+         </listitem>
+         
+         <listitem>
+           <para>
+           At present <emphasis>isatty()</emphasis> assumes that
+           any character device is a tty and that all other devices are not
+           ttys. Since the only kind of device that eCos currently supports
+           is serial character devices, this is an adequate
+           distinction.
+           </para>
+         </listitem>
+         
+         <listitem>
+           <para>
+           All system variables supported by sysconf will yield a
+           value. However, those that are irrelevant to eCos will
+           either return the default minimum defined in
+           <filename>&lt;limits.h&gt;</filename>,
+           or zero.
+           </para>
+         </listitem>
+       </itemizedlist>
+
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Files and Directories -->
+
+<sect1 id="posix-files-and-directories">
+<title>Files and Directories &lsqb;POSIX Section 5&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+DIR &ast;opendir( const char &ast;dirname ); 
+struct dirent &ast;readdir( DIR &ast;dirp ); 
+int readdir&lowbar;r( DIR &ast;dirp, struct dirent &ast;entry,
+               struct dirent &ast;&ast;result ); 
+void rewinddir( DIR &ast;dirp ); 
+int closedir( DIR &ast;dirp ); 
+int chdir( const char &ast;path ); 
+char &ast;getcwd( char &ast;buf, size&lowbar;t size );
+int open( const char &ast; path , int oflag , ... ); 
+int creat( const char &ast; path, mode&lowbar;t mode ); 
+int link( const char &ast;existing, const char &ast;new ); 
+int mkdir( const char &ast;path, mode&lowbar;t mode ); 
+int unlink( const char &ast;path ); 
+int rmdir( const char &ast;path ); 
+int rename( const char &ast;old, const char &ast;new ); 
+int stat( const char &ast;path, struct stat &ast;buf ); 
+int fstat( int fd, struct stat &ast;buf ); 
+int access( const char &ast;path, int amode ); 
+long pathconf(const char &ast;path, int name); 
+long fpathconf(int fd, int name);
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+
+<screen>
+mode&lowbar;t umask( mode&lowbar;t cmask ); 
+int mkfifo( const char &ast;path, mode&lowbar;t mode ); 
+int chmod( const char &ast;path, mode&lowbar;t mode );                 &sol;&sol; TBA 
+int fchmod( int fd, mode&lowbar;t mode );                              &sol;&sol; TBA 
+int chown( const char &ast;path, uid&lowbar;t owner, gid&lowbar;t group ); 
+int utime( const char &ast;path, const struct utimbuf &ast;times );    &sol;&sol; TBA 
+int ftruncate( int fd, off&lowbar;t length );                          &sol;&sol; TBA
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+
+       <itemizedlist>
+         <listitem>
+           <para>
+           If a call to <function>open()</function> or <function>creat()</function> supplies
+           the third &lowbar;mode&lowbar; parameter, it will
+           currently be ignored.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+           Most of the functionality of these functions depends on
+           the underlying filesystem.
+           </para>
+           </listitem>
+         <listitem>
+           <para>
+           Currently<emphasis> access()</emphasis> only checks the 
+           <emphasis>F&lowbar;OK</emphasis> mode explicitly, the others are
+           all assumed to be true by default.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+           The maximum number of open files allowed is supplied by
+           the CYGNUM&lowbar;FILEIO&lowbar;NFILE option. The maximum number
+           of file descriptors is supplied by the CYGNUM&lowbar;FILEIO&lowbar;NFD
+           option.  
+           </para>
+         </listitem>
+       </itemizedlist>
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Input and Output -->
+
+<sect1 id="posix-input-and-output">
+<title>Input and Output &lsqb;POSIX Section 6&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+int dup( int fd ); 
+int dup2( int fd, int fd2 ); 
+int close(int fd); 
+ssize&lowbar;t read(int fd, void &ast;buf, size&lowbar;t nbyte); 
+ssize&lowbar;t write(int fd, const void &ast;buf, size&lowbar;t nbyte); 
+int fcntl( int fd, int cmd, ... ); 
+off&lowbar;t lseek(int fd, off&lowbar;t offset, int whence); 
+int fsync( int fd );
+int fdatasync( int fd );</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+<screen>
+int pipe( int fildes&lsqb;2&rsqb; ); 
+int aio&lowbar;read( struct aiocb &ast;aiocbp );                               &sol;&sol; TBA 
+int aio&lowbar;write( struct aiocb &ast;aiocbp );                              &sol;&sol; TBA 
+int lio&lowbar;listio( int mode, struct aiocb &ast;const list&lsqb;&rsqb;,
+                int nent, struct sigevent &ast;sig);           &sol;&sol; TBA 
+int aio&lowbar;error( struct aiocb &ast;aiocbp );                              &sol;&sol; TBA 
+int aio&lowbar;return( struct aiocb &ast;aiocbp );                             &sol;&sol; TBA 
+int aio&lowbar;cancel( int fd, struct aiocb &ast;aiocbp );                     &sol;&sol; TBA 
+int aio&lowbar;suspend( const struct aiocb &ast;const list&lsqb;&rsqb;,
+                 int nent, const struct timespec &ast;timeout );       &sol;&sol; TBA 
+int aio&lowbar;fsync( int op, struct aiocb &ast;aiocbp );
+&sol;&sol; TBA
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+        <itemizedlist>
+         <listitem>
+           <para>
+           Only the <emphasis>F&lowbar;DUPFD</emphasis> command
+           of <emphasis>fcntl()</emphasis> is currently implemented.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+           Most of the functionality of these functions depends on
+           the underlying filesystem.
+           </para>
+         </listitem>
+       </itemizedlist>
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Device and Class Specific Functions -->
+
+<sect1 id="posix-device-and-class-specific-functions">
+<title>Device and Class Specific Functions &lsqb;POSIX Section 7&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+<screen>
+speed&lowbar;t cfgetospeed( const struct termios &ast;termios&lowbar;p ); 
+int cfsetospeed( struct termios &ast;termios&lowbar;p, speed&lowbar;t speed ); 
+speed&lowbar;t cfgetispeed( const struct termios &ast;termios&lowbar;p ); 
+int cfsetispeed( struct termios &ast;termios&lowbar;p, speed&lowbar;t speed ); 
+int tcgetattr( int fd, struct termios &ast;termios&lowbar;p ); 
+int tcsetattr( int fd, int optional&lowbar;actions,
+              const struct termios &ast;termios&lowbar;p ); 
+int tcsendbreak( int fd, int duration ); 
+int tcdrain( int fd );
+int tcflush( int fd, int queue&lowbar;selector ); 
+int tcsendbreak( int fd, int action );
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+
+<screen>
+pid&lowbar;t tcgetpgrp( int fd ); 
+int tcsetpgrp( int fd, pid&lowbar;t pgrp );</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+        <itemizedlist>
+         <listitem>
+           <para>
+           Only the functionality relevant to basic serial device
+           control is implemented. Only very limited support for
+           canonical input is provided, and then only via the
+           &ldquo;tty&rdquo; devices, not the &ldquo;serial&rdquo;
+           devices. None of the functionality relevant to job
+           control, controlling terminals and sessions is
+           implemented.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+           Only <emphasis>MIN</emphasis> &equals; 0 and
+           <emphasis>TIME</emphasis> &equals; 0 functionality is
+           provided.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+           Hardware flow control is supported if the underlying
+           device driver and serial port support it.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+           Support for break, framing and parity errors depends on
+           the functionality of the hardware and device driver.
+           </para>
+         </listitem>
+       </itemizedlist>
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ C Language Services -->
+
+<sect1 id="posix-C-language-services">
+<title>C Language Services &lsqb;POSIX Section 8&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+<screen>
+char &ast;setlocale( int category, const char &ast;locale ); 
+int fileno( FILE &ast;stream ); 
+FILE &ast;fdopen( int fd, const char &ast;type ); 
+int getc&lowbar;unlocked( FILE &ast;stream); 
+int getchar&lowbar;unlocked( void ); 
+int putc&lowbar;unlocked( FILE &ast;stream ); 
+int putchar&lowbar;unlocked( void ); 
+char &ast;strtok&lowbar;r( char &ast;s, const char &ast;sep, 
+                char &ast;&ast;lasts ); 
+char &ast;asctime&lowbar;r( const struct tm &ast;tm, char &ast;buf ); 
+char &ast;ctime&lowbar;r( const time&lowbar;t &ast;clock, char &ast;buf ); 
+struct tm &ast;gmtime&lowbar;r( const time&lowbar;t &ast;clock,
+                     struct tm &ast;result ); 
+struct tm &ast;localtime&lowbar;r( const time&lowbar;t &ast;clock,
+                        struct tm &ast;result ); 
+int rand&lowbar;r( unsigned int &ast;seed );
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+<screen>
+void flockfile( FILE &ast;file ); 
+int ftrylockfile( FILE &ast;file ); 
+void funlockfile( FILE &ast;file ); 
+int sigsetjmp( sigjmp&lowbar;buf env, int savemask );                  &sol;&sol; TBA 
+void siglongjmp( sigjmp&lowbar;buf env, int val );                     &sol;&sol; TBA 
+void tzset(void);                                                       &sol;&sol; TBA
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+       <itemizedlist>
+         <listitem>
+           <para>
+           <emphasis>setlocale()</emphasis> is implemented in the C
+           library Internationalization package.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+           Functions <emphasis>fileno()</emphasis> and
+           <emphasis>fdopen()</emphasis> are implemented in the C
+           library STDIO package.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+           Functions <emphasis>getc&lowbar;unlocked()</emphasis>, 
+           <emphasis>getchar&lowbar;unlocked()</emphasis>,
+           <emphasis>putc&lowbar;unlocked()</emphasis> and
+           <emphasis>putchar&lowbar;unlocked()</emphasis> are defined
+           but are currently identical to their non-unlocked
+           equivalents.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+           <emphasis>strtok&lowbar;r()</emphasis>, <emphasis>asctime&lowbar;r()</emphasis>, 
+           <emphasis>ctime&lowbar;r()</emphasis>, <emphasis>gmtime&lowbar;r()</emphasis>, 
+           <emphasis>localtime&lowbar;r()</emphasis> and
+           <emphasis>rand&lowbar;r()</emphasis> are all currently in
+           the C library, alongside their non-reentrant versions.
+           </para>
+         </listitem>
+       </itemizedlist>
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ System Databases -->
+
+<sect1 id="posix-system-databases">
+<title>System Databases &lsqb;POSIX Section 9&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+       
+<para>
+&lt;none&gt;
+</para>
+
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+
+<screen>
+struct group &ast;getgrgid( gid&lowbar;t gid ); 
+int getgrgid( gid&lowbar;t gid, struct group &ast;grp, char &ast;buffer, 
+             size&lowbar;t bufsize, struct group &ast;&ast;result ); 
+struct group &ast;getgrname( const char &ast;name ); 
+int getgrname&lowbar;r( const char &ast;name, struct group &ast;grp,
+                 char &ast;buffer, size&lowbar;t bufsize, struct group &ast;&ast;result ); 
+struct passwd &ast;getpwuid( uid&lowbar;t uid ); 
+int getpwuid&lowbar;r( uid&lowbar;t uid, struct passwd &ast;pwd,
+                char &ast;buffer, size&lowbar;t bufsize, struct passwd &ast;&ast;result ); 
+struct passwd &ast;getpwnam( const char &ast;name ); 
+int getpwnam&lowbar;r( const char &ast;name, struct passwd &ast;pwd,
+                char &ast;buffer, size&lowbar;t bufsize, struct passwd &ast;&ast;result );
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+        <itemizedlist>
+         <listitem>
+           <para>
+           None of the functions in this section are implemented.
+           </para>
+         </listitem>
+       </itemizedlist>
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Data Interchange Format -->
+
+<sect1 id="posix-data-interchange-format">
+<title>Data Interchange Format &lsqb;POSIX Section 10&rsqb;</title>
+      
+<para>
+This section details <emphasis>tar</emphasis> and
+<emphasis>cpio</emphasis> formats. Neither of these is supported by
+eCos.
+</para>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Synchronization -->
+
+<sect1 id="posix-synchronization">
+<title>Synchronization &lsqb;POSIX Section 11&rsqb;</title>
+
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+int sem&lowbar;init(sem&lowbar;t &ast;sem, int pshared, unsigned int value); 
+int sem&lowbar;destroy(sem&lowbar;t &ast;sem); 
+int sem&lowbar;wait(sem&lowbar;t &ast;sem); 
+int sem&lowbar;trywait(sem&lowbar;t &ast;sem); 
+int sem&lowbar;post(sem&lowbar;t &ast;sem);
+int sem&lowbar;getvalue(sem&lowbar;t &ast;sem, int &ast;sval); 
+int pthread&lowbar;mutexattr&lowbar;init( pthread&lowbar;mutexattr&lowbar;t &ast;attr); 
+int pthread&lowbar;mutexattr&lowbar;destroy( pthread&lowbar;mutexattr&lowbar;t &ast;attr); 
+int pthread&lowbar;mutex&lowbar;init(pthread&lowbar;mutex&lowbar;t &ast;mutex,
+                      const pthread&lowbar;mutexattr&lowbar;t &ast;mutex&lowbar;attr); 
+int pthread&lowbar;mutex&lowbar;destroy(pthread&lowbar;mutex&lowbar;t &ast;mutex); 
+int pthread&lowbar;mutex&lowbar;lock(pthread&lowbar;mutex&lowbar;t &ast;mutex); 
+int pthread&lowbar;mutex&lowbar;trylock(pthread&lowbar;mutex&lowbar;t &ast;mutex); 
+int pthread&lowbar;mutex&lowbar;unlock(pthread&lowbar;mutex&lowbar;t &ast;mutex); 
+int pthread&lowbar;condattr&lowbar;init(pthread&lowbar;condattr&lowbar;t &ast;attr); 
+int pthread&lowbar;condattr&lowbar;destroy(pthread&lowbar;condattr&lowbar;t &ast;attr); 
+int pthread&lowbar;cond&lowbar;init(pthread&lowbar;cond&lowbar;t &ast;cond, 
+                      const pthread&lowbar;condattr&lowbar;t &ast;attr); 
+int pthread&lowbar;cond&lowbar;destroy(pthread&lowbar;cond&lowbar;t &ast;cond); 
+int pthread&lowbar;cond&lowbar;signal(pthread&lowbar;cond&lowbar;t &ast;cond); 
+int pthread&lowbar;cond&lowbar;broadcast(pthread&lowbar;cond&lowbar;t &ast;cond); 
+int pthread&lowbar;cond&lowbar;wait(pthread&lowbar;cond&lowbar;t &ast;cond, 
+                      pthread&lowbar;mutex&lowbar;t &ast;mutex);
+int pthread&lowbar;cond&lowbar;timedwait(pthread&lowbar;cond&lowbar;t &ast;cond,
+                          pthread&lowbar;mutex&lowbar;t &ast;mutex,
+                          const struct timespec &ast;abstime);
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+
+<screen>
+sem&lowbar;t &ast;sem&lowbar;open(const char &ast;name, int oflag, ...);               &sol;&sol; TBA 
+int sem&lowbar;close(sem&lowbar;t &ast;sem);                                   &sol;&sol; TBA 
+int sem&lowbar;unlink(const char &ast;name);                           &sol;&sol; TBA 
+int pthread&lowbar;mutexattr&lowbar;getpshared( const pthread&lowbar;mutexattr&lowbar;t &ast;attr,
+                                 int &ast;pshared );
+int pthread&lowbar;mutexattr&lowbar;setpshared( const pthread&lowbar;mutexattr&lowbar;t &ast;attr,
+                                 int pshared );
+int  pthread&lowbar;condattr&lowbar;getpshared( const pthread&lowbar;condattr&lowbar;t &ast;attr, 
+                                 int &ast;pshared);
+int  pthread&lowbar;condattr&lowbar;setpshared( const pthread&lowbar;condattr&lowbar;t &ast;attr,
+                                 int pshared);</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+        <itemizedlist>
+         <listitem>
+           <para>
+           The presence of semaphores is controlled by the
+           CYGPKG&lowbar;POSIX&lowbar;SEMAPHORES option. This in turn
+           causes the &lowbar;POSIX&lowbar;SEMAPHORES feature test
+           macro to be defined and the semaphore API to be made
+           available.
+           </para>
+         </listitem>
+         
+         <listitem>
+           <para>
+           The <emphasis role="strong">pshared</emphasis> argument to
+           <emphasis>sem&lowbar;init()</emphasis> is not implemented,
+           its value is ignored.
+           </para>
+         </listitem>
+         
+         <listitem>
+           <para>
+           Functions <emphasis>sem&lowbar;open()</emphasis>, 
+           <emphasis>sem&lowbar;close()</emphasis> and
+           <emphasis>sem&lowbar;unlink()</emphasis> are present but
+           always return an error (ENOSYS).
+           </para>
+         </listitem>
+
+         <listitem>
+           <para>
+           The exact priority inversion protocols supported may be
+           controlled with the
+           &lowbar;POSIX&lowbar;THREAD&lowbar;PRIO&lowbar;INHERIT and
+           &lowbar;POSIX&lowbar;THREAD&lowbar;PRIO&lowbar;PROTECT
+           configuration options.
+           </para>
+         </listitem>
+         
+         <listitem>
+           <para>
+           &lcub;&lowbar;POSIX&lowbar;THREAD&lowbar;PROCESS&lowbar;SHARED&rcub; is
+           not defined, so the 
+           <emphasis role="strong">process-shared</emphasis> mutex
+           and condition variable attributes are not supported, and
+           neither are the functions
+           <emphasis>pthread&lowbar;mutexattr&lowbar;getpshared()</emphasis>,
+           <emphasis>pthread&lowbar;mutexattr&lowbar;setpshared()</emphasis>, 
+           <emphasis>pthread&lowbar;condattr&lowbar;getpshared()</emphasis> and 
+           <emphasis>pthread&lowbar;condattr&lowbar;setpshared()</emphasis>. 
+           </para>
+         </listitem>
+         
+         <listitem>
+         <para>
+           Condition variables do not become bound to a particular
+           mutex when
+           <emphasis>pthread&lowbar;cond&lowbar;wait()</emphasis> is
+           called. Hence different threads may wait on a condition
+           variable with different mutexes. This is at variance with
+           the standard, which requires a condition variable to
+           become (dynamically) bound by the first waiter, and
+           unbound when the last finishes. However, this difference
+           is largely benign, and the cost of policing this feature
+           is non-trivial.
+         </para>
+       </listitem>
+       </itemizedlist>
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Memory Management -->
+
+<sect1 id="posix-memory-management">
+<title>Memory Management &lsqb;POSIX Section 12&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+       
+<para>
+&lt;none&gt;
+</para>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+
+<screen>
+int mlockall( int flags ); 
+int munlockall( void ); 
+int mlock( const void &ast;addr, size&lowbar;t len ); 
+int munlock( const void &ast;addr, size&lowbar;t len ); 
+void mmap( void &ast;addr, size&lowbar;t len, int prot, int flags,      
+          int fd, off&lowbar;t off ); 
+int munmap( void &ast;addr, size&lowbar;t len ); 
+int mprotect( const void &ast;addr, size&lowbar;t len, int prot ); 
+int msync( void &ast;addr, size&lowbar;t len, int flags ); 
+int shm&lowbar;open( const char &ast;name, int oflag, mode&lowbar;t mode ); 
+int shm&lowbar;unlink( const char &ast;name );
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+<para>
+None of these functions are currently provided. Some may
+be implemented in a restricted form in the future.
+</para>
+
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Execution Scheduling -->
+
+<sect1 id="posix-execution-scheduling">
+<title>Execution Scheduling &lsqb;POSIX Section 13&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+int sched&lowbar;yield(void); 
+int sched&lowbar;get&lowbar;priority&lowbar;max(int policy); 
+int sched&lowbar;get&lowbar;priority&lowbar;min(int policy); 
+int sched&lowbar;rr&lowbar;get&lowbar;interval(pid&lowbar;t pid, struct timespec &ast;t); 
+int pthread&lowbar;attr&lowbar;setscope(pthread&lowbar;attr&lowbar;t &ast;attr, int scope); 
+int pthread&lowbar;attr&lowbar;getscope(const pthread&lowbar;attr&lowbar;t &ast;attr, int &ast;scope); 
+int pthread&lowbar;attr&lowbar;setinheritsched(pthread&lowbar;attr&lowbar;t &ast;attr, int inherit); 
+int pthread&lowbar;attr&lowbar;getinheritsched(const pthread&lowbar;attr&lowbar;t &ast;attr, int &ast;inherit); 
+int pthread&lowbar;attr&lowbar;setschedpolicy(pthread&lowbar;attr&lowbar;t &ast;attr, int policy); 
+int pthread&lowbar;attr&lowbar;getschedpolicy(const pthread&lowbar;attr&lowbar;t &ast;attr, int &ast;policy);
+int pthread&lowbar;attr&lowbar;setschedparam( pthread&lowbar;attr&lowbar;t &ast;attr, const struct sched&lowbar;param &ast;param); 
+int pthread&lowbar;attr&lowbar;getschedparam( const pthread&lowbar;attr&lowbar;t &ast;attr,
+                               struct sched&lowbar;param &ast;param); 
+int pthread&lowbar;setschedparam(pthread&lowbar;t thread, int policy,
+                         const struct sched&lowbar;param &ast;param); 
+int pthread&lowbar;getschedparam(pthread&lowbar;t thread, int &ast;policy,
+                         struct sched&lowbar;param &ast;param); 
+int pthread&lowbar;mutexattr&lowbar;setprotocol( pthread&lowbar;mutexattr&lowbar;t &ast;attr,
+                                   int protocol);
+int pthread&lowbar;mutexattr&lowbar;getprotocol( pthread&lowbar;mutexattr&lowbar;t &ast;attr,
+                                   int &ast;protocol); 
+int pthread&lowbar;mutexattr&lowbar;setprioceiling( pthread&lowbar;mutexattr&lowbar;t &ast;attr,
+                                      int prioceiling); 
+int pthread&lowbar;mutexattr&lowbar;getprioceiling( pthread&lowbar;mutexattr&lowbar;t &ast;attr,
+                                     int &ast;prioceiling);
+int pthread&lowbar;mutex&lowbar;setprioceiling( pthread&lowbar;mutex&lowbar;t &ast;mutex,
+                                 int prioceiling,
+                                 int &ast;old&lowbar;ceiling); 
+int pthread&lowbar;mutex&lowbar;getprioceiling( pthread&lowbar;mutex&lowbar;t &ast;mutex,
+                                  int &ast;prioceiling);
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+
+<screen>
+int sched&lowbar;setparam(pid&lowbar;t pid, const struct sched&lowbar;param &ast;param); 
+int sched&lowbar;getparam(pid&lowbar;t pid, struct sched&lowbar;param &ast;param); 
+int sched&lowbar;setscheduler(pid&lowbar;t pid, int policy,
+                      const struct sched&lowbar;param &ast;param); 
+int sched&lowbar;getscheduler(pid&lowbar;t pid);
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+        <itemizedlist>
+       <listitem>
+         <para>
+         The functions <emphasis>sched&lowbar;setparam()</emphasis>, 
+         <emphasis>sched&lowbar;getparam()</emphasis>,
+         <emphasis>sched&lowbar;setscheduler()</emphasis> and
+         <emphasis>sched&lowbar;getscheduler()</emphasis> are present
+         but always return an error.
+         </para>
+       </listitem>
+       <listitem>
+         <para>
+         The scheduler policy <emphasis>SCHED&lowbar;OTHER</emphasis> is
+         equivalent to <emphasis>SCHED&lowbar;RR</emphasis>.
+         </para>
+       </listitem>
+       <listitem>
+         <para>
+         Only <emphasis>PTHREAD&lowbar;SCOPE&lowbar;SYSTEM</emphasis>
+         is supported as a
+         <emphasis role="strong">contentionscope</emphasis>
+         attribute.
+         </para>
+       </listitem>
+       <listitem>
+         <para>
+         The default thread scheduling attributes are:
+         <screen>
+         contentionscope          PTHREAD&lowbar;SCOPE&lowbar;SYSTEM
+         inheritsched             PTHREAD&lowbar;INHERIT&lowbar;SCHED
+         schedpolicy              SCHED&lowbar;OTHER
+         schedparam.sched         0
+         </screen>
+          </para>
+       </listitem>
+       <listitem>
+         <para>
+         Mutex priority inversion protection is controlled by a
+         number of kernel configuration options.
+         If CYGSEM&lowbar;KERNEL&lowbar;SYNCH&lowbar;MUTEX&lowbar;PRIORITY&lowbar;INVERSION&lowbar;PROTOCOL&lowbar;INHERIT
+         is defined then
+         &lcub;&lowbar;POSIX&lowbar;THREAD&lowbar;PRIO&lowbar;INHERIT&rcub;
+         will be defined and PTHREAD&lowbar;PRIO&lowbar;INHERIT may
+         be set as the protocol in a
+         <emphasis>pthread&lowbar;mutexattr&lowbar;t</emphasis>
+         object.
+         If CYGSEM&lowbar;KERNEL&lowbar;SYNCH&lowbar;MUTEX&lowbar;PRIORITY&lowbar;INVERSION&lowbar;PROTOCOL&lowbar;CEILING
+         is defined then
+         &lcub;&lowbar;POSIX&lowbar;THREAD&lowbar;PRIO&lowbar;PROTECT&rcub;
+         will be defined and PTHREAD&lowbar;PRIO&lowbar;PROTECT may
+         be set as the protocol in a
+         <emphasis>pthread&lowbar;mutexattr&lowbar;t</emphasis> object.
+          </para>
+       </listitem>
+       <listitem>
+         <para>
+         The default attribute values set by
+         <emphasis>pthread&lowbar;mutexattr&lowbar;init()</emphasis>
+         is to set the protocol attribute to
+         PTHREAD&lowbar;PRIO&lowbar;NONE and the prioceiling
+         attribute to zero.
+         </para>
+       </listitem>
+       </itemizedlist>
+
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Clocks and Timers -->
+
+<sect1 id="posix-clocks-and-timers">
+<title>Clocks and Timers &lsqb;POSIX Section 14&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+int clock&lowbar;settime( clockid&lowbar;t clock&lowbar;id,
+const struct timespec &ast;tp); 
+int clock&lowbar;gettime( clockid&lowbar;t clock&lowbar;id, struct timespec &ast;tp); 
+int clock&lowbar;getres( clockid&lowbar;t clock&lowbar;id, struct timespec &ast;tp); 
+int timer&lowbar;create( clockid&lowbar;t clock&lowbar;id, struct sigevent &ast;evp,
+                 timer&lowbar;t &ast;timer&lowbar;id);
+int timer&lowbar;delete( timer&lowbar;t timer&lowbar;id ); 
+int timer&lowbar;settime( timer&lowbar;t timerid, int flags,
+                  const struct itimerspec &ast;value,
+                  struct itimerspec &ast;ovalue ); 
+int timer&lowbar;gettime( timer&lowbar;t timerid, struct itimerspec &ast;value ); 
+int timer&lowbar;getoverrun( timer&lowbar;t timerid ); 
+int nanosleep( const struct timespec &ast;rqtp, struct timespec &ast;rmtp);
+</screen>
+
+</sect2>
+
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+       
+<para>
+&lt;none&gt;
+</para>
+
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+
+<itemizedlist>
+  <listitem>
+    <para>
+    Currently <emphasis>timer&lowbar;getoverrun()</emphasis> only
+    reports timer notifications that are delayed in the timer
+    subsystem.  If they are delayed in the signal subsystem, due to
+    signal masks for example, this is not counted as an overrun.
+    </para>
+  </listitem>
+
+  <listitem>
+    <para>
+    The option CYGPKG&lowbar;POSIX&lowbar;TIMERS allows the timer support to be
+    enabled or disabled, and causes &lowbar;POSIX&lowbar;TIMERS to be defined
+    appropriately. This will cause other parts of the POSIX system to
+    have limited functionality.
+    </para>
+  </listitem>
+
+</itemizedlist>
+
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Message Passing -->
+
+<sect1 id="posix-message-passing">
+<title>Message Passing &lsqb;POSIX Section 15&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+mqd&lowbar;t mq&lowbar;open( const char &ast;name, int  oflag, ... ); 
+int mq&lowbar;close( mqd&lowbar;t  mqdes ); 
+int mq&lowbar;unlink( const char &ast;name );
+int mq&lowbar;send( mqd&lowbar;t mqdes, const char &ast;msg&lowbar;ptr,
+            size&lowbar;t msg&lowbar;len, unsigned int msg&lowbar;prio ); 
+ssize&lowbar;t mq&lowbar;receive( mqd&lowbar;t mqdes, char &ast;msg&lowbar;ptr,
+                   size&lowbar;t msg&lowbar;len, unsigned int &ast;msg&lowbar;prio );
+int mq&lowbar;setattr( mqd&lowbar;t mqdes, const struct mq&lowbar;attr &ast;mqstat,
+               struct mq&lowbar;attr &ast;omqstat ); 
+int mq&lowbar;getattr( mqd&lowbar;t mqdes, struct mq&lowbar;attr &ast;mqstat ); 
+int mq&lowbar;notify( mqd&lowbar;t mqdes, const struct sigevent &ast;notification );
+</screen>
+<para>From POSIX 1003.1d draft: </para>
+<screen>
+int mq&lowbar;send( mqd&lowbar;t mqdes, const char &ast;msg&lowbar;ptr,
+            size&lowbar;t msg&lowbar;len, unsigned int msg&lowbar;prio,
+             const struct timespec *abs_timeout ); 
+ssize&lowbar;t mq&lowbar;receive( mqd&lowbar;t mqdes, char &ast;msg&lowbar;ptr,
+                   size&lowbar;t msg&lowbar;len, unsigned int &ast;msg&lowbar;prio,
+             const struct timespec *abs_timeout );
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+       
+<para>
+&lt;none&gt;
+</para>
+
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+
+<itemizedlist>
+  <listitem>
+    <para>
+    The presence of message queues is controlled by the
+    CYGPKG&lowbar;POSIX&lowbar;MQUEUES option.  Setting this will
+    cause &lsqb;&lowbar;POSIX&lowbar;MESSAGE&lowbar;PASSING&rsqb; to
+    be defined and the message queue API to be made available.
+    </para>
+  </listitem>
+
+  <listitem>
+    <para>
+    Message queues are not currently filesystem objects. They live in
+    their own name and descriptor spaces.
+    </para>
+  </listitem>
+</itemizedlist>
+
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Thread Management -->
+
+<sect1 id="posix-thread-management">
+<title>Thread Management &lsqb;POSIX Section 16&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+int pthread&lowbar;attr&lowbar;init(pthread&lowbar;attr&lowbar;t &ast;attr); 
+int pthread&lowbar;attr&lowbar;destroy(pthread&lowbar;attr&lowbar;t &ast;attr); 
+int pthread&lowbar;attr&lowbar;setdetachstate(pthread&lowbar;attr&lowbar;t &ast;attr,
+                                int detachstate); 
+int pthread&lowbar;attr&lowbar;getdetachstate(const pthread&lowbar;attr&lowbar;t &ast;attr,
+                               int &ast;detachstate); 
+int pthread&lowbar;attr&lowbar;setstackaddr(pthread&lowbar;attr&lowbar;t &ast;attr,
+                              void &ast;stackaddr); 
+int pthread&lowbar;attr&lowbar;getstackaddr(const pthread&lowbar;attr&lowbar;t &ast;attr,
+                             void &ast;&ast;stackaddr); 
+int pthread&lowbar;attr&lowbar;setstacksize(pthread&lowbar;attr&lowbar;t &ast;attr,
+                              size&lowbar;t stacksize); 
+int pthread&lowbar;attr&lowbar;getstacksize(const pthread&lowbar;attr&lowbar;t &ast;attr,
+                             size&lowbar;t &ast;stacksize); 
+int pthread&lowbar;create( pthread&lowbar;t &ast;thread,
+                    const pthread&lowbar;attr&lowbar;t &ast;attr,
+                   void &ast;(&ast;start&lowbar;routine)(void &ast;),
+                   void &ast;arg);
+pthread&lowbar;t pthread&lowbar;self( void ); 
+int pthread&lowbar;equal(pthread&lowbar;t thread1, pthread&lowbar;t thread2); 
+void pthread&lowbar;exit(void &ast;retval); 
+int pthread&lowbar;join(pthread&lowbar;t thread, void &ast;&ast;thread&lowbar;return); 
+int pthread&lowbar;detach(pthread&lowbar;t thread); 
+int pthread&lowbar;once(pthread&lowbar;once&lowbar;t &ast;once&lowbar;control,
+                void (&ast;init&lowbar;routine)(void));
+</screen>
+
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+       
+<para>
+&lt;none&gt;
+</para>
+
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+
+<itemizedlist>
+  <listitem>
+    <para>
+    The presence of thread support as a whole is controlled by the the
+    CYGPKG_POSIX_PTHREAD configuration option. Note that disabling
+    this will also disable many other features of the POSIX package,
+    since these are intimately bound up with the thread mechanism.
+    </para>
+  </listitem>
+  
+  <listitem>
+    <para>
+    The default (non-scheduling) thread attributes are:
+    </para>
+    <screen>
+    detachstate            PTHREAD&lowbar;CREATE&lowbar;JOINABLE
+    stackaddr              unset
+    stacksize              unset
+    </screen>
+  </listitem>
+  
+  <listitem>
+    <para>
+      Dynamic thread stack allocation is only provided if there is an
+      implementation of
+      <emphasis>malloc()</emphasis> configured (i.e. a package
+      implements the
+      CYGINT&lowbar;MEMALLOC&lowbar;MALLOC&lowbar;ALLOCATORS
+      interface). If there is no malloc() available, then the thread
+      creator must supply a stack. If only a stack address is supplied
+      then the stack is assumed to be PTHREAD&lowbar;STACK&lowbar;MIN
+      bytes long. This size is seldom useful for any but the most
+      trivial of threads.  If a different sized stack is used, both
+      the stack address and stack size must be supplied.
+    </para>
+  </listitem>
+  
+  <listitem>
+    <para>
+      The value of PTHREAD&lowbar;THREADS&lowbar;MAX is supplied by
+      the CYGNUM&lowbar;POSIX&lowbar;PTHREAD&lowbar;THREADS&lowbar;MAX
+      option. This defines the maximum number of threads allowed. The
+      POSIX standard requires this value to be at least 64, and this
+      is the default value set.
+    </para>
+  </listitem>
+
+  <listitem>
+    <para>
+    When the POSIX package is installed, the thread that calls 
+    <emphasis>main()</emphasis> is initialized as a POSIX thread. The
+    priority of that thread is controlled by the
+    CYGNUM&lowbar;POSIX&lowbar;MAIN&lowbar;DEFAULT&lowbar;PRIORITY option.
+    </para>
+  </listitem>
+</itemizedlist>
+
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Thread-Specific Data -->
+
+<sect1 id="posix-thread-specific-data">
+<title>Thread-Specific Data &lsqb;POSIX Section 17&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+int pthread&lowbar;key&lowbar;create(pthread&lowbar;key&lowbar;t &ast;key,
+                      void (&ast;destructor)(void &ast;)); 
+int pthread&lowbar;setspecific(pthread&lowbar;key&lowbar;t key, const void &ast;pointer); 
+void &ast;pthread&lowbar;getspecific(pthread&lowbar;key&lowbar;t key); 
+int pthread&lowbar;key&lowbar;delete(pthread&lowbar;key&lowbar;t key);
+</screen>
+
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+<para>
+&lt;none&gt;
+</para>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+
+<itemizedlist>
+  <listitem>
+    <para>
+    The value of PTHREAD&lowbar;DESTRUCTOR&lowbar;ITERATIONS is
+    provided by the
+    CYGNUM&lowbar;POSIX&lowbar;PTHREAD&lowbar;DESTRUCTOR&lowbar;ITERATIONS
+    option. This controls the number of times that a key destructor
+    will be called while the data item remains non-NULL.
+    </para>
+  </listitem>
+  
+  <listitem>
+    <para>
+    The value of PTHREAD&lowbar;KEYS&lowbar;MAX is provided
+    by the CYGNUM&lowbar;POSIX&lowbar;PTHREAD&lowbar;KEYS&lowbar;MAX
+    option. This defines the maximum number of per-thread data items
+    supported. The POSIX standard calls for this to be a minimum of
+    128, which is rather large for an embedded system. The default
+    value for this option is set to 128 for compatibility but it
+    should be reduced to a more usable value.
+    </para>
+  </listitem>
+</itemizedlist>
+
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Thread Cancellation -->
+
+<sect1 id="posix-thread-cancellation">
+<title>Thread Cancellation &lsqb;POSIX Section 18&rsqb;</title>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Implemented</title>
+
+<screen>
+int pthread&lowbar;cancel(pthread&lowbar;t thread); 
+int pthread&lowbar;setcancelstate(int state, int &ast;oldstate); 
+int pthread&lowbar;setcanceltype(int type, int &ast;oldtype); 
+void pthread&lowbar;testcancel(void); 
+void pthread&lowbar;cleanup&lowbar;push( void (&ast;routine)(void &ast;),
+                           void &ast;arg); 
+void pthread&lowbar;cleanup&lowbar;pop( int execute);
+</screen>
+</sect2>
+
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Functions Omitted</title>
+<para>
+&lt;none&gt;
+</para>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+<para>
+Asynchronous cancellation is only partially implemented.  In
+particular, cancellation may occur in unexpected places in some
+functions. It is strongly recommended that only synchronous
+cancellation be used. 
+</para>
+</sect2>
+</sect1>
+
+<!-- }}} -->
+<!-- {{{ Non-POSIX Functions -->
+
+<sect1 id="posix-non-posix-functions">
+<title>Non-POSIX Functions</title>
+       
+<para>
+In addition to the standard POSIX functions defined above, the
+following non-POSIX functions are defined in the FILEIO package.
+</para>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>General I&sol;O Functions</title>
+<screen>
+int ioctl( int fd, CYG&lowbar;ADDRWORD com, CYG&lowbar;ADDRWORD data ); 
+int select( int nfd, fd&lowbar;set &ast;in, fd&lowbar;set &ast;out, fd&lowbar;set &ast;ex, struct timeval &ast;tv);
+</screen>
+</sect2>
+
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Socket Functions</title>
+<screen>
+int socket( int domain, int type, int protocol); 
+int bind( int s, const struct sockaddr &ast;sa, unsigned int len); 
+int listen( int s, int len); 
+int accept( int s, struct sockaddr &ast;sa, socklen&lowbar;t &ast;addrlen); 
+int connect( int s, const struct sockaddr &ast;sa, socklen&lowbar;t len); 
+int getpeername( int s, struct sockaddr &ast;sa, socklen&lowbar;t &ast;len); 
+int getsockname( int s, struct sockaddr &ast;sa, socklen&lowbar;t &ast;len); 
+int setsockopt( int s, int level, int optname, const void &ast;optval,
+               socklen&lowbar;t optlen); 
+int getsockopt( int s, int level, int optname, void &ast;optval,
+               socklen&lowbar;t &ast;optlen); 
+ssize&lowbar;t recvmsg( int s, struct msghdr &ast;msg, int flags); 
+ssize&lowbar;t recvfrom( int s, void &ast;buf, size&lowbar;t len, int flags, 
+                 struct sockaddr &ast;from, socklen&lowbar;t &ast;fromlen); 
+ssize&lowbar;t recv( int s, void &ast;buf, size&lowbar;t len, int flags); 
+ssize&lowbar;t sendmsg( int s, const struct msghdr &ast;msg, int flags); 
+ssize&lowbar;t sendto( int s, const void &ast;buf, size&lowbar;t len, int flags, 
+               const struct sockaddr &ast;to, socklen&lowbar;t tolen); 
+ssize&lowbar;t send( int s, const void &ast;buf, size&lowbar;t len, int flags); 
+int shutdown( int s, int how);
+</screen>
+</sect2>
+
+<!-- =================================================================== -->
+
+<sect2>
+<title>Notes</title>
+<itemizedlist>
+  <listitem>
+   <para>
+   The precise behaviour of these functions depends mainly on the
+   functionality of the underlying filesystem or network stack to
+   which they are applied.
+   </para>
+  </listitem>
+</itemizedlist>
+</sect2>
+</sect1>
+
+<!-- }}} -->
+
+</chapter>
+
+<!-- {{{ Bibliography -->
+
+<bibliography id="posix-references-and-bibliography">
+<title>References and Bibliography</title>
+
+    <bibliomixed>
+      <bibliomisc>&lsqb;Lewine&rsqb;</bibliomisc>
+      <author>
+       <firstname>Donald</firstname>
+       <othername>A.</othername>
+       <surname>Lweine</surname>
+      </author>
+      <title>Posix Programmer&rsquo;s Guide: Writing Portable Unix
+       Programs With the POSIX.1 Standard O&rsquo;Reilly &amp;
+       Associates; ISBN: 0937175730.</title></bibliomixed>
+
+    <bibliomixed>
+      <bibliomisc>&lsqb;Lewis1&rsqb;</bibliomisc>
+      <author>
+       <firstname>Bil</firstname>
+       <surname>Lewis</surname>
+      </author>
+      <author>
+       <firstname>Daniel</firstname>
+       <othername>J.</othername>
+       <surname>Berg</surname>
+      </author>
+      <title>Threads Primer: A Guide to Multithreaded Programming</title>
+      <publishername>Prentice Hall</publishername>
+      <isbn>ISBN: 013443698</isbn>
+    </bibliomixed>
+
+    <bibliomixed>
+      <bibliomisc>&lsqb;Lewis2&rsqb;</bibliomisc>
+      <author>
+       <firstname>Bil</firstname>
+       <surname>Lewis</surname>
+      </author>
+      <author>
+       <firstname>Daniel</firstname>
+       <othername>J.</othername>
+       <surname>Berg</surname>
+      </author>
+      <title>Multithreaded Programming With Pthreads</title>
+      <publisher>
+       <publishername>Prentice Hall Computer Books</publishername>
+      </publisher>
+      <isbn>ISBN: 0136807291</isbn>
+    </bibliomixed>
+
+    <bibliomixed>
+      <bibliomisc>&lsqb;Nichols&rsqb;</bibliomisc>
+      <author>
+       <firstname>Bradford</firstname>
+       <surname>Nichols</surname>
+      </author>
+      <author>
+       <firstname>Dick</firstname>
+       <surname>Buttlar</surname>
+      </author>
+      <author>
+       <firstname>Jacqueline</firstname>
+       <othername>Proulx</othername>
+       <surname>Farrell</surname>
+      </author>
+      <title>Pthreads Programming: A POSIX Standard for Better
+       Multiprocessing (O&rsquo;Reilly Nutshell)</title>
+      <publisher><publishername>O&rsquo;Reilly &amp; Associates</publishername>
+      </publisher>
+      <isbn>ISBN: 1565921151</isbn>
+    </bibliomixed>
+
+    <bibliomixed>
+      <bibliomisc>&lsqb;Norton&rsqb;</bibliomisc>
+      <author>
+       <firstname>Scott</firstname>
+       <othername>J.</othername>
+       <surname>Norton</surname>
+      </author>
+      <author>
+       <firstname>Mark</firstname>
+       <othername>D.</othername>
+       <surname>Depasquale</surname>
+      </author>
+      <title>Thread Time: The MultiThreaded Programming Guide</title>
+      <publisher><publishername>Prentice Hall</publishername>
+      </publisher>
+      <isbn>ISBN: 0131900676</isbn></bibliomixed>
+
+
+    <bibliomixed>
+      <bibliomisc>&lsqb;POSIX&rsqb;</bibliomisc>
+      <title>Portable Operating System Interface(POSIX) -
+Part 1: System Application Programming Interface (API)&lsqb;C
+Language&rsqb;</title>
+      <corpauthor>ISO&sol;IEC 9945-1:1996, IEEE</corpauthor></bibliomixed>
+
+    <bibliomixed>
+      <bibliomisc>&lsqb;SUS2&rsqb;</bibliomisc>
+      <title>Open Group; Single Unix Specification, Version 2</title>
+      <bibliomisc><ulink
+      url="http://www.opengroup.org/public/pubs/online/7908799/index.html">http://www.opengroup.org/public/pubs/online/7908799/index.html</ulink></bibliomisc>
+    </bibliomixed>
+
+  </bibliography>
+
+<!-- }}} -->
+
+</part>
diff --git a/packages/compat/posix/v2_0/include/export.h b/packages/compat/posix/v2_0/include/export.h
new file mode 100644 (file)
index 0000000..36edf0d
--- /dev/null
@@ -0,0 +1,114 @@
+#ifndef CYGONCE_POSIX_EXPORT_H
+#define CYGONCE_POSIX_EXPORT_H
+//=============================================================================
+//
+//      export.h
+//
+//      POSIX export header
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Nick Garnett
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg
+// Contributors:  nickg
+// Date:          2000-09-18
+// Purpose:       POSIX export header
+// Description:   This header contains definitions that the POSIX package exports
+//                to other packages. These are generally interfaces that are not
+//                provided by the public API.
+//                
+//              
+// Usage:
+//              #ifdef CYGPKG_POSIX
+//              #include <export.h>
+//              #endif
+//              ...
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/posix.h>
+
+#include <cyg/infra/cyg_type.h>
+
+#include <stddef.h>             // NULL, size_t
+
+#include <limits.h>
+#include <signal.h>
+
+#include <sys/types.h>
+
+#include <sched.h>              // SCHED_*
+
+//=============================================================================
+// POSIX API function management.
+// These macros should be inserted near the start and all returns of
+// any function that is part of the POSIX API.
+
+__externC void cyg_posix_function_start();
+__externC void cyg_posix_function_finish();
+
+#define CYG_POSIX_FUNCTION_START() cyg_posix_function_start()
+
+#define CYG_POSIX_FUNCTION_FINISH() cyg_posix_function_finish()
+
+//-----------------------------------------------------------------------------
+// Signal mask management
+//
+// These are exported to allow functions in other packages to
+// manipulate the current threads signal mask. they are currently only
+// used in the implementation of cyg_pselect() in the FILEIO package.
+
+#ifdef CYGPKG_POSIX_SIGNALS
+__externC void cyg_pthread_sigmask_set (const sigset_t *set, sigset_t *oset);
+__externC cyg_bool cyg_posix_sigpending(void);
+__externC void cyg_posix_deliver_signals(const sigset_t *mask);
+
+#define CYG_PTHREAD_SIGMASK_SET cyg_pthread_sigmask_set
+
+#define CYG_POSIX_SIGPENDING() cyg_posix_sigpending()
+
+#define CYG_POSIX_DELIVER_SIGNALS cyg_posix_deliver_signals
+#endif
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_POSIX_EXPORT_H
+// End of export.h
diff --git a/packages/compat/posix/v2_0/include/limits.h b/packages/compat/posix/v2_0/include/limits.h
new file mode 100644 (file)
index 0000000..2974ba1
--- /dev/null
@@ -0,0 +1,131 @@
+#ifndef CYGONCE_LIMITS_H
+#define CYGONCE_LIMITS_H
+//=============================================================================
+//
+//      limits.h
+//
+//      POSIX limits header
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg
+// Contributors:  nickg
+// Date:          2000-03-17
+// Purpose:       POSIX limits header
+// Description:   This file contains the compile time definitions that describe
+//                the minima and current values of various values and defined
+//                in POSIX.1 section 2.8.
+//              
+// Usage:
+//              #include <limits.h>
+//              ...
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/posix.h>
+
+//-----------------------------------------------------------------------------
+// Runtime invariants
+// These are all equal to or greater than the minimum values defined above.
+
+// From table 2-4
+
+#define NGROUPS_MAX             _POSIX_NGROUPS_MAX
+
+// From table 2-5
+
+#define AIO_LISTIO_MAX          _POSIX_AIO_LISTIO_MAX
+
+#define AIO_MAX                 _POSIX_AIO_MAX
+
+#define AIO_PRIO_DELTA_MAX      0
+
+#define ARG_MAX                 _POSIX_ARG_MAX
+
+#define CHILD_MAX               _POSIX_CHILD_MAX
+
+#define DELAYTIMER_MAX          _POSIX_DELAYTIMER_MAX
+
+#define LOGIN_NAME_MAX          _POSIX_LOGIN_NAME_MAX
+
+#define PAGESIZE                1
+
+#define PTHREAD_DESTRUCTOR_ITERATIONS CYGNUM_POSIX_PTHREAD_DESTRUCTOR_ITERATIONS
+
+#define PTHREAD_KEYS_MAX        CYGNUM_POSIX_PTHREAD_KEYS_MAX
+
+// Minimum size needed on a pthread stack to contain its per-thread control
+// structures and per-thread data. Since we cannot include all the headers
+// necessary to calculate this value here, the following is a generous estimate.
+#define PTHREAD_STACK_OVERHEAD  (0x180+(PTHREAD_KEYS_MAX*sizeof(void *)))
+
+#define PTHREAD_STACK_MIN       (CYGNUM_HAL_STACK_SIZE_MINIMUM+PTHREAD_STACK_OVERHEAD)
+
+#define PTHREAD_THREADS_MAX     CYGNUM_POSIX_PTHREAD_THREADS_MAX
+
+#define RTSIG_MAX               _POSIX_RTSIG_MAX
+
+#define SEM_NSEMS_MAX           _POSIX_SEM_NSEMS_MAX
+
+#define SEM_VALUE_MAX           _POSIX_SEM_VALUE_MAX
+
+#define SIGQUEUE_MAX            _POSIX_SIGQUEUE_MAX
+
+#define STREAM_MAX              _POSIX_STREAM_MAX
+
+#define TIMER_MAX               _POSIX_TIMER_MAX
+
+#define TTY_NAME_MAX            _POSIX_TTY_NAME_MAX
+
+#define TZNAME_MAX              _POSIX_TZNAME_MAX
+
+
+// From table 2-6.
+
+#define MAX_CANON               _POSIX_MAX_CANON
+
+#define MAX_INPUT               _POSIX_MAX_INPUT
+
+#define PIPE_BUF                _POSIX_PIPE_BUF
+
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_LIMITS_H
+// End of limits.h
diff --git a/packages/compat/posix/v2_0/include/mutex.h b/packages/compat/posix/v2_0/include/mutex.h
new file mode 100644 (file)
index 0000000..687479e
--- /dev/null
@@ -0,0 +1,172 @@
+#ifndef CYGONCE_POSIX_MUTEX_H
+#define CYGONCE_POSIX_MUTEX_H
+//=============================================================================
+//
+//      mutex.h
+//
+//      POSIX mutex and condition variable function definitions
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg,jlarmour
+// Contributors:  
+// Date:          2001-09-10
+// Purpose:       POSIX mutex and condition variable function definitions
+// Description:   This header contains POSIX API definitions for mutexes
+//                and cond vars.
+//              
+// Usage:         #include <pthread.h>
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/posix.h>
+
+#include <sys/types.h>   // pthread_* types
+
+//=============================================================================
+// Mutexes
+
+//-----------------------------------------------------------------------------
+// Mutex attributes manipulation functions
+
+// Initialize attribute object
+externC int pthread_mutexattr_init ( pthread_mutexattr_t *attr);
+
+// Destroy attribute object
+externC int pthread_mutexattr_destroy ( pthread_mutexattr_t *attr);
+
+#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
+
+// Set priority inversion protection protocol
+externC int pthread_mutexattr_setprotocol ( pthread_mutexattr_t *attr,
+                                            int protocol);
+
+// Get priority inversion protection protocol
+externC int pthread_mutexattr_getprotocol ( pthread_mutexattr_t *attr,
+                                            int *protocol);
+
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+
+// Set priority for priority ceiling protocol
+externC int pthread_mutexattr_setprioceiling ( pthread_mutexattr_t *attr,
+                                               int prioceiling);
+
+// Get priority for priority ceiling protocol
+externC int pthread_mutexattr_getprioceiling ( pthread_mutexattr_t *attr,
+                                               int *prioceiling);
+
+// Set priority ceiling of given thread, returning old ceiling.
+externC int pthread_mutex_setprioceiling( pthread_mutex_t *mutex,
+                                          int prioceiling,
+                                          int *old_ceiling);
+
+// Get priority ceiling of given thread
+externC int pthread_mutex_getprioceiling( pthread_mutex_t *mutex,
+                                          int *prioceiling);
+#endif
+
+#endif
+
+//-----------------------------------------------------------------------------
+// Mutex functions
+
+// Initialize mutex. If mutex_attr is NULL, use default attributes.
+externC int pthread_mutex_init (pthread_mutex_t *mutex,
+                                const pthread_mutexattr_t *mutex_attr);
+
+// Destroy mutex.
+externC int pthread_mutex_destroy (pthread_mutex_t *mutex);
+
+// Lock mutex, waiting for it if necessary.
+externC int pthread_mutex_lock (pthread_mutex_t *mutex);
+
+// Try to lock mutex.
+externC int pthread_mutex_trylock (pthread_mutex_t *mutex);
+
+
+// Unlock mutex.
+externC int pthread_mutex_unlock (pthread_mutex_t *mutex);
+
+
+
+//=============================================================================
+// Condition Variables
+
+//-----------------------------------------------------------------------------
+// Attribute manipulation functions
+// We do not actually support any attributes at present, so these do nothing.
+
+// Initialize condition variable attributes
+externC int pthread_condattr_init (pthread_condattr_t *attr);
+
+// Destroy condition variable attributes
+externC int pthread_condattr_destroy (pthread_condattr_t *attr);
+
+//-----------------------------------------------------------------------------
+// Condition variable functions
+
+// Initialize condition variable.
+externC int pthread_cond_init (pthread_cond_t *cond,
+                               const pthread_condattr_t *attr);
+
+// Destroy condition variable.
+externC int pthread_cond_destroy (pthread_cond_t *cond);
+
+// Wake up one thread waiting for condition variable
+externC int pthread_cond_signal (pthread_cond_t *cond);
+
+// Wake up all threads waiting for condition variable
+externC int pthread_cond_broadcast (pthread_cond_t *cond);
+
+// Block on condition variable until signalled. The mutex is
+// assumed to be locked before this call, will be unlocked
+// during the wait, and will be re-locked on wakeup.
+externC int pthread_cond_wait (pthread_cond_t *cond,
+                               pthread_mutex_t *mutex);
+
+// Block on condition variable until signalled, or the timeout expires.
+externC int pthread_cond_timedwait (pthread_cond_t *cond,
+                                    pthread_mutex_t *mutex,
+                                    const struct timespec *abstime);
+
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_POSIX_MUTEX_H
+// End of mutex.h
diff --git a/packages/compat/posix/v2_0/include/muttypes.h b/packages/compat/posix/v2_0/include/muttypes.h
new file mode 100644 (file)
index 0000000..91ddc86
--- /dev/null
@@ -0,0 +1,138 @@
+#ifndef CYGONCE_POSIX_MUTTYPES_H
+#define CYGONCE_POSIX_MUTTYPES_H
+//=============================================================================
+//
+//      muttypes.h
+//
+//      POSIX mutex types header
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg
+// Contributors:  nickg,jlarmour
+// Date:          2000-03-17
+// Purpose:       POSIX types header
+// Description:   This header contains POSIX type definitions for mutexes
+//                and cond vars. These types are implementation defined.
+//              
+// Usage:         #include <sys/types.h>
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/posix.h>
+#include <pkgconf/kernel.h>
+
+#include <cyg/infra/cyg_type.h>
+
+//-----------------------------------------------------------------------------
+// Mutex object
+// This structure must exactly correspond in size and layout to the underlying
+// eCos C++ class that implements this object. Because we have to support
+// PTHREAD_MUTEX_INITIALIZER we cannot abstract this object very easily.
+
+typedef struct
+{
+    CYG_WORD32  locked;
+    CYG_ADDRESS owner;
+    CYG_ADDRESS queue;
+
+#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
+    CYG_WORD32  protocol;       // this mutex's protocol
+#endif    
+    
+#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
+    CYG_WORD32  ceiling;        // mutex priority ceiling
+#endif
+    
+} pthread_mutex_t;
+
+#if defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC) &&\
+    defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING)
+#define PTHREAD_MUTEX_INITIALIZER { 0, 0, 0, 0, 0 }
+#elif defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC) ||\
+    defined(CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING)
+#define PTHREAD_MUTEX_INITIALIZER { 0, 0, 0, 0 }
+#else
+#define PTHREAD_MUTEX_INITIALIZER { 0, 0, 0 }
+#endif
+
+//-----------------------------------------------------------------------------
+// Mutex attributes structure
+
+typedef struct
+{
+    int         protocol;
+#ifdef _POSIX_THREAD_PRIO_PROTECT    
+    int         prioceiling;
+#endif    
+} pthread_mutexattr_t;
+
+// Values for protocol
+#define PTHREAD_PRIO_NONE       1
+#if defined(_POSIX_THREAD_PRIO_INHERIT)
+#define PTHREAD_PRIO_INHERIT    2
+#endif
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+#define PTHREAD_PRIO_PROTECT    3
+#endif
+
+//-----------------------------------------------------------------------------
+// Condition Variable structure.
+// Like mutexes, this must match the underlying eCos implementation class.
+
+typedef struct
+{
+    CYG_ADDRESS         mutex;
+    CYG_ADDRESS         queue;    
+} pthread_cond_t;
+
+#define PTHREAD_COND_INITIALIZER { 0, 0 }
+
+//-----------------------------------------------------------------------------
+// Condition variable attributes structure
+
+typedef struct
+{
+    int         dummy;
+} pthread_condattr_t;
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_POSIX_MUTTYPES_H
+// End of muttypes.h
diff --git a/packages/compat/posix/v2_0/include/pthread.h b/packages/compat/posix/v2_0/include/pthread.h
new file mode 100644 (file)
index 0000000..a7a5c15
--- /dev/null
@@ -0,0 +1,320 @@
+#ifndef CYGONCE_PTHREAD_H
+#define CYGONCE_PTHREAD_H
+//=============================================================================
+//
+//      pthread.h
+//
+//      POSIX pthread header
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg
+// Contributors:  nickg
+// Date:          2000-03-17
+// Purpose:       POSIX pthread header
+// Description:   This header contains all the definitions needed to support
+//                pthreads under eCos. The reader is referred to the POSIX
+//                standard or equivalent documentation for details of the
+//                functionality contained herein.
+//              
+// Usage:
+//              #include <pthread.h>
+//              ...
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/posix.h>
+
+#include <cyg/infra/cyg_type.h>
+
+#include <cyg/hal/hal_arch.h>   // CYGNUM_HAL_STACK_SIZE_MINIMUM
+
+#include <stddef.h>             // NULL, size_t
+
+#include <limits.h>
+
+#include <sys/types.h>
+
+#include <sched.h>              // SCHED_*
+
+//=============================================================================
+// General thread operations
+
+//-----------------------------------------------------------------------------
+// Thread creation and management.
+
+// Create a thread.
+__externC int pthread_create (pthread_t *__pthread,
+                              const pthread_attr_t *__attr,
+                              void *(*__start_routine) (void *),
+                              void *__arg);
+
+// Get current thread id.
+__externC pthread_t pthread_self (void);
+
+// Compare two thread identifiers.
+__externC int pthread_equal (pthread_t __thread1, pthread_t __thread2);
+
+// Terminate current thread.
+__externC void pthread_exit (void *__retval) CYGBLD_ATTRIB_NORET;
+
+// Wait for the thread to terminate. If thread_return is not NULL then
+// the retval from the thread's call to pthread_exit() is stored at
+// *thread_return.
+__externC int pthread_join (pthread_t __pthread, void **__thread_return);
+
+// Set the detachstate of the thread to "detached". The thread then does not
+// need to be joined and its resources will be freed when it exits.
+__externC int pthread_detach (pthread_t __pthread);
+
+//-----------------------------------------------------------------------------
+// Thread attribute handling.
+
+// Initialize attributes object with default attributes:
+// detachstate          == PTHREAD_JOINABLE
+// scope                == PTHREAD_SCOPE_SYSTEM
+// inheritsched         == PTHREAD_EXPLICIT_SCHED
+// schedpolicy          == SCHED_OTHER
+// schedparam           == unset
+// stackaddr            == unset
+// stacksize            == 0
+// 
+__externC int pthread_attr_init (pthread_attr_t *__attr);
+
+// Destroy thread attributes object
+__externC int pthread_attr_destroy (pthread_attr_t *__attr);
+
+
+// Set the detachstate attribute
+__externC int pthread_attr_setdetachstate (pthread_attr_t *__attr,
+                                           int __detachstate);
+
+// Get the detachstate attribute
+__externC int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
+                                           int *__detachstate);
+
+
+// Set scheduling contention scope
+__externC int pthread_attr_setscope (pthread_attr_t *__attr, int __scope);
+
+// Get scheduling contention scope
+__externC int pthread_attr_getscope (const pthread_attr_t *__attr, int *__scope);
+
+
+// Set scheduling inheritance attribute
+__externC int pthread_attr_setinheritsched (pthread_attr_t *__attr, int __inherit);
+
+// Get scheduling inheritance attribute
+__externC int pthread_attr_getinheritsched (const pthread_attr_t *__attr,
+                                            int *__inherit);
+
+
+// Set scheduling policy
+__externC int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy);
+
+// Get scheduling policy
+__externC int pthread_attr_getschedpolicy (const pthread_attr_t *__attr,
+                                           int *__policy);
+
+
+// Set scheduling parameters
+__externC int pthread_attr_setschedparam (pthread_attr_t *__attr,
+                                          const struct sched_param *__param);
+
+// Get scheduling parameters
+__externC int pthread_attr_getschedparam (const pthread_attr_t *__attr,
+                                          struct sched_param *__param);
+
+
+// Set starting address of stack. Whether this is at the start or end of
+// the memory block allocated for the stack depends on whether the stack
+// grows up or down.
+__externC int pthread_attr_setstackaddr (pthread_attr_t *__attr, void *__stackaddr);
+
+// Get any previously set stack address.
+__externC int pthread_attr_getstackaddr (const pthread_attr_t *__attr,
+                                         void **__stackaddr);
+
+
+// Set minimum creation stack size.
+__externC int pthread_attr_setstacksize (pthread_attr_t *__attr,
+                                         size_t __stacksize);
+
+// Get current minimal stack size.
+__externC int pthread_attr_getstacksize (const pthread_attr_t *__attr,
+                                         size_t *__stacksize);
+
+//-----------------------------------------------------------------------------
+// Thread scheduling controls
+
+// Set scheduling policy and parameters for the thread
+__externC int pthread_setschedparam (pthread_t __pthread,
+                                     int __policy,
+                                     const struct sched_param *__param);
+
+// Get scheduling policy and parameters for the thread
+__externC int pthread_getschedparam (pthread_t __pthread,
+                                     int *__policy,
+                                     struct sched_param *__param);
+
+
+
+//=============================================================================
+// Dynamic package initialization
+
+// Initializer for pthread_once_t instances
+#define PTHREAD_ONCE_INIT       0
+
+// Call init_routine just the once per control variable.
+__externC int pthread_once (pthread_once_t *__once_control,
+                            void (*__init_routine) (void));
+
+
+
+//=============================================================================
+//Thread specific data
+
+// Create a key to identify a location in the thread specific data area.
+// Each thread has its own distinct thread-specific data area but all are
+// addressed by the same keys. The destructor function is called whenever a
+// thread exits and the value associated with the key is non-NULL.
+__externC int pthread_key_create (pthread_key_t *__key,
+                                  void (*__destructor) (void *));
+
+// Delete key.
+__externC int pthread_key_delete (pthread_key_t __key);
+
+// Store the pointer value in the thread-specific data slot addressed
+// by the key.
+__externC int pthread_setspecific (pthread_key_t __key, const void *__pointer);
+
+// Retrieve the pointer value in the thread-specific data slot addressed
+// by the key.
+__externC void *pthread_getspecific (pthread_key_t __key);
+
+
+
+//=============================================================================
+// Thread Cancellation
+
+//-----------------------------------------------------------------------------
+// Data structure used to manage cleanup functions
+
+struct pthread_cleanup_buffer
+{
+    struct pthread_cleanup_buffer *prev;        // Chain cleanup buffers
+    void (*routine) (void *);                  // Function to call
+    void *arg;                                 // Arg to pass
+};
+
+//-----------------------------------------------------------------------------
+// Thread cancelled return value.
+// This is a value returned as the retval in pthread_join() of a
+// thread that has been cancelled. By making it the address of a
+// location we define we can ensure that it differs from NULL and any
+// other valid pointer (as required by the standard).
+
+__externC int pthread_canceled_dummy_var;
+
+#define PTHREAD_CANCELED                ((void *)(&pthread_canceled_dummy_var))
+
+//-----------------------------------------------------------------------------
+// Cancelability enable and type
+
+#define PTHREAD_CANCEL_ENABLE           1
+#define PTHREAD_CANCEL_DISABLE          2
+
+#define PTHREAD_CANCEL_ASYNCHRONOUS     1
+#define PTHREAD_CANCEL_DEFERRED         2
+
+//-----------------------------------------------------------------------------
+// Functions
+
+// Set cancel state of current thread to ENABLE or DISABLE.
+// Returns old state in *oldstate.
+__externC int pthread_setcancelstate (int __state, int *__oldstate);
+
+// Set cancel type of current thread to ASYNCHRONOUS or DEFERRED.
+// Returns old type in *oldtype.
+__externC int pthread_setcanceltype (int __type, int *__oldtype);
+
+// Cancel the thread.
+__externC int pthread_cancel (pthread_t __pthread);
+
+// Test for a pending cancellation for the current thread and terminate
+// the thread if there is one.
+__externC void pthread_testcancel (void);
+
+// Install a cleanup routine.
+// Note that pthread_cleanup_push() and pthread_cleanup_pop() are macros that
+// must be used in matching pairs and at the same brace nesting level.
+#define pthread_cleanup_push(__routine, __arg)                          \
+    {                                                                   \
+        struct pthread_cleanup_buffer _buffer_;                         \
+        pthread_cleanup_push_inner (&_buffer_, (__routine), (__arg));
+
+// Remove a cleanup handler installed by the matching pthread_cleanup_push().
+// If execute is non-zero, the handler function is called.
+#define pthread_cleanup_pop(__execute)                          \
+        pthread_cleanup_pop_inner (&_buffer_, (__execute));     \
+    }
+
+
+// These two functions actually implement the cleanup push and pop functionality.
+__externC void pthread_cleanup_push_inner (struct pthread_cleanup_buffer *__buffer,
+                                           void (*__routine) (void *),
+                                           void *__arg);
+
+__externC void pthread_cleanup_pop_inner (struct pthread_cleanup_buffer *__buffer,
+                                          int __execute);
+
+
+// -------------------------------------------------------------------------
+// eCos-specific function to measure stack usage of the supplied thread
+
+#ifdef CYGFUN_KERNEL_THREADS_STACK_MEASUREMENT
+__externC size_t pthread_measure_stack_usage (pthread_t __pthread);
+#endif
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_PTHREAD_H
+// End of pthread.h
diff --git a/packages/compat/posix/v2_0/include/semaphore.h b/packages/compat/posix/v2_0/include/semaphore.h
new file mode 100644 (file)
index 0000000..2f88a6d
--- /dev/null
@@ -0,0 +1,127 @@
+#ifndef CYGONCE_SEMAPHORE_H
+#define CYGONCE_SEMAPHORE_H
+//=============================================================================
+//
+//      semaphore.h
+//
+//      POSIX semaphore header
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg
+// Contributors:  nickg
+// Date:          2000-03-17
+// Purpose:       POSIX semaphore header
+// Description:   This header contains all the definitions needed to support
+//                semaphores under eCos. The reader is referred to the POSIX
+//                standard or equivalent documentation for details of the
+//                functionality contained herein.
+//              
+// Usage:
+//              #include <semaphore.h>
+//              ...
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/posix.h>
+
+#include <stddef.h>             // NULL, size_t
+
+#include <limits.h>
+
+#include <sys/types.h>
+
+//-----------------------------------------------------------------------------
+// Semaphore object definition
+
+// This structure must exactly correspond in size and layout to the underlying
+// eCos C++ class that implements this object.
+
+typedef struct
+{
+  CYG_WORD32    sem_value;
+  CYG_ADDRESS   sem_queue;
+} sem_t;
+
+//-----------------------------------------------------------------------------
+// Semaphore functions
+
+// Initialize semaphore to value.
+// pshared is not supported under eCos.
+externC int sem_init  (sem_t *sem, int pshared, unsigned int value);
+
+// Destroy the semaphore.
+externC int sem_destroy  (sem_t *sem);
+
+// Decrement value if >0 or wait for a post.
+externC int sem_wait  (sem_t *sem);
+
+// Decrement value if >0, return -1 if not.
+externC int sem_trywait  (sem_t *sem);
+
+// Increment value and wake a waiter if one is present.
+externC int sem_post  (sem_t *sem);
+
+// Get current value
+externC int sem_getvalue  (sem_t *sem, int *sval);
+
+//-----------------------------------------------------------------------------
+// Named semaphore functions
+// These are an optional feature under eCos
+
+// Open an existing named semaphore, or create it.
+externC sem_t *sem_open  (const char *name, int oflag, ...);
+
+// Close descriptor for semaphore.
+externC int sem_close  (sem_t *sem);
+
+// Remove named semaphore
+externC int sem_unlink  (const char *name);
+
+//-----------------------------------------------------------------------------
+// Special return value for sem_open()
+
+#define SEM_FAILED      ((sem_t *)NULL)
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_SEMAPHORE_H
+// End of semaphore.h
diff --git a/packages/compat/posix/v2_0/include/signal.h b/packages/compat/posix/v2_0/include/signal.h
new file mode 100644 (file)
index 0000000..2ccde69
--- /dev/null
@@ -0,0 +1,313 @@
+#ifndef CYGONCE_SIGNAL_H
+#define CYGONCE_SIGNAL_H
+//=============================================================================
+//
+//      signal.h
+//
+//      POSIX signal header
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg, jlarmour
+// Contributors:  
+// Date:          2000-03-17
+// Purpose:       POSIX signal header
+// Description:   This header contains all the definitions needed to support
+//                the POSIX signal API under eCos.
+//              
+// Usage:         This file can either be included directly, or indirectly via
+//                the C library signal.h header.
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/posix.h>
+
+#ifdef CYGPKG_POSIX_SIGNALS
+
+#include <stddef.h>             // NULL, size_t
+
+#include <limits.h>
+#include <sys/types.h>
+
+//-----------------------------------------------------------------------------
+// POSIX feature test macros
+
+// We do not support job control
+#undef _POSIX_JOB_CONTROL
+
+//-----------------------------------------------------------------------------
+// Manifest constants
+
+#ifdef _POSIX_REALTIME_SIGNALS
+// For now we define the topmost 8 signals as realtime
+#define SIGRTMIN                24
+#define SIGRTMAX                31
+#endif
+
+//-----------------------------------------------------------------------------
+// forward references
+
+struct timespec;
+
+//-----------------------------------------------------------------------------
+// Sigval structure
+
+union sigval
+{
+    int   sival_int;    // used when application-defined value is an int
+    void  *sival_ptr;   // used when application-defined value is a pointer
+};
+
+//-----------------------------------------------------------------------------
+// Siginfo structure passed to an SA_SIGINFO style handler
+
+typedef struct
+{
+    int          si_signo;      // signal number
+    int          si_code;       // cause of signal
+    union sigval si_value;      // signal value
+} siginfo_t;
+
+// Values for si_code
+# define SI_USER       1
+# define SI_QUEUE      2
+# define SI_TIMER      3
+# define SI_ASYNCIO    4
+# define SI_MESGQ      5
+# define SI_EXCEPT      6       // signal is result of an exception delivery
+
+//-----------------------------------------------------------------------------
+// Basic types
+
+// Integral type that can be accessed atomically - from ISO C 7.7
+typedef cyg_atomic sig_atomic_t;
+
+// Type of signal handler functions
+typedef void (*sa_sighandler_t)(int);
+
+// Type of signal handler used if SA_SIGINFO is set in sa_flags
+typedef void (*sa_siginfoaction_t)(int signo, siginfo_t *info,
+                                  void *context);
+
+//-----------------------------------------------------------------------------
+//Signal handlers for use with signal() and sigaction(). We avoid 0
+//because in an embedded system this may be start of ROM and thus
+//a possible function pointer for reset.
+
+#define SIG_DFL ((sa_sighandler_t) 1)      // Default action
+#define SIG_IGN ((sa_sighandler_t) 2)      // Ignore action
+#define SIG_ERR ((sa_sighandler_t)-1)      // Error return
+
+//-----------------------------------------------------------------------------
+// Signal values
+
+#define SIGNULL   0    // Reserved signal - do not use (POSIX 3.3.1.1)
+#define SIGHUP    1    // Hangup on controlling terminal (POSIX)
+#define SIGINT    2    // Interactive attention (ISO C)
+#define SIGQUIT   3    // Interactive termination (POSIX)
+#define SIGILL    4    // Illegal instruction (not reset when caught) (ISO C)
+#define SIGTRAP   5    // Trace trap (not reset when caught)
+#define SIGIOT    6    // IOT instruction
+#define SIGABRT   6    // Abnormal termination - used by abort() (ISO C)
+#define SIGEMT    7    // EMT instruction
+#define SIGFPE    8    // Floating Point Exception e.g. div by 0 (ISO C)
+#define SIGKILL   9    // Kill (cannot be caught or ignored) (POSIX)
+#define SIGBUS    10   // Bus error (POSIX)
+#define SIGSEGV   11   // Invalid memory reference (ISO C)
+#define SIGSYS    12   // Bad argument to system call (used by anything?)
+#define SIGPIPE   13   // Write on a pipe with no one to read it (POSIX)
+#define SIGALRM   14   // Alarm timeout (POSIX)
+#define SIGTERM   15   // Software termination request (ISO C)
+#define SIGUSR1   16   // Application-defined signal 1 (POSIX)
+#define SIGUSR2   17   // Application-defined signal 2 (POSIX)
+
+
+//-----------------------------------------------------------------------------
+// Signal sets.
+// At present we define a single 32 bit integer mask. We may need, at
+// some future point, to extend this to 64 bits, or a structure
+// containing an array of masks.
+
+typedef cyg_uint32 sigset_t;
+
+//-----------------------------------------------------------------------------
+// struct sigaction describes the action to be taken when we get a signal
+
+struct sigaction
+{
+    sigset_t               sa_mask;             // Additional signals to be blocked
+    int                    sa_flags;            // Special flags
+    union
+    {
+        sa_sighandler_t    sa_handler;          // signal handler
+        sa_siginfoaction_t sa_sigaction;        // Function to call instead of
+                                                // sa_handler if SA_SIGINFO is
+                                                // set in sa_flags
+    } sa_sigactionhandler;
+#define sa_handler   sa_sigactionhandler.sa_handler
+#define sa_sigaction sa_sigactionhandler.sa_sigaction
+};
+
+// sa_flag bits
+#define SA_NOCLDSTOP 1   // Don't generate SIGCHLD when children stop
+#define SA_SIGINFO   2   // Use the sa_siginfoaction_t style signal
+                         // handler, instead of the single argument handler
+
+//-----------------------------------------------------------------------------
+// Sigevent structure.
+
+struct sigevent
+{
+    int                  sigev_notify;
+    int                  sigev_signo;
+    union sigval         sigev_value;
+    void               (*sigev_notify_function) (union sigval);
+    pthread_attr_t      *sigev_notify_attributes;
+};
+
+# define SIGEV_NONE    1
+# define SIGEV_SIGNAL   2
+# define SIGEV_THREAD  3
+
+//-----------------------------------------------------------------------------
+// Functions to generate signals
+
+// Deliver sig to a process.
+// eCos only supports the value 0 for pid.
+externC int kill (pid_t pid, int sig);
+
+externC int pthread_kill (pthread_t thread, int sig);
+
+//-----------------------------------------------------------------------------
+// Functions to catch signals
+
+// Install signal handler for sig.
+externC int sigaction  (int sig, const struct sigaction *act,
+                        struct sigaction *oact);
+
+// Queue signal to process with value.
+externC int sigqueue  (pid_t pid, int sig, const union sigval value);
+
+//-----------------------------------------------------------------------------
+// Functions to deal with current blocked and pending masks
+
+// Set process blocked signal mask
+externC int sigprocmask  (int how, const sigset_t *set, sigset_t *oset);
+
+// Set calling thread's blocked signal mask
+externC int pthread_sigmask (int how, const sigset_t *set, sigset_t *oset);
+
+// Get set of pending signals for this process
+externC int sigpending  (sigset_t *set);
+
+// Values for the how arguments:
+#define SIG_BLOCK       1
+#define SIG_UNBLOCK     2
+#define SIG_SETMASK     3
+
+//-----------------------------------------------------------------------------
+// Wait for or accept signals
+
+// Block signals in set and wait for a signal
+externC int sigsuspend  (const sigset_t *set);
+
+// Wait for a signal in set to arrive
+externC int sigwait  (const sigset_t *set, int *sig);
+
+// Do the same as sigwait() except return a siginfo_t object too.
+externC int sigwaitinfo  (const sigset_t *set, siginfo_t *info);
+
+// Do the same as sigwaitinfo() but return anyway after timeout.
+externC int sigtimedwait  (const sigset_t *set, siginfo_t *info,
+                           const struct timespec *timeout);
+
+//-----------------------------------------------------------------------------
+// Signal sets
+
+// Clear all signals from set.
+externC int sigemptyset  (sigset_t *set);
+
+// Set all signals in set.
+externC int sigfillset  (sigset_t *set);
+
+// Add signo to set.
+externC int sigaddset  (sigset_t *set, int signo);
+
+// Remove signo from set.
+externC int sigdelset  (sigset_t *set, int signo);
+
+// Test whether signo is in set
+externC int sigismember  (const sigset_t *set, int signo);
+
+//-----------------------------------------------------------------------------
+// alarm, pause and sleep
+
+// Generate SIGALRM after some number of seconds
+externC unsigned int alarm( unsigned int seconds );
+
+// Wait for a signal to be delivered.
+externC int pause( void );
+
+// Wait for a signal, or the given number of seconds
+externC unsigned int sleep( unsigned int seconds );
+
+//-----------------------------------------------------------------------------
+// signal() - ISO C 7.7.1   //
+//
+// Installs a new signal handler for the specified signal, and returns
+// the old handler
+//
+
+externC sa_sighandler_t signal(int __sig, sa_sighandler_t __handler);
+
+// raise() - ISO C 7.7.2 //
+//
+// Raises the signal, which will cause the current signal handler for
+// that signal to be called
+
+externC int raise(int __sig);
+
+#endif // ifdef CYGPKG_POSIX_SIGNALS
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_SIGNAL_H
+// End of signal.h
diff --git a/packages/compat/posix/v2_0/include/sigsetjmp.h b/packages/compat/posix/v2_0/include/sigsetjmp.h
new file mode 100644 (file)
index 0000000..ff4a332
--- /dev/null
@@ -0,0 +1,94 @@
+#ifndef CYGONCE_SIGSETJMP_H
+#define CYGONCE_SIGSETJMP_H
+//=============================================================================
+//
+//      sigsetjmp.h
+//
+//      POSIX sigsetjmp header
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg, jlarmour
+// Contributors:  
+// Date:          2000-03-17
+// Purpose:       POSIX sigsetjmp header
+// Description:   This header contains all the definitions needed to support
+//                the POSIX sigsetjmp/siglongjmp API under eCos.
+//              
+// Usage:         This file must be included indirectly via
+//                the C library setjmp.h header.
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <signal.h>
+#include <cyg/hal/hal_arch.h>       // hal_jmp_buf
+
+//=============================================================================
+// sigjmp_buf structure
+// The API requires this to be an array type, but this array actually
+// contains three fields:
+// 0..sizeof(hal_jmp_buf)-1               HAL jump buffer
+// sizeof(hal_jmp_buf)                    savemask value (an int)
+// sizeof(hal_jmp_buf)+sizeof(int)...     sigset_t containing saved mask
+
+typedef struct {
+    hal_jmp_buf __jmp_buf;
+    int  __savemask;
+    sigset_t __sigsavemask;
+} sigjmp_buf[1];
+
+//=============================================================================
+// sigsetjmp() macro
+
+#define sigsetjmp( _env_, _savemask_ )                                        \
+(                                                                             \
+ ((_env_)[0].__savemask = _savemask_),                                        \
+ ((_savemask_)?pthread_sigmask(SIG_BLOCK,NULL,&((_env_)[0].__sigsavemask)):0),\
+ hal_setjmp((_env_)[0].__jmp_buf)                                             \
+)
+
+//=============================================================================
+// siglongjmp function
+
+__externC void siglongjmp( sigjmp_buf env, int val );
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_SIGSETJMP_H
+// End of sigsetjmp.h
diff --git a/packages/compat/posix/v2_0/include/time.h b/packages/compat/posix/v2_0/include/time.h
new file mode 100644 (file)
index 0000000..67cdbdb
--- /dev/null
@@ -0,0 +1,151 @@
+#ifndef CYGONCE_POSIX_TIME_H
+#define CYGONCE_POSIX_TIME_H
+/*=============================================================================
+//
+//      time.h
+//
+//      POSIX time header
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg
+// Contributors:  nickg, jlarmour
+// Date:          2000-03-17
+// Purpose:       POSIX time header
+// Description:   This header contains all the definitions needed to support
+//                the POSIX timer and timer API under eCos.
+//              
+// Usage:         Do not include this file directly - instead include <time.h>
+//              
+//
+//####DESCRIPTIONEND####
+//
+//===========================================================================*/
+
+#include <pkgconf/posix.h>
+#include <cyg/infra/cyg_type.h>
+
+/*---------------------------------------------------------------------------*/
+/* Types for timers and clocks */
+
+typedef int clockid_t;
+
+#ifdef CYGPKG_POSIX_TIMERS
+typedef int timer_t;
+
+/* forward declaration - if the app uses it it will have to include
+ * signal.h anyway
+ */
+struct sigevent;
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Structures */
+
+struct timespec
+{
+    time_t      tv_sec;
+    long        tv_nsec;
+};
+
+#ifdef CYGPKG_POSIX_TIMERS
+struct itimerspec
+{
+    struct timespec     it_interval;
+    struct timespec     it_value;
+};
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Manifest constants */
+
+#define CLOCK_REALTIME          0
+
+#ifdef CYGPKG_POSIX_TIMERS
+#define TIMER_ABSTIME           1
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Clock functions */
+
+/* Set the clocks current time */
+__externC int clock_settime( clockid_t clock_id, const struct timespec *tp);
+
+/* Get the clocks current time */
+__externC int clock_gettime( clockid_t clock_id, struct timespec *tp);
+
+/* Get the clocks resolution */
+__externC int clock_getres( clockid_t clock_id, struct timespec *tp);
+
+
+/*---------------------------------------------------------------------------*/
+/* Timer functions */
+
+#ifdef CYGPKG_POSIX_TIMERS
+
+/* Create a timer based on the given clock. */
+__externC int timer_create( clockid_t clock_id,
+                            struct sigevent *evp,
+                            timer_t *timer_id);
+
+/* Delete the timer */
+__externC int timer_delete( timer_t timer_id );
+
+/* Set the expiration time of the timer. */
+__externC int timer_settime( timer_t timerid, int flags,
+                             const struct itimerspec *value,
+                             struct itimerspec *ovalue );
+
+/* Get current timer values */
+__externC int timer_gettime( timer_t timerid, struct itimerspec *value );
+
+/* Get number of missed triggers */
+__externC int timer_getoverrun( timer_t timerid );
+
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Nanosleep */
+
+/* Sleep for the given time. */
+__externC int nanosleep( const struct timespec *rqtp,
+                         struct timespec *rmtp);
+
+
+/*---------------------------------------------------------------------------*/
+#endif /* ifndef CYGONCE_POSIX_TIME_H */
+/* End of time.h */
diff --git a/packages/compat/posix/v2_0/include/types.h b/packages/compat/posix/v2_0/include/types.h
new file mode 100644 (file)
index 0000000..dc74e0f
--- /dev/null
@@ -0,0 +1,112 @@
+#ifndef CYGONCE_POSIX_TYPES_H
+#define CYGONCE_POSIX_TYPES_H
+//=============================================================================
+//
+//      types.h
+//
+//      POSIX types header
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg
+// Contributors:  nickg
+// Date:          2000-03-17
+// Purpose:       POSIX types header
+// Description:   This header contains various POSIX type definitions. These types
+//                are implementation defined.
+//              
+// Usage:         #include <sys/types.h>
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/posix.h>
+
+#include <cyg/infra/cyg_type.h>
+
+//-----------------------------------------------------------------------------
+// Basic types.
+
+typedef cyg_uint32 pthread_t;
+typedef int pthread_key_t;
+typedef int pthread_once_t;
+
+//-----------------------------------------------------------------------------
+// Scheduling parameters. At present only the priority is defined.
+// Strictly this should be in <sched.h>, but the requirement for pthread_attr_t
+// to contain a sched_param object means that it must be here.
+
+struct sched_param
+{
+    int                 sched_priority;
+};
+
+//-----------------------------------------------------------------------------
+// Thread attribute structure.
+
+typedef struct pthread_attr_t
+{
+    unsigned int        detachstate:2,
+                        scope:2,
+                        inheritsched:2,
+                        schedpolicy:2,
+                        stackaddr_valid:1,
+                        stacksize_valid:1;
+    struct sched_param  schedparam;
+    void                *stackaddr;
+    size_t              stacksize;
+} pthread_attr_t;
+
+// Values for detachstate
+#define PTHREAD_CREATE_JOINABLE                1
+#define PTHREAD_CREATE_DETACHED                2
+
+// Values for scope
+#define PTHREAD_SCOPE_SYSTEM            1
+#define PTHREAD_SCOPE_PROCESS           2
+
+// Values for inheritsched
+#define PTHREAD_INHERIT_SCHED           1
+#define PTHREAD_EXPLICIT_SCHED          2
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_POSIX_TYPES_H
+// End of types.h
diff --git a/packages/compat/posix/v2_0/include/utsname.h b/packages/compat/posix/v2_0/include/utsname.h
new file mode 100644 (file)
index 0000000..3f0b79c
--- /dev/null
@@ -0,0 +1,98 @@
+#ifndef CYGONCE_UTSNAME_H
+#define CYGONCE_UTSNAME_H
+//=============================================================================
+//
+//      utsname.h
+//
+//      POSIX utsname header
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg
+// Contributors:  nickg
+// Date:          2000-03-17
+// Purpose:       POSIX utsname header
+// Description:   This header contains all the definitions needed to support
+//                utsnames under eCos. The reader is referred to the POSIX
+//                standard or equivalent documentation for details of the
+//                functionality contained herein.
+//              
+// Usage:
+//              #include <utsname.h>
+//              ...
+//              
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/posix.h>
+
+#include <cyg/infra/cyg_type.h>
+
+#include <cyg/hal/hal_arch.h>   // CYGNUM_HAL_STACK_SIZE_MINIMUM
+
+#include <stddef.h>             // NULL, size_t
+
+#include <limits.h>
+
+#include <sys/types.h>
+
+#include <sched.h>              // SCHED_*
+
+//=============================================================================
+// UTSName structure
+
+struct utsname
+{
+    char        sysname[CYG_POSIX_UTSNAME_LENGTH];
+    char        nodename[CYG_POSIX_UTSNAME_NODENAME_LENGTH];
+    char        release[CYG_POSIX_UTSNAME_LENGTH];
+    char        version[CYG_POSIX_UTSNAME_LENGTH];
+    char        machine[CYG_POSIX_UTSNAME_LENGTH];
+};
+
+//=============================================================================
+// uname() function
+
+__externC int uname( struct utsname *name );
+
+//-----------------------------------------------------------------------------
+#endif // ifndef CYGONCE_UTSNAME_H
+// End of utsname.h
diff --git a/packages/compat/posix/v2_0/src/except.cxx b/packages/compat/posix/v2_0/src/except.cxx
new file mode 100644 (file)
index 0000000..a82913b
--- /dev/null
@@ -0,0 +1,343 @@
+//==========================================================================
+//
+//      except.cxx
+//
+//      POSIX exception translation
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-03-27
+// Purpose:             POSIX exception translation
+// Description:         This file contains code to translate eCos hardware
+//                      exceptions into POSIX signals.
+//              
+//              
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/posix.h>
+
+#include <cyg/kernel/ktypes.h>          // base kernel types
+#include <cyg/infra/cyg_trac.h>         // tracing macros
+#include <cyg/infra/cyg_ass.h>          // assertion macros
+
+#include <cyg/infra/diag.h>
+
+#include "pprivate.h"                   // POSIX private header
+
+#include <signal.h>                     // our header
+
+#include <cyg/kernel/thread.inl>
+
+//==========================================================================
+// Translation table from eCos exceptions to POSIX signals.
+
+static const struct
+{
+    cyg_code    exception;
+    int         signal;
+} exception_signal_mapping[] =
+{
+#ifdef CYGNUM_HAL_EXCEPTION_DATA_ACCESS
+    {CYGNUM_HAL_EXCEPTION_DATA_ACCESS, SIGBUS},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_DATA_WRITE
+    {CYGNUM_HAL_EXCEPTION_DATA_WRITE, SIGBUS},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_CODE_ACCESS
+    {CYGNUM_HAL_EXCEPTION_CODE_ACCESS, SIGBUS},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_CODE_WRITE
+    {CYGNUM_HAL_EXCEPTION_CODE_WRITE, SIGBUS},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_CODE_EXECUTE
+    {CYGNUM_HAL_EXCEPTION_CODE_EXECUTE, SIGBUS},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_IO_ACCESS
+    {CYGNUM_HAL_EXCEPTION_IO_ACCESS, SIGBUS},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_IO_WRITE
+    {CYGNUM_HAL_EXCEPTION_IO_ACCESS, SIGBUS},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_DATA_TLBMISS_ACCESS
+    {CYGNUM_HAL_EXCEPTION_DATA_TLBMISS_ACCESS, SIGSEGV},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_DATA_TLBMISS_WRITE
+    {CYGNUM_HAL_EXCEPTION_DATA_TLBMISS_WRITE, SIGSEGV},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_CODE_TLBMISS_ACCESS
+    {CYGNUM_HAL_EXCEPTION_CODE_TLBMISS_ACCESS, SIGSEGV},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_CODE_TLBMISS_WRITE
+    {CYGNUM_HAL_EXCEPTION_CODE_TLBMISS_WRITE, SIGSEGV},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_DATA_TLBERROR_ACCESS
+    {CYGNUM_HAL_EXCEPTION_DATA_TLBERROR_ACCESS, SIGSEGV},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_DATA_TLBERROR_WRITE
+    {CYGNUM_HAL_EXCEPTION_DATA_TLBERROR_WRITE, SIGSEGV},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_CODE_TLBERROR_ACCESS
+    {CYGNUM_HAL_EXCEPTION_CODE_TLBERROR_ACCESS, SIGSEGV},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_CODE_TLBERROR_WRITE
+    {CYGNUM_HAL_EXCEPTION_CODE_TLBERROR_WRITE, SIGSEGV},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_ACCESS
+    {CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_ACCESS, SIGBUS},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_WRITE
+    {CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_WRITE, SIGBUS},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_IO_UNALIGNED_ACCESS
+    {CYGNUM_HAL_EXCEPTION_IO_UNALIGNED_ACCESS, SIGBUS},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_IO_UNALIGNED_WRITE
+    {CYGNUM_HAL_EXCEPTION_IO_UNALIGNED_WRITE, SIGBUS},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION
+    {CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION, SIGILL},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_INTERRUPT
+    {CYGNUM_HAL_EXCEPTION_INTERRUPT, SIGINT},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_TRAP
+    {CYGNUM_HAL_EXCEPTION_TRAP, SIGTRAP},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_DIV_BY_ZERO
+    {CYGNUM_HAL_EXCEPTION_DIV_BY_ZERO, SIGFPE},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_OVERFLOW
+    {CYGNUM_HAL_EXCEPTION_OVERFLOW, SIGFPE},
+#endif    
+#ifdef CYGNUM_HAL_EXCEPTION_BOUNDS
+    {CYGNUM_HAL_EXCEPTION_BOUNDS, SIGSEGV},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_SINGLE_STEP
+    {CYGNUM_HAL_EXCEPTION_SINGLE_STEP, SIGTRAP},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_INSTRUCTION_BP
+    {CYGNUM_HAL_EXCEPTION_INSTRUCTION_BP, SIGTRAP},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_PERIPHERAL_BP
+    {CYGNUM_HAL_EXCEPTION_PERIPHERAL_BP, SIGTRAP},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_DATA_BP
+    {CYGNUM_HAL_EXCEPTION_DATA_BP, SIGTRAP},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_DEVELOPMENT_BP
+    {CYGNUM_HAL_EXCEPTION_DEVELOPMENT_BP, SIGTRAP},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_STACK_OVERFLOW
+    {CYGNUM_HAL_EXCEPTION_STACK_OVERFLOW, SIGSEGV},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_STACK_FAULT
+    {CYGNUM_HAL_EXCEPTION_STACK_FAULT, SIGSEGV},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_PARITY
+    {CYGNUM_HAL_EXCEPTION_PARITY, SIGBUS},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_FPU
+    {CYGNUM_HAL_EXCEPTION_FPU, SIGFPE},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_FPU_NOT_AVAIL
+    {CYGNUM_HAL_EXCEPTION_FPU_NOT_AVAIL, SIGFPE},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_FPU_OVERFLOW
+    {CYGNUM_HAL_EXCEPTION_FPU_OVERFLOW, SIGFPE},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_FPU_UNDERFLOW
+    {CYGNUM_HAL_EXCEPTION_FPU_UNDERFLOW, SIGFPE},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_FPU_DIV_BY_ZERO
+    {CYGNUM_HAL_EXCEPTION_FPU_DIV_BY_ZERO, SIGFPE},
+#endif
+#ifdef CYGNUM_HAL_EXCEPTION_SYSTEM_CALL
+    {CYGNUM_HAL_EXCEPTION_SYSTEM_CALL, SIGSYS},
+#endif
+    {0, 0} // dummy value to ensure compiler is happy
+};
+
+//==========================================================================
+// POSIX exception handler
+
+static void cyg_posix_exception_handler(
+    CYG_ADDRWORD        data,                   // user supplied data == signal number
+    cyg_code            exception_number,       // exception being raised
+    CYG_ADDRWORD        exception_info          // any exception specific info
+    )
+{
+    int signo = 0;
+
+    pthread_info *self = pthread_self_info();
+
+    if( self == NULL )
+    {
+        // Not a POSIX thread, just return
+        return;
+    }
+    
+#ifdef CYGSEM_KERNEL_EXCEPTIONS_DECODE
+
+    signo = data;
+
+#else
+
+    for( int i = 0; exception_signal_mapping[i].signal != 0; i++ )    
+    {
+        if( exception_signal_mapping[i].exception == exception_number )
+        {
+            signo = exception_signal_mapping[i].signal;
+            break;
+        }
+    }
+
+#endif
+
+    if( sigismember( &self->sigmask, signo ) )
+    {
+        // The signal is masked in the current thread. POSIX says that
+        // the behaviour is undefined here. We choose to ignore it.
+
+        return;
+    }
+
+    // The kernel exception handler may have disabled interrupts, so
+    // we (re-)enable them here. From this point on we are running in
+    // a context that is effectively just pushed onto the stack of the
+    // current thread. If we return we will unwind and resume
+    // execution from the excepting code. We can also, in theory,
+    // longjump out of the signal handler, and although that is
+    // deprecated, we make sure in cyg_deliver_signals() that it is
+    // possible to do it.
+    
+    HAL_ENABLE_INTERRUPTS();
+    
+    struct sigevent sev;
+
+    sev.sigev_notify           = SIGEV_SIGNAL;
+    sev.sigev_signo            = signo;
+    sev.sigev_value.sival_ptr  = (void *)exception_info;
+
+    // Generate the signal
+    cyg_sigqueue( &sev, SI_EXCEPT );
+
+    // And try to deliver it
+    cyg_deliver_signals();
+}
+
+//==========================================================================
+// Install all the exception handlers
+
+static void install_handlers( Cyg_Thread *thread)
+{
+#ifdef CYGSEM_KERNEL_EXCEPTIONS_DECODE
+
+    // With decoded exceptions, we must install a separate exception
+    // handler for each supported exception.
+
+    for( int i = 0; exception_signal_mapping[i].signal != 0; i++ )
+    {
+        thread->register_exception( exception_signal_mapping[i].exception,
+                                    cyg_posix_exception_handler,
+                                    exception_signal_mapping[i].signal,,
+                                    NULL,
+                                    NULL);
+    }
+    
+#else
+
+    // Otherwise there is just one exception handler for all exceptions.
+    
+    thread->register_exception( CYGNUM_HAL_EXCEPTION_MIN,
+                                cyg_posix_exception_handler,
+                                0,
+                                NULL,
+                                NULL);
+    
+#endif    
+    
+}
+
+//==========================================================================
+// Initialization
+
+externC void cyg_posix_exception_start()
+{
+#ifdef CYGSEM_KERNEL_EXCEPTIONS_GLOBAL
+
+    // With global exceptions, we only need to install a single static
+    // set of exception handlers. Note that by this point in system
+    // initialization the idle thread should be installed as the
+    // current thread, so we pass a pointer to that to
+    // install_handlers(). The identity of the thread passed is
+    // actually irrelevant in this case and is just used as a handle
+    // into the thread class.
+
+    install_handlers( Cyg_Thread::self() );
+    
+#endif    
+}
+
+//==========================================================================
+// Per thread exception initialization and destruction
+
+externC void cyg_pthread_exception_init(pthread_info *thread)
+{
+#ifndef CYGSEM_KERNEL_EXCEPTIONS_GLOBAL
+
+    // With non-global exceptions we must install a new set of handlers
+    // for each thread.
+
+    install_handlers( thread->thread );
+    
+#endif
+}
+
+externC void cyg_pthread_exception_destroy(pthread_info *thread)
+{
+    // Nothing to do at present.
+}
+
+// -------------------------------------------------------------------------
+// EOF except.cxx
diff --git a/packages/compat/posix/v2_0/src/misc.cxx b/packages/compat/posix/v2_0/src/misc.cxx
new file mode 100644 (file)
index 0000000..d56ef91
--- /dev/null
@@ -0,0 +1,386 @@
+//==========================================================================
+//
+//      misc.cxx
+//
+//      POSIX misc function implementations
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-07-18
+// Purpose:             POSIX misc function implementation
+// Description:         This file contains the implementation of miscellaneous POSIX
+//                      functions that do not belong elsewhere.
+//              
+//              
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/posix.h>
+
+#include <cyg/kernel/ktypes.h>         // base kernel types
+#include <cyg/infra/cyg_trac.h>        // tracing macros
+#include <cyg/infra/cyg_ass.h>         // assertion macros
+
+#include "pprivate.h"                   // POSIX private header
+
+#include <unistd.h>
+#include <sys/utsname.h>                // My header
+#include <string.h>                     // strcpy
+#include <limits.h>
+#include <time.h>
+
+#include <cyg/kernel/sched.hxx>
+
+#include <cyg/kernel/sched.inl>
+
+// -------------------------------------------------------------------------
+// Supply some suitable values for constants that may not be present
+// in all configurations.
+
+#ifndef MQ_OPEN_MAX
+#define MQ_OPEN_MAX 0
+#endif
+#ifndef MQ_PRIO_MAX
+#define MQ_PRIO_MAX 0
+#endif
+
+// -------------------------------------------------------------------------
+
+#define __string(_x) #_x
+#define __xstring(_x) __string(_x)
+
+// -------------------------------------------------------------------------
+// uname()
+
+__externC int uname( struct utsname *name )
+{
+    CYG_REPORT_FUNCTYPE( "returning %d" );
+
+    strcpy( name->sysname, "eCos" );
+    strcpy( name->nodename, "" );       // should use gethostname()
+    strcpy( name->release, __xstring( CYGNUM_KERNEL_VERSION_MAJOR ) );
+    strcpy( name->version, __xstring( CYGNUM_KERNEL_VERSION_MINOR ) );
+    strcpy( name->machine, "" );
+
+    CYG_REPORT_RETVAL(0);
+    return 0;
+}
+
+// -------------------------------------------------------------------------
+// sysconf()
+
+#define SC_CASE( _name, _val ) case _name: return _val
+
+__externC long sysconf( int name )
+{
+
+    switch( name )
+    {
+        SC_CASE( _SC_AIO_LISTIO_MAX,                    AIO_LISTIO_MAX );
+        SC_CASE( _SC_AIO_MAX,                           AIO_MAX );
+        SC_CASE( _SC_AIO_PRIO_DELTA_MAX,                AIO_PRIO_DELTA_MAX );
+        SC_CASE( _SC_ARG_MAX,                           ARG_MAX );
+        SC_CASE( _SC_CHILD_MAX,                         CHILD_MAX );
+        SC_CASE( _SC_DELAYTIMER_MAX,                    DELAYTIMER_MAX );
+        SC_CASE( _SC_GETGR_R_SIZE_MAX,                  0 );
+        SC_CASE( _SC_GETPW_R_SIZE_MAX,                  0 );
+        SC_CASE( _SC_LOGIN_NAME_MAX,                    LOGIN_NAME_MAX );
+        SC_CASE( _SC_MQ_OPEN_MAX,                       MQ_OPEN_MAX );
+        SC_CASE( _SC_MQ_PRIO_MAX,                       MQ_PRIO_MAX );
+        SC_CASE( _SC_NGROUPS_MAX,                       NGROUPS_MAX );
+        SC_CASE( _SC_OPEN_MAX,                          OPEN_MAX );
+        SC_CASE( _SC_PAGESIZE,                          PAGESIZE );
+        SC_CASE( _SC_RTSIG_MAX,                         RTSIG_MAX );
+        SC_CASE( _SC_SEM_NSEMS_MAX,                     SEM_NSEMS_MAX );
+        SC_CASE( _SC_SEM_VALUE_MAX,                     SEM_VALUE_MAX );
+        SC_CASE( _SC_SIGQUEUE_MAX,                      SIGQUEUE_MAX );
+        SC_CASE( _SC_STREAM_MAX,                        STREAM_MAX );
+#ifdef CYGPKG_POSIX_PTHREAD
+        SC_CASE( _SC_THREAD_DESTRUCTOR_ITERATIONS,      PTHREAD_DESTRUCTOR_ITERATIONS );
+        SC_CASE( _SC_THREAD_KEYS_MAX,                   PTHREAD_KEYS_MAX );
+        SC_CASE( _SC_THREAD_STACK_MIN,                  PTHREAD_STACK_MIN );
+        SC_CASE( _SC_THREAD_THREADS_MAX,                PTHREAD_THREADS_MAX );
+#endif
+        SC_CASE( _SC_TIMER_MAX,                         TIMER_MAX );
+        SC_CASE( _SC_TTY_NAME_MAX,                      TTY_NAME_MAX );
+        SC_CASE( _SC_TZNAME_MAX,                        TZNAME_MAX );
+        SC_CASE( _SC_VERSION,                           _POSIX_VERSION );
+
+#ifdef CYGPKG_POSIX_TIMERS
+    case _SC_CLK_TCK:
+    {
+        struct timespec ts;
+        ts.tv_sec = 1;
+        ts.tv_nsec = 0;
+        cyg_tick_count ticks = cyg_timespec_to_ticks( &ts );
+        return ticks;
+    }
+#endif
+
+    case _SC_ASYNCHRONOUS_IO:
+    #ifdef _POSIX_ASYNCHRONOUS_IO
+        return 1;
+    #else
+        return -1;
+    #endif
+            
+    case _SC_FSYNC:
+    #ifdef _POSIX_FSYNC
+        return 1;
+    #else
+        return -1;
+    #endif
+                
+    case _SC_JOB_CONTROL:
+    #ifdef _POSIX_JOB_CONTROL
+        return 1;
+    #else
+        return -1;
+    #endif
+                    
+    case _SC_MAPPED_FILES:
+    #ifdef _POSIX_MAPPED_FILES
+        return 1;
+    #else
+        return -1;
+    #endif
+                        
+    case _SC_MEMLOCK:
+    #ifdef _POSIX_MEMLOCK
+        return 1;
+    #else
+        return -1;
+    #endif
+                            
+    case _SC_MEMLOCK_RANGE:
+    #ifdef _POSIX_MEMLOCK_RANGE
+        return 1;
+    #else
+        return -1        ;
+    #endif      
+                                
+    case _SC_MEMORY_PROTECTION:
+    #ifdef _POSIX_MEMORY_PROTECTION
+        return 1;
+    #else
+        return -1;
+    #endif
+            
+    case _SC_MESSAGE_PASSING:
+    #ifdef _POSIX_MESSAGE_PASSING
+        return 1;
+    #else
+        return -1;
+    #endif
+                
+    case _SC_PRIORITIZED_IO:
+    #ifdef _POSIX_PRIORITIZED_IO
+        return 1;
+    #else
+        return -1;
+    #endif
+                    
+    case _SC_PRIORITY_SCHEDULING:
+    #ifdef _POSIX_PRIORITY_SCHEDULING
+        return 1;
+    #else
+        return -1;
+    #endif
+                        
+    case _SC_REALTIME_SIGNALS:
+    #ifdef _POSIX_REALTIME_SIGNALS
+        return 1;
+    #else
+        return -1;
+    #endif
+                            
+    case _SC_SAVED_IDS:
+    #ifdef _POSIX_SAVED_IDS
+        return 1;
+    #else
+        return -1;
+    #endif
+                                
+    case _SC_SEMAPHORES:
+    #ifdef _POSIX_SEMAPHORES
+        return 1;
+    #else
+        return -1;
+    #endif
+                                    
+    case _SC_SHARED_MEMORY_OBJECTS:
+    #ifdef _POSIX_SHARED_MEMORY_OBJECTS
+        return 1;
+    #else
+        return -1;
+    #endif
+                                        
+    case _SC_SYNCHRONIZED_IO:
+    #ifdef _POSIX_SYNCHRONIZED_IO
+        return 1;
+    #else
+        return -1;
+    #endif
+                                            
+    case _SC_THREADS:
+    #ifdef _POSIX_THREADS
+        return 1;
+    #else
+        return -1;
+    #endif
+                                                
+    case _SC_THREAD_ATTR_STACKADDR:
+    #ifdef _POSIX_THREAD_ATTR_STACKADDR
+        return 1;
+    #else
+        return -1;
+    #endif
+                                                    
+    case _SC_THREAD_ATTR_STACKSIZE:
+    #ifdef _POSIX_THREAD_ATTR_STACKSIZE
+        return 1;
+    #else
+        return -1;
+    #endif
+                                                        
+    case _SC_THREAD_PRIO_INHERIT:
+    #ifdef _POSIX_THREAD_PRIO_INHERIT
+        return 1;
+    #else
+        return -1;
+    #endif
+                                                            
+    case _SC_THREAD_PRIO_PROTECT:
+    #ifdef _POSIX_THREAD_PRIO_PROTECT
+        return 1;
+    #else
+        return -1;
+    #endif
+                                                                
+    case _SC_THREAD_PRIORITY_SCHEDULING:
+    #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+        return 1;
+    #else
+        return -1;
+    #endif
+                                                                    
+    case _SC_THREAD_PROCESS_SHARED:
+    #ifdef _POSIX_THREAD_PROCESS_SHARED
+        return 1;
+    #else
+        return -1;
+    #endif
+                                                                        
+    case _SC_THREAD_SAFE_FUNCTIONS:
+    #ifdef _POSIX_THREAD_SAFE_FUNCTIONS
+        return 1;
+    #else
+        return -1;
+    #endif
+                                                                            
+    case _SC_TIMERS:
+    #ifdef _POSIX_TIMERS
+        return 1;
+    #else
+        return -1;
+    #endif
+                                                                                
+
+    default:
+        errno = EINVAL;
+        return -1;
+    }
+}
+
+//==========================================================================
+// Some trivial compatibility functions.
+// These are merely present to permit existing code to be ported a little
+// more easily, and to provide adequate standards compatibility.
+
+__externC pid_t getpid    ( void ) { return 42; }
+__externC pid_t getppid   ( void ) { return 41; }
+__externC uid_t getuid    ( void ) { return 666; }
+__externC uid_t geteuid   ( void ) { return 666; }
+__externC gid_t getgid    ( void ) { return 88; }
+__externC gid_t getegid   ( void ) { return 88; }
+__externC int   setuid    ( uid_t uid ) { errno = EPERM; return -1; }
+__externC int   setgid    ( uid_t gid ) { errno = EPERM; return -1; }
+__externC int   getgroups ( int gidsetsize, gid_t grouplist[] ) { return 0; };
+__externC pid_t getpgrp   ( void ) { return 42; }
+__externC pid_t setsid    ( void ) { errno = EPERM; return -1; }
+__externC int   setpgid   ( pid_t pid, pid_t pgid ) { errno = ENOSYS; return -1; }
+
+//==========================================================================
+// Exports to other packages
+
+// -------------------------------------------------------------------------
+// POSIX API function entry
+
+__externC void cyg_posix_function_start()
+{
+    Cyg_Thread *self = Cyg_Scheduler::get_current_thread();
+
+    // Inhibit ASR delivery in this function until it returns.
+    
+    self->set_asr_inhibit();
+}
+
+// -------------------------------------------------------------------------
+
+__externC void cyg_posix_function_finish()
+{
+    Cyg_Thread *self = Cyg_Scheduler::get_current_thread();
+
+    // Re-allow ASR delivery.
+    
+    self->clear_asr_inhibit();
+
+    // After clearing the inhibit flag, blip the scheduler lock
+    // to get any pending ASRs delivered.
+    Cyg_Scheduler::lock();
+    Cyg_Scheduler::unlock();
+}
+
+// -------------------------------------------------------------------------
+// EOF misc.cxx
diff --git a/packages/compat/posix/v2_0/src/mqueue.cxx b/packages/compat/posix/v2_0/src/mqueue.cxx
new file mode 100644 (file)
index 0000000..350950a
--- /dev/null
@@ -0,0 +1,1005 @@
+/*========================================================================
+//
+//      mqueue.cxx
+//
+//      Message queues tests
+//
+//========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     jlarmour
+// Contributors:  
+// Date:          2000-05-14
+// Purpose:       This file provides the implementation for POSIX message
+//                queues
+// Description:   It uses eCos kernel mqueues as the underlying
+//                implementation
+// Usage:         
+//
+//####DESCRIPTIONEND####
+//
+//======================================================================
+*/
+
+/* CONFIGURATION */
+
+#include <pkgconf/posix.h>
+
+#ifdef CYGPKG_POSIX_MQUEUES
+
+#include <pkgconf/kernel.h>
+
+/* INCLUDES */
+
+#include <cyg/infra/cyg_type.h>      // common types etc.
+#include <cyg/infra/cyg_ass.h>       // Assertion support
+#include <cyg/infra/cyg_trac.h>      // Tracing support
+#include <cyg/kernel/mqueue.hxx>     // eCos Mqueue Header
+#include <cyg/kernel/sched.hxx>      // Cyg_Scheduler::lock()
+#include <cyg/kernel/sched.inl>      // inlines for above
+#include <mqueue.h>                  // Standard POSIX mqueue header
+#include <sys/types.h>               // mode_t, ssize_t
+#include <limits.h>                  // PATH_MAX
+#include <stdlib.h>                  // malloc, etc.
+#include <errno.h>                   // errno
+#include <fcntl.h>                   // O_*
+#include <stdarg.h>                  // varargs
+#include <pthread.h>                 // mutexes
+#include <string.h>                  // strncpy
+#ifdef CYGFUN_POSIX_MQUEUE_NOTIFY
+# include <signal.h>
+# include "pprivate.h"               // cyg_sigqueue()
+#endif
+#ifdef CYGFUN_KERNEL_THREADS_TIMER
+# include <time.h>
+# include "pprivate.h"               // cyg_timespec_to_ticks()
+#endif
+
+/* CONSTANTS */
+
+#define MQ_VALID_MAGIC  0x6db256c1
+
+/* TYPE DEFINITIONS */
+
+struct mqtabent;
+
+// this is a queue user - each one of these corresponds to a mqd_t
+struct mquser {
+    int flags;               // O_RDONLY, O_WRONLY, O_RDWR, O_NONBLOCK
+    struct mqtabent *tabent; // back pointer to table entry
+    struct mquser *next;
+    bool notifieruser;       // POSIX sucks so bad. It requires a mq_close
+                             // to only deregister the notification if it
+                             // was done via this descriptor. So we have to
+                             // know if it was this one
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    cyg_uint32 magic;        // magic number: MQ_VALID_MAGIC if valid
+#endif    
+};
+
+struct mqtabent {
+    char name[ PATH_MAX ]; // ascii name - set to "" when unused
+    Cyg_Mqueue *mq;        // the underlying queue object
+    long maxmsg;           // as set on creation
+    long msgsize;          // as set on creation
+    bool unlinkme;         // unlink when final user closes?
+    struct mquser *users;  // each user
+
+#ifdef CYGFUN_POSIX_MQUEUE_NOTIFY
+    const struct sigevent *sigev; // notification event
+#endif
+};
+
+/* GLOBALS */
+
+static struct mqtabent mqtab[ CYGNUM_POSIX_MQUEUE_OPEN_MAX ];
+static pthread_mutex_t mqtab_mut = PTHREAD_MUTEX_INITIALIZER;
+
+/* LOCAL FUNCTIONS */
+
+//------------------------------------------------------------------------
+
+// placement new definition
+inline void *operator new(size_t size, void *ptr) 
+{ 
+    CYG_CHECK_DATA_PTR( ptr, "Bad pointer" ); 
+    return ptr; 
+} 
+
+// Deallocation callback from Cyg_Mqueue
+static void
+my_free( void *ptr, size_t )
+{
+    free( ptr );
+}
+
+//------------------------------------------------------------------------
+
+// Do the actual "unlink" of a queue, i.e. mark it invalid in the table.
+// The table mutex is assumed to be locked
+static void
+do_mq_unlink( struct mqtabent *tabent )
+{
+    CYG_REPORT_FUNCTION();
+    CYG_CHECK_DATA_PTRC( tabent );
+
+    tabent->name[0] = '\0'; // won't match anything the user sends now
+    tabent->mq->~Cyg_Mqueue();
+    free( tabent->mq );
+    tabent->mq=NULL;
+
+    CYG_REPORT_RETURN();
+}
+
+//------------------------------------------------------------------------
+
+#ifdef CYGFUN_POSIX_MQUEUE_NOTIFY
+
+static void
+notifyme( Cyg_Mqueue &q, CYG_ADDRWORD data )
+{
+    CYG_REPORT_FUNCTION();
+    struct mquser *user = (struct mquser *)data;
+    CYG_CHECK_DATA_PTRC( user );
+    struct mqtabent *tabent = user->tabent;
+    CYG_CHECK_DATA_PTRC( tabent );
+
+    Cyg_Scheduler::lock();
+    // we may have been pre-empted before this, so check there's still a
+    // notification to do
+
+    if ( NULL == tabent->sigev ) {
+        Cyg_Scheduler::unlock();
+        CYG_REPORT_RETURN();
+        return;
+    } // if
+
+    const struct sigevent *ev = tabent->sigev;
+    
+    // first deregister
+    q.setnotify( NULL, 0 );
+    tabent->sigev = NULL;
+    user->notifieruser = false; // not any more
+    
+    // now the rest of the world can go
+    Cyg_Scheduler::unlock();
+    
+    // queue event. If it fails... nothing we can do :-( so ignore return code
+    cyg_sigqueue( ev, SI_MESGQ );
+
+    cyg_deliver_signals();
+    
+    CYG_REPORT_RETURN();
+}
+
+#endif // ifdef CYGFUN_POSIX_MQUEUE_NOTIFY
+
+//------------------------------------------------------------------------
+
+/* EXPORTED FUNCTIONS */
+
+externC mqd_t
+mq_open( const char *name, int oflag, ... )
+{
+    CYG_REPORT_FUNCTYPE( "returning %08x" );
+    CYG_REPORT_FUNCARG2( "name=%08x, oflag=%d", name, oflag );
+    CYG_CHECK_DATA_PTRC( name );
+
+    if ( ((oflag & O_RDONLY) != O_RDONLY) &&
+         ((oflag & O_WRONLY) != O_WRONLY) &&
+         ((oflag & O_RDWR) != O_RDWR)) {
+        // user didn't specify mode
+        errno = EINVAL;
+        CYG_REPORT_RETVAL( -1 );
+        return (mqd_t)-1;
+    } // if
+
+    mqd_t retval;
+    cyg_ucount32 i;
+    struct mqtabent *qtabent=NULL;
+    int interr;
+
+    interr = pthread_mutex_lock( &mqtab_mut );
+    // should never fail
+    CYG_ASSERT( interr == 0, "internal lock failed!" );
+    
+    // find if a matching entry exists first
+    // FIXME: Should check for length and return ENAMETOOLONG
+    for ( i=0; i < CYGNUM_POSIX_MQUEUE_OPEN_MAX; i++ ) {
+        if ( 0 == strncmp(name, mqtab[i].name, PATH_MAX) ) {
+            qtabent = &mqtab[i];
+            break;
+        } // if
+    } // for
+    
+    if ( (NULL != qtabent) && (O_EXCL == (oflag & O_EXCL)) ) {
+        errno = EEXIST;
+        retval = (mqd_t)-1;
+        goto exit_unlock;
+    }
+        
+    if ( (NULL == qtabent) && (O_CREAT != (oflag & O_CREAT)) ) {
+        errno = ENOENT;
+        retval = (mqd_t)-1;
+        goto exit_unlock;
+    }
+
+    // so if we didn't find something, we must be being asked to create it
+    if (NULL == qtabent) {
+        mode_t mode; // FIXME: mode ignored for now
+        const struct mq_attr *attr;
+        const struct mq_attr default_attr = { 0, MQ_OPEN_MAX, 128 };
+        va_list args;
+        
+        va_start( args, oflag );
+        mode = va_arg( args, mode_t );
+        attr = va_arg( args, struct mq_attr * );
+        va_end( args );
+
+        // find an empty table entry
+        for ( i=0; i < CYGNUM_POSIX_MQUEUE_OPEN_MAX; i++ ) {
+            if ( NULL == mqtab[i].mq )
+                break;
+        }
+
+        // if not found, table is full
+        if ( i == CYGNUM_POSIX_MQUEUE_OPEN_MAX ) {
+            errno = ENFILE;
+            retval = (mqd_t)-1;
+            goto exit_unlock;
+        }
+
+        Cyg_Mqueue::qerr_t qerr;
+
+        // user can specify NULL attr, which means arbitrary message queue
+        // size! Duh.
+        if ( NULL == attr )
+            attr = &default_attr;
+        else {
+            // if they do supply one, POSIX says we're meant to check it
+            if (attr->mq_maxmsg <= 0 || attr->mq_msgsize <= 0) {
+                errno = EINVAL;
+                retval = (mqd_t)-1;
+                goto exit_unlock;
+            }
+        } // else
+
+        // allocate the underlying queue
+        Cyg_Mqueue *mqholder = (Cyg_Mqueue *)malloc( sizeof(Cyg_Mqueue) );
+        if ( NULL == mqholder ) {
+            errno = ENOSPC;
+            retval = (mqd_t)-1;
+            goto exit_unlock;
+        }
+            
+        // construct it with placement new
+        mqtab[i].mq = new (mqholder) Cyg_Mqueue( attr->mq_maxmsg,
+                                                 attr->mq_msgsize,
+                                                 &malloc, &my_free, &qerr );
+            
+        switch (qerr) {
+        case Cyg_Mqueue::OK:
+            break;
+        case Cyg_Mqueue::NOMEM:
+            free( mqholder );
+            errno = ENOSPC;
+            retval = (mqd_t)-1;
+            goto exit_unlock;
+        default:
+            CYG_FAIL("Unhandled Cyg_Mqueue constructor return error");
+            break;
+        } // switch
+
+        mqtab[i].users = (struct mquser *) malloc( sizeof(struct mquser) );
+        if ( NULL == mqtab[i].users ) {
+            mqtab[i].mq->~Cyg_Mqueue();
+            free( mqholder );
+            errno = ENOSPC;
+            retval = (mqd_t)-1;
+            goto exit_unlock;
+        }
+
+        // initialize mqtab[i]
+        mqtab[i].maxmsg  = attr->mq_maxmsg;
+        mqtab[i].msgsize = attr->mq_msgsize;
+        mqtab[i].unlinkme = false;
+#ifdef CYGFUN_POSIX_MQUEUE_NOTIFY
+        mqtab[i].sigev = NULL;
+#endif
+        strncpy( mqtab[i].name, name, PATH_MAX );
+
+        // initialize first mqtab[i].users
+        mqtab[i].users->next = NULL;
+        // set the mode for later, but also note that O_NONBLOCK can
+        // be set in oflags *or* the attr the user passed
+        mqtab[i].users->flags = oflag | (attr->mq_flags & O_NONBLOCK);
+
+        // set back pointer so that message queue handle can find actual queue
+        mqtab[i].users->tabent = &mqtab[i]; 
+        
+        mqtab[i].users->notifieruser = false;
+
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+        mqtab[i].users->magic = MQ_VALID_MAGIC; // now valid
+#endif
+        
+        retval=(mqd_t)mqtab[i].users;
+
+        goto exit_unlock;
+    } // if (NULL == qtabent)
+
+    // so we're not creating, and we have a valid qtabent
+
+    // But this qtabent may be being unlinked. If so, we are permitted
+    // to return an error, so we will. (see under mq_unlink() in POSIX)
+    // Which error though? EINVAL seems best, but POSIX doesn't say :-/
+
+    if (true == qtabent->unlinkme) {
+        errno = EINVAL;
+        retval = (mqd_t)-1;
+        goto exit_unlock;
+    }
+    
+    // now we have a usable qtabent
+
+    struct mquser *user;
+    user = (struct mquser *) malloc( sizeof(struct mquser) );
+    if ( NULL == user ) {
+            errno = ENOSPC;
+            retval = (mqd_t)-1;
+            goto exit_unlock;
+    }
+
+    // prepend to qtab user list
+    user->next = qtabent->users;
+    qtabent->users = user;
+
+    // set back pointer so that message queue handle can find actual queue
+    user->tabent = qtabent;
+
+    user->flags = oflag;
+
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    user->magic = MQ_VALID_MAGIC; // now valid
+#endif
+
+    retval=(mqd_t)user;
+
+ exit_unlock:
+    interr = pthread_mutex_unlock( &mqtab_mut );
+    // should never fail
+    CYG_ASSERT( interr == 0, "internal lock failed!" );
+    CYG_REPORT_RETVAL( retval );
+    return retval;
+} // mq_open()
+
+//------------------------------------------------------------------------
+
+// NOTE: It is the *user*'s responsibility to ensure that nothing is
+// blocked in mq_send() or mq_receive() when closing the queue with
+// that descriptor. The standard does not specify the behaviour, so that's
+// what I am assuming
+
+externC int
+mq_close( mqd_t mqdes )
+{
+    CYG_REPORT_FUNCTYPE( "returning %d" );
+    CYG_REPORT_FUNCARG1XV( mqdes );
+    
+    struct mquser *user = (struct mquser *)mqdes;
+
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    if ( user->magic != MQ_VALID_MAGIC ) {
+        errno  = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+#endif
+    
+    int interr;
+
+    interr = pthread_mutex_lock( &mqtab_mut );
+    // should never fail
+    CYG_ASSERT( interr == 0, "internal lock failed!" );
+
+    struct mqtabent *tabent = user->tabent;
+    struct mquser *usertmp;
+    
+    // perhaps should return EBADF instead of assert?
+    CYG_ASSERT( tabent->users != NULL, "Null message queue user list" );
+
+#ifdef CYGFUN_POSIX_MQUEUE_NOTIFY
+    // deregister notification iff this was the message queue descriptor
+    // that was used to register it (POSIX says)
+    if ( true == user->notifieruser ) {
+        tabent->mq->setnotify( NULL, 0 );
+        tabent->sigev = NULL;
+        // not worth clearing notifieruser
+    }
+#endif
+
+    // find in the list for this queue and remove - sucks a bit, but seems
+    // best over all - the list shouldn't be too long
+    if ( tabent->users == user ) {
+        tabent->users = user->next;  // remove
+    } else {
+        for ( usertmp=tabent->users;
+              NULL != usertmp->next;
+              usertmp = usertmp->next ) {
+            if ( usertmp->next == user )
+                break;
+        } // for
+
+        // perhaps should return EBADF instead of assert?
+        CYG_ASSERT( usertmp->next != NULL, "Couldn't find message queue user" );
+
+        usertmp->next = user->next; // remove
+    } // else
+    
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    user->magic = 0; // invalidate
+#endif
+
+    // free it up
+    free( user );
+
+    if ( (true == tabent->unlinkme) && (NULL == tabent->users) ) {
+        do_mq_unlink( tabent );
+    } // if
+
+    interr = pthread_mutex_unlock( &mqtab_mut );
+    // should never fail
+    CYG_ASSERT( interr == 0, "internal lock failed!" );
+    CYG_REPORT_RETVAL( 0 );
+    return 0;
+} // mq_close()
+
+
+//------------------------------------------------------------------------
+
+externC int
+mq_unlink( const char *name )
+{
+    CYG_REPORT_FUNCTYPE( "returning %d" );
+    CYG_REPORT_FUNCARG1( "name=%s", name );
+
+    int retval, interr;
+    cyg_ucount32 i;
+    struct mqtabent *qtabent=NULL;
+
+    interr = pthread_mutex_lock( &mqtab_mut );
+    // should never fail
+    CYG_ASSERT( interr == 0, "internal lock failed!" );
+
+    // find the entry first
+    // FIXME: Should check for length and return ENAMETOOLONG
+    for ( i=0; i < CYGNUM_POSIX_MQUEUE_OPEN_MAX; i++ ) {
+        if ( 0 == strncmp(name, mqtab[i].name, PATH_MAX) ) {
+            qtabent = &mqtab[i];
+            break;
+        } // if
+    } // for
+
+    if ( NULL == qtabent ) { // not found
+        errno = ENOENT;
+        retval = -1;
+        goto exit_unlock;
+    }
+
+    if ( NULL != qtabent->users ) {   // still in use
+        qtabent->unlinkme = true;     // so mark it as pending deletion
+    } else {
+        do_mq_unlink( qtabent );
+    } // else
+
+    retval = 0;
+
+ exit_unlock:
+    interr = pthread_mutex_unlock( &mqtab_mut );
+    // should never fail
+    CYG_ASSERT( interr == 0, "internal lock failed!" );
+    CYG_REPORT_RETVAL( retval );
+    return retval;
+} // mq_unlink()
+
+//------------------------------------------------------------------------
+
+externC int
+mq_send( mqd_t mqdes, const char *msg_ptr, size_t msg_len,
+         unsigned int msg_prio )
+{
+    CYG_REPORT_FUNCTYPE( "returning %d" );
+    CYG_REPORT_FUNCARG4( "mqdes=%08x, msg_ptr=%08x, msg_len=%u, msg_prio=%u",
+                         mqdes, msg_ptr, msg_len, msg_prio );
+    CYG_CHECK_DATA_PTRC( msg_ptr );
+    
+    struct mquser *user = (struct mquser *)mqdes;
+    struct mqtabent *tabent = user->tabent;
+
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    if ( user->magic != MQ_VALID_MAGIC ) {
+        errno  = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+#endif
+    
+    if ( msg_len > (size_t)tabent->msgsize ) {
+        errno = EMSGSIZE;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+
+    if ( msg_prio > MQ_PRIO_MAX ) {
+        errno = EINVAL;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+
+    if ( (O_WRONLY != (user->flags & O_WRONLY)) && 
+         (O_RDWR != (user->flags & O_RDWR)) ) {
+        errno = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+
+    // go for it
+    Cyg_Mqueue::qerr_t err;
+    err = tabent->mq->put( msg_ptr, msg_len, msg_prio,
+                           ((user->flags & O_NONBLOCK) != O_NONBLOCK) );
+    switch (err) {
+
+    case Cyg_Mqueue::INTR:
+        errno = EINTR;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+
+    case Cyg_Mqueue::WOULDBLOCK:
+        CYG_ASSERT( (user->flags & O_NONBLOCK) == O_NONBLOCK,
+                    "Message queue assumed non-blocking when blocking requested"
+            );
+        errno = EAGAIN;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+        
+    case Cyg_Mqueue::OK:
+        CYG_REPORT_RETVAL( 0 );
+        return 0;
+
+    default:
+        CYG_FAIL( "unhandled message queue return code" );
+        return -1; // keep compiler happy
+    } // switch
+} // mq_send()
+
+//------------------------------------------------------------------------
+
+
+externC ssize_t
+mq_receive( mqd_t mqdes, char *msg_ptr, size_t msg_len,
+            unsigned int *msg_prio )
+{
+    CYG_REPORT_FUNCTYPE( "returning %ld" );
+    CYG_REPORT_FUNCARG4( "mqdes=%08x, msg_ptr=%08x, msg_len=%u, msg_prio=%08x",
+                         mqdes, msg_ptr, msg_len, msg_prio );
+    CYG_CHECK_DATA_PTRC( msg_ptr );
+    CYG_CHECK_DATA_PTRC( msg_ptr+msg_len-1 );
+    if ( NULL != msg_prio )
+        CYG_CHECK_DATA_PTRC( msg_prio );
+    
+    
+    struct mquser *user = (struct mquser *)mqdes;
+    struct mqtabent *tabent = user->tabent;
+
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    if ( user->magic != MQ_VALID_MAGIC ) {
+        errno  = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return (ssize_t)-1;
+    }
+#endif
+    
+    if ( (O_RDONLY != (user->flags & O_RDONLY)) && 
+         (O_RDWR != (user->flags & O_RDWR)) ) {
+        errno = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return (ssize_t)-1;
+    }
+
+    if ( msg_len < (size_t)tabent->msgsize ) {
+        errno = EMSGSIZE;
+        CYG_REPORT_RETVAL( -1 );
+        return (ssize_t)-1;
+    }
+
+    // go for it
+    Cyg_Mqueue::qerr_t err;
+    err = tabent->mq->get( msg_ptr, &msg_len, msg_prio,
+                           ((user->flags & O_NONBLOCK) != O_NONBLOCK) );
+    switch (err) {
+
+    case Cyg_Mqueue::INTR:
+        errno = EINTR;
+        CYG_REPORT_RETVAL( -1 );
+        return (ssize_t)-1;
+
+    case Cyg_Mqueue::WOULDBLOCK:
+        CYG_ASSERT( (user->flags & O_NONBLOCK) == O_NONBLOCK,
+                    "Message queue assumed non-blocking when blocking requested"
+            );
+        errno = EAGAIN;
+        CYG_REPORT_RETVAL( -1 );
+        return (ssize_t)-1;
+        
+    case Cyg_Mqueue::OK:
+        CYG_ASSERT( msg_len <= (size_t)tabent->msgsize,
+                    "returned message too long" );
+        if ( NULL != msg_prio )
+            CYG_ASSERT( *msg_prio <= MQ_PRIO_MAX,
+                        "returned message has invalid priority" );
+        CYG_REPORT_RETVAL( msg_len );
+        return (ssize_t)msg_len;
+
+    default:
+        CYG_FAIL( "unhandled message queue return code" );
+        return (ssize_t)-1; // keep compiler happy
+    } // switch
+    
+} // mq_receive()
+
+
+//------------------------------------------------------------------------
+#ifdef CYGFUN_KERNEL_THREADS_TIMER
+externC int
+mq_timedsend( mqd_t mqdes, const char *msg_ptr, size_t msg_len,
+              unsigned int msg_prio, const struct timespec *abs_timeout)
+{
+    CYG_REPORT_FUNCTYPE( "returning %d" );
+    CYG_REPORT_FUNCARG6( "mqdes=%08x, msg_ptr=%08x, msg_len=%u, msg_prio=%u, "
+                         "abs_timeout = %lu, %ld",
+                         mqdes, msg_ptr, msg_len, msg_prio, 
+                         abs_timeout->tv_sec, abs_timeout->tv_nsec);
+    CYG_CHECK_DATA_PTRC( msg_ptr );
+    
+    struct mquser *user = (struct mquser *)mqdes;
+    struct mqtabent *tabent = user->tabent;
+
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    if ( user->magic != MQ_VALID_MAGIC ) {
+        errno  = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+#endif
+    
+    if ( msg_len > (size_t)tabent->msgsize ) {
+        errno = EMSGSIZE;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+
+    if ( msg_prio > MQ_PRIO_MAX ) {
+        errno = EINVAL;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+
+    if ( (O_WRONLY != (user->flags & O_WRONLY)) && 
+         (O_RDWR != (user->flags & O_RDWR)) ) {
+        errno = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+
+    // go for it
+    Cyg_Mqueue::qerr_t err;
+    bool nonblocking = ((user->flags & O_NONBLOCK) == O_NONBLOCK);
+    bool badtimespec = (abs_timeout->tv_nsec < 0) ||
+        (abs_timeout->tv_nsec > 999999999l);
+    cyg_tick_count abs_ticks = cyg_timespec_to_ticks(abs_timeout);
+
+    // We should never time out if there is room in the queue.  Simplest
+    // way to ensure this is to try the non-blocking put() first.
+    err = tabent->mq->put( msg_ptr, msg_len, msg_prio, false, abs_ticks );
+
+    // If the blocking variant would have blocked and that is what's wanted
+    if ( Cyg_Mqueue::WOULDBLOCK == err && !nonblocking && !badtimespec ) {
+        err = tabent->mq->put( msg_ptr, msg_len, msg_prio, true, 
+                               abs_ticks );
+    }
+
+    switch (err) {
+
+    case Cyg_Mqueue::INTR:
+        errno = EINTR;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+
+    case Cyg_Mqueue::WOULDBLOCK:
+        if (badtimespec) {
+            errno = EINVAL;
+            CYG_REPORT_RETVAL( -1 );
+            return -1;
+        }
+        CYG_ASSERT( (user->flags & O_NONBLOCK) == O_NONBLOCK,
+                    "Message queue assumed non-blocking when blocking requested"
+            );
+        errno = EAGAIN;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+
+    case Cyg_Mqueue::TIMEOUT:
+        errno = ETIMEDOUT;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+        
+    case Cyg_Mqueue::OK:
+        CYG_REPORT_RETVAL( 0 );
+        return 0;
+
+    default:
+        CYG_FAIL( "unhandled message queue return code" );
+        return -1; // keep compiler happy
+    } // switch
+} // mq_timedsend()
+
+//------------------------------------------------------------------------
+
+
+externC ssize_t
+mq_timedreceive( mqd_t mqdes, char *msg_ptr, size_t msg_len,
+            unsigned int *msg_prio, const struct timespec *abs_timeout)
+{
+    CYG_REPORT_FUNCTYPE( "returning %ld" );
+    CYG_REPORT_FUNCARG6( "mqdes=%08x, msg_ptr=%08x, msg_len=%u, msg_prio=%08x, "
+                        "abs_timeout = %lu, %ld",
+                         mqdes, msg_ptr, msg_len, msg_prio,
+                         abs_timeout->tv_sec, abs_timeout->tv_nsec );
+    CYG_CHECK_DATA_PTRC( msg_ptr );
+    CYG_CHECK_DATA_PTRC( msg_ptr+msg_len-1 );
+    if ( NULL != msg_prio )
+        CYG_CHECK_DATA_PTRC( msg_prio );
+    
+    
+    struct mquser *user = (struct mquser *)mqdes;
+    struct mqtabent *tabent = user->tabent;
+
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    if ( user->magic != MQ_VALID_MAGIC ) {
+        errno  = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return (ssize_t)-1;
+    }
+#endif
+    
+    if ( (O_RDONLY != (user->flags & O_RDONLY)) && 
+         (O_RDWR != (user->flags & O_RDWR)) ) {
+        errno = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return (ssize_t)-1;
+    }
+
+    if ( msg_len < (size_t)tabent->msgsize ) {
+        errno = EMSGSIZE;
+        CYG_REPORT_RETVAL( -1 );
+        return (ssize_t)-1;
+    }
+
+    // go for it
+    Cyg_Mqueue::qerr_t err;
+    bool nonblocking = ((user->flags & O_NONBLOCK) == O_NONBLOCK);
+    bool badtimespec = (abs_timeout->tv_nsec < 0) ||
+        (abs_timeout->tv_nsec > 999999999l);
+    cyg_tick_count abs_ticks = cyg_timespec_to_ticks(abs_timeout);
+
+    // We should never time out if there is something to read.  Simplest
+    // way to ensure this is to try the non-blocking get() first.
+    err = tabent->mq->get( msg_ptr, &msg_len, msg_prio, false, abs_ticks );
+
+    // If the blocking variant would have blocked and that is what's wanted
+    if ( Cyg_Mqueue::WOULDBLOCK == err && !nonblocking && !badtimespec ) {
+        err = tabent->mq->get( msg_ptr, &msg_len, msg_prio, true, abs_ticks );
+    }
+
+    switch (err) {
+
+    case Cyg_Mqueue::INTR:
+        errno = EINTR;
+        CYG_REPORT_RETVAL( -1 );
+        return (ssize_t)-1;
+
+    case Cyg_Mqueue::WOULDBLOCK:
+        if (badtimespec) {
+            errno = EINVAL;
+            CYG_REPORT_RETVAL( -1 );
+            return -1;
+        }
+        CYG_ASSERT( (user->flags & O_NONBLOCK) == O_NONBLOCK,
+                    "Message queue assumed non-blocking when blocking requested"
+            );
+        errno = EAGAIN;
+        CYG_REPORT_RETVAL( -1 );
+        return (ssize_t)-1;
+
+    case Cyg_Mqueue::TIMEOUT:
+        errno = ETIMEDOUT;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+        
+    case Cyg_Mqueue::OK:
+        CYG_ASSERT( msg_len <= (size_t)tabent->msgsize,
+                    "returned message too long" );
+        if ( NULL != msg_prio )
+            CYG_ASSERT( *msg_prio <= MQ_PRIO_MAX,
+                        "returned message has invalid priority" );
+        CYG_REPORT_RETVAL( msg_len );
+        return (ssize_t)msg_len;
+
+    default:
+        CYG_FAIL( "unhandled message queue return code" );
+        return (ssize_t)-1; // keep compiler happy
+    } // switch
+    
+} // mq_timedreceive()
+
+//------------------------------------------------------------------------
+#endif
+
+#ifdef CYGFUN_POSIX_MQUEUE_NOTIFY
+
+externC int
+mq_notify( mqd_t mqdes, const struct sigevent *notification )
+{
+    CYG_REPORT_FUNCTYPE( "returning %d" );
+    CYG_REPORT_FUNCARG2( "mqdes=%08x, notification=%08x", mqdes, notification );
+    if ( NULL != notification )
+        CYG_CHECK_DATA_PTRC( notification );
+    
+    struct mquser *user = (struct mquser *)mqdes;
+    struct mqtabent *tabent = user->tabent;
+
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    if ( user->magic != MQ_VALID_MAGIC ) {
+        errno  = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+#endif
+    
+    // lock scheduler since we test and set non-atomically
+    Cyg_Scheduler::lock();
+    
+    // we are being told to clear the notification function
+    if ( NULL == notification ) {
+        tabent->mq->setnotify( NULL, 0 );
+        tabent->sigev = NULL;
+        Cyg_Scheduler::unlock();
+        CYG_REPORT_RETVAL( 0 );
+        return 0;
+    } // if
+    
+    if ( NULL != tabent->sigev ) {  // already registered
+        Cyg_Scheduler::unlock();
+        errno = EBUSY;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    } // if
+
+    tabent->sigev = notification;
+    user->notifieruser = true; // Used for deciding about whether to
+                               // deregister in mq_close()
+    tabent->mq->setnotify( &notifyme, (CYG_ADDRWORD) user );
+    Cyg_Scheduler::unlock();
+    
+    CYG_REPORT_RETVAL( 0 );
+    return 0;
+} // mq_notify()
+
+#endif // ifdef CYGFUN_POSIX_MQUEUE_NOTIFY
+
+//------------------------------------------------------------------------
+
+externC int
+mq_setattr( mqd_t mqdes, const struct mq_attr *mqstat,
+            struct mq_attr *omqstat )
+{
+    CYG_REPORT_FUNCTYPE( "returning %d" );
+    CYG_REPORT_FUNCARG3( "mqdes=%08x, mqstat=%08x, omqstat=%08x",
+                         mqdes, mqstat, omqstat );
+    CYG_CHECK_DATA_PTRC( mqstat );
+
+    struct mquser *user = (struct mquser *)mqdes;
+
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    if ( user->magic != MQ_VALID_MAGIC ) {
+        errno  = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+#endif
+    
+    if ( NULL != omqstat ) {
+        CYG_CHECK_DATA_PTRC( omqstat );
+        mq_getattr( mqdes, omqstat );
+    } // if
+
+    // Two-stage update, so lock sched since it's quick
+    Cyg_Scheduler::lock();
+    user->flags &= ~O_NONBLOCK;  // clear
+    if ( (mqstat->mq_flags & O_NONBLOCK) == O_NONBLOCK ) {
+        user->flags |= O_NONBLOCK;
+    } // if
+    Cyg_Scheduler::unlock();
+
+    CYG_REPORT_RETVAL( 0 );
+    return 0;
+} // mq_setattr()
+
+//------------------------------------------------------------------------
+
+externC int
+mq_getattr( mqd_t mqdes, struct mq_attr *mqstat )
+{
+    CYG_REPORT_FUNCTYPE( "returning %d" );
+    CYG_REPORT_FUNCARG2( "mqdes=%08x, mqstat=%08x", mqdes, mqstat );
+    CYG_CHECK_DATA_PTRC( mqstat );
+
+    struct mquser *user = (struct mquser *)mqdes;
+    struct mqtabent *tabent = user->tabent;
+
+#ifdef CYGIMP_POSIX_MQUEUE_VALIDATE_DESCRIPTOR
+    if ( user->magic != MQ_VALID_MAGIC ) {
+        errno  = EBADF;
+        CYG_REPORT_RETVAL( -1 );
+        return -1;
+    }
+#endif
+    
+    mqstat->mq_flags   = user->flags;
+    mqstat->mq_maxmsg  = tabent->maxmsg;
+    mqstat->mq_msgsize = tabent->msgsize;
+    mqstat->mq_curmsgs = tabent->mq->count();    
+    
+    CYG_REPORT_RETVAL( 0 );
+    return 0;
+} // mq_getattr()
+
+
+//------------------------------------------------------------------------
+
+#endif // ifdef CYGPKG_POSIX_MQUEUES
+
+/* EOF mqueue.cxx */
diff --git a/packages/compat/posix/v2_0/src/mutex.cxx b/packages/compat/posix/v2_0/src/mutex.cxx
new file mode 100644 (file)
index 0000000..66dbf45
--- /dev/null
@@ -0,0 +1,551 @@
+//==========================================================================
+//
+//      pthread.cxx
+//
+//      POSIX pthreads implementation
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos 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 GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg, jlarmour, Wade Jensen
+// Date:                2000-03-27
+// Purpose:             POSIX pthread implementation
+// Description:         This file contains the implementation of the POSIX pthread
+//                      functions.
+//              
+//              
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/posix.h>
+
+#include <cyg/infra/cyg_trac.h>        // tracing macros
+#include <cyg/infra/cyg_ass.h>         // assertion macros
+
+#include "pprivate.h"                  // POSIX private header
+
+#include <cyg/kernel/thread.hxx>       // thread definitions
+#include <cyg/kernel/mutex.hxx>        // mutex definitions
+#include <cyg/kernel/clock.hxx>        // clock definitions
+#include <cyg/kernel/sched.hxx>        // scheduler primitives
+#include <pthread.h>
+
+#include <cyg/kernel/thread.inl>       // thread inlines
+#include <cyg/kernel/sched.inl>        // scheduler inlines
+
+//-----------------------------------------------------------------------------
+// new operator to allow us to construct mutex objects
+
+inline void *operator new(size_t size,  cyg_uint8 *ptr) { return (void *)ptr; };
+
+//=============================================================================
+// Mutexes
+
+//-----------------------------------------------------------------------------
+// Mutex attributes manipulation functions
+
+//-----------------------------------------------------------------------------
+// Initialize attribute object
+
+externC int pthread_mutexattr_init ( pthread_mutexattr_t *attr)
+{
+    PTHREAD_ENTRY();
+    
+    PTHREAD_CHECK(attr);
+
+    attr->protocol      = PTHREAD_PRIO_NONE;
+#ifdef _POSIX_THREAD_PRIO_PROTECT    
+    attr->prioceiling   = 0;
+#endif
+    
+    PTHREAD_RETURN(0);
+}
+
+//-----------------------------------------------------------------------------
+// Destroy attribute object
+
+externC int pthread_mutexattr_destroy ( pthread_mutexattr_t *attr)
+{
+    PTHREAD_ENTRY();
+    
+    PTHREAD_CHECK(attr);
+
+    // Nothing to do here...
+    
+    PTHREAD_RETURN(0);
+}
+
+//-----------------------------------------------------------------------------
+// Optional functions depending on priority inversion protection options.
+
+#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
+
+// Set priority inversion protection protocol
+externC int pthread_mutexattr_setprotocol ( pthread_mutexattr_t *attr,
+                                            int protocol)
+{
+    PTHREAD_ENTRY();
+    
+    PTHREAD_CHECK(attr);
+
+    switch( protocol )
+    {
+    case PTHREAD_PRIO_NONE:
+#if defined(_POSIX_THREAD_PRIO_INHERIT)        
+    case PTHREAD_PRIO_INHERIT:
+#endif
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+    case PTHREAD_PRIO_PROTECT:
+#endif        
+        attr->protocol = protocol;
+        PTHREAD_RETURN(0);
+
+    default:
+        PTHREAD_RETURN(EINVAL);
+    }
+    
+    PTHREAD_RETURN(0);
+}
+
+// Get priority inversion protection protocol
+externC int pthread_mutexattr_getprotocol ( pthread_mutexattr_t *attr,
+                                            int *protocol)
+{
+    PTHREAD_ENTRY();
+    
+    PTHREAD_CHECK(attr);
+
+    if( protocol != NULL )
+        *protocol = attr->protocol;
+    
+    PTHREAD_RETURN(0);
+}
+
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+
+// Set priority for priority ceiling protocol
+externC int pthread_mutexattr_setprioceiling ( pthread_mutexattr_t *attr,
+                                               int prioceiling)
+{
+    PTHREAD_ENTRY();
+    
+    PTHREAD_CHECK(attr);
+
+    
+    attr->prioceiling = prioceiling;
+    
+    PTHREAD_RETURN(0);
+}
+
+// Get priority for priority ceiling protocol
+externC int pthread_mutexattr_getprioceiling ( pthread_mutexattr_t *attr,
+                                               int *prioceiling)
+{
+    PTHREAD_ENTRY();
+    
+    PTHREAD_CHECK(attr);
+
+    if( prioceiling != NULL )
+        *prioceiling = attr->prioceiling;
+    
+    PTHREAD_RETURN(0);
+}
+
+// Set priority ceiling of given mutex, returning old ceiling.
+externC int pthread_mutex_setprioceiling( pthread_mutex_t *mutex,
+                                          int prioceiling,
+                                          int *old_ceiling)
+{
+    PTHREAD_ENTRY();
+    
+    PTHREAD_CHECK(mutex);
+
+    pthread_mutex_lock( mutex );
+
+    Cyg_Mutex *mx = (Cyg_Mutex *)mutex;
+
+    if( old_ceiling != NULL )
+        *old_ceiling = mx->get_ceiling();
+    
+    mx->set_ceiling( prioceiling );
+    
+    pthread_mutex_unlock( mutex );
+
+    PTHREAD_RETURN(0);
+}
+
+// Get priority ceiling of given mutex
+externC int pthread_mutex_getprioceiling( pthread_mutex_t *mutex,
+                                          int *prioceiling)
+{
+    PTHREAD_ENTRY();
+    
+    PTHREAD_CHECK(mutex);
+
+    Cyg_Mutex *mx = (Cyg_Mutex *)mutex;
+
+    if( prioceiling != NULL )
+        *prioceiling = mx->get_ceiling();
+        
+    PTHREAD_RETURN(0);
+}
+
+#endif // defined(_POSIX_THREAD_PRIO_PROTECT)
+
+#endif // defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
+
+//-----------------------------------------------------------------------------
+// Mutex functions
+
+//-----------------------------------------------------------------------------
+// Initialize mutex. If mutex_attr is NULL, use default attributes.
+
+externC int pthread_mutex_init (pthread_mutex_t *mutex,
+                                const pthread_mutexattr_t *mutex_attr)
+{
+    PTHREAD_ENTRY();
+
+    PTHREAD_CHECK( mutex );
+    
+    pthread_mutexattr_t use_attr;
+
+    // Set up the attributes we are going to use
+    if( mutex_attr == NULL )
+        pthread_mutexattr_init( &use_attr );
+    else use_attr = *mutex_attr;
+
+    // Now translate the POSIX protocol identifier into the eCos one.
+    Cyg_Mutex::cyg_protcol protocol;
+    
+    switch( use_attr.protocol )
+    {
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+    case PTHREAD_PRIO_PROTECT:
+        protocol = Cyg_Mutex::CEILING;
+        break;
+#endif
+#if defined(_POSIX_THREAD_PRIO_INHERIT)
+    case PTHREAD_PRIO_INHERIT:
+        protocol = Cyg_Mutex::INHERIT;
+        break;
+#endif        
+    case PTHREAD_PRIO_NONE:
+        protocol = Cyg_Mutex::NONE;
+        break;
+
+    default:
+        PTHREAD_RETURN(EINVAL);
+    }
+
+    Cyg_Mutex *mx = new((cyg_uint8 *)mutex) Cyg_Mutex(  protocol );
+
+    mx = mx; // silence compiler warning
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+    if ( protocol == Cyg_Mutex::CEILING )
+        mx->set_ceiling( use_attr.prioceiling );
+#endif
+    
+    PTHREAD_RETURN(0);
+}
+
+//-----------------------------------------------------------------------------
+// Destroy mutex.
+
+externC int pthread_mutex_destroy (pthread_mutex_t *mutex)
+{
+    PTHREAD_ENTRY();
+
+    int err = ENOERR;
+    
+    PTHREAD_CHECK( mutex );
+
+    Cyg_Mutex *mx = (Cyg_Mutex *)mutex;
+    
+    if( mx->get_owner() != NULL )
+        err = EBUSY;
+    else mx->~Cyg_Mutex();
+    
+    PTHREAD_RETURN(err);
+}